diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 210d53be65819..3ea07501477f8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -325,17 +325,6 @@ jobs: bootjdk-platform: linux-x64 runs-on: ubuntu-22.04 - test-macos-x64: - name: macos-x64 - needs: - - build-macos-x64 - uses: ./.github/workflows/test.yml - with: - platform: macos-x64 - bootjdk-platform: macos-x64 - runs-on: macos-13 - xcode-toolset-version: '14.3.1' - test-macos-aarch64: name: macos-aarch64 needs: diff --git a/bin/idea.sh b/bin/idea.sh index c85ae294454e5..1ebe9d96c7fa1 100644 --- a/bin/idea.sh +++ b/bin/idea.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2009, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -99,7 +99,7 @@ if [ "$VERBOSE" = "true" ] ; then echo "idea template dir: $IDEA_TEMPLATE" fi -cd $TOP ; make -f "$IDEA_MAKE/idea.gmk" -I $MAKE_DIR/.. idea MAKEOVERRIDES= OUT=$IDEA_OUTPUT/env.cfg MODULES="$*" $CONF_ARG || exit 1 +cd $TOP ; make idea-gen-config IDEA_OUTPUT=$IDEA_OUTPUT MODULES="$*" $CONF_ARG || exit 1 cd $SCRIPT_DIR . $IDEA_OUTPUT/env.cfg diff --git a/doc/hotspot-unit-tests.html b/doc/hotspot-unit-tests.html index 556cfecc42d7f..fcd4a93f8e485 100644 --- a/doc/hotspot-unit-tests.html +++ b/doc/hotspot-unit-tests.html @@ -245,7 +245,7 @@

Error messages

All GoogleTest asserts print compared expressions and their values, so there is no need to have them in error messages. Asserts print only compared values, they do not print any of interim variables, e.g. -ASSERT_TRUE((val1 == val2 && isFail(foo(8)) || i == 18) +ASSERT_TRUE((val1 == val2 && isFail(foo(8))) || i == 18) prints only one value. If you use some complex predicates, please consider EXPECT_PRED* or EXPECT_FORMAT_PRED assertions family, they check that a predicate returns true/success and diff --git a/doc/hotspot-unit-tests.md b/doc/hotspot-unit-tests.md index 62ace4ef6ee8b..e1222baa2e3a4 100644 --- a/doc/hotspot-unit-tests.md +++ b/doc/hotspot-unit-tests.md @@ -172,7 +172,7 @@ Provide informative, but not too verbose error messages. All GoogleTest asserts print compared expressions and their values, so there is no need to have them in error messages. Asserts print only compared values, they do not print any of interim variables, e.g. -`ASSERT_TRUE((val1 == val2 && isFail(foo(8)) || i == 18)` prints only +`ASSERT_TRUE((val1 == val2 && isFail(foo(8))) || i == 18)` prints only one value. If you use some complex predicates, please consider `EXPECT_PRED*` or `EXPECT_FORMAT_PRED` assertions family, they check that a predicate returns true/success and print out all parameters values. diff --git a/make/CompileDemos.gmk b/make/CompileDemos.gmk index 6c751552e5042..6c95aa08c2b00 100644 --- a/make/CompileDemos.gmk +++ b/make/CompileDemos.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -132,12 +132,19 @@ define SetupBuildDemoBody JARMAIN := $$($1_MAIN_CLASS), \ MANIFEST := $(DEMO_MANIFEST), \ EXTRA_MANIFEST_ATTR := $$($1_EXTRA_MANIFEST_ATTR), \ - SRCZIP := $(SUPPORT_OUTPUTDIR)/demos/image/$$($1_DEMO_SUBDIR)/$1/src.zip, \ EXCLUDE_FILES := $$($1_EXCLUDE_FILES), \ DISABLED_WARNINGS := $$($1_DISABLED_WARNINGS), \ )) $1 += $$(BUILD_DEMO_$1) + + $$(eval $$(call SetupZipArchive, ZIP_SRC_DEMO_$1, \ + SRC := $$($1_MAIN_SRC) $$($1_EXTRA_SRC_DIR), \ + ZIP := $(SUPPORT_OUTPUTDIR)/demos/image/$$($1_DEMO_SUBDIR)/$1/src.zip, \ + EXCLUDE_FILES := $$($1_EXCLUDE_FILES), \ + )) + + $1 += $$(ZIP_SRC_DEMO_$1) endif # Copy files. Sort is needed to remove duplicates. diff --git a/make/Coverage.gmk b/make/Coverage.gmk index 503acbe03ab18..c6c82af240119 100644 --- a/make/Coverage.gmk +++ b/make/Coverage.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -47,7 +47,6 @@ $(JCOV_IMAGE_DIR)/release: $(JCOV_INPUT_IMAGE_DIR)/release -t $(JCOV_TEMP)/$(JCOV_IMAGE_SUBDIR)/template.xml \ -rt $(JCOV_HOME)/lib/jcov_network_saver.jar \ -exclude 'java.lang.Object' \ - -exclude 'jdk.internal.org.objectweb.**' \ -exclude jdk.test.Main -exclude '**\$Proxy*' \ $(JCOV_FILTERS) \ $(JCOV_TEMP)/$(JCOV_IMAGE_SUBDIR) diff --git a/make/Main.gmk b/make/Main.gmk index 7675fe6fcf718..79b2932439cba 100644 --- a/make/Main.gmk +++ b/make/Main.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -356,6 +356,14 @@ $(eval $(call SetupTarget, vscode-project-ccls, \ DEPS := compile-commands, \ )) +################################################################################ +# IDEA IntelliJ projects + +$(eval $(call SetupTarget, idea-gen-config, \ + MAKEFILE := ide/idea/jdk/IdeaGenConfig, \ + ARGS := IDEA_OUTPUT="$(IDEA_OUTPUT)" MODULES="$(MODULES)", \ +)) + ################################################################################ # Build demos targets diff --git a/make/StaticLibs.gmk b/make/StaticLibs.gmk index d54c67b50b3ea..e4b8e422caf21 100644 --- a/make/StaticLibs.gmk +++ b/make/StaticLibs.gmk @@ -67,10 +67,8 @@ else ifeq ($(call isTargetOs, windows), true) BROKEN_STATIC_LIBS += splashscreen # libsspi_bridge has name conflicts with sunmscapi BROKEN_STATIC_LIBS += sspi_bridge - # These libs define DllMain which conflict with Hotspot - BROKEN_STATIC_LIBS += awt dt_shmem dt_socket - # These libs are dependent on any of the above disabled libs - BROKEN_STATIC_LIBS += fontmanager jawt lcms net nio + # dt_shmem define jdwpTransport_OnLoad which conflict with dt_socket + BROKEN_STATIC_LIBS += dt_shmem endif $(foreach module, $(STATIC_LIB_MODULES), \ @@ -107,7 +105,8 @@ else endif $(eval $(call SetupBuildLauncher, java, \ - CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS -DENABLE_ARG_FILES, \ + ENABLE_ARG_FILES := true, \ + EXPAND_CLASSPATH_WILDCARDS := true, \ EXTRA_RCFLAGS := $(JAVA_RCFLAGS), \ VERSION_INFO_RESOURCE := $(JAVA_VERSION_INFO_RESOURCE), \ OPTIMIZATION := HIGH, \ diff --git a/make/autoconf/flags-cflags.m4 b/make/autoconf/flags-cflags.m4 index d33f1885922d5..729e508cc2624 100644 --- a/make/autoconf/flags-cflags.m4 +++ b/make/autoconf/flags-cflags.m4 @@ -564,8 +564,8 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER], elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then # The -utf-8 option sets source and execution character sets to UTF-8 to enable correct # compilation of all source files regardless of the active code page on Windows. - TOOLCHAIN_CFLAGS_JVM="-nologo -MD -Zc:preprocessor -Zc:inline -permissive- -utf-8 -MP" - TOOLCHAIN_CFLAGS_JDK="-nologo -MD -Zc:preprocessor -Zc:inline -permissive- -utf-8 -Zc:wchar_t-" + TOOLCHAIN_CFLAGS_JVM="-nologo -MD -Zc:preprocessor -Zc:inline -Zc:throwingNew -permissive- -utf-8 -MP" + TOOLCHAIN_CFLAGS_JDK="-nologo -MD -Zc:preprocessor -Zc:inline -Zc:throwingNew -permissive- -utf-8 -Zc:wchar_t-" fi # CFLAGS C language level for JDK sources (hotspot only uses C++) @@ -830,6 +830,22 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP], FLAGS_SETUP_BRANCH_PROTECTION + if test "x$FLAGS_CPU" = xriscv64; then + AC_MSG_CHECKING([if RVV/vector sigcontext supported]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ], + [ + return (int)sizeof(struct __riscv_v_ext_state); + ])], + [ + AC_MSG_RESULT([yes]) + ], + [ + $1_DEFINES_CPU_JVM="${$1_DEFINES_CPU_JVM} -DNO_RVV_SIGCONTEXT" + AC_MSG_RESULT([no]) + ] + ) + fi + # EXPORT to API CFLAGS_JVM_COMMON="$ALWAYS_CFLAGS_JVM $ALWAYS_DEFINES_JVM \ $TOOLCHAIN_CFLAGS_JVM ${$1_TOOLCHAIN_CFLAGS_JVM} \ diff --git a/make/autoconf/flags-ldflags.m4 b/make/autoconf/flags-ldflags.m4 index ffb1f0d6e1979..2e060a71d4d05 100644 --- a/make/autoconf/flags-ldflags.m4 +++ b/make/autoconf/flags-ldflags.m4 @@ -197,8 +197,8 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_CPU_DEP], $2LDFLAGS_JDKEXE="$LDFLAGS_JDK_COMMON $EXECUTABLE_LDFLAGS \ ${$1_CPU_EXECUTABLE_LDFLAGS} $REPRODUCIBLE_LDFLAGS $FILE_MACRO_LDFLAGS" - $2LDFLAGS_STATIC_JDK="$BASIC_LDFLAGS $BASIC_LDFLAGS_JVM_ONLY \ - $OS_LDFLAGS ${$2EXTRA_LDFLAGS} $REPRODUCIBLE_LDFLAGS $FILE_MACRO_LDFLAGS" + $2LDFLAGS_STATIC_JDK="$BASIC_LDFLAGS $OS_LDFLAGS ${$2EXTRA_LDFLAGS} \ + $REPRODUCIBLE_LDFLAGS $FILE_MACRO_LDFLAGS" $2JVM_LDFLAGS="$BASIC_LDFLAGS $BASIC_LDFLAGS_JVM_ONLY $OS_LDFLAGS $OS_LDFLAGS_JVM_ONLY \ $DEBUGLEVEL_LDFLAGS $DEBUGLEVEL_LDFLAGS_JVM_ONLY \ diff --git a/make/autoconf/jdk-options.m4 b/make/autoconf/jdk-options.m4 index c09f581688ca0..b90f04a89e255 100644 --- a/make/autoconf/jdk-options.m4 +++ b/make/autoconf/jdk-options.m4 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -446,6 +446,7 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_ADDRESS_SANITIZER], fi if test "x$TOOLCHAIN_TYPE" = "xclang"; then ASAN_CFLAGS="$ASAN_CFLAGS -fsanitize-address-use-after-return=never" + ASAN_LDFLAGS="$ASAN_LDFLAGS -shared-libasan" fi elif test "x$TOOLCHAIN_TYPE" = "xmicrosoft"; then # -Oy- is equivalent to -fno-omit-frame-pointer in GCC/Clang. diff --git a/make/autoconf/lib-hsdis.m4 b/make/autoconf/lib-hsdis.m4 index a4d2c5f81f3f3..784c76424cf0d 100644 --- a/make/autoconf/lib-hsdis.m4 +++ b/make/autoconf/lib-hsdis.m4 @@ -1,5 +1,5 @@ # -# Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. # 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,9 @@ AC_DEFUN([LIB_SETUP_HSDIS_CAPSTONE], HSDIS_CFLAGS="-I${CAPSTONE}/include/capstone" if test "x$OPENJDK_TARGET_OS" != xwindows; then HSDIS_LDFLAGS="-L${CAPSTONE}/lib" + if test "x$OPENJDK_TARGET_CPU_BITS" = "x64" ; then + HSDIS_LDFLAGS="-L${CAPSTONE}/lib64 $HSDIS_LDFLAGS" + fi HSDIS_LIBS="-lcapstone" else HSDIS_LDFLAGS="-nodefaultlib:libcmt.lib" diff --git a/make/common/JavaCompilation.gmk b/make/common/JavaCompilation.gmk index 59ea23d359b6a..c56217b9f33c2 100644 --- a/make/common/JavaCompilation.gmk +++ b/make/common/JavaCompilation.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. # 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,10 +32,8 @@ endif include MakeIO.gmk -# Java compilation needs SetupJarArchive and/or SetupZipArchive, if we're -# generating a jar file or a source zip. +# Java compilation needs SetupJarArchive if we're generating a jar file include JarArchive.gmk -include ZipArchive.gmk ### ### Definitions for common release targets @@ -156,7 +154,6 @@ endef # COPY_FILES myapp/foo/setting.txt means copy this file over to the package myapp/foo # CLEAN .properties means copy and clean all properties file to the corresponding package in BIN. # CLEAN_FILES myapp/foo/setting.txt means clean this file over to the package myapp/foo -# SRCZIP Create a src.zip based on the found sources and copied files. # INCLUDE_FILES "com/sun/SolarisFoobar.java" means only compile this file! # EXCLUDE_FILES "com/sun/SolarisFoobar.java" means do not compile this particular file! # "SolarisFoobar.java" means do not compile SolarisFoobar, wherever it is found. @@ -529,19 +526,6 @@ define SetupJavaCompilationBody # Add jar to target list $1 += $$($1_JAR) endif - - # Check if a srczip was specified, then setup the rules for the srczip. - ifneq ($$($1_SRCZIP), ) - $$(eval $$(call SetupZipArchive, ZIP_ARCHIVE_$1, \ - SRC := $$($1_SRC), \ - ZIP := $$($1_SRCZIP), \ - INCLUDES := $$($1_INCLUDES), \ - EXCLUDES := $$($1_EXCLUDES), \ - EXCLUDE_FILES := $$($1_EXCLUDE_FILES))) - - # Add zip to target list - $1 += $$($1_SRCZIP) - endif endif # Source files found endef diff --git a/make/common/JdkNativeCompilation.gmk b/make/common/JdkNativeCompilation.gmk index ca0f1429c6165..a4f48385f4189 100644 --- a/make/common/JdkNativeCompilation.gmk +++ b/make/common/JdkNativeCompilation.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -266,6 +266,9 @@ JDK_RCFLAGS=$(RCFLAGS) \ # will be replaced with proper values for hotspot. # HEADERS_FROM_SRC -- if false, does not add source dirs automatically as # header include dirs. (Defaults to true.) +# JAVA_HEADERS -- if false, does not add the directory with the generated +# headers from the Java compilation of the current module to the search +# path for include files. (Defaults to true.) # JDK_LIBS -- libraries generated by the JDK build system to link against. # These take the form :. For the current module, the # module name and colon can be omitted. The basename should be specified @@ -385,7 +388,9 @@ define SetupJdkNativeCompilationBody # Add the module specific java header dir ifneq ($$(MODULE), ) - $1_SRC_HEADER_FLAGS += $$(addprefix -I, $$(call GetJavaHeaderDir, $$(MODULE))) + ifneq ($$($1_JAVA_HEADERS), false) + $1_SRC_HEADER_FLAGS += $$(addprefix -I, $$(call GetJavaHeaderDir, $$(MODULE))) + endif endif $1_JDK_LIBS += $$($1_JDK_LIBS_$$(OPENJDK_TARGET_OS)) diff --git a/make/common/modules/LauncherCommon.gmk b/make/common/modules/LauncherCommon.gmk index 38485283dcb98..32b14353b5274 100644 --- a/make/common/modules/LauncherCommon.gmk +++ b/make/common/modules/LauncherCommon.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -48,21 +48,18 @@ JAVA_MANIFEST := $(TOPDIR)/src/java.base/windows/native/launcher/java.manifest # used as the name of the executable. # # Remaining parameters are named arguments. These include: -# MAIN_MODULE The module of the main class to launch if different from the -# current module # MAIN_CLASS The Java main class to launch -# JAVA_ARGS Processed into a -DJAVA_ARGS and added to CFLAGS -# EXTRA_JAVA_ARGS Processed into a -DEXTRA_JAVA_ARGS and is prepended -# before JAVA_ARGS to CFLAGS, primarily to allow long string literal -# compile time defines exceeding Visual Studio 2013 limitations. -# CFLAGS Additional CFLAGS -# CFLAGS_windows Additional CFLAGS_windows +# JAVA_ARGS Additional arguments to pass to Java when launching the main class +# EXPAND_CLASSPATH_WILDCARDS Set to true to pass EXPAND_CLASSPATH_WILDCARDS +# ENABLE_ARG_FILES Set to true to pass ENABLE_ARG_FILES +# WINDOWS_JAVAW Set to true to pass JAVAW on Windows # EXTRA_RCFLAGS Additional EXTRA_RCFLAGS # MACOSX_PRIVILEGED On macosx, allow to access other processes # OPTIMIZATION Override default optimization level (LOW) # OUTPUT_DIR Override default output directory # VERSION_INFO_RESOURCE Override default Windows resource file # STATIC_LAUNCHER If true, will use settings for building a static launcher +# LIBS Additional libraries to pass as LIBS argument to SetupJdkExecutable SetupBuildLauncher = $(NamedParamsMacroTemplate) define SetupBuildLauncherBody # Setup default values (unless overridden) @@ -70,19 +67,25 @@ define SetupBuildLauncherBody $1_OPTIMIZATION := LOW endif - ifeq ($$($1_MAIN_MODULE), ) - $1_MAIN_MODULE := $(MODULE) - endif + $1_MAIN_MODULE := $(MODULE) ifneq ($$($1_MAIN_CLASS), ) $1_JAVA_ARGS += -Xms8m $1_LAUNCHER_CLASS := -m $$($1_MAIN_MODULE)/$$($1_MAIN_CLASS) endif - ifneq ($$($1_EXTRA_JAVA_ARGS), ) - $1_EXTRA_JAVA_ARGS_STR := '{ $$(strip $$(foreach a, \ - $$(addprefix -J, $$($1_EXTRA_JAVA_ARGS)), "$$a"$(COMMA) )) }' - $1_CFLAGS += -DEXTRA_JAVA_ARGS=$$($1_EXTRA_JAVA_ARGS_STR) + ifeq ($$($1_EXPAND_CLASSPATH_WILDCARDS), true) + $1_CFLAGS += -DEXPAND_CLASSPATH_WILDCARDS + endif + + ifeq ($$($1_ENABLE_ARG_FILES), true) + $1_CFLAGS += -DENABLE_ARG_FILES + endif + + ifeq ($(call isTargetOs, windows), true) + ifeq ($$($1_WINDOWS_JAVAW), true) + $1_CFLAGS += -DJAVAW + endif endif ifneq ($$($1_JAVA_ARGS), ) @@ -143,8 +146,8 @@ define SetupBuildLauncherBody -DLAUNCHER_NAME='"$$(LAUNCHER_NAME)"' \ -DPROGNAME='"$1"' \ $$($1_CFLAGS), \ - CFLAGS_windows := $$($1_CFLAGS_windows), \ EXTRA_HEADER_DIRS := java.base:libjvm, \ + JAVA_HEADERS := false, \ DISABLED_WARNINGS_gcc := unused-function unused-variable, \ DISABLED_WARNINGS_clang := unused-function, \ LDFLAGS := $$($1_LDFLAGS), \ @@ -154,12 +157,6 @@ define SetupBuildLauncherBody JDK_LIBS := $$($1_JDK_LIBS), \ JDK_LIBS_windows := $$($1_JDK_LIBS_windows), \ LIBS := $$($1_LIBS), \ - LIBS_unix := $(LIBZ_LIBS), \ - LIBS_linux := $(LIBDL) -lpthread, \ - LIBS_macosx := \ - -framework ApplicationServices \ - -framework Cocoa \ - -framework Security, \ LINK_TYPE := $$($1_LINK_TYPE), \ OUTPUT_DIR := $$($1_OUTPUT_DIR), \ OBJECT_DIR := $$($1_OBJECT_DIR), \ diff --git a/make/common/native/CompileFile.gmk b/make/common/native/CompileFile.gmk index 0c67a337acf82..498a04a0fdaf0 100644 --- a/make/common/native/CompileFile.gmk +++ b/make/common/native/CompileFile.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -253,11 +253,13 @@ define CreatePrecompiledHeader $$(eval $$(call CreateCompiledNativeFile, $1_$$(notdir $$($1_GENERATED_PCH_SRC)), \ FILE := $$($1_GENERATED_PCH_SRC), \ BASE := $1, \ - EXTRA_CXXFLAGS := -Fp$$($1_PCH_FILE) -Yc$$(notdir $$($1_PRECOMPILED_HEADER)), \ + EXTRA_CXXFLAGS := -I$$(dir $$($1_PRECOMPILED_HEADER)) -Fp$$($1_PCH_FILE) \ + -Yc$$(notdir $$($1_PRECOMPILED_HEADER)), \ )) $1_USE_PCH_FLAGS := \ - -Fp$$($1_PCH_FILE) -Yu$$(notdir $$($1_PRECOMPILED_HEADER)) + -FI$$(notdir $$($1_PRECOMPILED_HEADER)) -Fp$$($1_PCH_FILE) \ + -Yu$$(notdir $$($1_PRECOMPILED_HEADER)) $$($1_ALL_OBJS): $$($1_GENERATED_PCH_OBJ) @@ -271,7 +273,8 @@ define CreatePrecompiledHeader else ifneq ($(findstring $(TOOLCHAIN_TYPE), gcc clang), ) ifeq ($(TOOLCHAIN_TYPE), gcc) $1_PCH_FILE := $$($1_OBJECT_DIR)/precompiled/$$(notdir $$($1_PRECOMPILED_HEADER)).gch - $1_USE_PCH_FLAGS := -I$$($1_OBJECT_DIR)/precompiled + $1_USE_PCH_FLAGS := -I$$($1_OBJECT_DIR)/precompiled \ + -include $$(notdir $$($1_PRECOMPILED_HEADER)) else ifeq ($(TOOLCHAIN_TYPE), clang) $1_PCH_FILE := $$($1_OBJECT_DIR)/precompiled/$$(notdir $$($1_PRECOMPILED_HEADER)).pch $1_USE_PCH_FLAGS := -include-pch $$($1_PCH_FILE) diff --git a/make/conf/module-loader-map.conf b/make/conf/module-loader-map.conf index b628bfbf2da30..92bffc0e9bcdf 100644 --- a/make/conf/module-loader-map.conf +++ b/make/conf/module-loader-map.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. # 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 @@ NATIVE_ACCESS_MODULES= \ java.smartcardio \ jdk.accessibility \ jdk.attach \ + jdk.compiler \ jdk.crypto.cryptoki \ jdk.crypto.mscapi \ jdk.hotspot.agent \ diff --git a/make/hotspot/gensrc/GensrcAdlc.gmk b/make/hotspot/gensrc/GensrcAdlc.gmk index d43a8b8d3aba5..2be368e2694ab 100644 --- a/make/hotspot/gensrc/GensrcAdlc.gmk +++ b/make/hotspot/gensrc/GensrcAdlc.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -37,13 +37,8 @@ ifeq ($(call check-jvm-feature, compiler2), true) ifeq ($(call isBuildOs, linux), true) ADLC_CFLAGS := -fno-exceptions -DLINUX else ifeq ($(call isBuildOs, aix), true) - ifeq ($(TOOLCHAIN_TYPE), clang) - ADLC_LDFLAGS += -m64 - ADLC_CFLAGS := -fno-rtti -fexceptions -ffunction-sections -m64 -DAIX -mcpu=pwr8 - else - ADLC_LDFLAGS += -q64 - ADLC_CFLAGS := -qnortti -qeh -q64 -DAIX - endif + ADLC_LDFLAGS += -m64 + ADLC_CFLAGS := -fno-rtti -fexceptions -ffunction-sections -m64 -DAIX -mcpu=pwr8 else ifeq ($(call isBuildOs, windows), true) ADLC_CFLAGS := -nologo -EHsc ADLC_CFLAGS_WARNINGS := -W3 -D_CRT_SECURE_NO_WARNINGS diff --git a/make/hotspot/lib/JvmFlags.gmk b/make/hotspot/lib/JvmFlags.gmk index e5929ab994ba0..5544f391d4ad3 100644 --- a/make/hotspot/lib/JvmFlags.gmk +++ b/make/hotspot/lib/JvmFlags.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved. # 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,6 @@ JVM_SRC_DIRS += $(call uniq, $(wildcard $(foreach d, $(JVM_SRC_ROOTS), \ JVM_CFLAGS_INCLUDES += \ $(patsubst %,-I%,$(JVM_SRC_DIRS)) \ - -I$(TOPDIR)/src/hotspot/share/precompiled \ -I$(TOPDIR)/src/hotspot/share/include \ -I$(TOPDIR)/src/hotspot/os/$(HOTSPOT_TARGET_OS_TYPE)/include \ -I$(SUPPORT_OUTPUTDIR)/modules_include/java.base \ @@ -93,11 +92,6 @@ JVM_CFLAGS += \ $(EXTRA_CFLAGS) \ # -# -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp. -ifeq ($(USE_PRECOMPILED_HEADER), false) - JVM_CFLAGS += -DDONT_USE_PRECOMPILED_HEADER -endif - ifneq ($(HOTSPOT_OVERRIDE_LIBPATH), ) JVM_CFLAGS += -DOVERRIDE_LIBPATH='"$(HOTSPOT_OVERRIDE_LIBPATH)"' endif diff --git a/make/ide/idea/jdk/idea.gmk b/make/ide/idea/jdk/IdeaGenConfig.gmk similarity index 60% rename from make/ide/idea/jdk/idea.gmk rename to make/ide/idea/jdk/IdeaGenConfig.gmk index b27de609c49be..8318463776f94 100644 --- a/make/ide/idea/jdk/idea.gmk +++ b/make/ide/idea/jdk/IdeaGenConfig.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. # 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,36 +23,35 @@ # questions. # -include Makefile -include make/MainSupport.gmk - -.PHONY: idea - -ifeq ($(SPEC), ) - ifneq ($(words $(SPECS)), 1) - @echo "Error: Multiple build specification files found. Please select one explicitly." - @exit 2 - endif - idea: - @cd $(topdir) - @$(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -j 1 -f $(topdir)/make/ide/idea/jdk/idea.gmk SPEC=$(SPECS) HAS_SPEC=true ACTUAL_TOPDIR=$(topdir) MODULES="$(MODULES)" idea -else #with SPEC - include make/common/Modules.gmk - - ifeq ($(MODULES), ) - SEL_MODULES := $(call FindAllModules) - else - SEL_MODULES := $(MODULES) - endif - - idea: +default: all + +include $(SPEC) +include MakeBase.gmk + +include Modules.gmk + +# MODULES and IDEA_OUTPUT is passed on the command line +ifeq ($(MODULES), ) + override MODULES := $(call FindAllModules) +endif + +ifeq ($(IDEA_OUTPUT), ) + override IDEA_OUTPUT := $(WORKSPACE_ROOT)/.idea +endif + +OUT := $(IDEA_OUTPUT)/env.cfg + +idea: + $(RM) $(OUT) $(ECHO) "SUPPORT=$(SUPPORT_OUTPUTDIR)" >> $(OUT) - $(ECHO) "MODULE_ROOTS=\"$(foreach mod, $(SEL_MODULES), $(call FindModuleSrcDirs, $(mod)))\"" >> $(OUT) - $(ECHO) "MODULE_NAMES=\"$(strip $(foreach mod, $(SEL_MODULES), $(mod)))\"" >> $(OUT) - $(ECHO) "SEL_MODULES=\"$(SEL_MODULES)\"" >> $(OUT) + $(ECHO) "MODULE_ROOTS=\"$(foreach mod, $(MODULES), $(call FindModuleSrcDirs, $(mod)))\"" >> $(OUT) + $(ECHO) "MODULE_NAMES=\"$(strip $(foreach mod, $(MODULES), $(mod)))\"" >> $(OUT) + $(ECHO) "SEL_MODULES=\"$(MODULES)\"" >> $(OUT) $(ECHO) "BOOT_JDK=\"$(BOOT_JDK)\"" >> $(OUT) $(ECHO) "CYGPATH=\"$(PATHTOOL)\"" >> $(OUT) $(ECHO) "SPEC=\"$(SPEC)\"" >> $(OUT) $(ECHO) "JT_HOME=\"$(JT_HOME)\"" >> $(OUT) -endif +all: idea + +.PHONY: default all idea diff --git a/make/modules/java.base/Launcher.gmk b/make/modules/java.base/Launcher.gmk index 024c1c4731b0c..246767f393718 100644 --- a/make/modules/java.base/Launcher.gmk +++ b/make/modules/java.base/Launcher.gmk @@ -38,7 +38,8 @@ JAVA_RCFLAGS ?= -I$(TOPDIR)/src/java.base/windows/native/launcher/icons ################################################################################ $(eval $(call SetupBuildLauncher, java, \ - CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS -DENABLE_ARG_FILES, \ + ENABLE_ARG_FILES := true, \ + EXPAND_CLASSPATH_WILDCARDS := true, \ EXTRA_RCFLAGS := $(JAVA_RCFLAGS), \ VERSION_INFO_RESOURCE := $(JAVA_VERSION_INFO_RESOURCE), \ OPTIMIZATION := HIGH, \ @@ -50,7 +51,9 @@ $(eval $(call SetupBuildLauncher, java, \ ifeq ($(call isTargetOs, windows), true) $(eval $(call SetupBuildLauncher, javaw, \ - CFLAGS := -DJAVAW -DEXPAND_CLASSPATH_WILDCARDS -DENABLE_ARG_FILES, \ + ENABLE_ARG_FILES := true, \ + EXPAND_CLASSPATH_WILDCARDS := true, \ + WINDOWS_JAVAW := true, \ EXTRA_RCFLAGS := $(JAVA_RCFLAGS), \ VERSION_INFO_RESOURCE := $(JAVA_VERSION_INFO_RESOURCE), \ )) diff --git a/make/modules/jdk.compiler/Launcher.gmk b/make/modules/jdk.compiler/Launcher.gmk index e80c31bcb18f3..e5c4bbe4b8cdb 100644 --- a/make/modules/jdk.compiler/Launcher.gmk +++ b/make/modules/jdk.compiler/Launcher.gmk @@ -32,7 +32,7 @@ include LauncherCommon.gmk $(eval $(call SetupBuildLauncher, javac, \ MAIN_CLASS := com.sun.tools.javac.Main, \ JAVA_ARGS := --add-modules ALL-DEFAULT, \ - CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS, \ + EXPAND_CLASSPATH_WILDCARDS := true, \ )) ################################################################################ @@ -41,5 +41,5 @@ $(eval $(call SetupBuildLauncher, javac, \ $(eval $(call SetupBuildLauncher, serialver, \ MAIN_CLASS := sun.tools.serialver.SerialVer, \ - CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS, \ + EXPAND_CLASSPATH_WILDCARDS := true, \ )) diff --git a/make/modules/jdk.javadoc/Launcher.gmk b/make/modules/jdk.javadoc/Launcher.gmk index 30d714be30d6a..608468962f382 100644 --- a/make/modules/jdk.javadoc/Launcher.gmk +++ b/make/modules/jdk.javadoc/Launcher.gmk @@ -32,5 +32,5 @@ include LauncherCommon.gmk $(eval $(call SetupBuildLauncher, javadoc, \ MAIN_CLASS := jdk.javadoc.internal.tool.Main, \ JAVA_ARGS := --add-modules ALL-DEFAULT, \ - CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS, \ + EXPAND_CLASSPATH_WILDCARDS := true, \ )) diff --git a/make/modules/jdk.jconsole/Launcher.gmk b/make/modules/jdk.jconsole/Launcher.gmk index 3e65c3cccc37a..35d93d6feb917 100644 --- a/make/modules/jdk.jconsole/Launcher.gmk +++ b/make/modules/jdk.jconsole/Launcher.gmk @@ -36,5 +36,5 @@ $(eval $(call SetupBuildLauncher, jconsole, \ --add-modules ALL-DEFAULT \ -Djconsole.showOutputViewer \ -Djdk.attach.allowAttachSelf=true, \ - CFLAGS_windows := -DJAVAW, \ + WINDOWS_JAVAW := true, \ )) diff --git a/make/modules/jdk.jdeps/Launcher.gmk b/make/modules/jdk.jdeps/Launcher.gmk index 1aa54e16f4564..812d690a91d34 100644 --- a/make/modules/jdk.jdeps/Launcher.gmk +++ b/make/modules/jdk.jdeps/Launcher.gmk @@ -31,7 +31,7 @@ include LauncherCommon.gmk $(eval $(call SetupBuildLauncher, javap, \ MAIN_CLASS := com.sun.tools.javap.Main, \ - CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS, \ + EXPAND_CLASSPATH_WILDCARDS := true, \ )) ################################################################################ @@ -40,7 +40,7 @@ $(eval $(call SetupBuildLauncher, javap, \ $(eval $(call SetupBuildLauncher, jdeps, \ MAIN_CLASS := com.sun.tools.jdeps.Main, \ - CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS, \ + EXPAND_CLASSPATH_WILDCARDS := true, \ )) ################################################################################ @@ -49,7 +49,7 @@ $(eval $(call SetupBuildLauncher, jdeps, \ $(eval $(call SetupBuildLauncher, jdeprscan, \ MAIN_CLASS := com.sun.tools.jdeprscan.Main, \ - CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS, \ + EXPAND_CLASSPATH_WILDCARDS := true, \ )) ################################################################################ @@ -58,5 +58,5 @@ $(eval $(call SetupBuildLauncher, jdeprscan, \ $(eval $(call SetupBuildLauncher, jnativescan, \ MAIN_CLASS := com.sun.tools.jnativescan.Main, \ - CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS, \ + EXPAND_CLASSPATH_WILDCARDS := true, \ )) diff --git a/make/modules/jdk.jfr/Launcher.gmk b/make/modules/jdk.jfr/Launcher.gmk index 2dd3586a92072..ad07c839f9073 100644 --- a/make/modules/jdk.jfr/Launcher.gmk +++ b/make/modules/jdk.jfr/Launcher.gmk @@ -31,5 +31,5 @@ include LauncherCommon.gmk $(eval $(call SetupBuildLauncher, jfr, \ MAIN_CLASS := jdk.jfr.internal.tool.Main, \ - CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS, \ + EXPAND_CLASSPATH_WILDCARDS := true, \ )) diff --git a/make/modules/jdk.jlink/Launcher.gmk b/make/modules/jdk.jlink/Launcher.gmk index d427906519357..ef6f5ad1665bd 100644 --- a/make/modules/jdk.jlink/Launcher.gmk +++ b/make/modules/jdk.jlink/Launcher.gmk @@ -31,7 +31,7 @@ include LauncherCommon.gmk $(eval $(call SetupBuildLauncher, jimage, \ MAIN_CLASS := jdk.tools.jimage.Main, \ - CFLAGS := -DENABLE_ARG_FILES, \ + ENABLE_ARG_FILES := true, \ )) ################################################################################ @@ -41,7 +41,8 @@ $(eval $(call SetupBuildLauncher, jimage, \ $(eval $(call SetupBuildLauncher, jlink, \ MAIN_CLASS := jdk.tools.jlink.internal.Main, \ JAVA_ARGS := --add-modules ALL-DEFAULT, \ - CFLAGS := -DENABLE_ARG_FILES -DEXPAND_CLASSPATH_WILDCARDS, \ + ENABLE_ARG_FILES := true, \ + EXPAND_CLASSPATH_WILDCARDS := true, \ )) ################################################################################ @@ -50,5 +51,6 @@ $(eval $(call SetupBuildLauncher, jlink, \ $(eval $(call SetupBuildLauncher, jmod, \ MAIN_CLASS := jdk.tools.jmod.Main, \ - CFLAGS := -DENABLE_ARG_FILES -DEXPAND_CLASSPATH_WILDCARDS, \ + ENABLE_ARG_FILES := true, \ + EXPAND_CLASSPATH_WILDCARDS := true, \ )) diff --git a/make/modules/jdk.jshell/Launcher.gmk b/make/modules/jdk.jshell/Launcher.gmk index bf555d7f64c13..66da3a9e5fcae 100644 --- a/make/modules/jdk.jshell/Launcher.gmk +++ b/make/modules/jdk.jshell/Launcher.gmk @@ -31,5 +31,5 @@ include LauncherCommon.gmk $(eval $(call SetupBuildLauncher, jshell, \ MAIN_CLASS := jdk.internal.jshell.tool.JShellToolProvider, \ - CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS, \ + EXPAND_CLASSPATH_WILDCARDS := true, \ )) diff --git a/make/test/BuildMicrobenchmark.gmk b/make/test/BuildMicrobenchmark.gmk index 1052e422f7b06..272cb1af0a6bb 100644 --- a/make/test/BuildMicrobenchmark.gmk +++ b/make/test/BuildMicrobenchmark.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. # 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,8 +96,6 @@ $(eval $(call SetupJavaCompilation, BUILD_JDK_MICROBENCHMARK, \ --add-exports java.base/jdk.internal.foreign=ALL-UNNAMED \ --add-exports java.base/jdk.internal.misc=ALL-UNNAMED \ --add-exports java.base/jdk.internal.util=ALL-UNNAMED \ - --add-exports java.base/jdk.internal.org.objectweb.asm.tree=ALL-UNNAMED \ - --add-exports java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED \ --add-exports java.base/jdk.internal.vm=ALL-UNNAMED \ --add-exports java.base/sun.invoke.util=ALL-UNNAMED \ --add-exports java.base/sun.security.util=ALL-UNNAMED \ diff --git a/make/test/BuildTestLib.gmk b/make/test/BuildTestLib.gmk index 5659423826136..1a13e1914685c 100644 --- a/make/test/BuildTestLib.gmk +++ b/make/test/BuildTestLib.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -64,7 +64,6 @@ $(eval $(call SetupJavaCompilation, BUILD_TEST_LIB_JAR, \ BIN := $(TEST_LIB_SUPPORT)/test-lib_classes, \ HEADERS := $(TEST_LIB_SUPPORT)/test-lib_headers, \ JAR := $(TEST_LIB_SUPPORT)/test-lib.jar, \ - DISABLED_WARNINGS := try deprecation rawtypes unchecked serial cast removal preview restricted dangling-doc-comments, \ JAVAC_FLAGS := --add-exports java.base/sun.security.util=ALL-UNNAMED \ --add-exports java.base/jdk.internal.classfile=ALL-UNNAMED \ --add-exports java.base/jdk.internal.classfile.attribute=ALL-UNNAMED \ diff --git a/src/hotspot/cpu/aarch64/abstractInterpreter_aarch64.cpp b/src/hotspot/cpu/aarch64/abstractInterpreter_aarch64.cpp index 33a72263a2774..a3c729fdd56e7 100644 --- a/src/hotspot/cpu/aarch64/abstractInterpreter_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/abstractInterpreter_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "interpreter/interpreter.hpp" #include "oops/constMethod.hpp" #include "oops/klass.inline.hpp" diff --git a/src/hotspot/cpu/aarch64/assembler_aarch64.cpp b/src/hotspot/cpu/aarch64/assembler_aarch64.cpp index 76f88764416e3..b03344f2d8027 100644 --- a/src/hotspot/cpu/aarch64/assembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/assembler_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, 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. * @@ -22,7 +22,6 @@ * questions. */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" #include "asm/macroAssembler.hpp" diff --git a/src/hotspot/cpu/aarch64/bytecodes_aarch64.cpp b/src/hotspot/cpu/aarch64/bytecodes_aarch64.cpp index 744a983b18341..119ad8baec368 100644 --- a/src/hotspot/cpu/aarch64/bytecodes_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/bytecodes_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "interpreter/bytecodes.hpp" diff --git a/src/hotspot/cpu/aarch64/c1_CodeStubs_aarch64.cpp b/src/hotspot/cpu/aarch64/c1_CodeStubs_aarch64.cpp index 89a97a4984fc8..2334cbdff24e4 100644 --- a/src/hotspot/cpu/aarch64/c1_CodeStubs_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/c1_CodeStubs_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "c1/c1_CodeStubs.hpp" #include "c1/c1_FrameMap.hpp" diff --git a/src/hotspot/cpu/aarch64/c1_FpuStackSim_aarch64.cpp b/src/hotspot/cpu/aarch64/c1_FpuStackSim_aarch64.cpp index c50da1c8bebf3..158af57603ca8 100644 --- a/src/hotspot/cpu/aarch64/c1_FpuStackSim_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/c1_FpuStackSim_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -28,4 +28,3 @@ //-------------------------------------------------------- // No FPU stack on AARCH64 -#include "precompiled.hpp" diff --git a/src/hotspot/cpu/aarch64/c1_FrameMap_aarch64.cpp b/src/hotspot/cpu/aarch64/c1_FrameMap_aarch64.cpp index 91582b6733e5e..051b2ff47c142 100644 --- a/src/hotspot/cpu/aarch64/c1_FrameMap_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/c1_FrameMap_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_FrameMap.hpp" #include "c1/c1_LIR.hpp" #include "runtime/sharedRuntime.hpp" diff --git a/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp index b01360c3f7ebc..31a775e4f0335 100644 --- a/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "asm/assembler.hpp" #include "c1/c1_CodeStubs.hpp" diff --git a/src/hotspot/cpu/aarch64/c1_LIRGenerator_aarch64.cpp b/src/hotspot/cpu/aarch64/c1_LIRGenerator_aarch64.cpp index 4ae2da6680263..64f1799a75923 100644 --- a/src/hotspot/cpu/aarch64/c1_LIRGenerator_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/c1_LIRGenerator_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "c1/c1_Compilation.hpp" #include "c1/c1_FrameMap.hpp" @@ -779,13 +778,11 @@ void LIRGenerator::do_MathIntrinsic(Intrinsic* x) { } case vmIntrinsics::_floatToFloat16: { LIR_Opr tmp = new_register(T_FLOAT); - __ move(LIR_OprFact::floatConst(-0.0), tmp); __ f2hf(src, dst, tmp); break; } case vmIntrinsics::_float16ToFloat: { LIR_Opr tmp = new_register(T_FLOAT); - __ move(LIR_OprFact::floatConst(-0.0), tmp); __ hf2f(src, dst, tmp); break; } diff --git a/src/hotspot/cpu/aarch64/c1_LIR_aarch64.cpp b/src/hotspot/cpu/aarch64/c1_LIR_aarch64.cpp index 0dd1a2156e89e..5d2890251d7d4 100644 --- a/src/hotspot/cpu/aarch64/c1_LIR_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/c1_LIR_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/register.hpp" #include "c1/c1_LIR.hpp" diff --git a/src/hotspot/cpu/aarch64/c1_LinearScan_aarch64.cpp b/src/hotspot/cpu/aarch64/c1_LinearScan_aarch64.cpp index 4b426694cd7e3..d99916ecb8863 100644 --- a/src/hotspot/cpu/aarch64/c1_LinearScan_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/c1_LinearScan_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_Instruction.hpp" #include "c1/c1_LinearScan.hpp" #include "utilities/bitMap.inline.hpp" diff --git a/src/hotspot/cpu/aarch64/c1_MacroAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/c1_MacroAssembler_aarch64.cpp index fc6cadc8450cb..6b1a5a7f1e0c4 100644 --- a/src/hotspot/cpu/aarch64/c1_MacroAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/c1_MacroAssembler_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_MacroAssembler.hpp" #include "c1/c1_Runtime1.hpp" #include "gc/shared/barrierSetAssembler.hpp" diff --git a/src/hotspot/cpu/aarch64/c1_Runtime1_aarch64.cpp b/src/hotspot/cpu/aarch64/c1_Runtime1_aarch64.cpp index 19665d1b89404..5ab753188cbe0 100644 --- a/src/hotspot/cpu/aarch64/c1_Runtime1_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/c1_Runtime1_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "c1/c1_CodeStubs.hpp" #include "c1/c1_Defs.hpp" diff --git a/src/hotspot/cpu/aarch64/c2_CodeStubs_aarch64.cpp b/src/hotspot/cpu/aarch64/c2_CodeStubs_aarch64.cpp index 90157a5668d94..5d8d1fbd9cb44 100644 --- a/src/hotspot/cpu/aarch64/c2_CodeStubs_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/c2_CodeStubs_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "opto/c2_MacroAssembler.hpp" #include "opto/c2_CodeStubs.hpp" #include "runtime/objectMonitor.hpp" diff --git a/src/hotspot/cpu/aarch64/c2_MacroAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/c2_MacroAssembler_aarch64.cpp index 5cc579762969d..e3d197a457215 100644 --- a/src/hotspot/cpu/aarch64/c2_MacroAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/c2_MacroAssembler_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" #include "opto/c2_MacroAssembler.hpp" diff --git a/src/hotspot/cpu/aarch64/c2_init_aarch64.cpp b/src/hotspot/cpu/aarch64/c2_init_aarch64.cpp index 436e0c5e41c31..e1bf8e3d1af11 100644 --- a/src/hotspot/cpu/aarch64/c2_init_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/c2_init_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2019, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "opto/compile.hpp" #include "opto/node.hpp" diff --git a/src/hotspot/cpu/aarch64/codeBuffer_aarch64.cpp b/src/hotspot/cpu/aarch64/codeBuffer_aarch64.cpp index 31618414e31b7..97d9f7afdfb48 100644 --- a/src/hotspot/cpu/aarch64/codeBuffer_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/codeBuffer_aarch64.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/codeBuffer.inline.hpp" #include "asm/macroAssembler.hpp" diff --git a/src/hotspot/cpu/aarch64/compiledIC_aarch64.cpp b/src/hotspot/cpu/aarch64/compiledIC_aarch64.cpp index b9248b01a0911..24a7a78b8004b 100644 --- a/src/hotspot/cpu/aarch64/compiledIC_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/compiledIC_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2018, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "code/compiledIC.hpp" #include "code/nmethod.hpp" diff --git a/src/hotspot/cpu/aarch64/compressedKlass_aarch64.cpp b/src/hotspot/cpu/aarch64/compressedKlass_aarch64.cpp index 6ad6e3134bc51..0c2d9a32c8c13 100644 --- a/src/hotspot/cpu/aarch64/compressedKlass_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/compressedKlass_aarch64.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2023, Red Hat, Inc. All rights reserved. - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "logging/log.hpp" #include "oops/compressedKlass.hpp" diff --git a/src/hotspot/cpu/aarch64/downcallLinker_aarch64.cpp b/src/hotspot/cpu/aarch64/downcallLinker_aarch64.cpp index 4322eb1c4fcb6..7febbaa63bbc9 100644 --- a/src/hotspot/cpu/aarch64/downcallLinker_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/downcallLinker_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2019, Arm Limited. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -22,7 +22,6 @@ * questions. */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "code/codeBlob.hpp" #include "code/codeCache.hpp" diff --git a/src/hotspot/cpu/aarch64/foreignGlobals_aarch64.cpp b/src/hotspot/cpu/aarch64/foreignGlobals_aarch64.cpp index 9d1a66f887126..1ed5e6f312f76 100644 --- a/src/hotspot/cpu/aarch64/foreignGlobals_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/foreignGlobals_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2019, 2022, Arm Limited. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -22,7 +22,6 @@ * questions. */ -#include "precompiled.hpp" #include "code/vmreg.inline.hpp" #include "runtime/jniHandles.hpp" #include "runtime/jniHandles.inline.hpp" diff --git a/src/hotspot/cpu/aarch64/frame_aarch64.cpp b/src/hotspot/cpu/aarch64/frame_aarch64.cpp index 361b913fd2ea2..7201674cd639c 100644 --- a/src/hotspot/cpu/aarch64/frame_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/frame_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "compiler/oopMap.hpp" #include "interpreter/interpreter.hpp" #include "memory/resourceArea.hpp" @@ -163,6 +162,11 @@ bool frame::safe_for_sender(JavaThread *thread) { } if (Continuation::is_return_barrier_entry(sender_pc)) { + // sender_pc might be invalid so check that the frame + // actually belongs to a Continuation. + if (!Continuation::is_frame_in_continuation(thread, *this)) { + return false; + } // If our sender_pc is the return barrier, then our "real" sender is the continuation entry frame s = Continuation::continuation_bottom_sender(thread, *this, sender_sp); sender_sp = s.sp(); diff --git a/src/hotspot/cpu/aarch64/gc/g1/g1BarrierSetAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/gc/g1/g1BarrierSetAssembler_aarch64.cpp index df521f94d1f84..42f3c4a015ac4 100644 --- a/src/hotspot/cpu/aarch64/gc/g1/g1BarrierSetAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/gc/g1/g1BarrierSetAssembler_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "gc/g1/g1BarrierSet.hpp" #include "gc/g1/g1BarrierSetAssembler.hpp" diff --git a/src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.cpp index 0161843036bc5..828033975a065 100644 --- a/src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderData.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/barrierSetAssembler.hpp" diff --git a/src/hotspot/cpu/aarch64/gc/shared/barrierSetNMethod_aarch64.cpp b/src/hotspot/cpu/aarch64/gc/shared/barrierSetNMethod_aarch64.cpp index 5169a510154ab..c45611c882b5a 100644 --- a/src/hotspot/cpu/aarch64/gc/shared/barrierSetNMethod_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/gc/shared/barrierSetNMethod_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "code/codeCache.hpp" #include "code/nativeInst.hpp" #include "gc/shared/barrierSet.hpp" diff --git a/src/hotspot/cpu/aarch64/gc/shared/cardTableBarrierSetAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/gc/shared/cardTableBarrierSetAssembler_aarch64.cpp index 6afdb285914fb..ea36183c9de95 100644 --- a/src/hotspot/cpu/aarch64/gc/shared/cardTableBarrierSetAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/gc/shared/cardTableBarrierSetAssembler_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/cardTable.hpp" diff --git a/src/hotspot/cpu/aarch64/gc/shared/modRefBarrierSetAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/gc/shared/modRefBarrierSetAssembler_aarch64.cpp index a50152d244fba..6890159189310 100644 --- a/src/hotspot/cpu/aarch64/gc/shared/modRefBarrierSetAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/gc/shared/modRefBarrierSetAssembler_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "gc/shared/modRefBarrierSetAssembler.hpp" diff --git a/src/hotspot/cpu/aarch64/gc/shenandoah/c1/shenandoahBarrierSetC1_aarch64.cpp b/src/hotspot/cpu/aarch64/gc/shenandoah/c1/shenandoahBarrierSetC1_aarch64.cpp index 666335330ed1b..e33ef47cf3c38 100644 --- a/src/hotspot/cpu/aarch64/gc/shenandoah/c1/shenandoahBarrierSetC1_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/gc/shenandoah/c1/shenandoahBarrierSetC1_aarch64.cpp @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_LIRAssembler.hpp" #include "c1/c1_MacroAssembler.hpp" #include "compiler/compilerDefinitions.inline.hpp" diff --git a/src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp index f682e86cdfbdd..19270d9fecf57 100644 --- a/src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahBarrierSet.hpp" #include "gc/shenandoah/shenandoahBarrierSetAssembler.hpp" #include "gc/shenandoah/shenandoahForwarding.hpp" diff --git a/src/hotspot/cpu/aarch64/gc/z/zAddress_aarch64.cpp b/src/hotspot/cpu/aarch64/gc/z/zAddress_aarch64.cpp index c656736aa6473..a58c91a6a41e1 100644 --- a/src/hotspot/cpu/aarch64/gc/z/zAddress_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/gc/z/zAddress_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/gcLogPrecious.hpp" #include "gc/shared/gc_globals.hpp" #include "gc/z/zAddress.hpp" @@ -85,7 +84,7 @@ static size_t probe_valid_max_address_bit() { munmap(result_addr, page_size); } } - log_info_p(gc, init)("Probing address space for the highest valid bit: " SIZE_FORMAT, max_address_bit); + log_info_p(gc, init)("Probing address space for the highest valid bit: %zu", max_address_bit); return MAX2(max_address_bit, MINIMUM_MAX_ADDRESS_BIT); #else // LINUX return DEFAULT_MAX_ADDRESS_BIT; diff --git a/src/hotspot/cpu/aarch64/gc/z/zBarrierSetAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/gc/z/zBarrierSetAssembler_aarch64.cpp index 3f1898b6742e1..5d4f0801ec62f 100644 --- a/src/hotspot/cpu/aarch64/gc/z/zBarrierSetAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/gc/z/zBarrierSetAssembler_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "code/codeBlob.hpp" #include "code/vmreg.inline.hpp" diff --git a/src/hotspot/cpu/aarch64/icache_aarch64.cpp b/src/hotspot/cpu/aarch64/icache_aarch64.cpp index 8bdddd4f1516a..311f3a7de1f73 100644 --- a/src/hotspot/cpu/aarch64/icache_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/icache_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "runtime/icache.hpp" void ICacheStubGenerator::generate_icache_flush( diff --git a/src/hotspot/cpu/aarch64/immediate_aarch64.cpp b/src/hotspot/cpu/aarch64/immediate_aarch64.cpp index 9c67a0dfeada9..024d554b98f54 100644 --- a/src/hotspot/cpu/aarch64/immediate_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/immediate_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, 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. * @@ -26,7 +26,6 @@ #include #include -#include "precompiled.hpp" #include "immediate_aarch64.hpp" #include "metaprogramming/primitiveConversions.hpp" #include "utilities/globalDefinitions.hpp" diff --git a/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp b/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp index 836caa86cb0af..9892de21a8114 100644 --- a/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "compiler/compiler_globals.hpp" #include "gc/shared/barrierSet.hpp" @@ -503,7 +502,7 @@ void InterpreterMacroAssembler::remove_activation( // get method access flags ldr(r1, Address(rfp, frame::interpreter_frame_method_offset * wordSize)); - ldr(r2, Address(r1, Method::access_flags_offset())); + ldrh(r2, Address(r1, Method::access_flags_offset())); tbz(r2, exact_log2(JVM_ACC_SYNCHRONIZED), unlocked); // Don't unlock anything if the _do_not_unlock_if_synchronized flag diff --git a/src/hotspot/cpu/aarch64/interpreterRT_aarch64.cpp b/src/hotspot/cpu/aarch64/interpreterRT_aarch64.cpp index 90c7ca6f08a3d..d6310a2d326c9 100644 --- a/src/hotspot/cpu/aarch64/interpreterRT_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/interpreterRT_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved. * Copyright (c) 2021, Azul Systems, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "interpreter/interp_masm.hpp" #include "interpreter/interpreter.hpp" diff --git a/src/hotspot/cpu/aarch64/jniFastGetField_aarch64.cpp b/src/hotspot/cpu/aarch64/jniFastGetField_aarch64.cpp index aea268ea94443..8bec45b4b479a 100644 --- a/src/hotspot/cpu/aarch64/jniFastGetField_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/jniFastGetField_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2025, 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/barrierSetAssembler.hpp" diff --git a/src/hotspot/cpu/aarch64/jvmciCodeInstaller_aarch64.cpp b/src/hotspot/cpu/aarch64/jvmciCodeInstaller_aarch64.cpp index 45ad873ae2747..3015206dadc4d 100644 --- a/src/hotspot/cpu/aarch64/jvmciCodeInstaller_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/jvmciCodeInstaller_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "jvmci/jvmci.hpp" #include "jvmci/jvmciCodeInstaller.hpp" diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp index d561fb912a311..b6472b1b94812 100644 --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2024, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" #include "ci/ciEnv.hpp" diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64_aes.cpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64_aes.cpp index 03853a7ca46be..84b85b7b445cb 100644 --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64_aes.cpp +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64_aes.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64_chacha.cpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64_chacha.cpp index 9e53258730e50..1f7bb8f46f64f 100644 --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64_chacha.cpp +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64_chacha.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * 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,9 +22,6 @@ * */ -#include "precompiled.hpp" - -#include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" #include "macroAssembler_aarch64.hpp" #include "memory/resourceArea.hpp" diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64_trig.cpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64_trig.cpp index 91226dc78eb4f..d4bc983511f1d 100644 --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64_trig.cpp +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64_trig.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, Cavium. All rights reserved. (By BELLSOFT) * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" #include "macroAssembler_aarch64.hpp" diff --git a/src/hotspot/cpu/aarch64/methodHandles_aarch64.cpp b/src/hotspot/cpu/aarch64/methodHandles_aarch64.cpp index aa6a9d14ff176..588b8898d2d2a 100644 --- a/src/hotspot/cpu/aarch64/methodHandles_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/methodHandles_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "classfile/javaClasses.inline.hpp" #include "classfile/vmClasses.hpp" diff --git a/src/hotspot/cpu/aarch64/nativeInst_aarch64.cpp b/src/hotspot/cpu/aarch64/nativeInst_aarch64.cpp index 1f6d729238974..33158d6b97a91 100644 --- a/src/hotspot/cpu/aarch64/nativeInst_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/nativeInst_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "code/codeCache.hpp" #include "code/compiledIC.hpp" diff --git a/src/hotspot/cpu/aarch64/registerMap_aarch64.cpp b/src/hotspot/cpu/aarch64/registerMap_aarch64.cpp index 7bf513eba31ed..b58386ec80291 100644 --- a/src/hotspot/cpu/aarch64/registerMap_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/registerMap_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021, Arm Limited. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -22,7 +22,6 @@ * questions. */ -#include "precompiled.hpp" #include "runtime/registerMap.hpp" #include "vmreg_aarch64.inline.hpp" diff --git a/src/hotspot/cpu/aarch64/register_aarch64.cpp b/src/hotspot/cpu/aarch64/register_aarch64.cpp index 3a46e38a72a76..82683daae4f08 100644 --- a/src/hotspot/cpu/aarch64/register_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/register_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "register_aarch64.hpp" Register::RegisterImpl all_RegisterImpls [Register::number_of_declared_registers + 1]; diff --git a/src/hotspot/cpu/aarch64/relocInfo_aarch64.cpp b/src/hotspot/cpu/aarch64/relocInfo_aarch64.cpp index c4c8648d552d0..f5d7d9e4387ec 100644 --- a/src/hotspot/cpu/aarch64/relocInfo_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/relocInfo_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "code/nmethod.hpp" #include "code/relocInfo.hpp" diff --git a/src/hotspot/cpu/aarch64/runtime_aarch64.cpp b/src/hotspot/cpu/aarch64/runtime_aarch64.cpp index 5358a4e6a1d48..635c074eadc63 100644 --- a/src/hotspot/cpu/aarch64/runtime_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/runtime_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #ifdef COMPILER2 #include "asm/macroAssembler.hpp" #include "asm/macroAssembler.inline.hpp" diff --git a/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp b/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp index fa48092fd505a..b0b299876018a 100644 --- a/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2021, Red Hat Inc. All rights reserved. * Copyright (c) 2021, Azul Systems, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "asm/macroAssembler.inline.hpp" #include "code/codeCache.hpp" @@ -760,7 +759,7 @@ AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm Label L_skip_barrier; { // Bypass the barrier for non-static methods - __ ldrw(rscratch1, Address(rmethod, Method::access_flags_offset())); + __ ldrh(rscratch1, Address(rmethod, Method::access_flags_offset())); __ andsw(zr, rscratch1, JVM_ACC_STATIC); __ br(Assembler::EQ, L_skip_barrier); // non-static } diff --git a/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp b/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp index de5df5c1af156..0986e45a0a2c2 100644 --- a/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2024, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "asm/macroAssembler.inline.hpp" #include "asm/register.hpp" diff --git a/src/hotspot/cpu/aarch64/stubRoutines_aarch64.cpp b/src/hotspot/cpu/aarch64/stubRoutines_aarch64.cpp index dee615df5a51f..407e3d70af9ac 100644 --- a/src/hotspot/cpu/aarch64/stubRoutines_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/stubRoutines_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "runtime/deoptimization.hpp" #include "runtime/frame.inline.hpp" #include "runtime/javaThread.hpp" diff --git a/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp b/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp index f70450b722223..fbe06a6d78138 100644 --- a/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "classfile/javaClasses.hpp" #include "compiler/disassembler.hpp" @@ -809,7 +808,7 @@ void TemplateInterpreterGenerator::lock_method() { #ifdef ASSERT { Label L; - __ ldrw(r0, access_flags); + __ ldrh(r0, access_flags); __ tst(r0, JVM_ACC_SYNCHRONIZED); __ br(Assembler::NE, L); __ stop("method doesn't need synchronization"); @@ -820,7 +819,7 @@ void TemplateInterpreterGenerator::lock_method() { // get synchronization object { Label done; - __ ldrw(r0, access_flags); + __ ldrh(r0, access_flags); __ tst(r0, JVM_ACC_STATIC); // get receiver (assume this is frequent case) __ ldr(r0, Address(rlocals, Interpreter::local_offset_in_bytes(0))); @@ -1225,7 +1224,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { // make sure method is native & not abstract #ifdef ASSERT - __ ldrw(r0, access_flags); + __ ldrh(r0, access_flags); { Label L; __ tst(r0, JVM_ACC_NATIVE); @@ -1277,7 +1276,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { #ifdef ASSERT { Label L; - __ ldrw(r0, access_flags); + __ ldrh(r0, access_flags); __ tst(r0, JVM_ACC_SYNCHRONIZED); __ br(Assembler::EQ, L); __ stop("method needs synchronization"); @@ -1354,7 +1353,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { // pass mirror handle if static call { Label L; - __ ldrw(t, Address(rmethod, Method::access_flags_offset())); + __ ldrh(t, Address(rmethod, Method::access_flags_offset())); __ tbz(t, exact_log2(JVM_ACC_STATIC), L); // get mirror __ load_mirror(t, rmethod, r10, rscratch2); @@ -1564,7 +1563,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { // do unlocking if necessary { Label L; - __ ldrw(t, Address(rmethod, Method::access_flags_offset())); + __ ldrh(t, Address(rmethod, Method::access_flags_offset())); __ tbz(t, exact_log2(JVM_ACC_SYNCHRONIZED), L); // the code below should be shared with interpreter macro // assembler implementation @@ -1695,7 +1694,7 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) { // make sure method is not native & not abstract #ifdef ASSERT - __ ldrw(r0, access_flags); + __ ldrh(r0, access_flags); { Label L; __ tst(r0, JVM_ACC_NATIVE); @@ -1751,7 +1750,7 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) { #ifdef ASSERT { Label L; - __ ldrw(r0, access_flags); + __ ldrh(r0, access_flags); __ tst(r0, JVM_ACC_SYNCHRONIZED); __ br(Assembler::EQ, L); __ stop("method needs synchronization"); diff --git a/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp b/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp index 60d4c3c511009..e50810486c80d 100644 --- a/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "compiler/disassembler.hpp" #include "compiler/compilerDefinitions.inline.hpp" diff --git a/src/hotspot/cpu/aarch64/upcallLinker_aarch64.cpp b/src/hotspot/cpu/aarch64/upcallLinker_aarch64.cpp index a2925f00b053f..ac597bea07d5c 100644 --- a/src/hotspot/cpu/aarch64/upcallLinker_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/upcallLinker_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2019, 2022, Arm Limited. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -22,7 +22,6 @@ * questions. */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "classfile/javaClasses.hpp" #include "logging/logStream.hpp" diff --git a/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp b/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp index 87c7862e2503d..874f8a380ae48 100644 --- a/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2020, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "pauth_aarch64.hpp" #include "register_aarch64.hpp" #include "runtime/arguments.hpp" @@ -158,6 +157,10 @@ void VM_Version::initialize() { if (FLAG_IS_DEFAULT(OnSpinWaitInstCount)) { FLAG_SET_DEFAULT(OnSpinWaitInstCount, 2); } + if (FLAG_IS_DEFAULT(CodeEntryAlignment) && + (_model == CPU_MODEL_AMPERE_1A || _model == CPU_MODEL_AMPERE_1B)) { + FLAG_SET_DEFAULT(CodeEntryAlignment, 32); + } } // ThunderX diff --git a/src/hotspot/cpu/aarch64/vmreg_aarch64.cpp b/src/hotspot/cpu/aarch64/vmreg_aarch64.cpp index 49adb39834005..47ca0b30708b9 100644 --- a/src/hotspot/cpu/aarch64/vmreg_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/vmreg_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "code/vmreg.hpp" #include "vmreg_aarch64.inline.hpp" diff --git a/src/hotspot/cpu/aarch64/vtableStubs_aarch64.cpp b/src/hotspot/cpu/aarch64/vtableStubs_aarch64.cpp index 56da06433e0b8..11ea02621d765 100644 --- a/src/hotspot/cpu/aarch64/vtableStubs_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/vtableStubs_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.inline.hpp" #include "asm/macroAssembler.inline.hpp" #include "code/compiledIC.hpp" diff --git a/src/hotspot/cpu/arm/abstractInterpreter_arm.cpp b/src/hotspot/cpu/arm/abstractInterpreter_arm.cpp index 53e557fad86c8..075db4736f132 100644 --- a/src/hotspot/cpu/arm/abstractInterpreter_arm.cpp +++ b/src/hotspot/cpu/arm/abstractInterpreter_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "interpreter/bytecode.hpp" #include "interpreter/interpreter.hpp" diff --git a/src/hotspot/cpu/arm/arm.ad b/src/hotspot/cpu/arm/arm.ad index a3db5c0619ced..617745dee20ab 100644 --- a/src/hotspot/cpu/arm/arm.ad +++ b/src/hotspot/cpu/arm/arm.ad @@ -1,5 +1,5 @@ // -// Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. // // This code is free software; you can redistribute it and/or modify it @@ -283,7 +283,7 @@ void MachPrologNode::format( PhaseRegAlloc *ra_, outputStream *st ) const { } st->print_cr("PUSH R_FP|R_LR_LR"); st->print("\t"); if (framesize != 0) { - st->print ("SUB R_SP, R_SP, " SIZE_FORMAT,framesize); + st->print ("SUB R_SP, R_SP, %zu", framesize); } if (C->stub_function() == nullptr && BarrierSet::barrier_set()->barrier_set_nmethod() != nullptr) { @@ -362,7 +362,7 @@ void MachEpilogNode::format( PhaseRegAlloc *ra_, outputStream *st ) const { framesize -= 2*wordSize; if (framesize != 0) { - st->print("ADD R_SP, R_SP, " SIZE_FORMAT "\n\t",framesize); + st->print("ADD R_SP, R_SP, %zu\n\t",framesize); } st->print("POP R_FP|R_LR_LR"); diff --git a/src/hotspot/cpu/arm/assembler_arm.cpp b/src/hotspot/cpu/arm/assembler_arm.cpp index ec34912ad5113..246c25c6575c1 100644 --- a/src/hotspot/cpu/arm/assembler_arm.cpp +++ b/src/hotspot/cpu/arm/assembler_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" #include "ci/ciEnv.hpp" diff --git a/src/hotspot/cpu/arm/assembler_arm_32.cpp b/src/hotspot/cpu/arm/assembler_arm_32.cpp index b140bce707633..36a0ae6ebacaa 100644 --- a/src/hotspot/cpu/arm/assembler_arm_32.cpp +++ b/src/hotspot/cpu/arm/assembler_arm_32.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" #include "ci/ciEnv.hpp" diff --git a/src/hotspot/cpu/arm/c1_CodeStubs_arm.cpp b/src/hotspot/cpu/arm/c1_CodeStubs_arm.cpp index 8e85fa88a8749..bca6c7ca30cb8 100644 --- a/src/hotspot/cpu/arm/c1_CodeStubs_arm.cpp +++ b/src/hotspot/cpu/arm/c1_CodeStubs_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "c1/c1_CodeStubs.hpp" #include "c1/c1_FrameMap.hpp" diff --git a/src/hotspot/cpu/arm/c1_FrameMap_arm.cpp b/src/hotspot/cpu/arm/c1_FrameMap_arm.cpp index 7eb4009be1136..0fd113c8ceb1b 100644 --- a/src/hotspot/cpu/arm/c1_FrameMap_arm.cpp +++ b/src/hotspot/cpu/arm/c1_FrameMap_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_FrameMap.hpp" #include "c1/c1_LIR.hpp" #include "runtime/sharedRuntime.hpp" diff --git a/src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp b/src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp index b14e6f0b4ca0c..14a51bf4b1352 100644 --- a/src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp +++ b/src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "c1/c1_Compilation.hpp" #include "c1/c1_LIRAssembler.hpp" diff --git a/src/hotspot/cpu/arm/c1_LIRGenerator_arm.cpp b/src/hotspot/cpu/arm/c1_LIRGenerator_arm.cpp index a70bf2cbda953..39c20700a2d6c 100644 --- a/src/hotspot/cpu/arm/c1_LIRGenerator_arm.cpp +++ b/src/hotspot/cpu/arm/c1_LIRGenerator_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "c1/c1_Compilation.hpp" #include "c1/c1_FrameMap.hpp" diff --git a/src/hotspot/cpu/arm/c1_LIR_arm.cpp b/src/hotspot/cpu/arm/c1_LIR_arm.cpp index 9d70fd12f3558..b8d693093483b 100644 --- a/src/hotspot/cpu/arm/c1_LIR_arm.cpp +++ b/src/hotspot/cpu/arm/c1_LIR_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_LIR.hpp" FloatRegister LIR_Opr::as_float_reg() const { diff --git a/src/hotspot/cpu/arm/c1_LinearScan_arm.cpp b/src/hotspot/cpu/arm/c1_LinearScan_arm.cpp index 21030b9a23f95..f1d6c6a0ff94f 100644 --- a/src/hotspot/cpu/arm/c1_LinearScan_arm.cpp +++ b/src/hotspot/cpu/arm/c1_LinearScan_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_Instruction.hpp" #include "c1/c1_LinearScan.hpp" #include "utilities/bitMap.inline.hpp" diff --git a/src/hotspot/cpu/arm/c1_MacroAssembler_arm.cpp b/src/hotspot/cpu/arm/c1_MacroAssembler_arm.cpp index 70542d278acf7..195607d5c9119 100644 --- a/src/hotspot/cpu/arm/c1_MacroAssembler_arm.cpp +++ b/src/hotspot/cpu/arm/c1_MacroAssembler_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_MacroAssembler.hpp" #include "c1/c1_Runtime1.hpp" #include "gc/shared/barrierSet.hpp" diff --git a/src/hotspot/cpu/arm/c1_Runtime1_arm.cpp b/src/hotspot/cpu/arm/c1_Runtime1_arm.cpp index bae882ea93d93..949e985ab1eea 100644 --- a/src/hotspot/cpu/arm/c1_Runtime1_arm.cpp +++ b/src/hotspot/cpu/arm/c1_Runtime1_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "c1/c1_Defs.hpp" #include "c1/c1_LIRAssembler.hpp" diff --git a/src/hotspot/cpu/arm/c2_MacroAssembler_arm.cpp b/src/hotspot/cpu/arm/c2_MacroAssembler_arm.cpp index 900bd33fd9d46..89be6d288ffeb 100644 --- a/src/hotspot/cpu/arm/c2_MacroAssembler_arm.cpp +++ b/src/hotspot/cpu/arm/c2_MacroAssembler_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" #include "opto/c2_MacroAssembler.hpp" diff --git a/src/hotspot/cpu/arm/compiledIC_arm.cpp b/src/hotspot/cpu/arm/compiledIC_arm.cpp index 2556a79126a6d..86927cd24ab9e 100644 --- a/src/hotspot/cpu/arm/compiledIC_arm.cpp +++ b/src/hotspot/cpu/arm/compiledIC_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "code/compiledIC.hpp" #include "code/nativeInst.hpp" diff --git a/src/hotspot/cpu/arm/downcallLinker_arm.cpp b/src/hotspot/cpu/arm/downcallLinker_arm.cpp index eb15424eb38cf..e0d32dbe154e0 100644 --- a/src/hotspot/cpu/arm/downcallLinker_arm.cpp +++ b/src/hotspot/cpu/arm/downcallLinker_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, Red Hat, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -22,7 +22,6 @@ * questions. */ -#include "precompiled.hpp" #include "prims/downcallLinker.hpp" #include "utilities/debug.hpp" diff --git a/src/hotspot/cpu/arm/foreignGlobals_arm.cpp b/src/hotspot/cpu/arm/foreignGlobals_arm.cpp index 5f5a4eb32e0c7..677440e380235 100644 --- a/src/hotspot/cpu/arm/foreignGlobals_arm.cpp +++ b/src/hotspot/cpu/arm/foreignGlobals_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, Red Hat, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -22,7 +22,6 @@ * questions. */ -#include "precompiled.hpp" #include "code/vmreg.hpp" #include "prims/foreignGlobals.hpp" #include "utilities/debug.hpp" diff --git a/src/hotspot/cpu/arm/frame_arm.cpp b/src/hotspot/cpu/arm/frame_arm.cpp index 13a5c471c6fea..2722f93edec55 100644 --- a/src/hotspot/cpu/arm/frame_arm.cpp +++ b/src/hotspot/cpu/arm/frame_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "compiler/oopMap.hpp" #include "interpreter/interpreter.hpp" #include "memory/resourceArea.hpp" diff --git a/src/hotspot/cpu/arm/gc/g1/g1BarrierSetAssembler_arm.cpp b/src/hotspot/cpu/arm/gc/g1/g1BarrierSetAssembler_arm.cpp index 17ac726ada774..466dcc8fe66c1 100644 --- a/src/hotspot/cpu/arm/gc/g1/g1BarrierSetAssembler_arm.cpp +++ b/src/hotspot/cpu/arm/gc/g1/g1BarrierSetAssembler_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "gc/g1/g1BarrierSet.hpp" #include "gc/g1/g1BarrierSetAssembler.hpp" diff --git a/src/hotspot/cpu/arm/gc/shared/barrierSetAssembler_arm.cpp b/src/hotspot/cpu/arm/gc/shared/barrierSetAssembler_arm.cpp index 521c766bcd072..704ca71ce990d 100644 --- a/src/hotspot/cpu/arm/gc/shared/barrierSetAssembler_arm.cpp +++ b/src/hotspot/cpu/arm/gc/shared/barrierSetAssembler_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/barrierSetAssembler.hpp" #include "gc/shared/barrierSetNMethod.hpp" diff --git a/src/hotspot/cpu/arm/gc/shared/barrierSetNMethod_arm.cpp b/src/hotspot/cpu/arm/gc/shared/barrierSetNMethod_arm.cpp index ed15cc5ebcfe7..224a499ff5420 100644 --- a/src/hotspot/cpu/arm/gc/shared/barrierSetNMethod_arm.cpp +++ b/src/hotspot/cpu/arm/gc/shared/barrierSetNMethod_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "code/nativeInst.hpp" #include "gc/shared/barrierSetAssembler.hpp" #include "gc/shared/barrierSetNMethod.hpp" diff --git a/src/hotspot/cpu/arm/gc/shared/cardTableBarrierSetAssembler_arm.cpp b/src/hotspot/cpu/arm/gc/shared/cardTableBarrierSetAssembler_arm.cpp index 11b2ca2ef1d8c..91d3b8e9e5cee 100644 --- a/src/hotspot/cpu/arm/gc/shared/cardTableBarrierSetAssembler_arm.cpp +++ b/src/hotspot/cpu/arm/gc/shared/cardTableBarrierSetAssembler_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/cardTable.hpp" diff --git a/src/hotspot/cpu/arm/gc/shared/modRefBarrierSetAssembler_arm.cpp b/src/hotspot/cpu/arm/gc/shared/modRefBarrierSetAssembler_arm.cpp index 73208cec4e8fe..cb4058d48edb9 100644 --- a/src/hotspot/cpu/arm/gc/shared/modRefBarrierSetAssembler_arm.cpp +++ b/src/hotspot/cpu/arm/gc/shared/modRefBarrierSetAssembler_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "gc/shared/modRefBarrierSetAssembler.hpp" diff --git a/src/hotspot/cpu/arm/icache_arm.cpp b/src/hotspot/cpu/arm/icache_arm.cpp index 61fcb8a358048..53e9824756a2e 100644 --- a/src/hotspot/cpu/arm/icache_arm.cpp +++ b/src/hotspot/cpu/arm/icache_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.inline.hpp" #include "asm/macroAssembler.hpp" #include "runtime/icache.hpp" diff --git a/src/hotspot/cpu/arm/interp_masm_arm.cpp b/src/hotspot/cpu/arm/interp_masm_arm.cpp index 3a81fdddb3c32..e9e6187a6d181 100644 --- a/src/hotspot/cpu/arm/interp_masm_arm.cpp +++ b/src/hotspot/cpu/arm/interp_masm_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/cardTable.hpp" @@ -736,7 +735,7 @@ void InterpreterMacroAssembler::remove_activation(TosState state, Register ret_a ldrb(Rflag, do_not_unlock_if_synchronized); // get method access flags - ldr_u32(Raccess_flags, Address(Rmethod, Method::access_flags_offset())); + ldrh(Raccess_flags, Address(Rmethod, Method::access_flags_offset())); strb(zero_register(Rtemp), do_not_unlock_if_synchronized); // reset the flag diff --git a/src/hotspot/cpu/arm/interpreterRT_arm.cpp b/src/hotspot/cpu/arm/interpreterRT_arm.cpp index c8996bc266ca3..20dcbcdd8be0e 100644 --- a/src/hotspot/cpu/arm/interpreterRT_arm.cpp +++ b/src/hotspot/cpu/arm/interpreterRT_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "interpreter/interp_masm.hpp" #include "interpreter/interpreter.hpp" diff --git a/src/hotspot/cpu/arm/jniFastGetField_arm.cpp b/src/hotspot/cpu/arm/jniFastGetField_arm.cpp index 2a7e16578fffa..3a5dd10e82eba 100644 --- a/src/hotspot/cpu/arm/jniFastGetField_arm.cpp +++ b/src/hotspot/cpu/arm/jniFastGetField_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.inline.hpp" #include "asm/macroAssembler.hpp" #include "code/codeBlob.hpp" diff --git a/src/hotspot/cpu/arm/macroAssembler_arm.cpp b/src/hotspot/cpu/arm/macroAssembler_arm.cpp index 8e7b323e535f1..638b3a5404c25 100644 --- a/src/hotspot/cpu/arm/macroAssembler_arm.cpp +++ b/src/hotspot/cpu/arm/macroAssembler_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2023, Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" #include "asm/macroAssembler.hpp" diff --git a/src/hotspot/cpu/arm/methodHandles_arm.cpp b/src/hotspot/cpu/arm/methodHandles_arm.cpp index f59e01112e904..3710fa33f365e 100644 --- a/src/hotspot/cpu/arm/methodHandles_arm.cpp +++ b/src/hotspot/cpu/arm/methodHandles_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,6 @@ // cross platform development for JSR292. // Last synchronization: changeset f8c9417e3571 -#include "precompiled.hpp" #include "classfile/javaClasses.inline.hpp" #include "classfile/vmClasses.hpp" #include "interpreter/interpreter.hpp" @@ -497,7 +496,7 @@ void trace_method_handle_stub(const char* adaptername, if (!has_mh) { mh_reg_name = "R5"; } - log_info(methodhandles)("MH %s %s=" PTR_FORMAT " sp=(" PTR_FORMAT "+" INTX_FORMAT ") stack_size=" INTX_FORMAT " bp=" PTR_FORMAT, + log_info(methodhandles)("MH %s %s=" PTR_FORMAT " sp=(" PTR_FORMAT "+%zd) stack_size=%zd bp=" PTR_FORMAT, adaptername, mh_reg_name, mh_reg, (intptr_t)entry_sp, (intptr_t)saved_sp - (intptr_t)entry_sp, (intptr_t)(base_sp - last_sp), (intptr_t)saved_bp); diff --git a/src/hotspot/cpu/arm/nativeInst_arm_32.cpp b/src/hotspot/cpu/arm/nativeInst_arm_32.cpp index 6a4062f29b3ba..2caf2d7587e53 100644 --- a/src/hotspot/cpu/arm/nativeInst_arm_32.cpp +++ b/src/hotspot/cpu/arm/nativeInst_arm_32.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.inline.hpp" #include "code/codeCache.hpp" #include "memory/resourceArea.hpp" diff --git a/src/hotspot/cpu/arm/register_arm.cpp b/src/hotspot/cpu/arm/register_arm.cpp index a0ae9ff4f92a9..ea3ef87e6708f 100644 --- a/src/hotspot/cpu/arm/register_arm.cpp +++ b/src/hotspot/cpu/arm/register_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "register_arm.hpp" #include "utilities/debug.hpp" diff --git a/src/hotspot/cpu/arm/relocInfo_arm.cpp b/src/hotspot/cpu/arm/relocInfo_arm.cpp index fb112cdcfc0fa..2006be978bcdf 100644 --- a/src/hotspot/cpu/arm/relocInfo_arm.cpp +++ b/src/hotspot/cpu/arm/relocInfo_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.inline.hpp" #include "code/relocInfo.hpp" #include "nativeInst_arm.hpp" diff --git a/src/hotspot/cpu/arm/runtime_arm.cpp b/src/hotspot/cpu/arm/runtime_arm.cpp index cd76843d6dfef..cf4b398cf1fb9 100644 --- a/src/hotspot/cpu/arm/runtime_arm.cpp +++ b/src/hotspot/cpu/arm/runtime_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #ifdef COMPILER2 #include "asm/assembler.inline.hpp" #include "code/vmreg.hpp" diff --git a/src/hotspot/cpu/arm/sharedRuntime_arm.cpp b/src/hotspot/cpu/arm/sharedRuntime_arm.cpp index 82e16836acb57..c63d72920a5b6 100644 --- a/src/hotspot/cpu/arm/sharedRuntime_arm.cpp +++ b/src/hotspot/cpu/arm/sharedRuntime_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.inline.hpp" #include "code/compiledIC.hpp" #include "code/debugInfoRec.hpp" diff --git a/src/hotspot/cpu/arm/stubGenerator_arm.cpp b/src/hotspot/cpu/arm/stubGenerator_arm.cpp index 9b91e02cf07f2..be550d818c00c 100644 --- a/src/hotspot/cpu/arm/stubGenerator_arm.cpp +++ b/src/hotspot/cpu/arm/stubGenerator_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.inline.hpp" #include "compiler/oopMap.hpp" #include "gc/shared/barrierSet.hpp" diff --git a/src/hotspot/cpu/arm/stubRoutines_arm.cpp b/src/hotspot/cpu/arm/stubRoutines_arm.cpp index 0cd174d8da673..ac98896163f9f 100644 --- a/src/hotspot/cpu/arm/stubRoutines_arm.cpp +++ b/src/hotspot/cpu/arm/stubRoutines_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "runtime/deoptimization.hpp" #include "runtime/frame.inline.hpp" #include "runtime/stubRoutines.hpp" diff --git a/src/hotspot/cpu/arm/templateInterpreterGenerator_arm.cpp b/src/hotspot/cpu/arm/templateInterpreterGenerator_arm.cpp index 9df7a455eeb84..3f1cd1e23de8c 100644 --- a/src/hotspot/cpu/arm/templateInterpreterGenerator_arm.cpp +++ b/src/hotspot/cpu/arm/templateInterpreterGenerator_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "asm/macroAssembler.inline.hpp" #include "classfile/javaClasses.hpp" @@ -579,7 +578,7 @@ void TemplateInterpreterGenerator::lock_method() { #ifdef ASSERT { Label L; - __ ldr_u32(Rtemp, Address(Rmethod, Method::access_flags_offset())); + __ ldrh(Rtemp, Address(Rmethod, Method::access_flags_offset())); __ tbnz(Rtemp, JVM_ACC_SYNCHRONIZED_BIT, L); __ stop("method doesn't need synchronization"); __ bind(L); @@ -588,7 +587,7 @@ void TemplateInterpreterGenerator::lock_method() { // get synchronization object { Label done; - __ ldr_u32(Rtemp, Address(Rmethod, Method::access_flags_offset())); + __ ldrh(Rtemp, Address(Rmethod, Method::access_flags_offset())); __ tst(Rtemp, JVM_ACC_STATIC); __ ldr(R0, Address(Rlocals, Interpreter::local_offset_in_bytes(0)), eq); // get receiver (assume this is frequent case) __ b(done, eq); @@ -851,7 +850,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { // make sure method is native & not abstract #ifdef ASSERT - __ ldr_u32(Rtemp, Address(Rmethod, Method::access_flags_offset())); + __ ldrh(Rtemp, Address(Rmethod, Method::access_flags_offset())); { Label L; __ tbnz(Rtemp, JVM_ACC_NATIVE_BIT, L); @@ -893,7 +892,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { // no synchronization necessary #ifdef ASSERT { Label L; - __ ldr_u32(Rtemp, Address(Rmethod, Method::access_flags_offset())); + __ ldrh(Rtemp, Address(Rmethod, Method::access_flags_offset())); __ tbz(Rtemp, JVM_ACC_SYNCHRONIZED_BIT, L); __ stop("method needs synchronization"); __ bind(L); @@ -975,7 +974,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { // Pass JNIEnv and mirror for static methods { Label L; - __ ldr_u32(Rtemp, Address(Rmethod, Method::access_flags_offset())); + __ ldrh(Rtemp, Address(Rmethod, Method::access_flags_offset())); __ add(R0, Rthread, in_bytes(JavaThread::jni_environment_offset())); __ tbz(Rtemp, JVM_ACC_STATIC_BIT, L); __ load_mirror(Rtemp, Rmethod, Rtemp); @@ -1204,7 +1203,7 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) { // make sure method is not native & not abstract #ifdef ASSERT - __ ldr_u32(Rtemp, Address(Rmethod, Method::access_flags_offset())); + __ ldrh(Rtemp, Address(Rmethod, Method::access_flags_offset())); { Label L; __ tbz(Rtemp, JVM_ACC_NATIVE_BIT, L); @@ -1249,7 +1248,7 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) { // no synchronization necessary #ifdef ASSERT { Label L; - __ ldr_u32(Rtemp, Address(Rmethod, Method::access_flags_offset())); + __ ldrh(Rtemp, Address(Rmethod, Method::access_flags_offset())); __ tbz(Rtemp, JVM_ACC_SYNCHRONIZED_BIT, L); __ stop("method needs synchronization"); __ bind(L); diff --git a/src/hotspot/cpu/arm/templateTable_arm.cpp b/src/hotspot/cpu/arm/templateTable_arm.cpp index 0974ff1f9a9c3..bbe5713090af5 100644 --- a/src/hotspot/cpu/arm/templateTable_arm.cpp +++ b/src/hotspot/cpu/arm/templateTable_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "gc/shared/barrierSetAssembler.hpp" #include "gc/shared/collectedHeap.hpp" diff --git a/src/hotspot/cpu/arm/upcallLinker_arm.cpp b/src/hotspot/cpu/arm/upcallLinker_arm.cpp index 696b2001e6b7b..532ff7be8bc31 100644 --- a/src/hotspot/cpu/arm/upcallLinker_arm.cpp +++ b/src/hotspot/cpu/arm/upcallLinker_arm.cpp @@ -21,7 +21,6 @@ * questions. */ -#include "precompiled.hpp" #include "prims/upcallLinker.hpp" #include "utilities/debug.hpp" diff --git a/src/hotspot/cpu/arm/vm_version_arm_32.cpp b/src/hotspot/cpu/arm/vm_version_arm_32.cpp index d3ba352f78b15..148786a55da41 100644 --- a/src/hotspot/cpu/arm/vm_version_arm_32.cpp +++ b/src/hotspot/cpu/arm/vm_version_arm_32.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "jvm.h" #include "memory/resourceArea.hpp" diff --git a/src/hotspot/cpu/arm/vmreg_arm.cpp b/src/hotspot/cpu/arm/vmreg_arm.cpp index c7c972db5c9b6..4ce1dd0be20f5 100644 --- a/src/hotspot/cpu/arm/vmreg_arm.cpp +++ b/src/hotspot/cpu/arm/vmreg_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "code/vmreg.hpp" diff --git a/src/hotspot/cpu/arm/vtableStubs_arm.cpp b/src/hotspot/cpu/arm/vtableStubs_arm.cpp index 8f453558848b5..2d7ccd1969b0d 100644 --- a/src/hotspot/cpu/arm/vtableStubs_arm.cpp +++ b/src/hotspot/cpu/arm/vtableStubs_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.inline.hpp" #include "asm/macroAssembler.inline.hpp" #include "code/compiledIC.hpp" diff --git a/src/hotspot/cpu/ppc/abstractInterpreter_ppc.cpp b/src/hotspot/cpu/ppc/abstractInterpreter_ppc.cpp index 56f8fce5ce926..cc094ad4f995b 100644 --- a/src/hotspot/cpu/ppc/abstractInterpreter_ppc.cpp +++ b/src/hotspot/cpu/ppc/abstractInterpreter_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2023 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "interpreter/interpreter.hpp" #include "oops/constMethod.hpp" #include "oops/klass.inline.hpp" diff --git a/src/hotspot/cpu/ppc/assembler_ppc.cpp b/src/hotspot/cpu/ppc/assembler_ppc.cpp index 40c69dd290280..23f17dbb0400d 100644 --- a/src/hotspot/cpu/ppc/assembler_ppc.cpp +++ b/src/hotspot/cpu/ppc/assembler_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.inline.hpp" #include "gc/shared/cardTableBarrierSet.hpp" #include "gc/shared/collectedHeap.inline.hpp" diff --git a/src/hotspot/cpu/ppc/c1_CodeStubs_ppc.cpp b/src/hotspot/cpu/ppc/c1_CodeStubs_ppc.cpp index 4d3927dc644b8..baf21ec493205 100644 --- a/src/hotspot/cpu/ppc/c1_CodeStubs_ppc.cpp +++ b/src/hotspot/cpu/ppc/c1_CodeStubs_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "c1/c1_CodeStubs.hpp" #include "c1/c1_FrameMap.hpp" diff --git a/src/hotspot/cpu/ppc/c1_FrameMap_ppc.cpp b/src/hotspot/cpu/ppc/c1_FrameMap_ppc.cpp index a776dbcc4ef58..e4684613e2589 100644 --- a/src/hotspot/cpu/ppc/c1_FrameMap_ppc.cpp +++ b/src/hotspot/cpu/ppc/c1_FrameMap_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2019 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_FrameMap.hpp" #include "c1/c1_LIR.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 af426935b2f2b..499ed73218923 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, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "c1/c1_Compilation.hpp" #include "c1/c1_LIRAssembler.hpp" diff --git a/src/hotspot/cpu/ppc/c1_LIRGenerator_ppc.cpp b/src/hotspot/cpu/ppc/c1_LIRGenerator_ppc.cpp index b332ffbcee7d1..b0cf941fb7a9f 100644 --- a/src/hotspot/cpu/ppc/c1_LIRGenerator_ppc.cpp +++ b/src/hotspot/cpu/ppc/c1_LIRGenerator_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "c1/c1_Compilation.hpp" #include "c1/c1_FrameMap.hpp" @@ -702,8 +701,6 @@ void LIRGenerator::do_MathIntrinsic(Intrinsic* x) { value.load_item(); LIR_Opr dst = rlock_result(x); LIR_Opr tmp = new_register(T_FLOAT); - // f2hf treats tmp as live_in. Workaround: initialize to some value. - __ move(LIR_OprFact::floatConst(-0.0), tmp); // just to satisfy LinearScan __ f2hf(value.result(), dst, tmp); break; } diff --git a/src/hotspot/cpu/ppc/c1_LIR_ppc.cpp b/src/hotspot/cpu/ppc/c1_LIR_ppc.cpp index d031aaa1e4061..56a9307f21f96 100644 --- a/src/hotspot/cpu/ppc/c1_LIR_ppc.cpp +++ b/src/hotspot/cpu/ppc/c1_LIR_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/register.hpp" #include "c1/c1_LIR.hpp" diff --git a/src/hotspot/cpu/ppc/c1_LinearScan_ppc.cpp b/src/hotspot/cpu/ppc/c1_LinearScan_ppc.cpp index 026540f25b213..d6ceab8b27b1b 100644 --- a/src/hotspot/cpu/ppc/c1_LinearScan_ppc.cpp +++ b/src/hotspot/cpu/ppc/c1_LinearScan_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_Instruction.hpp" #include "c1/c1_LinearScan.hpp" #include "utilities/bitMap.inline.hpp" diff --git a/src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.cpp b/src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.cpp index 8cd21478d41a4..c89bf29177e26 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, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "c1/c1_MacroAssembler.hpp" #include "c1/c1_Runtime1.hpp" diff --git a/src/hotspot/cpu/ppc/c1_Runtime1_ppc.cpp b/src/hotspot/cpu/ppc/c1_Runtime1_ppc.cpp index 47cafc45f33ea..41d2fcb5730c4 100644 --- a/src/hotspot/cpu/ppc/c1_Runtime1_ppc.cpp +++ b/src/hotspot/cpu/ppc/c1_Runtime1_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "c1/c1_Defs.hpp" #include "c1/c1_MacroAssembler.hpp" diff --git a/src/hotspot/cpu/ppc/c2_CodeStubs_ppc.cpp b/src/hotspot/cpu/ppc/c2_CodeStubs_ppc.cpp index 93ee0659a57f8..484e0fd0196db 100644 --- a/src/hotspot/cpu/ppc/c2_CodeStubs_ppc.cpp +++ b/src/hotspot/cpu/ppc/c2_CodeStubs_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021, 2022, SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "opto/c2_MacroAssembler.hpp" #include "opto/c2_CodeStubs.hpp" #include "runtime/sharedRuntime.hpp" diff --git a/src/hotspot/cpu/ppc/c2_MacroAssembler_ppc.cpp b/src/hotspot/cpu/ppc/c2_MacroAssembler_ppc.cpp index d7f2aefd9c477..9754acd349c1e 100644 --- a/src/hotspot/cpu/ppc/c2_MacroAssembler_ppc.cpp +++ b/src/hotspot/cpu/ppc/c2_MacroAssembler_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" #include "opto/c2_MacroAssembler.hpp" diff --git a/src/hotspot/cpu/ppc/c2_init_ppc.cpp b/src/hotspot/cpu/ppc/c2_init_ppc.cpp index d570abc431a9d..3c524f3b80e94 100644 --- a/src/hotspot/cpu/ppc/c2_init_ppc.cpp +++ b/src/hotspot/cpu/ppc/c2_init_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "opto/compile.hpp" #include "opto/node.hpp" #include "runtime/globals.hpp" diff --git a/src/hotspot/cpu/ppc/compiledIC_ppc.cpp b/src/hotspot/cpu/ppc/compiledIC_ppc.cpp index a7907b43c4bac..c8cb68e3eb4eb 100644 --- a/src/hotspot/cpu/ppc/compiledIC_ppc.cpp +++ b/src/hotspot/cpu/ppc/compiledIC_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "code/compiledIC.hpp" #include "code/nmethod.hpp" diff --git a/src/hotspot/cpu/ppc/compressedKlass_ppc.cpp b/src/hotspot/cpu/ppc/compressedKlass_ppc.cpp index 51012eef86594..060eb058cfa4e 100644 --- a/src/hotspot/cpu/ppc/compressedKlass_ppc.cpp +++ b/src/hotspot/cpu/ppc/compressedKlass_ppc.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2023, Red Hat, Inc. All rights reserved. - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * */ -#include "precompiled.hpp" #include "oops/compressedKlass.hpp" #include "utilities/globalDefinitions.hpp" diff --git a/src/hotspot/cpu/ppc/downcallLinker_ppc.cpp b/src/hotspot/cpu/ppc/downcallLinker_ppc.cpp index 45859f33bfb20..026283d35278b 100644 --- a/src/hotspot/cpu/ppc/downcallLinker_ppc.cpp +++ b/src/hotspot/cpu/ppc/downcallLinker_ppc.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2020, 2024 SAP SE. All rights reserved. - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * questions. */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "code/codeBlob.hpp" #include "code/codeCache.hpp" diff --git a/src/hotspot/cpu/ppc/foreignGlobals_ppc.cpp b/src/hotspot/cpu/ppc/foreignGlobals_ppc.cpp index 2143d1394992e..4d98b7630784f 100644 --- a/src/hotspot/cpu/ppc/foreignGlobals_ppc.cpp +++ b/src/hotspot/cpu/ppc/foreignGlobals_ppc.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2020, 2023, SAP SE. All rights reserved. - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * questions. */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "code/vmreg.inline.hpp" #include "runtime/jniHandles.hpp" diff --git a/src/hotspot/cpu/ppc/frame_ppc.cpp b/src/hotspot/cpu/ppc/frame_ppc.cpp index f698b14d312b8..38c26e5e4970b 100644 --- a/src/hotspot/cpu/ppc/frame_ppc.cpp +++ b/src/hotspot/cpu/ppc/frame_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "compiler/oopMap.hpp" #include "interpreter/interpreter.hpp" #include "memory/resourceArea.hpp" @@ -122,6 +121,11 @@ bool frame::safe_for_sender(JavaThread *thread) { address sender_pc = (address) sender_abi->lr; if (Continuation::is_return_barrier_entry(sender_pc)) { + // sender_pc might be invalid so check that the frame + // actually belongs to a Continuation. + if (!Continuation::is_frame_in_continuation(thread, *this)) { + return false; + } // If our sender_pc is the return barrier, then our "real" sender is the continuation entry frame s = Continuation::continuation_bottom_sender(thread, *this, sender_sp); sender_sp = s.sp(); diff --git a/src/hotspot/cpu/ppc/gc/g1/g1BarrierSetAssembler_ppc.cpp b/src/hotspot/cpu/ppc/gc/g1/g1BarrierSetAssembler_ppc.cpp index 39693bdf925bf..46ab535b9c9ef 100644 --- a/src/hotspot/cpu/ppc/gc/g1/g1BarrierSetAssembler_ppc.cpp +++ b/src/hotspot/cpu/ppc/gc/g1/g1BarrierSetAssembler_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "gc/g1/g1BarrierSet.hpp" #include "gc/g1/g1BarrierSetAssembler.hpp" diff --git a/src/hotspot/cpu/ppc/gc/shared/barrierSetAssembler_ppc.cpp b/src/hotspot/cpu/ppc/gc/shared/barrierSetAssembler_ppc.cpp index 956b082d194b4..360e0bcbf8c37 100644 --- a/src/hotspot/cpu/ppc/gc/shared/barrierSetAssembler_ppc.cpp +++ b/src/hotspot/cpu/ppc/gc/shared/barrierSetAssembler_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2022 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "classfile/classLoaderData.hpp" #include "gc/shared/barrierSetAssembler.hpp" diff --git a/src/hotspot/cpu/ppc/gc/shared/barrierSetNMethod_ppc.cpp b/src/hotspot/cpu/ppc/gc/shared/barrierSetNMethod_ppc.cpp index d1d0e5ab02412..19084ed27c7c0 100644 --- a/src/hotspot/cpu/ppc/gc/shared/barrierSetNMethod_ppc.cpp +++ b/src/hotspot/cpu/ppc/gc/shared/barrierSetNMethod_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "code/codeBlob.hpp" #include "code/nmethod.hpp" #include "code/nativeInst.hpp" diff --git a/src/hotspot/cpu/ppc/gc/shared/cardTableBarrierSetAssembler_ppc.cpp b/src/hotspot/cpu/ppc/gc/shared/cardTableBarrierSetAssembler_ppc.cpp index c9b6b94e1ee72..c0d078890fc4d 100644 --- a/src/hotspot/cpu/ppc/gc/shared/cardTableBarrierSetAssembler_ppc.cpp +++ b/src/hotspot/cpu/ppc/gc/shared/cardTableBarrierSetAssembler_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2021 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/cardTable.hpp" diff --git a/src/hotspot/cpu/ppc/gc/shared/modRefBarrierSetAssembler_ppc.cpp b/src/hotspot/cpu/ppc/gc/shared/modRefBarrierSetAssembler_ppc.cpp index a500a078c2d33..3a3ed391be0f7 100644 --- a/src/hotspot/cpu/ppc/gc/shared/modRefBarrierSetAssembler_ppc.cpp +++ b/src/hotspot/cpu/ppc/gc/shared/modRefBarrierSetAssembler_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2021 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "gc/shared/modRefBarrierSetAssembler.hpp" #include "runtime/jniHandles.hpp" diff --git a/src/hotspot/cpu/ppc/gc/shenandoah/c1/shenandoahBarrierSetC1_ppc.cpp b/src/hotspot/cpu/ppc/gc/shenandoah/c1/shenandoahBarrierSetC1_ppc.cpp index ce12d1fcf03f1..48422bc66212e 100644 --- a/src/hotspot/cpu/ppc/gc/shenandoah/c1/shenandoahBarrierSetC1_ppc.cpp +++ b/src/hotspot/cpu/ppc/gc/shenandoah/c1/shenandoahBarrierSetC1_ppc.cpp @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "c1/c1_LIRAssembler.hpp" #include "c1/c1_MacroAssembler.hpp" diff --git a/src/hotspot/cpu/ppc/gc/shenandoah/shenandoahBarrierSetAssembler_ppc.cpp b/src/hotspot/cpu/ppc/gc/shenandoah/shenandoahBarrierSetAssembler_ppc.cpp index 9ce0b7c8eb4ee..38423f119003d 100644 --- a/src/hotspot/cpu/ppc/gc/shenandoah/shenandoahBarrierSetAssembler_ppc.cpp +++ b/src/hotspot/cpu/ppc/gc/shenandoah/shenandoahBarrierSetAssembler_ppc.cpp @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "gc/shared/gcArguments.hpp" #include "gc/shared/gc_globals.hpp" diff --git a/src/hotspot/cpu/ppc/gc/z/zAddress_ppc.cpp b/src/hotspot/cpu/ppc/gc/z/zAddress_ppc.cpp index 5891d50f715ee..28a57b2dc293f 100644 --- a/src/hotspot/cpu/ppc/gc/z/zAddress_ppc.cpp +++ b/src/hotspot/cpu/ppc/gc/z/zAddress_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/gcLogPrecious.hpp" #include "gc/shared/gc_globals.hpp" #include "gc/z/zAddress.inline.hpp" @@ -82,7 +81,7 @@ static size_t probe_valid_max_address_bit() { munmap(result_addr, page_size); } } - log_info_p(gc, init)("Probing address space for the highest valid bit: " SIZE_FORMAT, max_address_bit); + log_info_p(gc, init)("Probing address space for the highest valid bit: %zu", max_address_bit); return MAX2(max_address_bit, MINIMUM_MAX_ADDRESS_BIT); #else // LINUX return DEFAULT_MAX_ADDRESS_BIT; diff --git a/src/hotspot/cpu/ppc/gc/z/zBarrierSetAssembler_ppc.cpp b/src/hotspot/cpu/ppc/gc/z/zBarrierSetAssembler_ppc.cpp index b9ea67dabe3d6..7b9d86142afea 100644 --- a/src/hotspot/cpu/ppc/gc/z/zBarrierSetAssembler_ppc.cpp +++ b/src/hotspot/cpu/ppc/gc/z/zBarrierSetAssembler_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -22,7 +22,6 @@ * questions. */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "asm/register.hpp" #include "code/codeBlob.hpp" diff --git a/src/hotspot/cpu/ppc/icache_ppc.cpp b/src/hotspot/cpu/ppc/icache_ppc.cpp index 6901efc37b77a..05ad3c7a30d14 100644 --- a/src/hotspot/cpu/ppc/icache_ppc.cpp +++ b/src/hotspot/cpu/ppc/icache_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "runtime/icache.hpp" // Use inline assembler to implement icache flush. diff --git a/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp b/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp index 67b9bdc04142f..ffbcb083f3cd1 100644 --- a/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp +++ b/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -24,7 +24,6 @@ */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/barrierSetAssembler.hpp" @@ -681,14 +680,14 @@ void InterpreterMacroAssembler::unlock_if_synchronized_method(TosState state, // Check if synchronized method or unlocking prevented by // JavaThread::do_not_unlock_if_synchronized flag. lbz(Rdo_not_unlock_flag, in_bytes(JavaThread::do_not_unlock_if_synchronized_offset()), R16_thread); - lwz(Raccess_flags, in_bytes(Method::access_flags_offset()), R19_method); + lhz(Raccess_flags, in_bytes(Method::access_flags_offset()), R19_method); li(R0, 0); stb(R0, in_bytes(JavaThread::do_not_unlock_if_synchronized_offset()), R16_thread); // reset flag push(state); // Skip if we don't have to unlock. - rldicl_(R0, Raccess_flags, 64-JVM_ACC_SYNCHRONIZED_BIT, 63); // Extract bit and compare to 0. + testbitdi(CCR0, R0, Raccess_flags, JVM_ACC_SYNCHRONIZED_BIT); beq(CCR0, Lunlocked); cmpwi(CCR0, Rdo_not_unlock_flag, 0); diff --git a/src/hotspot/cpu/ppc/interpreterRT_ppc.cpp b/src/hotspot/cpu/ppc/interpreterRT_ppc.cpp index e2043db71004b..c3d4bb01e5f1b 100644 --- a/src/hotspot/cpu/ppc/interpreterRT_ppc.cpp +++ b/src/hotspot/cpu/ppc/interpreterRT_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2013 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.inline.hpp" #include "interpreter/interp_masm.hpp" #include "interpreter/interpreter.hpp" diff --git a/src/hotspot/cpu/ppc/jniFastGetField_ppc.cpp b/src/hotspot/cpu/ppc/jniFastGetField_ppc.cpp index 819ecaf550e38..a6174959fe682 100644 --- a/src/hotspot/cpu/ppc/jniFastGetField_ppc.cpp +++ b/src/hotspot/cpu/ppc/jniFastGetField_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2019 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/barrierSetAssembler.hpp" diff --git a/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp b/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp index 971ed99f9eb50..f73325b652e85 100644 --- a/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp +++ b/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "code/compiledIC.hpp" #include "compiler/disassembler.hpp" diff --git a/src/hotspot/cpu/ppc/methodHandles_ppc.cpp b/src/hotspot/cpu/ppc/methodHandles_ppc.cpp index ccec05e710530..5017284c39d2f 100644 --- a/src/hotspot/cpu/ppc/methodHandles_ppc.cpp +++ b/src/hotspot/cpu/ppc/methodHandles_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "classfile/javaClasses.inline.hpp" #include "classfile/vmClasses.hpp" diff --git a/src/hotspot/cpu/ppc/nativeInst_ppc.cpp b/src/hotspot/cpu/ppc/nativeInst_ppc.cpp index 78ed81be9cb75..1114da60d2bb6 100644 --- a/src/hotspot/cpu/ppc/nativeInst_ppc.cpp +++ b/src/hotspot/cpu/ppc/nativeInst_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "code/compiledIC.hpp" #include "memory/resourceArea.hpp" diff --git a/src/hotspot/cpu/ppc/register_ppc.cpp b/src/hotspot/cpu/ppc/register_ppc.cpp index e84f89373adb0..4591d3ec2e447 100644 --- a/src/hotspot/cpu/ppc/register_ppc.cpp +++ b/src/hotspot/cpu/ppc/register_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2022 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "register_ppc.hpp" const char* Register::name() const { diff --git a/src/hotspot/cpu/ppc/relocInfo_ppc.cpp b/src/hotspot/cpu/ppc/relocInfo_ppc.cpp index c0fe87a1e13d4..559d30a8f23f7 100644 --- a/src/hotspot/cpu/ppc/relocInfo_ppc.cpp +++ b/src/hotspot/cpu/ppc/relocInfo_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.inline.hpp" #include "code/relocInfo.hpp" #include "nativeInst_ppc.hpp" diff --git a/src/hotspot/cpu/ppc/runtime_ppc.cpp b/src/hotspot/cpu/ppc/runtime_ppc.cpp index eceebc45c94e8..efd2ffa5672f7 100644 --- a/src/hotspot/cpu/ppc/runtime_ppc.cpp +++ b/src/hotspot/cpu/ppc/runtime_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #ifdef COMPILER2 #include "asm/macroAssembler.inline.hpp" #include "code/vmreg.hpp" diff --git a/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp b/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp index c2e4c2e9b55c9..95544045ff7a7 100644 --- a/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp +++ b/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "code/debugInfoRec.hpp" #include "code/compiledIC.hpp" @@ -1202,7 +1201,7 @@ AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm Label L_skip_barrier; { // Bypass the barrier for non-static methods - __ lwz(R0, in_bytes(Method::access_flags_offset()), R19_method); + __ lhz(R0, in_bytes(Method::access_flags_offset()), R19_method); __ andi_(R0, R0, JVM_ACC_STATIC); __ beq(CCR0, L_skip_barrier); // non-static } diff --git a/src/hotspot/cpu/ppc/stubGenerator_ppc.cpp b/src/hotspot/cpu/ppc/stubGenerator_ppc.cpp index f1168b5d07bf2..da17b2fced44d 100644 --- a/src/hotspot/cpu/ppc/stubGenerator_ppc.cpp +++ b/src/hotspot/cpu/ppc/stubGenerator_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "compiler/oopMap.hpp" #include "gc/shared/barrierSet.hpp" diff --git a/src/hotspot/cpu/ppc/stubRoutines_ppc_64.cpp b/src/hotspot/cpu/ppc/stubRoutines_ppc_64.cpp index 7df905b90682c..60cca4efb5771 100644 --- a/src/hotspot/cpu/ppc/stubRoutines_ppc_64.cpp +++ b/src/hotspot/cpu/ppc/stubRoutines_ppc_64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2019 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "runtime/os.hpp" #include "runtime/stubRoutines.hpp" diff --git a/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp b/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp index 9147dfc1677ab..c8b5dbe0c163e 100644 --- a/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp +++ b/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "classfile/javaClasses.hpp" #include "compiler/disassembler.hpp" @@ -144,9 +143,9 @@ address TemplateInterpreterGenerator::generate_slow_signature_handler() { // TODO PPC port: requires change in shared code. //assert(in_bytes(AccessFlags::flags_offset()) == 0, // "MethodDesc._access_flags == MethodDesc._access_flags._flags"); - // _access_flags must be a 32 bit value. - assert(sizeof(AccessFlags) == 4, "wrong size"); - __ lwa(R11_scratch1/*access_flags*/, method_(access_flags)); + // _access_flags must be a 16 bit value. + assert(sizeof(AccessFlags) == 2, "wrong size"); + __ lhz(R11_scratch1/*access_flags*/, method_(access_flags)); // testbit with condition register. __ testbitdi(CCR0, R0, R11_scratch1/*access_flags*/, JVM_ACC_STATIC_BIT); __ btrue(CCR0, L); @@ -823,7 +822,7 @@ void TemplateInterpreterGenerator::lock_method(Register Rflags, Register Rscratc { if (!flags_preloaded) { - __ lwz(Rflags, method_(access_flags)); + __ lhz(Rflags, method_(access_flags)); } #ifdef ASSERT @@ -1301,8 +1300,8 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { assert(__ nonvolatile_accross_vthread_preemtion(access_flags), "access_flags not preserved"); // Type check. - assert(4 == sizeof(AccessFlags), "unexpected field size"); - __ lwz(access_flags, method_(access_flags)); + assert(2 == sizeof(AccessFlags), "unexpected field size"); + __ lhz(access_flags, method_(access_flags)); // We don't want to reload R19_method and access_flags after calls // to some helper functions. @@ -1769,7 +1768,7 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) { #ifdef ASSERT else { Label Lok; - __ lwz(R0, in_bytes(Method::access_flags_offset()), R19_method); + __ lhz(R0, in_bytes(Method::access_flags_offset()), R19_method); __ andi_(R0, R0, JVM_ACC_SYNCHRONIZED); __ asm_assert_eq("method needs synchronization"); __ bind(Lok); diff --git a/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp b/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp index 43e78dd9d1514..d2f03c76df17f 100644 --- a/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp +++ b/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "cds/cdsConfig.hpp" #include "compiler/disassembler.hpp" diff --git a/src/hotspot/cpu/ppc/upcallLinker_ppc.cpp b/src/hotspot/cpu/ppc/upcallLinker_ppc.cpp index 40da31fa20932..872eee3b98e5a 100644 --- a/src/hotspot/cpu/ppc/upcallLinker_ppc.cpp +++ b/src/hotspot/cpu/ppc/upcallLinker_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2023 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -22,7 +22,6 @@ * questions. */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "classfile/javaClasses.hpp" #include "logging/logStream.hpp" diff --git a/src/hotspot/cpu/ppc/vm_version_ppc.cpp b/src/hotspot/cpu/ppc/vm_version_ppc.cpp index 9a4f13e41a04d..6aada789c1daf 100644 --- a/src/hotspot/cpu/ppc/vm_version_ppc.cpp +++ b/src/hotspot/cpu/ppc/vm_version_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.inline.hpp" #include "asm/macroAssembler.inline.hpp" #include "compiler/disassembler.hpp" @@ -90,7 +89,7 @@ void VM_Version::initialize() { default: break; } guarantee(PowerArchitecturePPC64_ok, "PowerArchitecturePPC64 cannot be set to " - UINTX_FORMAT " on this machine", PowerArchitecturePPC64); + "%zu on this machine", PowerArchitecturePPC64); // Power 8: Configure Data Stream Control Register. if (PowerArchitecturePPC64 >= 8 && has_mfdscr()) { diff --git a/src/hotspot/cpu/ppc/vmreg_ppc.cpp b/src/hotspot/cpu/ppc/vmreg_ppc.cpp index e76a83bc26961..d8a5c35cac0f5 100644 --- a/src/hotspot/cpu/ppc/vmreg_ppc.cpp +++ b/src/hotspot/cpu/ppc/vmreg_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2022 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "code/vmreg.hpp" diff --git a/src/hotspot/cpu/ppc/vtableStubs_ppc_64.cpp b/src/hotspot/cpu/ppc/vtableStubs_ppc_64.cpp index 567cfae8d0a5e..189a1fdeb147e 100644 --- a/src/hotspot/cpu/ppc/vtableStubs_ppc_64.cpp +++ b/src/hotspot/cpu/ppc/vtableStubs_ppc_64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "code/compiledIC.hpp" #include "code/vtableStubs.hpp" diff --git a/src/hotspot/cpu/riscv/abstractInterpreter_riscv.cpp b/src/hotspot/cpu/riscv/abstractInterpreter_riscv.cpp index 7e7321501cbbc..843a58e28d712 100644 --- a/src/hotspot/cpu/riscv/abstractInterpreter_riscv.cpp +++ b/src/hotspot/cpu/riscv/abstractInterpreter_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "interpreter/interpreter.hpp" #include "oops/constMethod.hpp" #include "oops/klass.inline.hpp" diff --git a/src/hotspot/cpu/riscv/assembler_riscv.cpp b/src/hotspot/cpu/riscv/assembler_riscv.cpp index 6a581a4d08193..4659afc09b57c 100644 --- a/src/hotspot/cpu/riscv/assembler_riscv.cpp +++ b/src/hotspot/cpu/riscv/assembler_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, 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. @@ -27,7 +27,6 @@ #include #include -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" #include "compiler/disassembler.hpp" diff --git a/src/hotspot/cpu/riscv/assembler_riscv.hpp b/src/hotspot/cpu/riscv/assembler_riscv.hpp index 31713d7362a18..21a41bd3eb400 100644 --- a/src/hotspot/cpu/riscv/assembler_riscv.hpp +++ b/src/hotspot/cpu/riscv/assembler_riscv.hpp @@ -552,24 +552,6 @@ class Assembler : public AbstractAssembler { #undef INSN -#define INSN(NAME, op, funct3) \ - void NAME(FloatRegister Rd, Register Rs, const int32_t offset) { \ - guarantee(is_simm12(offset), "offset is invalid."); \ - unsigned insn = 0; \ - uint32_t val = offset & 0xfff; \ - patch((address)&insn, 6, 0, op); \ - patch((address)&insn, 14, 12, funct3); \ - patch_reg((address)&insn, 15, Rs); \ - patch_reg((address)&insn, 7, Rd); \ - patch((address)&insn, 31, 20, val); \ - emit(insn); \ - } - - INSN(flw, 0b0000111, 0b010); - INSN(_fld, 0b0000111, 0b011); - -#undef INSN - #define INSN(NAME, op, funct3) \ void NAME(Register Rs1, Register Rs2, const int64_t offset) { \ guarantee(is_simm13(offset) && ((offset % 2) == 0), "offset is invalid."); \ @@ -813,29 +795,9 @@ enum operand_size { int8, int16, int32, uint32, int64 }; INSN(sc_d, 0b0101111, 0b011, 0b00011); #undef INSN -#define INSN(NAME, op, funct5, funct7) \ - void NAME(FloatRegister Rd, FloatRegister Rs1, RoundingMode rm = rne) { \ - unsigned insn = 0; \ - patch((address)&insn, 6, 0, op); \ - patch((address)&insn, 14, 12, rm); \ - patch((address)&insn, 24, 20, funct5); \ - patch((address)&insn, 31, 25, funct7); \ - patch_reg((address)&insn, 7, Rd); \ - patch_reg((address)&insn, 15, Rs1); \ - emit(insn); \ - } - - INSN(fsqrt_s, 0b1010011, 0b00000, 0b0101100); - INSN(fsqrt_d, 0b1010011, 0b00000, 0b0101101); - INSN(fcvt_s_h, 0b1010011, 0b00010, 0b0100000); - INSN(fcvt_h_s, 0b1010011, 0b00000, 0b0100010); - INSN(fcvt_s_d, 0b1010011, 0b00001, 0b0100000); - INSN(fcvt_d_s, 0b1010011, 0b00000, 0b0100001); -#undef INSN - // Immediate Instruction #define INSN(NAME, op, funct3) \ - void NAME(Register Rd, Register Rs1, int32_t imm) { \ + void NAME(Register Rd, Register Rs1, int64_t imm) { \ guarantee(is_simm12(imm), "Immediate is out of validity"); \ unsigned insn = 0; \ patch((address)&insn, 6, 0, op); \ @@ -846,17 +808,17 @@ enum operand_size { int8, int16, int32, uint32, int64 }; emit(insn); \ } - INSN(_addi, 0b0010011, 0b000); - INSN(slti, 0b0010011, 0b010); - INSN(_addiw, 0b0011011, 0b000); - INSN(_and_imm12, 0b0010011, 0b111); - INSN(ori, 0b0010011, 0b110); - INSN(xori, 0b0010011, 0b100); + INSN(_addi, 0b0010011, 0b000); + INSN(_addiw, 0b0011011, 0b000); + INSN(_andi, 0b0010011, 0b111); + INSN(ori, 0b0010011, 0b110); + INSN(xori, 0b0010011, 0b100); + INSN(slti, 0b0010011, 0b010); #undef INSN #define INSN(NAME, op, funct3) \ - void NAME(Register Rd, Register Rs1, uint32_t imm) { \ + void NAME(Register Rd, Register Rs1, uint64_t imm) { \ guarantee(is_uimm12(imm), "Immediate is out of validity"); \ unsigned insn = 0; \ patch((address)&insn,6, 0, op); \ @@ -928,209 +890,408 @@ enum operand_size { int8, int16, int32, uint32, int64 }; #undef INSN -// Float and Double Rigster Instruction -#define INSN(NAME, op, funct2) \ - void NAME(FloatRegister Rd, FloatRegister Rs1, FloatRegister Rs2, FloatRegister Rs3, RoundingMode rm = rne) { \ - unsigned insn = 0; \ - patch((address)&insn, 6, 0, op); \ - patch((address)&insn, 14, 12, rm); \ - patch((address)&insn, 26, 25, funct2); \ - patch_reg((address)&insn, 7, Rd); \ - patch_reg((address)&insn, 15, Rs1); \ - patch_reg((address)&insn, 20, Rs2); \ - patch_reg((address)&insn, 27, Rs3); \ - emit(insn); \ - } - - INSN(fmadd_s, 0b1000011, 0b00); - INSN(fmsub_s, 0b1000111, 0b00); - INSN(fnmsub_s, 0b1001011, 0b00); - INSN(fnmadd_s, 0b1001111, 0b00); - INSN(fmadd_d, 0b1000011, 0b01); - INSN(fmsub_d, 0b1000111, 0b01); - INSN(fnmsub_d, 0b1001011, 0b01); - INSN(fnmadd_d, 0b1001111, 0b01); - -#undef INSN - -// Float and Double Rigster Instruction -#define INSN(NAME, op, funct3, funct7) \ - void NAME(FloatRegister Rd, FloatRegister Rs1, FloatRegister Rs2) { \ - unsigned insn = 0; \ - patch((address)&insn, 6, 0, op); \ - patch((address)&insn, 14, 12, funct3); \ - patch((address)&insn, 31, 25, funct7); \ - patch_reg((address)&insn, 7, Rd); \ - patch_reg((address)&insn, 15, Rs1); \ - patch_reg((address)&insn, 20, Rs2); \ - emit(insn); \ - } - - INSN(fsgnj_s, 0b1010011, 0b000, 0b0010000); - INSN(fsgnjn_s, 0b1010011, 0b001, 0b0010000); - INSN(fsgnjx_s, 0b1010011, 0b010, 0b0010000); - INSN(fmin_s, 0b1010011, 0b000, 0b0010100); - INSN(fmax_s, 0b1010011, 0b001, 0b0010100); - INSN(fsgnj_d, 0b1010011, 0b000, 0b0010001); - INSN(fsgnjn_d, 0b1010011, 0b001, 0b0010001); - INSN(fsgnjx_d, 0b1010011, 0b010, 0b0010001); - INSN(fmin_d, 0b1010011, 0b000, 0b0010101); - INSN(fmax_d, 0b1010011, 0b001, 0b0010101); - -#undef INSN - -// Float and Double Rigster Arith Instruction -#define INSN(NAME, op, funct3, funct7) \ - void NAME(Register Rd, FloatRegister Rs1, FloatRegister Rs2) { \ - unsigned insn = 0; \ - patch((address)&insn, 6, 0, op); \ - patch((address)&insn, 14, 12, funct3); \ - patch((address)&insn, 31, 25, funct7); \ - patch_reg((address)&insn, 7, Rd); \ - patch_reg((address)&insn, 15, Rs1); \ - patch_reg((address)&insn, 20, Rs2); \ - emit(insn); \ +// ========================== +// Floating Point Instructions +// ========================== + static constexpr uint32_t OP_FP_MAJOR = 0b1010011; + + enum FmtPrecision : uint8_t { + S_32_sp = 0b00, + D_64_dp = 0b01, + H_16_hp = 0b10, + Q_128_qp = 0b11 + }; + + private: + + template + void fp_base(uint8_t Rd, uint8_t Rs1, uint8_t Rs2, RoundingMode rm) { + assert(Fmt != H_16_hp || UseZfh || UseZfhmin, "No half precision enabled"); + assert_cond(Fmt != Q_128_qp); + guarantee(is_uimm3(rm), "Rounding mode is out of validity"); + guarantee(is_uimm2(Fmt), "FMT is out of validity"); + guarantee(is_uimm5(funct5), "Funct5 is out of validity"); + uint32_t insn = 0; + patch((address)&insn, 6, 0, OP_FP_MAJOR); + patch((address)&insn, 11, 7, Rd); + patch((address)&insn, 14, 12, rm); + patch((address)&insn, 19, 15, Rs1); + patch((address)&insn, 24, 20, Rs2); + patch((address)&insn, 26, 25, Fmt); + patch((address)&insn, 31, 27, funct5); + emit(insn); } - INSN(feq_s, 0b1010011, 0b010, 0b1010000); - INSN(flt_s, 0b1010011, 0b001, 0b1010000); - INSN(fle_s, 0b1010011, 0b000, 0b1010000); - INSN(feq_d, 0b1010011, 0b010, 0b1010001); - INSN(fle_d, 0b1010011, 0b000, 0b1010001); - INSN(flt_d, 0b1010011, 0b001, 0b1010001); -#undef INSN + template + void fp_base(FloatRegister Rd, FloatRegister Rs1, FloatRegister Rs2, RoundingMode rm) { + fp_base(Rd->raw_encoding(), Rs1->raw_encoding(), Rs2->raw_encoding(), rm); + } -// Float and Double Arith Instruction -#define INSN(NAME, op, funct7) \ - void NAME(FloatRegister Rd, FloatRegister Rs1, FloatRegister Rs2, RoundingMode rm = rne) { \ - unsigned insn = 0; \ - patch((address)&insn, 6, 0, op); \ - patch((address)&insn, 14, 12, rm); \ - patch((address)&insn, 31, 25, funct7); \ - patch_reg((address)&insn, 7, Rd); \ - patch_reg((address)&insn, 15, Rs1); \ - patch_reg((address)&insn, 20, Rs2); \ - emit(insn); \ + template + void fp_base(FloatRegister Rd, FloatRegister Rs1, FloatRegister Rs2, int8_t rm) { + fp_base(Rd->raw_encoding(), Rs1->raw_encoding(), Rs2->raw_encoding(), (RoundingMode)rm); } - INSN(fadd_s, 0b1010011, 0b0000000); - INSN(fsub_s, 0b1010011, 0b0000100); - INSN(fmul_s, 0b1010011, 0b0001000); - INSN(fdiv_s, 0b1010011, 0b0001100); - INSN(fadd_d, 0b1010011, 0b0000001); - INSN(fsub_d, 0b1010011, 0b0000101); - INSN(fmul_d, 0b1010011, 0b0001001); - INSN(fdiv_d, 0b1010011, 0b0001101); + template + void fp_base(Register Rd, FloatRegister Rs1, FloatRegister Rs2, int8_t rm) { + fp_base(Rd->raw_encoding(), Rs1->raw_encoding(), Rs2->raw_encoding(), (RoundingMode)rm); + } -#undef INSN + template + void fp_base(FloatRegister Rd, FloatRegister Rs1, int8_t Rs2, int8_t rm) { + guarantee(is_uimm5(Rs2), "Rs2 is out of validity"); + fp_base(Rd->raw_encoding(), Rs1->raw_encoding(), Rs2, (RoundingMode)rm); + } -// Whole Float and Double Conversion Instruction -#define INSN(NAME, op, funct5, funct7) \ - void NAME(FloatRegister Rd, Register Rs1, RoundingMode rm = rne) { \ - unsigned insn = 0; \ - patch((address)&insn, 6, 0, op); \ - patch((address)&insn, 14, 12, rm); \ - patch((address)&insn, 24, 20, funct5); \ - patch((address)&insn, 31, 25, funct7); \ - patch_reg((address)&insn, 7, Rd); \ - patch_reg((address)&insn, 15, Rs1); \ - emit(insn); \ + template + void fp_base(FloatRegister Rd, Register Rs1, FloatRegister Rs2, RoundingMode rm) { + fp_base(Rd->raw_encoding(), Rs1->raw_encoding(), Rs2->raw_encoding(), rm); } - INSN(fcvt_s_w, 0b1010011, 0b00000, 0b1101000); - INSN(fcvt_s_wu, 0b1010011, 0b00001, 0b1101000); - INSN(fcvt_s_l, 0b1010011, 0b00010, 0b1101000); - INSN(fcvt_s_lu, 0b1010011, 0b00011, 0b1101000); - INSN(fcvt_d_w, 0b1010011, 0b00000, 0b1101001); - INSN(fcvt_d_wu, 0b1010011, 0b00001, 0b1101001); - INSN(fcvt_d_l, 0b1010011, 0b00010, 0b1101001); - INSN(fcvt_d_lu, 0b1010011, 0b00011, 0b1101001); + template + void fp_base(Register Rd, FloatRegister Rs1, uint8_t Rs2, RoundingMode rm) { + guarantee(is_uimm5(Rs2), "Rs2 is out of validity"); + fp_base(Rd->raw_encoding(), Rs1->raw_encoding(), Rs2, rm); + } -#undef INSN + template + void fp_base(Register Rd, FloatRegister Rs1, uint8_t Rs2, uint8_t rm) { + guarantee(is_uimm5(Rs2), "Rs2 is out of validity"); + fp_base(Rd->raw_encoding(), Rs1->raw_encoding(), Rs2, (RoundingMode)rm); + } -// Float and Double Conversion Instruction -#define INSN(NAME, op, funct5, funct7) \ - void NAME(Register Rd, FloatRegister Rs1, RoundingMode rm = rtz) { \ - unsigned insn = 0; \ - patch((address)&insn, 6, 0, op); \ - patch((address)&insn, 14, 12, rm); \ - patch((address)&insn, 24, 20, funct5); \ - patch((address)&insn, 31, 25, funct7); \ - patch_reg((address)&insn, 7, Rd); \ - patch_reg((address)&insn, 15, Rs1); \ - emit(insn); \ + template + void fp_base(FloatRegister Rd, Register Rs1, uint8_t Rs2, RoundingMode rm) { + guarantee(is_uimm5(Rs2), "Rs2 is out of validity"); + fp_base(Rd->raw_encoding(), Rs1->raw_encoding(), Rs2, rm); } - INSN(fcvt_w_s, 0b1010011, 0b00000, 0b1100000); - INSN(fcvt_l_s, 0b1010011, 0b00010, 0b1100000); - INSN(fcvt_wu_s, 0b1010011, 0b00001, 0b1100000); - INSN(fcvt_lu_s, 0b1010011, 0b00011, 0b1100000); - INSN(fcvt_w_d, 0b1010011, 0b00000, 0b1100001); - INSN(fcvt_wu_d, 0b1010011, 0b00001, 0b1100001); - INSN(fcvt_l_d, 0b1010011, 0b00010, 0b1100001); - INSN(fcvt_lu_d, 0b1010011, 0b00011, 0b1100001); - -#undef INSN - -// Float and Double Move Instruction -#define INSN(NAME, op, funct3, funct5, funct7) \ - void NAME(FloatRegister Rd, Register Rs1) { \ - unsigned insn = 0; \ - patch((address)&insn, 6, 0, op); \ - patch((address)&insn, 14, 12, funct3); \ - patch((address)&insn, 20, funct5); \ - patch((address)&insn, 31, 25, funct7); \ - patch_reg((address)&insn, 7, Rd); \ - patch_reg((address)&insn, 15, Rs1); \ - emit(insn); \ - } - - INSN(fmv_h_x, 0b1010011, 0b000, 0b00000, 0b1111010); - INSN(fmv_w_x, 0b1010011, 0b000, 0b00000, 0b1111000); - INSN(fmv_d_x, 0b1010011, 0b000, 0b00000, 0b1111001); - -#undef INSN - -enum fclass_mask { - minf = 1 << 0, // negative infinite - mnorm = 1 << 1, // negative normal number - msubnorm = 1 << 2, // negative subnormal number - mzero = 1 << 3, // negative zero - pzero = 1 << 4, // positive zero - psubnorm = 1 << 5, // positive subnormal number - pnorm = 1 << 6, // positive normal number - pinf = 1 << 7, // positive infinite - snan = 1 << 8, // signaling NaN - qnan = 1 << 9, // quiet NaN - zero = mzero | pzero, - subnorm = msubnorm | psubnorm, - norm = mnorm | pnorm, - inf = minf | pinf, - nan = snan | qnan, - finite = zero | subnorm | norm, -}; + template + void fp_base(FloatRegister Rd, Register Rs1, uint8_t Rs2, int8_t rm) { + guarantee(is_uimm5(Rs2), "Rs2 is out of validity"); + fp_base(Rd->raw_encoding(), Rs1->raw_encoding(), Rs2, (RoundingMode)rm); + } + + public: -// Float and Double Conversion/Classify Instruction -#define INSN(NAME, op, funct3, funct5, funct7) \ - void NAME(Register Rd, FloatRegister Rs1) { \ - unsigned insn = 0; \ - patch((address)&insn, 6, 0, op); \ - patch((address)&insn, 14, 12, funct3); \ - patch((address)&insn, 20, funct5); \ - patch((address)&insn, 31, 25, funct7); \ - patch_reg((address)&insn, 7, Rd); \ - patch_reg((address)&insn, 15, Rs1); \ - emit(insn); \ + enum FClassBits { + minf = 1 << 0, // negative infinite + mnorm = 1 << 1, // negative normal number + msubnorm = 1 << 2, // negative subnormal number + mzero = 1 << 3, // negative zero + pzero = 1 << 4, // positive zero + psubnorm = 1 << 5, // positive subnormal number + pnorm = 1 << 6, // positive normal number + pinf = 1 << 7, // positive infinite + snan = 1 << 8, // signaling NaN + qnan = 1 << 9, // quiet NaN + zero = mzero | pzero, + subnorm = msubnorm | psubnorm, + norm = mnorm | pnorm, + inf = minf | pinf, + nan = snan | qnan, + finite = zero | subnorm | norm, + }; + + void fsqrt_s(FloatRegister Rd, FloatRegister Rs1, RoundingMode rm = rne) { + fp_base(Rd, Rs1, 0b00000, rm); } - INSN(fclass_h, 0b1010011, 0b001, 0b00000, 0b1110010); - INSN(fclass_s, 0b1010011, 0b001, 0b00000, 0b1110000); - INSN(fclass_d, 0b1010011, 0b001, 0b00000, 0b1110001); - INSN(fmv_x_h, 0b1010011, 0b000, 0b00000, 0b1110010); - INSN(fmv_x_w, 0b1010011, 0b000, 0b00000, 0b1110000); - INSN(fmv_x_d, 0b1010011, 0b000, 0b00000, 0b1110001); + void fsqrt_d(FloatRegister Rd, FloatRegister Rs1, RoundingMode rm = rne) { + fp_base(Rd, Rs1, 0b00000, rm); + } -#undef INSN + void fcvt_s_d(FloatRegister Rd, FloatRegister Rs1, RoundingMode rm = rne) { + fp_base(Rd, Rs1, 0b00001, rm); + } + + void fcvt_d_s(FloatRegister Rd, FloatRegister Rs1, RoundingMode rm = rne) { + fp_base(Rd, Rs1, 0b00000, rm); + } + + void fsgnj_s(FloatRegister Rd, FloatRegister Rs1, FloatRegister Rs2) { + fp_base(Rd, Rs1, Rs2, 0b000); + } + + void fsgnjn_s(FloatRegister Rd, FloatRegister Rs1, FloatRegister Rs2) { + fp_base(Rd, Rs1, Rs2, 0b001); + } + + void fsgnjx_s(FloatRegister Rd, FloatRegister Rs1, FloatRegister Rs2) { + fp_base(Rd, Rs1, Rs2, 0b010); + } + + void fmin_s(FloatRegister Rd, FloatRegister Rs1, FloatRegister Rs2) { + fp_base(Rd, Rs1, Rs2, 0b000); + } + + void fmax_s(FloatRegister Rd, FloatRegister Rs1, FloatRegister Rs2) { + fp_base(Rd, Rs1, Rs2, 0b001); + } + + void fsgnj_d(FloatRegister Rd, FloatRegister Rs1, FloatRegister Rs2) { + fp_base(Rd, Rs1, Rs2, 0b000); + } + + void fsgnjn_d(FloatRegister Rd, FloatRegister Rs1, FloatRegister Rs2) { + fp_base(Rd, Rs1, Rs2, 0b001); + } + + void fsgnjx_d(FloatRegister Rd, FloatRegister Rs1, FloatRegister Rs2) { + fp_base(Rd, Rs1, Rs2, 0b010); + } + + void fmin_d(FloatRegister Rd, FloatRegister Rs1, FloatRegister Rs2) { + fp_base(Rd, Rs1, Rs2, 0b000); + } + + void fmax_d(FloatRegister Rd, FloatRegister Rs1, FloatRegister Rs2) { + fp_base(Rd, Rs1, Rs2, 0b001); + } + + void feq_s(Register Rd, FloatRegister Rs1, FloatRegister Rs2) { + fp_base(Rd, Rs1, Rs2, 0b010); + } + + void flt_s(Register Rd, FloatRegister Rs1, FloatRegister Rs2) { + fp_base(Rd, Rs1, Rs2, 0b001); + } + + void fle_s(Register Rd, FloatRegister Rs1, FloatRegister Rs2) { + fp_base(Rd, Rs1, Rs2, 0b000); + } + + void feq_d(Register Rd, FloatRegister Rs1, FloatRegister Rs2) { + fp_base(Rd, Rs1, Rs2, 0b010); + } + + void fle_d(Register Rd, FloatRegister Rs1, FloatRegister Rs2) { + fp_base(Rd, Rs1, Rs2, 0b000); + } + + void flt_d(Register Rd, FloatRegister Rs1, FloatRegister Rs2) { + fp_base(Rd, Rs1, Rs2, 0b001); + } + + void fadd_s(FloatRegister Rd, FloatRegister Rs1, FloatRegister Rs2, RoundingMode rm = rne) { + fp_base(Rd, Rs1, Rs2, rm); + } + + void fsub_s(FloatRegister Rd, FloatRegister Rs1, FloatRegister Rs2, RoundingMode rm = rne) { + fp_base(Rd, Rs1, Rs2, rm); + } + + void fmul_s(FloatRegister Rd, FloatRegister Rs1, FloatRegister Rs2, RoundingMode rm = rne) { + fp_base(Rd, Rs1, Rs2, rm); + } + + void fdiv_s(FloatRegister Rd, FloatRegister Rs1, FloatRegister Rs2, RoundingMode rm = rne) { + fp_base(Rd, Rs1, Rs2, rm); + } + + void fadd_d(FloatRegister Rd, FloatRegister Rs1, FloatRegister Rs2, RoundingMode rm = rne) { + fp_base(Rd, Rs1, Rs2, rm); + } + + void fsub_d(FloatRegister Rd, FloatRegister Rs1, FloatRegister Rs2, RoundingMode rm = rne) { + fp_base(Rd, Rs1, Rs2, rm); + } + + void fmul_d(FloatRegister Rd, FloatRegister Rs1, FloatRegister Rs2, RoundingMode rm = rne) { + fp_base(Rd, Rs1, Rs2, rm); + } + + void fdiv_d(FloatRegister Rd, FloatRegister Rs1, FloatRegister Rs2, RoundingMode rm = rne) { + fp_base(Rd, Rs1, Rs2, rm); + } + + void fcvt_s_w(FloatRegister Rd, Register Rs1, RoundingMode rm = rne) { + fp_base(Rd, Rs1, 0b00000, rm); + } + + void fcvt_s_wu(FloatRegister Rd, Register Rs1, RoundingMode rm = rne) { + fp_base(Rd, Rs1, 0b00001, rm); + } + + void fcvt_s_l(FloatRegister Rd, Register Rs1, RoundingMode rm = rne) { + fp_base(Rd, Rs1, 0b00010, rm); + } + + void fcvt_s_lu(FloatRegister Rd, Register Rs1, RoundingMode rm = rne) { + fp_base(Rd, Rs1, 0b00011, rm); + } + + void fcvt_d_w(FloatRegister Rd, Register Rs1, RoundingMode rm = rne) { + fp_base(Rd, Rs1, 0b00000, rm); + } + + void fcvt_d_wu(FloatRegister Rd, Register Rs1, RoundingMode rm = rne) { + fp_base(Rd, Rs1, 0b00001, rm); + } + + void fcvt_d_l(FloatRegister Rd, Register Rs1, RoundingMode rm = rne) { + fp_base(Rd, Rs1, 0b00010, rm); + } + + void fcvt_d_lu(FloatRegister Rd, Register Rs1, RoundingMode rm = rne) { + fp_base(Rd, Rs1, 0b00011, rm); + } + + void fcvt_w_s(Register Rd, FloatRegister Rs1, RoundingMode rm = rtz) { + fp_base(Rd, Rs1, 0b00000, rm); + } + + void fcvt_l_s(Register Rd, FloatRegister Rs1, RoundingMode rm = rtz) { + fp_base(Rd, Rs1, 0b00010, rm); + } + + void fcvt_wu_s(Register Rd, FloatRegister Rs1, RoundingMode rm = rtz) { + fp_base(Rd, Rs1, 0b00001, rm); + } + + void fcvt_lu_s(Register Rd, FloatRegister Rs1, RoundingMode rm = rtz) { + fp_base(Rd, Rs1, 0b00011, rm); + } + + void fcvt_w_d(Register Rd, FloatRegister Rs1, RoundingMode rm = rtz) { + fp_base(Rd, Rs1, 0b00000, rm); + } + + void fcvt_wu_d(Register Rd, FloatRegister Rs1, RoundingMode rm = rtz) { + fp_base(Rd, Rs1, 0b00001, rm); + } + + void fcvt_l_d(Register Rd, FloatRegister Rs1, RoundingMode rm = rtz) { + fp_base(Rd, Rs1, 0b00010, rm); + } + + void fcvt_lu_d(Register Rd, FloatRegister Rs1, RoundingMode rm = rtz) { + fp_base(Rd, Rs1, 0b00011, rm); + } + + void fmv_w_x(FloatRegister Rd, Register Rs1) { + fp_base(Rd, Rs1, 0b00000, 0b000); + } + + void fmv_d_x(FloatRegister Rd, Register Rs1) { + fp_base(Rd, Rs1, 0b00000, 0b000); + } + + void fclass_s(Register Rd, FloatRegister Rs1) { + fp_base(Rd, Rs1, 0b00000, 0b001); + } + + void fclass_d(Register Rd, FloatRegister Rs1) { + fp_base(Rd, Rs1, 0b00000, 0b001); + } + + void fmv_x_w(Register Rd, FloatRegister Rs1) { + fp_base(Rd, Rs1, 0b00000, 0b000); + } + + void fmv_x_d(Register Rd, FloatRegister Rs1) { + fp_base(Rd, Rs1, 0b00000, 0b000); + } + + private: + static constexpr unsigned int OP_LOAD_FP = 0b0000111; + + template + void fp_load(FloatRegister Rd, Register Rs, const int32_t offset) { + guarantee(is_uimm3(FpWidth), "Rounding mode is out of validity"); + guarantee(is_simm12(offset), "offset is invalid."); + unsigned insn = 0; + uint32_t val = offset & 0xfff; + patch((address)&insn, 6, 0, OP_LOAD_FP); + patch_reg((address)&insn, 7, Rd); + patch((address)&insn, 14, 12, FpWidth); + patch_reg((address)&insn, 15, Rs); + patch((address)&insn, 31, 20, val); + emit(insn); + } + + public: + + void flw(FloatRegister Rd, Register Rs, const int32_t offset) { fp_load<0b010>(Rd, Rs, offset); } + void _fld(FloatRegister Rd, Register Rs, const int32_t offset) { fp_load<0b011>(Rd, Rs, offset); } + + private: + template + void fp_fm(FloatRegister Rd, FloatRegister Rs1, FloatRegister Rs2, FloatRegister Rs3, RoundingMode rm) { + assert_cond(Fmt != Q_128_qp); + guarantee(is_uimm3(rm), "Rounding mode is out of validity"); + guarantee(is_uimm2(Fmt), "FMT is out of validity"); + unsigned insn = 0; + patch((address)&insn, 6, 0, OpVal); + patch_reg((address)&insn, 7, Rd); + patch((address)&insn, 14, 12, rm); + patch_reg((address)&insn, 15, Rs1); + patch_reg((address)&insn, 20, Rs2); + patch((address)&insn, 26, 25, Fmt); + patch_reg((address)&insn, 27, Rs3); + emit(insn); + } + + public: + void fmadd_s(FloatRegister Rd, FloatRegister Rs1, FloatRegister Rs2, FloatRegister Rs3, RoundingMode rm = rne) { + fp_fm(Rd, Rs1, Rs2, Rs3, rm); + } + + void fmsub_s(FloatRegister Rd, FloatRegister Rs1, FloatRegister Rs2, FloatRegister Rs3, RoundingMode rm = rne) { + fp_fm(Rd, Rs1, Rs2, Rs3, rm); + } + + void fnmsub_s(FloatRegister Rd, FloatRegister Rs1, FloatRegister Rs2, FloatRegister Rs3, RoundingMode rm = rne) { + fp_fm(Rd, Rs1, Rs2, Rs3, rm); + } + + void fnmadd_s(FloatRegister Rd, FloatRegister Rs1, FloatRegister Rs2, FloatRegister Rs3, RoundingMode rm = rne) { + fp_fm(Rd, Rs1, Rs2, Rs3, rm); + } + + void fmadd_d(FloatRegister Rd, FloatRegister Rs1, FloatRegister Rs2, FloatRegister Rs3, RoundingMode rm = rne) { + fp_fm(Rd, Rs1, Rs2, Rs3, rm); + } + + void fmsub_d(FloatRegister Rd, FloatRegister Rs1, FloatRegister Rs2, FloatRegister Rs3, RoundingMode rm = rne) { + fp_fm(Rd, Rs1, Rs2, Rs3, rm); + } + + void fnmsub_d(FloatRegister Rd, FloatRegister Rs1, FloatRegister Rs2, FloatRegister Rs3, RoundingMode rm = rne) { + fp_fm(Rd, Rs1, Rs2, Rs3, rm); + } + + void fnmadd_d(FloatRegister Rd, FloatRegister Rs1, FloatRegister Rs2, FloatRegister Rs3, RoundingMode rm = rne) { + fp_fm(Rd, Rs1, Rs2, Rs3, rm); + } + +// -------------- ZFH Instruction Definitions -------------- +// Zfh Standard Extensions for Half-Precision Floating-Point + void fclass_h(Register Rd, FloatRegister Rs1) { + assert_cond(UseZfh); + fp_base(Rd, Rs1, 0b00000, 0b001); + } + +// Zfh and Zfhmin Half-Precision Floating-Point + void fcvt_s_h(FloatRegister Rd, FloatRegister Rs1, RoundingMode rm = rne) { + assert_cond(UseZfh || UseZfhmin); + fp_base(Rd, Rs1, 0b00010, rm); + } + + void fcvt_h_s(FloatRegister Rd, FloatRegister Rs1, RoundingMode rm = rne) { + assert_cond(UseZfh || UseZfhmin); + fp_base(Rd, Rs1, 0b00000, rm); + } + + void fmv_h_x(FloatRegister Rd, Register Rs1) { + assert_cond(UseZfh || UseZfhmin); + fp_base(Rd, Rs1, 0b00000, 0b000); + } + + void fmv_x_h(Register Rd, FloatRegister Rs1) { + assert_cond(UseZfh || UseZfhmin); + fp_base(Rd, Rs1, 0b00000, 0b000); + } // ========================== // RISC-V Vector Extension @@ -2015,10 +2176,10 @@ enum Nf { } INSN(add_uw, 0b0111011, 0b000, 0b0000100); - INSN(rol, 0b0110011, 0b001, 0b0110000); - INSN(rolw, 0b0111011, 0b001, 0b0110000); - INSN(ror, 0b0110011, 0b101, 0b0110000); - INSN(rorw, 0b0111011, 0b101, 0b0110000); + INSN(rolr, 0b0110011, 0b001, 0b0110000); + INSN(rolrw, 0b0111011, 0b001, 0b0110000); + INSN(rorr, 0b0110011, 0b101, 0b0110000); + INSN(rorrw, 0b0111011, 0b101, 0b0110000); INSN(sh1add, 0b0110011, 0b010, 0b0010000); INSN(sh2add, 0b0110011, 0b100, 0b0010000); INSN(sh3add, 0b0110011, 0b110, 0b0010000); @@ -2230,7 +2391,7 @@ enum Nf { } #define INSN(NAME, funct3, op) \ - void NAME(Register Rd_Rs1, int32_t imm) { \ + void NAME(Register Rd_Rs1, int64_t imm) { \ assert_cond(is_simm6(imm)); \ uint16_t insn = 0; \ c_patch((address)&insn, 1, 0, op); \ @@ -2247,7 +2408,7 @@ enum Nf { #undef INSN #define INSN(NAME, funct3, op) \ - void NAME(int32_t imm) { \ + void NAME(int64_t imm) { \ assert_cond(is_simm10(imm)); \ assert_cond((imm & 0b1111) == 0); \ assert_cond(imm != 0); \ @@ -2268,7 +2429,7 @@ enum Nf { #undef INSN #define INSN(NAME, funct3, op) \ - void NAME(Register Rd, uint32_t uimm) { \ + void NAME(Register Rd, uint64_t uimm) { \ assert_cond(is_uimm10(uimm)); \ assert_cond((uimm & 0b11) == 0); \ assert_cond(uimm != 0); \ @@ -2325,7 +2486,7 @@ enum Nf { #undef INSN #define INSN(NAME, funct3, funct2, op) \ - void NAME(Register Rd_Rs1, int32_t imm) { \ + void NAME(Register Rd_Rs1, int64_t imm) { \ assert_cond(is_simm6(imm)); \ uint16_t insn = 0; \ c_patch((address)&insn, 1, 0, op); \ @@ -2950,7 +3111,7 @@ enum Nf { // Immediate Instructions // -------------------------- #define INSN(NAME) \ - void NAME(Register Rd, Register Rs1, int32_t imm) { \ + void NAME(Register Rd, Register Rs1, int64_t imm) { \ /* addi -> c.addi/c.nop/c.mv/c.addi16sp/c.addi4spn */ \ if (do_compress()) { \ if (Rd == Rs1 && is_simm6(imm)) { \ @@ -2978,7 +3139,7 @@ enum Nf { // -------------------------- #define INSN(NAME) \ - void NAME(Register Rd, Register Rs1, int32_t imm) { \ + void NAME(Register Rd, Register Rs1, int64_t imm) { \ /* addiw -> c.addiw */ \ if (do_compress() && (Rd == Rs1 && Rd != x0 && is_simm6(imm))) { \ c_addiw(Rd, imm); \ @@ -2993,17 +3154,17 @@ enum Nf { // -------------------------- #define INSN(NAME) \ - void NAME(Register Rd, Register Rs1, int32_t imm) { \ - /* and_imm12 -> c.andi */ \ + void NAME(Register Rd, Register Rs1, int64_t imm) { \ + /* andi -> c.andi */ \ if (do_compress() && \ (Rd == Rs1 && Rd->is_compressed_valid() && is_simm6(imm))) { \ c_andi(Rd, imm); \ return; \ } \ - _and_imm12(Rd, Rs1, imm); \ + _andi(Rd, Rs1, imm); \ } - INSN(and_imm12); + INSN(andi); #undef INSN @@ -3070,42 +3231,63 @@ enum Nf { #undef INSN // Cache Management Operations -#define INSN(NAME, funct) \ - void NAME(Register Rs1) { \ - unsigned insn = 0; \ - patch((address)&insn, 6, 0, 0b0001111); \ - patch((address)&insn, 14, 12, 0b010); \ - patch_reg((address)&insn, 15, Rs1); \ - patch((address)&insn, 31, 20, funct); \ - emit(insn); \ +// These instruction may be turned off for user space. + private: + enum CBO_FUNCT : unsigned int { + CBO_INVAL = 0b0000000000000, + CBO_CLEAN = 0b0000000000001, + CBO_FLUSH = 0b0000000000010, + CBO_ZERO = 0b0000000000100 + }; + + template + void cbo_base(Register Rs1) { + assert((UseZicbom && FUNCT != CBO_ZERO) || UseZicboz, "sanity"); + unsigned insn = 0; + patch((address)&insn, 6, 0, 0b0001111); + patch((address)&insn, 14, 12, 0b010); + patch_reg((address)&insn, 15, Rs1); + patch((address)&insn, 31, 20, FUNCT); + emit(insn); } - INSN(cbo_inval, 0b0000000000000); - INSN(cbo_clean, 0b0000000000001); - INSN(cbo_flush, 0b0000000000010); - INSN(cbo_zero, 0b0000000000100); + // This instruction have some security implication. + // At this time it's not likely to be enabled for user mode. + void cbo_inval(Register Rs1) { cbo_base(Rs1); } + public: + // Zicbom + void cbo_clean(Register Rs1) { cbo_base(Rs1); } + void cbo_flush(Register Rs1) { cbo_base(Rs1); } + // Zicboz + void cbo_zero(Register Rs1) { cbo_base(Rs1); } -#undef INSN + private: + enum PREFETCH_FUNCT : unsigned int { + PREFETCH_I = 0b0000000000000, + PREFETCH_R = 0b0000000000001, + PREFETCH_W = 0b0000000000011 + }; -#define INSN(NAME, funct) \ - void NAME(Register Rs1, int32_t offset) { \ - guarantee((offset & 0x1f) == 0, "offset lowest 5 bits must be zero"); \ - int32_t upperOffset = offset >> 5; \ - unsigned insn = 0; \ - patch((address)&insn, 6, 0, 0b0010011); \ - patch((address)&insn, 14, 12, 0b110); \ - patch_reg((address)&insn, 15, Rs1); \ - patch((address)&insn, 24, 20, funct); \ - upperOffset &= 0x7f; \ - patch((address)&insn, 31, 25, upperOffset); \ - emit(insn); \ + template + void prefetch_base(Register Rs1, int32_t offset) { + assert_cond(UseZicbop); + guarantee((offset & 0x1f) == 0, "offset lowest 5 bits must be zero"); + int32_t upperOffset = offset >> 5; + unsigned insn = 0; + patch((address)&insn, 6, 0, 0b0010011); + patch((address)&insn, 14, 12, 0b110); + patch_reg((address)&insn, 15, Rs1); + patch((address)&insn, 24, 20, FUNCT); + upperOffset &= 0x7f; + patch((address)&insn, 31, 25, upperOffset); + emit(insn); } - INSN(prefetch_i, 0b0000000000000); - INSN(prefetch_r, 0b0000000000001); - INSN(prefetch_w, 0b0000000000011); - -#undef INSN + public: + // Zicbop + void prefetch_i(Register Rs1, int32_t offset) { prefetch_base(Rs1, offset); } + void prefetch_r(Register Rs1, int32_t offset) { prefetch_base(Rs1, offset); } + void prefetch_w(Register Rs1, int32_t offset) { prefetch_base(Rs1, offset); } // -------------- Zicond Instruction Definitions -------------- // Zicond conditional operations extension @@ -3381,6 +3563,7 @@ enum Nf { static bool is_simm18(int64_t x); static bool is_simm21(int64_t x); + static bool is_uimm2(uint64_t x); static bool is_uimm3(uint64_t x); static bool is_uimm5(uint64_t x); static bool is_uimm6(uint64_t x); diff --git a/src/hotspot/cpu/riscv/assembler_riscv.inline.hpp b/src/hotspot/cpu/riscv/assembler_riscv.inline.hpp index c51650881fc73..1f9e6df217206 100644 --- a/src/hotspot/cpu/riscv/assembler_riscv.inline.hpp +++ b/src/hotspot/cpu/riscv/assembler_riscv.inline.hpp @@ -38,6 +38,7 @@ inline bool Assembler::is_simm13(int64_t x) { return is_simm(x, 13); } inline bool Assembler::is_simm18(int64_t x) { return is_simm(x, 18); } inline bool Assembler::is_simm21(int64_t x) { return is_simm(x, 21); } +inline bool Assembler::is_uimm2(uint64_t x) { return is_uimm(x, 2); } inline bool Assembler::is_uimm3(uint64_t x) { return is_uimm(x, 3); } inline bool Assembler::is_uimm5(uint64_t x) { return is_uimm(x, 5); } inline bool Assembler::is_uimm6(uint64_t x) { return is_uimm(x, 6); } diff --git a/src/hotspot/cpu/riscv/c1_CodeStubs_riscv.cpp b/src/hotspot/cpu/riscv/c1_CodeStubs_riscv.cpp index 46af27a011f5a..b9bd7b356fa6b 100644 --- a/src/hotspot/cpu/riscv/c1_CodeStubs_riscv.cpp +++ b/src/hotspot/cpu/riscv/c1_CodeStubs_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 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. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "c1/c1_CodeStubs.hpp" #include "c1/c1_FrameMap.hpp" diff --git a/src/hotspot/cpu/riscv/c1_FrameMap_riscv.cpp b/src/hotspot/cpu/riscv/c1_FrameMap_riscv.cpp index 172031941b2b0..d3ccd46048b06 100644 --- a/src/hotspot/cpu/riscv/c1_FrameMap_riscv.cpp +++ b/src/hotspot/cpu/riscv/c1_FrameMap_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_FrameMap.hpp" #include "c1/c1_LIR.hpp" #include "runtime/sharedRuntime.hpp" diff --git a/src/hotspot/cpu/riscv/c1_LIRAssembler_arith_riscv.cpp b/src/hotspot/cpu/riscv/c1_LIRAssembler_arith_riscv.cpp index ee6dedfcc076b..f84c44d6fea9b 100644 --- a/src/hotspot/cpu/riscv/c1_LIRAssembler_arith_riscv.cpp +++ b/src/hotspot/cpu/riscv/c1_LIRAssembler_arith_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "c1/c1_LIRAssembler.hpp" #include "c1/c1_MacroAssembler.hpp" diff --git a/src/hotspot/cpu/riscv/c1_LIRAssembler_arraycopy_riscv.cpp b/src/hotspot/cpu/riscv/c1_LIRAssembler_arraycopy_riscv.cpp index 7d673383cad26..5aa213fba7a7b 100644 --- a/src/hotspot/cpu/riscv/c1_LIRAssembler_arraycopy_riscv.cpp +++ b/src/hotspot/cpu/riscv/c1_LIRAssembler_arraycopy_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "c1/c1_LIRAssembler.hpp" #include "c1/c1_MacroAssembler.hpp" @@ -211,7 +210,7 @@ void LIR_Assembler::arraycopy_type_check(Register src, Register src_pos, Registe Label cont, slow; #define PUSH(r1, r2) \ - __ addi(sp, sp, -2 * wordSize); \ + __ subi(sp, sp, 2 * wordSize); \ __ sd(r1, Address(sp, 1 * wordSize)); \ __ sd(r2, Address(sp, 0)); @@ -337,10 +336,10 @@ void LIR_Assembler::arraycopy_prepare_params(Register src, Register src_pos, Reg Register dst, Register dst_pos, BasicType basic_type) { int scale = array_element_size(basic_type); __ shadd(c_rarg0, src_pos, src, t0, scale); - __ add(c_rarg0, c_rarg0, arrayOopDesc::base_offset_in_bytes(basic_type)); + __ addi(c_rarg0, c_rarg0, arrayOopDesc::base_offset_in_bytes(basic_type)); assert_different_registers(c_rarg0, dst, dst_pos, length); __ shadd(c_rarg1, dst_pos, dst, t0, scale); - __ add(c_rarg1, c_rarg1, arrayOopDesc::base_offset_in_bytes(basic_type)); + __ addi(c_rarg1, c_rarg1, arrayOopDesc::base_offset_in_bytes(basic_type)); assert_different_registers(c_rarg1, dst, length); __ mv(c_rarg2, length); assert_different_registers(c_rarg2, dst); diff --git a/src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.cpp b/src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.cpp index d587a557a7312..8d5299aa0fd2c 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, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, 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. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "asm/macroAssembler.inline.hpp" #include "c1/c1_CodeStubs.hpp" @@ -1084,7 +1083,7 @@ void LIR_Assembler::typecheck_helper_slowcheck(ciKlass *k, Register obj, Registe // check for self __ beq(klass_RInfo, k_RInfo, *success_target); - __ addi(sp, sp, -2 * wordSize); // 2: store k_RInfo and klass_RInfo + __ subi(sp, sp, 2 * wordSize); // 2: store k_RInfo and klass_RInfo __ sd(k_RInfo, Address(sp, 0)); // sub klass __ sd(klass_RInfo, Address(sp, wordSize)); // super klass __ far_call(RuntimeAddress(Runtime1::entry_for(C1StubId::slow_subtype_check_id))); @@ -1099,7 +1098,7 @@ void LIR_Assembler::typecheck_helper_slowcheck(ciKlass *k, Register obj, Registe // perform the fast part of the checking logic __ check_klass_subtype_fast_path(klass_RInfo, k_RInfo, Rtmp1, success_target, failure_target, nullptr); // call out-of-line instance of __ check_klass_subtytpe_slow_path(...) - __ addi(sp, sp, -2 * wordSize); // 2: store k_RInfo and klass_RInfo + __ subi(sp, sp, 2 * wordSize); // 2: store k_RInfo and klass_RInfo __ sd(klass_RInfo, Address(sp, wordSize)); // sub klass __ sd(k_RInfo, Address(sp, 0)); // super klass __ far_call(RuntimeAddress(Runtime1::entry_for(C1StubId::slow_subtype_check_id))); @@ -2139,7 +2138,7 @@ void LIR_Assembler::lir_store_slowcheck(Register k_RInfo, Register klass_RInfo, // perform the fast part of the checking logic __ check_klass_subtype_fast_path(klass_RInfo, k_RInfo, Rtmp1, success_target, failure_target, nullptr); // call out-of-line instance of __ check_klass_subtype_slow_path(...) - __ addi(sp, sp, -2 * wordSize); // 2: store k_RInfo and klass_RInfo + __ subi(sp, sp, 2 * wordSize); // 2: store k_RInfo and klass_RInfo __ sd(klass_RInfo, Address(sp, wordSize)); // sub klass __ sd(k_RInfo, Address(sp, 0)); // super klass __ far_call(RuntimeAddress(Runtime1::entry_for(C1StubId::slow_subtype_check_id))); diff --git a/src/hotspot/cpu/riscv/c1_LIRGenerator_riscv.cpp b/src/hotspot/cpu/riscv/c1_LIRGenerator_riscv.cpp index b328d457192ba..00de4488793cb 100644 --- a/src/hotspot/cpu/riscv/c1_LIRGenerator_riscv.cpp +++ b/src/hotspot/cpu/riscv/c1_LIRGenerator_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "c1/c1_Compilation.hpp" #include "c1/c1_FrameMap.hpp" diff --git a/src/hotspot/cpu/riscv/c1_LIR_riscv.cpp b/src/hotspot/cpu/riscv/c1_LIR_riscv.cpp index 5f1c394ab3d46..6ce70f48cb459 100644 --- a/src/hotspot/cpu/riscv/c1_LIR_riscv.cpp +++ b/src/hotspot/cpu/riscv/c1_LIR_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2021, Huawei Technologies Co., Ltd. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/register.hpp" #include "c1/c1_LIR.hpp" diff --git a/src/hotspot/cpu/riscv/c1_LinearScan_riscv.cpp b/src/hotspot/cpu/riscv/c1_LinearScan_riscv.cpp index 78a61128bdd5d..8a6dfbbdf1eb4 100644 --- a/src/hotspot/cpu/riscv/c1_LinearScan_riscv.cpp +++ b/src/hotspot/cpu/riscv/c1_LinearScan_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_Instruction.hpp" #include "c1/c1_LinearScan.hpp" #include "utilities/bitMap.inline.hpp" diff --git a/src/hotspot/cpu/riscv/c1_MacroAssembler_riscv.cpp b/src/hotspot/cpu/riscv/c1_MacroAssembler_riscv.cpp index ed932dddcd8d8..76089e8dd4536 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, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, 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. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_LIR.hpp" #include "c1/c1_MacroAssembler.hpp" #include "c1/c1_Runtime1.hpp" @@ -199,16 +198,16 @@ void C1_MacroAssembler::initialize_body(Register obj, Register len_in_bytes, int Label done; // len_in_bytes is positive and ptr sized - sub(len_in_bytes, len_in_bytes, hdr_size_in_bytes); + subi(len_in_bytes, len_in_bytes, hdr_size_in_bytes); beqz(len_in_bytes, done); // Preserve obj if (hdr_size_in_bytes) { - add(obj, obj, hdr_size_in_bytes); + addi(obj, obj, hdr_size_in_bytes); } zero_memory(obj, len_in_bytes, tmp); if (hdr_size_in_bytes) { - sub(obj, obj, hdr_size_in_bytes); + subi(obj, obj, hdr_size_in_bytes); } bind(done); @@ -262,7 +261,7 @@ void C1_MacroAssembler::initialize_object(Register obj, Register klass, Register j(entry_point); bind(loop); - sub(index, index, 1); + subi(index, index, 1); for (int i = -unroll; i < 0; i++) { if (-i == remainder) { bind(entry_point); @@ -272,7 +271,7 @@ void C1_MacroAssembler::initialize_object(Register obj, Register klass, Register if (remainder == 0) { bind(entry_point); } - add(t0, t0, unroll * wordSize); + addi(t0, t0, unroll * wordSize); bnez(index, loop); } } @@ -301,7 +300,7 @@ void C1_MacroAssembler::allocate_array(Register obj, Register len, Register tmp1 // align object end 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); + andi(arr_size, arr_size, ~MinObjAlignmentInBytesMask); try_allocate(obj, arr_size, 0, tmp1, tmp2, slow_case); diff --git a/src/hotspot/cpu/riscv/c1_Runtime1_riscv.cpp b/src/hotspot/cpu/riscv/c1_Runtime1_riscv.cpp index 6f59f5c2b9559..c076f28be6cab 100644 --- a/src/hotspot/cpu/riscv/c1_Runtime1_riscv.cpp +++ b/src/hotspot/cpu/riscv/c1_Runtime1_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 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. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "c1/c1_CodeStubs.hpp" #include "c1/c1_Defs.hpp" @@ -147,7 +146,7 @@ int StubAssembler::call_RT(Register oop_result, Register metadata_result, addres const int arg1_sp_offset = 0; const int arg2_sp_offset = 1; const int arg3_sp_offset = 2; - addi(sp, sp, -(arg_num + 1) * wordSize); + subi(sp, sp, (arg_num + 1) * wordSize); sd(arg1, Address(sp, arg1_sp_offset * wordSize)); sd(arg2, Address(sp, arg2_sp_offset * wordSize)); sd(arg3, Address(sp, arg3_sp_offset * wordSize)); @@ -301,14 +300,14 @@ static OopMap* save_live_registers(StubAssembler* sasm, if (save_fpu_registers) { // float registers - __ addi(sp, sp, -(FrameMap::nof_fpu_regs * wordSize)); + __ subi(sp, sp, FrameMap::nof_fpu_regs * wordSize); for (int i = 0; i < FrameMap::nof_fpu_regs; i++) { __ fsd(as_FloatRegister(i), Address(sp, i * wordSize)); } } else { // we define reg_save_layout = 62 as the fixed frame size, // we should also sub 32 * wordSize to sp when save_fpu_registers == false - __ addi(sp, sp, -32 * wordSize); + __ subi(sp, sp, 32 * wordSize); } return generate_oop_map(sasm, save_fpu_registers); @@ -543,7 +542,7 @@ void Runtime1::generate_unwind_exception(StubAssembler *sasm) { // Save our return address because // exception_handler_for_return_address will destroy it. We also // save exception_oop - __ addi(sp, sp, -2 * wordSize); + __ subi(sp, sp, 2 * wordSize); __ sd(exception_oop, Address(sp, wordSize)); __ sd(ra, Address(sp)); @@ -883,7 +882,13 @@ OopMapSet* Runtime1::generate_code_for(C1StubId id, StubAssembler* sasm) { __ ld(x10, Address(sp, (sup_k_off) * VMRegImpl::stack_slot_size)); // super klass Label miss; - __ check_klass_subtype_slow_path(x14, x10, x12, x15, nullptr, &miss); + __ check_klass_subtype_slow_path(x14, /*sub_klass*/ + x10, /*super_klass*/ + x12, /*tmp1_reg*/ + x15, /*tmp2_reg*/ + nullptr, /*L_success*/ + &miss /*L_failure*/); + // Need extras for table lookup: x7, x11, x13 // fallthrough on success: __ mv(t0, 1); diff --git a/src/hotspot/cpu/riscv/c2_CodeStubs_riscv.cpp b/src/hotspot/cpu/riscv/c2_CodeStubs_riscv.cpp index 6ed6a1979212d..3436f9f8fc9db 100644 --- a/src/hotspot/cpu/riscv/c2_CodeStubs_riscv.cpp +++ b/src/hotspot/cpu/riscv/c2_CodeStubs_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "opto/c2_CodeStubs.hpp" #include "opto/c2_MacroAssembler.hpp" #include "runtime/objectMonitor.hpp" diff --git a/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp b/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp index 798804269d4ae..7564df6b861cf 100644 --- a/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp +++ b/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" #include "opto/c2_MacroAssembler.hpp" @@ -211,16 +210,14 @@ void C2_MacroAssembler::fast_unlock(Register objectReg, Register boxReg, // Handle existing monitor. bind(object_has_monitor); - STATIC_ASSERT(markWord::monitor_value <= INT_MAX); - add(tmp, tmp, -(int)markWord::monitor_value); // monitor - + subi(tmp, tmp, (int)markWord::monitor_value); // monitor ld(disp_hdr, Address(tmp, ObjectMonitor::recursions_offset())); Label notRecursive; beqz(disp_hdr, notRecursive); // Will be 0 if not recursive. // Recursive lock - addi(disp_hdr, disp_hdr, -1); + subi(disp_hdr, disp_hdr, 1); sd(disp_hdr, Address(tmp, ObjectMonitor::recursions_offset())); j(unlocked); @@ -537,7 +534,7 @@ void C2_MacroAssembler::fast_unlock_lightweight(Register obj, Register box, if (!UseObjectMonitorTable) { assert(tmp1_monitor == tmp1_mark, "should be the same here"); // Untag the monitor. - add(tmp1_monitor, tmp1_mark, -(int)markWord::monitor_value); + subi(tmp1_monitor, tmp1_mark, (int)markWord::monitor_value); } else { ld(tmp1_monitor, Address(box, BasicLock::object_monitor_cache_offset_in_bytes())); // No valid pointer below alignof(ObjectMonitor*). Take the slow path. @@ -553,7 +550,7 @@ void C2_MacroAssembler::fast_unlock_lightweight(Register obj, Register box, beqz(tmp2_recursions, not_recursive); // Recursive unlock. - addi(tmp2_recursions, tmp2_recursions, -1); + subi(tmp2_recursions, tmp2_recursions, 1); sd(tmp2_recursions, Address(tmp1_monitor, ObjectMonitor::recursions_offset())); j(unlocked); @@ -732,7 +729,7 @@ void C2_MacroAssembler::string_indexof_char(Register str1, Register cnt1, BLOCK_COMMENT("string_indexof_char {"); beqz(cnt1, NOMATCH); - addi(t0, cnt1, isL ? -32 : -16); + subi(t0, cnt1, isL ? 32 : 16); bgtz(t0, DO_LONG); string_indexof_char_short(str1, cnt1, ch, result, isL); j(DONE); @@ -780,7 +777,7 @@ void C2_MacroAssembler::string_indexof_char(Register str1, Register cnt1, bind(CH1_LOOP); ld(ch1, Address(str1)); addi(str1, str1, 8); - addi(cnt1, cnt1, -8); + subi(cnt1, cnt1, 8); compute_match_mask(ch1, ch, match_mask, mask1, mask2); bnez(match_mask, HIT); bgtz(cnt1, CH1_LOOP); @@ -957,7 +954,7 @@ void C2_MacroAssembler::string_indexof(Register haystack, Register needle, const int ASIZE = 256; const int STORE_BYTES = 8; // 8 bytes stored per instruction(sd) - sub(sp, sp, ASIZE); + subi(sp, sp, ASIZE); // init BC offset table with default value: needle_len slli(t0, needle_len, 8); @@ -976,16 +973,16 @@ void C2_MacroAssembler::string_indexof(Register haystack, Register needle, for (int i = 0; i < 4; i++) { sd(tmp5, Address(ch1, i * wordSize)); } - add(ch1, ch1, 32); - sub(tmp6, tmp6, 4); + addi(ch1, ch1, 32); + subi(tmp6, tmp6, 4); bgtz(tmp6, BM_INIT_LOOP); - sub(nlen_tmp, needle_len, 1); // m - 1, index of the last element in pattern + subi(nlen_tmp, needle_len, 1); // m - 1, index of the last element in pattern Register orig_haystack = tmp5; mv(orig_haystack, haystack); // result_tmp = tmp4 shadd(haystack_end, result_tmp, haystack, haystack_end, haystack_chr_shift); - sub(ch2, needle_len, 1); // bc offset init value, ch2 is t1 + subi(ch2, needle_len, 1); // bc offset init value, ch2 is t1 mv(tmp3, needle); // for (i = 0; i < m - 1; ) { @@ -1000,7 +997,7 @@ void C2_MacroAssembler::string_indexof(Register haystack, Register needle, // } bind(BCLOOP); (this->*needle_load_1chr)(ch1, Address(tmp3), noreg); - add(tmp3, tmp3, needle_chr_size); + addi(tmp3, tmp3, needle_chr_size); if (!needle_isL) { // ae == StrIntrinsicNode::UU mv(tmp6, ASIZE); @@ -1010,7 +1007,7 @@ void C2_MacroAssembler::string_indexof(Register haystack, Register needle, sb(ch2, Address(tmp4)); // store skip offset to BC offset table bind(BCSKIP); - sub(ch2, ch2, 1); // for next pattern element, skip distance -1 + subi(ch2, ch2, 1); // for next pattern element, skip distance -1 bgtz(ch2, BCLOOP); // tmp6: pattern end, address after needle @@ -1047,7 +1044,7 @@ void C2_MacroAssembler::string_indexof(Register haystack, Register needle, // compare pattern to source string backward shadd(result, nlen_tmp, haystack, result, haystack_chr_shift); (this->*haystack_load_1chr)(skipch, Address(result), noreg); - sub(nlen_tmp, nlen_tmp, firstStep); // nlen_tmp is positive here, because needle_len >= 8 + subi(nlen_tmp, nlen_tmp, firstStep); // nlen_tmp is positive here, because needle_len >= 8 if (needle_isL == haystack_isL) { // re-init tmp3. It's for free because it's executed in parallel with // load above. Alternative is to initialize it before loop, but it'll @@ -1066,7 +1063,7 @@ void C2_MacroAssembler::string_indexof(Register haystack, Register needle, if (isLL) { j(BMLOOPSTR1_AFTER_LOAD); } else { - sub(nlen_tmp, nlen_tmp, 1); // no need to branch for UU/UL case. cnt1 >= 8 + subi(nlen_tmp, nlen_tmp, 1); // no need to branch for UU/UL case. cnt1 >= 8 j(BMLOOPSTR1_CMP); } @@ -1077,7 +1074,7 @@ void C2_MacroAssembler::string_indexof(Register haystack, Register needle, (this->*haystack_load_1chr)(ch2, Address(ch2), noreg); bind(BMLOOPSTR1_AFTER_LOAD); - sub(nlen_tmp, nlen_tmp, 1); + subi(nlen_tmp, nlen_tmp, 1); bltz(nlen_tmp, BMLOOPSTR1_LASTCMP); bind(BMLOOPSTR1_CMP); @@ -1099,11 +1096,11 @@ void C2_MacroAssembler::string_indexof(Register haystack, Register needle, lbu(result_tmp, Address(result_tmp)); // load skip offset bind(BMADV); - sub(nlen_tmp, needle_len, 1); + subi(nlen_tmp, needle_len, 1); // move haystack after bad char skip offset shadd(haystack, result_tmp, haystack, result, haystack_chr_shift); ble(haystack, haystack_end, BMLOOPSTR2); - add(sp, sp, ASIZE); + addi(sp, sp, ASIZE); j(NOMATCH); bind(BMLOOPSTR1_LASTCMP); @@ -1114,11 +1111,11 @@ void C2_MacroAssembler::string_indexof(Register haystack, Register needle, if (!haystack_isL) { srli(result, result, 1); } - add(sp, sp, ASIZE); + addi(sp, sp, ASIZE); j(DONE); bind(LINEARSTUB); - sub(t0, needle_len, 16); // small patterns still should be handled by simple algorithm + subi(t0, needle_len, 16); // small patterns still should be handled by simple algorithm bltz(t0, LINEARSEARCH); mv(result, zr); RuntimeAddress stub = nullptr; @@ -1197,7 +1194,7 @@ void C2_MacroAssembler::string_indexof_linearscan(Register haystack, Register ne if (needle_con_cnt == -1) { Label DOSHORT, FIRST_LOOP, STR2_NEXT, STR1_LOOP, STR1_NEXT; - sub(t0, needle_len, needle_isL == haystack_isL ? 4 : 2); + subi(t0, needle_len, needle_isL == haystack_isL ? 4 : 2); bltz(t0, DOSHORT); (this->*needle_load_1chr)(first, Address(needle), noreg); @@ -1214,13 +1211,13 @@ void C2_MacroAssembler::string_indexof_linearscan(Register haystack, Register ne beq(first, ch2, STR1_LOOP); bind(STR2_NEXT); - add(hlen_neg, hlen_neg, haystack_chr_size); + addi(hlen_neg, hlen_neg, haystack_chr_size); blez(hlen_neg, FIRST_LOOP); j(NOMATCH); bind(STR1_LOOP); - add(nlen_tmp, nlen_neg, needle_chr_size); - add(hlen_tmp, hlen_neg, haystack_chr_size); + addi(nlen_tmp, nlen_neg, needle_chr_size); + addi(hlen_tmp, hlen_neg, haystack_chr_size); bgez(nlen_tmp, MATCH); bind(STR1_NEXT); @@ -1229,14 +1226,14 @@ void C2_MacroAssembler::string_indexof_linearscan(Register haystack, Register ne add(ch2, haystack, hlen_tmp); (this->*haystack_load_1chr)(ch2, Address(ch2), noreg); bne(ch1, ch2, STR2_NEXT); - add(nlen_tmp, nlen_tmp, needle_chr_size); - add(hlen_tmp, hlen_tmp, haystack_chr_size); + addi(nlen_tmp, nlen_tmp, needle_chr_size); + addi(hlen_tmp, hlen_tmp, haystack_chr_size); bltz(nlen_tmp, STR1_NEXT); j(MATCH); bind(DOSHORT); if (needle_isL == haystack_isL) { - sub(t0, needle_len, 2); + subi(t0, needle_len, 2); bltz(t0, DO1); bgtz(t0, DO3); } @@ -1245,7 +1242,7 @@ void C2_MacroAssembler::string_indexof_linearscan(Register haystack, Register ne if (needle_con_cnt == 4) { Label CH1_LOOP; (this->*load_4chr)(ch1, Address(needle), noreg); - sub(result_tmp, haystack_len, 4); + subi(result_tmp, haystack_len, 4); slli(tmp3, result_tmp, haystack_chr_shift); // result as tmp add(haystack, haystack, tmp3); neg(hlen_neg, tmp3); @@ -1274,7 +1271,7 @@ void C2_MacroAssembler::string_indexof_linearscan(Register haystack, Register ne (this->*load_4chr)(ch2, Address(tmp3), noreg); } beq(ch1, ch2, MATCH); - add(hlen_neg, hlen_neg, haystack_chr_size); + addi(hlen_neg, hlen_neg, haystack_chr_size); blez(hlen_neg, CH1_LOOP); j(NOMATCH); } @@ -1285,7 +1282,7 @@ void C2_MacroAssembler::string_indexof_linearscan(Register haystack, Register ne bind(DO2); (this->*load_2chr)(ch1, Address(needle), noreg); if (needle_con_cnt == 2) { - sub(result_tmp, haystack_len, 2); + subi(result_tmp, haystack_len, 2); } slli(tmp3, result_tmp, haystack_chr_shift); add(haystack, haystack, tmp3); @@ -1308,7 +1305,7 @@ void C2_MacroAssembler::string_indexof_linearscan(Register haystack, Register ne (this->*load_2chr)(ch2, Address(tmp3), noreg); } beq(ch1, ch2, MATCH); - add(hlen_neg, hlen_neg, haystack_chr_size); + addi(hlen_neg, hlen_neg, haystack_chr_size); blez(hlen_neg, CH1_LOOP); j(NOMATCH); BLOCK_COMMENT("} string_indexof DO2"); @@ -1322,7 +1319,7 @@ void C2_MacroAssembler::string_indexof_linearscan(Register haystack, Register ne (this->*load_2chr)(first, Address(needle), noreg); (this->*needle_load_1chr)(ch1, Address(needle, 2 * needle_chr_size), noreg); if (needle_con_cnt == 3) { - sub(result_tmp, haystack_len, 3); + subi(result_tmp, haystack_len, 3); } slli(hlen_tmp, result_tmp, haystack_chr_shift); add(haystack, haystack, hlen_tmp); @@ -1341,12 +1338,12 @@ void C2_MacroAssembler::string_indexof_linearscan(Register haystack, Register ne beq(first, ch2, STR1_LOOP); bind(STR2_NEXT); - add(hlen_neg, hlen_neg, haystack_chr_size); + addi(hlen_neg, hlen_neg, haystack_chr_size); blez(hlen_neg, FIRST_LOOP); j(NOMATCH); bind(STR1_LOOP); - add(hlen_tmp, hlen_neg, 2 * haystack_chr_size); + addi(hlen_tmp, hlen_neg, 2 * haystack_chr_size); add(ch2, haystack, hlen_tmp); (this->*haystack_load_1chr)(ch2, Address(ch2), noreg); bne(ch1, ch2, STR2_NEXT); @@ -1360,7 +1357,7 @@ void C2_MacroAssembler::string_indexof_linearscan(Register haystack, Register ne BLOCK_COMMENT("string_indexof DO1 {"); bind(DO1); (this->*needle_load_1chr)(ch1, Address(needle), noreg); - sub(result_tmp, haystack_len, 1); + subi(result_tmp, haystack_len, 1); slli(tmp3, result_tmp, haystack_chr_shift); add(haystack, haystack, tmp3); neg(hlen_neg, tmp3); @@ -1369,7 +1366,7 @@ void C2_MacroAssembler::string_indexof_linearscan(Register haystack, Register ne add(tmp3, haystack, hlen_neg); (this->*haystack_load_1chr)(ch2, Address(tmp3), noreg); beq(ch1, ch2, MATCH); - add(hlen_neg, hlen_neg, haystack_chr_size); + addi(hlen_neg, hlen_neg, haystack_chr_size); blez(hlen_neg, DO1_LOOP); BLOCK_COMMENT("} string_indexof DO1"); } @@ -1444,7 +1441,7 @@ void C2_MacroAssembler::string_compare(Register str1, Register str2, ld(tmp2, Address(str2)); mv(t0, STUB_THRESHOLD); bge(cnt2, t0, STUB); - sub(cnt2, cnt2, minCharsInWord); + subi(cnt2, cnt2, minCharsInWord); beqz(cnt2, TAIL_CHECK); // convert cnt2 from characters to bytes if (!str1_isL) { @@ -1458,7 +1455,7 @@ void C2_MacroAssembler::string_compare(Register str1, Register str2, ld(tmp2, Address(str2)); mv(t0, STUB_THRESHOLD); bge(cnt2, t0, STUB); - addi(cnt2, cnt2, -4); + subi(cnt2, cnt2, 4); add(str1, str1, cnt2); sub(cnt1, zr, cnt2); slli(cnt2, cnt2, 1); @@ -1586,13 +1583,13 @@ void C2_MacroAssembler::string_compare(Register str1, Register str2, // while comparing previous (this->*str1_load_chr)(tmp1, Address(str1), t0); addi(str1, str1, str1_chr_size); - addi(cnt2, cnt2, -1); + subi(cnt2, cnt2, 1); beqz(cnt2, SHORT_LAST_INIT); (this->*str2_load_chr)(cnt1, Address(str2), t0); addi(str2, str2, str2_chr_size); j(SHORT_LOOP_START); bind(SHORT_LOOP); - addi(cnt2, cnt2, -1); + subi(cnt2, cnt2, 1); beqz(cnt2, SHORT_LAST); bind(SHORT_LOOP_START); (this->*str1_load_chr)(tmp2, Address(str1), t0); @@ -1600,7 +1597,7 @@ void C2_MacroAssembler::string_compare(Register str1, Register str2, (this->*str2_load_chr)(t0, Address(str2), t0); addi(str2, str2, str2_chr_size); bne(tmp1, cnt1, SHORT_LOOP_TAIL); - addi(cnt2, cnt2, -1); + subi(cnt2, cnt2, 1); beqz(cnt2, SHORT_LAST2); (this->*str1_load_chr)(tmp1, Address(str1), t0); addi(str1, str1, str1_chr_size); @@ -1635,7 +1632,7 @@ void C2_MacroAssembler::arrays_equals(Register a1, Register a2, assert(elem_size == 1 || elem_size == 2, "must be char or byte"); assert_different_registers(a1, a2, result, tmp1, tmp2, tmp3, t0); - int elem_per_word = wordSize/elem_size; + int elem_per_word = wordSize / elem_size; int log_elem_size = exact_log2(elem_size); int length_offset = arrayOopDesc::length_offset_in_bytes(); int base_offset = arrayOopDesc::base_offset_in_bytes(elem_size == 2 ? T_CHAR : T_BYTE); @@ -1664,14 +1661,14 @@ void C2_MacroAssembler::arrays_equals(Register a1, Register a2, la(a1, Address(a1, base_offset)); la(a2, Address(a2, base_offset)); // Check for short strings, i.e. smaller than wordSize. - addi(cnt1, cnt1, -elem_per_word); + subi(cnt1, cnt1, elem_per_word); bltz(cnt1, SHORT); // Main 8 byte comparison loop. bind(NEXT_WORD); { ld(tmp1, Address(a1)); ld(tmp2, Address(a2)); - addi(cnt1, cnt1, -elem_per_word); + subi(cnt1, cnt1, elem_per_word); addi(a1, a1, wordSize); addi(a2, a2, wordSize); bne(tmp1, tmp2, DONE); @@ -1743,14 +1740,14 @@ void C2_MacroAssembler::string_equals(Register a1, Register a2, mv(result, false); // Check for short strings, i.e. smaller than wordSize. - addi(cnt1, cnt1, -wordSize); + subi(cnt1, cnt1, wordSize); bltz(cnt1, SHORT); // Main 8 byte comparison loop. bind(NEXT_WORD); { ld(tmp1, Address(a1)); ld(tmp2, Address(a2)); - addi(cnt1, cnt1, -wordSize); + subi(cnt1, cnt1, wordSize); addi(a1, a1, wordSize); addi(a2, a2, wordSize); bne(tmp1, tmp2, DONE); @@ -1838,7 +1835,7 @@ void C2_MacroAssembler::arrays_hashcode(Register ary, Register cnt, Register res beqz(cnt, DONE); - andi(chunks, cnt, ~(stride-1)); + andi(chunks, cnt, ~(stride - 1)); beqz(chunks, TAIL); mv(pow31_4, 923521); // [31^^4] @@ -1847,7 +1844,7 @@ void C2_MacroAssembler::arrays_hashcode(Register ary, Register cnt, Register res slli(chunks_end, chunks, chunks_end_shift); add(chunks_end, ary, chunks_end); - andi(cnt, cnt, stride-1); // don't forget about tail! + andi(cnt, cnt, stride - 1); // don't forget about tail! bind(WIDE_LOOP); mulw(result, result, pow31_4); // 31^^4 * h @@ -2061,7 +2058,7 @@ void C2_MacroAssembler::minmax_fp(FloatRegister dst, FloatRegister src1, FloatRe is_double ? fclass_d(t1, src2) : fclass_s(t1, src2); orr(t0, t0, t1); - andi(t0, t0, fclass_mask::nan); // if src1 or src2 is quiet or signaling NaN then return NaN + andi(t0, t0, FClassBits::nan); // if src1 or src2 is quiet or signaling NaN then return NaN beqz(t0, Compare); is_double ? fadd_d(dst, src1, src2) : fadd_s(dst, src1, src2); @@ -2155,7 +2152,7 @@ void C2_MacroAssembler::signum_fp(FloatRegister dst, FloatRegister one, bool is_ : fclass_s(t0, dst); // check if input is -0, +0, signaling NaN or quiet NaN - andi(t0, t0, fclass_mask::zero | fclass_mask::nan); + andi(t0, t0, FClassBits::zero | FClassBits::nan); bnez(t0, done); @@ -2371,7 +2368,7 @@ void C2_MacroAssembler::signum_fp_v(VectorRegister dst, VectorRegister one, Basi // check if input is -0, +0, signaling NaN or quiet NaN vfclass_v(v0, dst); - mv(t0, fclass_mask::zero | fclass_mask::nan); + mv(t0, FClassBits::zero | FClassBits::nan); vand_vx(v0, v0, t0); vmseq_vi(v0, v0, 0); diff --git a/src/hotspot/cpu/riscv/c2_init_riscv.cpp b/src/hotspot/cpu/riscv/c2_init_riscv.cpp index cdbd69807bee1..70a024f7f8afc 100644 --- a/src/hotspot/cpu/riscv/c2_init_riscv.cpp +++ b/src/hotspot/cpu/riscv/c2_init_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2019, 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. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "opto/compile.hpp" #include "opto/node.hpp" diff --git a/src/hotspot/cpu/riscv/codeBuffer_riscv.cpp b/src/hotspot/cpu/riscv/codeBuffer_riscv.cpp index e99183a5b5d91..280b3bd54e5ce 100644 --- a/src/hotspot/cpu/riscv/codeBuffer_riscv.cpp +++ b/src/hotspot/cpu/riscv/codeBuffer_riscv.cpp @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "asm/codeBuffer.inline.hpp" #include "asm/macroAssembler.hpp" diff --git a/src/hotspot/cpu/riscv/codeBuffer_riscv.hpp b/src/hotspot/cpu/riscv/codeBuffer_riscv.hpp index a864d7073dcfb..f541ac117eba0 100644 --- a/src/hotspot/cpu/riscv/codeBuffer_riscv.hpp +++ b/src/hotspot/cpu/riscv/codeBuffer_riscv.hpp @@ -33,6 +33,6 @@ public: void flush_bundle(bool start_new_bundle) {} - static bool supports_shared_stubs() { return false; } + static bool supports_shared_stubs() { return true; } #endif // CPU_RISCV_CODEBUFFER_RISCV_HPP diff --git a/src/hotspot/cpu/riscv/compiledIC_riscv.cpp b/src/hotspot/cpu/riscv/compiledIC_riscv.cpp index 65f3aa263aa02..a86e65ab58086 100644 --- a/src/hotspot/cpu/riscv/compiledIC_riscv.cpp +++ b/src/hotspot/cpu/riscv/compiledIC_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2018, Red Hat Inc. All rights reserved. * Copyright (c) 2020, 2021, Huawei Technologies Co., Ltd. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "code/compiledIC.hpp" #include "code/nmethod.hpp" diff --git a/src/hotspot/cpu/riscv/compressedKlass_riscv.cpp b/src/hotspot/cpu/riscv/compressedKlass_riscv.cpp index 7e596e0a7e99a..a2e732025d539 100644 --- a/src/hotspot/cpu/riscv/compressedKlass_riscv.cpp +++ b/src/hotspot/cpu/riscv/compressedKlass_riscv.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2023, Red Hat, Inc. All rights reserved. - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * */ -#include "precompiled.hpp" #include "oops/compressedKlass.hpp" #include "utilities/globalDefinitions.hpp" @@ -31,7 +30,7 @@ char* CompressedKlassPointers::reserve_address_space_for_compressed_classes(size char* result = nullptr; - // RiscV loads a 64-bit immediate in up to four separate steps, splitting it into four different sections + // RISC-V loads a 64-bit immediate in up to four separate steps, splitting it into four different sections // (two 32-bit sections, each split into two subsections of 20/12 bits). // // 63 ....... 44 43 ... 32 31 ....... 12 11 ... 0 @@ -51,11 +50,6 @@ char* CompressedKlassPointers::reserve_address_space_for_compressed_classes(size // with one instruction (2) result = reserve_address_space_for_unscaled_encoding(size, aslr); - // Failing that, attempt to reserve for base=zero shift>0 - if (result == nullptr && optimize_for_zero_base) { - result = reserve_address_space_for_zerobased_encoding(size, aslr); - } - // Failing that, optimize for case (3) - a base with only bits set between [32-44) if (result == nullptr) { const uintptr_t from = nth_bit(32); diff --git a/src/hotspot/cpu/riscv/downcallLinker_riscv.cpp b/src/hotspot/cpu/riscv/downcallLinker_riscv.cpp index 97b168a98119e..1edb30a36ea78 100644 --- a/src/hotspot/cpu/riscv/downcallLinker_riscv.cpp +++ b/src/hotspot/cpu/riscv/downcallLinker_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "code/codeBlob.hpp" #include "code/codeCache.hpp" diff --git a/src/hotspot/cpu/riscv/foreignGlobals_riscv.cpp b/src/hotspot/cpu/riscv/foreignGlobals_riscv.cpp index 2975b088b0c19..339e205c48afe 100644 --- a/src/hotspot/cpu/riscv/foreignGlobals_riscv.cpp +++ b/src/hotspot/cpu/riscv/foreignGlobals_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "code/vmreg.inline.hpp" #include "runtime/jniHandles.hpp" #include "runtime/jniHandles.inline.hpp" diff --git a/src/hotspot/cpu/riscv/frame_riscv.cpp b/src/hotspot/cpu/riscv/frame_riscv.cpp index ecc450bd6b254..8ee6d11dcaf39 100644 --- a/src/hotspot/cpu/riscv/frame_riscv.cpp +++ b/src/hotspot/cpu/riscv/frame_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, 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. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "compiler/oopMap.hpp" #include "interpreter/interpreter.hpp" #include "memory/resourceArea.hpp" @@ -158,6 +157,11 @@ bool frame::safe_for_sender(JavaThread *thread) { } if (Continuation::is_return_barrier_entry(sender_pc)) { + // sender_pc might be invalid so check that the frame + // actually belongs to a Continuation. + if (!Continuation::is_frame_in_continuation(thread, *this)) { + return false; + } // If our sender_pc is the return barrier, then our "real" sender is the continuation entry frame s = Continuation::continuation_bottom_sender(thread, *this, sender_sp); sender_sp = s.sp(); diff --git a/src/hotspot/cpu/riscv/gc/g1/g1BarrierSetAssembler_riscv.cpp b/src/hotspot/cpu/riscv/gc/g1/g1BarrierSetAssembler_riscv.cpp index 6a3e4f95b9848..ef5dcdd8074a3 100644 --- a/src/hotspot/cpu/riscv/gc/g1/g1BarrierSetAssembler_riscv.cpp +++ b/src/hotspot/cpu/riscv/gc/g1/g1BarrierSetAssembler_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2024, Huawei Technologies Co., Ltd. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "gc/g1/g1BarrierSet.hpp" #include "gc/g1/g1BarrierSetAssembler.hpp" @@ -106,7 +105,7 @@ static void generate_queue_test_and_insertion(MacroAssembler* masm, ByteSize ind __ ld(tmp1, Address(thread, in_bytes(index_offset))); // tmp1 := *(index address) __ beqz(tmp1, runtime); // jump to runtime if index == 0 (full buffer) // The buffer is not full, store value into it. - __ sub(tmp1, tmp1, wordSize); // tmp1 := next index + __ subi(tmp1, tmp1, wordSize); // tmp1 := next index __ sd(tmp1, Address(thread, in_bytes(index_offset))); // *(index address) := next index __ ld(tmp2, Address(thread, in_bytes(buffer_offset))); // tmp2 := buffer address __ add(tmp2, tmp2, tmp1); @@ -490,7 +489,7 @@ void G1BarrierSetAssembler::generate_c1_pre_barrier_runtime_stub(StubAssembler* __ ld(tmp, queue_index); __ beqz(tmp, runtime); - __ sub(tmp, tmp, wordSize); + __ subi(tmp, tmp, wordSize); __ sd(tmp, queue_index); __ ld(t1, buffer); __ add(tmp, tmp, t1); @@ -557,7 +556,7 @@ void G1BarrierSetAssembler::generate_c1_post_barrier_runtime_stub(StubAssembler* __ ld(t0, queue_index); __ beqz(t0, runtime); - __ sub(t0, t0, wordSize); + __ subi(t0, t0, wordSize); __ sd(t0, queue_index); // Reuse RA to hold buffer_addr diff --git a/src/hotspot/cpu/riscv/gc/shared/barrierSetAssembler_riscv.cpp b/src/hotspot/cpu/riscv/gc/shared/barrierSetAssembler_riscv.cpp index d96d405aa2282..c49c8406befec 100644 --- a/src/hotspot/cpu/riscv/gc/shared/barrierSetAssembler_riscv.cpp +++ b/src/hotspot/cpu/riscv/gc/shared/barrierSetAssembler_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderData.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/barrierSetAssembler.hpp" diff --git a/src/hotspot/cpu/riscv/gc/shared/barrierSetNMethod_riscv.cpp b/src/hotspot/cpu/riscv/gc/shared/barrierSetNMethod_riscv.cpp index 5373704c078a8..39da77181c674 100644 --- a/src/hotspot/cpu/riscv/gc/shared/barrierSetNMethod_riscv.cpp +++ b/src/hotspot/cpu/riscv/gc/shared/barrierSetNMethod_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "code/codeCache.hpp" #include "code/nativeInst.hpp" #include "gc/shared/barrierSetAssembler.hpp" diff --git a/src/hotspot/cpu/riscv/gc/shared/cardTableBarrierSetAssembler_riscv.cpp b/src/hotspot/cpu/riscv/gc/shared/cardTableBarrierSetAssembler_riscv.cpp index 2ad44400687f2..df7ff65442ef9 100644 --- a/src/hotspot/cpu/riscv/gc/shared/cardTableBarrierSetAssembler_riscv.cpp +++ b/src/hotspot/cpu/riscv/gc/shared/cardTableBarrierSetAssembler_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/cardTable.hpp" @@ -69,7 +68,7 @@ void CardTableBarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembl __ beqz(count, L_done); // zero count - nothing to do // end = start + count << LogBytesPerHeapOop __ shadd(end, count, start, count, LogBytesPerHeapOop); - __ sub(end, end, BytesPerHeapOop); // last element address to make inclusive + __ subi(end, end, BytesPerHeapOop); // last element address to make inclusive __ srli(start, start, CardTable::card_shift()); __ srli(end, end, CardTable::card_shift()); @@ -81,7 +80,7 @@ void CardTableBarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembl __ bind(L_loop); __ add(tmp, start, count); __ sb(zr, Address(tmp)); - __ sub(count, count, 1); + __ subi(count, count, 1); __ bgez(count, L_loop); __ bind(L_done); } diff --git a/src/hotspot/cpu/riscv/gc/shared/modRefBarrierSetAssembler_riscv.cpp b/src/hotspot/cpu/riscv/gc/shared/modRefBarrierSetAssembler_riscv.cpp index f2b0face0a9d3..6b0871007f488 100644 --- a/src/hotspot/cpu/riscv/gc/shared/modRefBarrierSetAssembler_riscv.cpp +++ b/src/hotspot/cpu/riscv/gc/shared/modRefBarrierSetAssembler_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "gc/shared/modRefBarrierSetAssembler.hpp" diff --git a/src/hotspot/cpu/riscv/gc/shenandoah/c1/shenandoahBarrierSetC1_riscv.cpp b/src/hotspot/cpu/riscv/gc/shenandoah/c1/shenandoahBarrierSetC1_riscv.cpp index d15b3aa31f905..2a96bd32cf8d7 100644 --- a/src/hotspot/cpu/riscv/gc/shenandoah/c1/shenandoahBarrierSetC1_riscv.cpp +++ b/src/hotspot/cpu/riscv/gc/shenandoah/c1/shenandoahBarrierSetC1_riscv.cpp @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_LIRAssembler.hpp" #include "c1/c1_MacroAssembler.hpp" #include "gc/shared/gc_globals.hpp" diff --git a/src/hotspot/cpu/riscv/gc/shenandoah/shenandoahBarrierSetAssembler_riscv.cpp b/src/hotspot/cpu/riscv/gc/shenandoah/shenandoahBarrierSetAssembler_riscv.cpp index 257d445f01187..97b83d78811a8 100644 --- a/src/hotspot/cpu/riscv/gc/shenandoah/shenandoahBarrierSetAssembler_riscv.cpp +++ b/src/hotspot/cpu/riscv/gc/shenandoah/shenandoahBarrierSetAssembler_riscv.cpp @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahBarrierSet.hpp" #include "gc/shenandoah/shenandoahBarrierSetAssembler.hpp" #include "gc/shenandoah/shenandoahForwarding.hpp" @@ -143,7 +142,7 @@ void ShenandoahBarrierSetAssembler::satb_write_barrier_pre(MacroAssembler* masm, __ ld(tmp1, index); // tmp := *index_adr __ beqz(tmp1, runtime); // tmp == 0? If yes, goto runtime - __ sub(tmp1, tmp1, wordSize); // tmp := tmp - wordSize + __ subi(tmp1, tmp1, wordSize); // tmp := tmp - wordSize __ sd(tmp1, index); // *index_adr := tmp __ ld(tmp2, buffer); __ add(tmp1, tmp1, tmp2); // tmp := tmp + *buffer_adr @@ -562,7 +561,7 @@ void ShenandoahBarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssemb // end = start + count << LogBytesPerHeapOop // last element address to make inclusive __ shadd(end, count, start, tmp, LogBytesPerHeapOop); - __ sub(end, end, BytesPerHeapOop); + __ subi(end, end, BytesPerHeapOop); __ srli(start, start, CardTable::card_shift()); __ srli(end, end, CardTable::card_shift()); @@ -575,7 +574,7 @@ void ShenandoahBarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssemb __ bind(L_loop); __ add(tmp, start, count); __ sb(zr, Address(tmp)); - __ sub(count, count, 1); + __ subi(count, count, 1); __ bgez(count, L_loop); __ bind(L_done); } @@ -690,7 +689,7 @@ void ShenandoahBarrierSetAssembler::generate_c1_pre_barrier_runtime_stub(StubAss __ ld(tmp, queue_index); __ beqz(tmp, runtime); - __ sub(tmp, tmp, wordSize); + __ subi(tmp, tmp, wordSize); __ sd(tmp, queue_index); __ ld(t1, buffer); __ add(tmp, tmp, t1); diff --git a/src/hotspot/cpu/riscv/gc/z/zAddress_riscv.cpp b/src/hotspot/cpu/riscv/gc/z/zAddress_riscv.cpp index 715f0d8aff7cb..683d892915f50 100644 --- a/src/hotspot/cpu/riscv/gc/z/zAddress_riscv.cpp +++ b/src/hotspot/cpu/riscv/gc/z/zAddress_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2023, Huawei Technologies Co., Ltd. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -22,7 +22,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/gcLogPrecious.hpp" #include "gc/shared/gc_globals.hpp" #include "gc/z/zAddress.hpp" @@ -84,7 +83,7 @@ static size_t probe_valid_max_address_bit() { munmap(result_addr, page_size); } } - log_info_p(gc, init)("Probing address space for the highest valid bit: " SIZE_FORMAT, max_address_bit); + log_info_p(gc, init)("Probing address space for the highest valid bit: %zu", max_address_bit); return MAX2(max_address_bit, MINIMUM_MAX_ADDRESS_BIT); #else // LINUX return DEFAULT_MAX_ADDRESS_BIT; diff --git a/src/hotspot/cpu/riscv/gc/z/zBarrierSetAssembler_riscv.cpp b/src/hotspot/cpu/riscv/gc/z/zBarrierSetAssembler_riscv.cpp index 0b093838b8b68..09dea62b6d18f 100644 --- a/src/hotspot/cpu/riscv/gc/z/zBarrierSetAssembler_riscv.cpp +++ b/src/hotspot/cpu/riscv/gc/z/zBarrierSetAssembler_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "code/codeBlob.hpp" #include "code/vmreg.inline.hpp" @@ -241,7 +240,7 @@ static void store_barrier_buffer_add(MacroAssembler* masm, __ beqz(tmp2, slow_path); // Bump the pointer - __ sub(tmp2, tmp2, sizeof(ZStoreBarrierEntry)); + __ subi(tmp2, tmp2, sizeof(ZStoreBarrierEntry)); __ sd(tmp2, Address(tmp1, ZStoreBarrierBuffer::current_offset())); // Compute the buffer entry address @@ -848,10 +847,10 @@ void ZBarrierSetAssembler::generate_c1_load_barrier_stub(LIR_Assembler* ce, // Save x10 unless it is the result or tmp register // Set up SP to accommdate parameters and maybe x10. if (ref != x10 && tmp != x10) { - __ sub(sp, sp, 32); + __ subi(sp, sp, 32); __ sd(x10, Address(sp, 16)); } else { - __ sub(sp, sp, 16); + __ subi(sp, sp, 16); } // Setup arguments and call runtime stub @@ -963,7 +962,7 @@ void ZBarrierSetAssembler::generate_c1_store_barrier_stub(LIR_Assembler* ce, __ la(stub->new_zpointer()->as_register(), ce->as_Address(stub->ref_addr()->as_address_ptr())); - __ sub(sp, sp, 16); + __ subi(sp, sp, 16); //Setup arguments and call runtime stub assert(stub->new_zpointer()->is_valid(), "invariant"); ce->store_parameter(stub->new_zpointer()->as_register(), 0); diff --git a/src/hotspot/cpu/riscv/globals_riscv.hpp b/src/hotspot/cpu/riscv/globals_riscv.hpp index 806cca16269ea..a70dedd1ef79b 100644 --- a/src/hotspot/cpu/riscv/globals_riscv.hpp +++ b/src/hotspot/cpu/riscv/globals_riscv.hpp @@ -104,6 +104,7 @@ define_pd_global(intx, InlineSmallCode, 1000); product(bool, UseZbb, false, DIAGNOSTIC, "Use Zbb instructions") \ product(bool, UseZbs, false, DIAGNOSTIC, "Use Zbs instructions") \ product(bool, UseZfh, false, DIAGNOSTIC, "Use Zfh instructions") \ + product(bool, UseZfhmin, false, DIAGNOSTIC, "Use Zfhmin instructions") \ product(bool, UseZacas, false, EXPERIMENTAL, "Use Zacas instructions") \ product(bool, UseZcb, false, EXPERIMENTAL, "Use Zcb instructions") \ product(bool, UseZic64b, false, EXPERIMENTAL, "Use Zic64b instructions") \ diff --git a/src/hotspot/cpu/riscv/icache_riscv.cpp b/src/hotspot/cpu/riscv/icache_riscv.cpp index d615dcfb9e9ae..258bc665770fd 100644 --- a/src/hotspot/cpu/riscv/icache_riscv.cpp +++ b/src/hotspot/cpu/riscv/icache_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2022, Huawei Technologies Co., Ltd. All rights reserved. * Copyright (c) 2023, Rivos Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "riscv_flush_icache.hpp" #include "runtime/java.hpp" diff --git a/src/hotspot/cpu/riscv/interp_masm_riscv.cpp b/src/hotspot/cpu/riscv/interp_masm_riscv.cpp index e17a3765b50ec..c132f9cda7a08 100644 --- a/src/hotspot/cpu/riscv/interp_masm_riscv.cpp +++ b/src/hotspot/cpu/riscv/interp_masm_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/barrierSetAssembler.hpp" @@ -270,18 +269,18 @@ void InterpreterMacroAssembler::pop_l(Register r) { } void InterpreterMacroAssembler::push_ptr(Register r) { - addi(esp, esp, -wordSize); + subi(esp, esp, wordSize); sd(r, Address(esp, 0)); } void InterpreterMacroAssembler::push_i(Register r) { - addi(esp, esp, -wordSize); + subi(esp, esp, wordSize); sext(r, r, 32); sd(r, Address(esp, 0)); } void InterpreterMacroAssembler::push_l(Register r) { - addi(esp, esp, -2 * wordSize); + subi(esp, esp, 2 * wordSize); sd(zr, Address(esp, wordSize)); sd(r, Address(esp)); } @@ -297,12 +296,12 @@ void InterpreterMacroAssembler::pop_d(FloatRegister r) { } void InterpreterMacroAssembler::push_f(FloatRegister r) { - addi(esp, esp, -wordSize); + subi(esp, esp, wordSize); fsw(r, Address(esp, 0)); } void InterpreterMacroAssembler::push_d(FloatRegister r) { - addi(esp, esp, -2 * wordSize); + subi(esp, esp, 2 * wordSize); fsd(r, Address(esp, 0)); } @@ -544,7 +543,7 @@ void InterpreterMacroAssembler::remove_activation( // get method access flags ld(x11, Address(fp, frame::interpreter_frame_method_offset * wordSize)); - ld(x12, Address(x11, Method::access_flags_offset())); + load_unsigned_short(x12, Address(x11, Method::access_flags_offset())); test_bit(t0, x12, exact_log2(JVM_ACC_SYNCHRONIZED)); beqz(t0, unlocked); @@ -895,7 +894,7 @@ void InterpreterMacroAssembler::verify_method_data_pointer() { assert(ProfileInterpreter, "must be profiling interpreter"); #ifdef ASSERT Label verify_continue; - add(sp, sp, -4 * wordSize); + subi(sp, sp, 4 * wordSize); sd(x10, Address(sp, 0)); sd(x11, Address(sp, wordSize)); sd(x12, Address(sp, 2 * wordSize)); @@ -920,7 +919,7 @@ void InterpreterMacroAssembler::verify_method_data_pointer() { ld(x11, Address(sp, wordSize)); ld(x12, Address(sp, 2 * wordSize)); ld(x13, Address(sp, 3 * wordSize)); - add(sp, sp, 4 * wordSize); + addi(sp, sp, 4 * wordSize); #endif // ASSERT } @@ -961,7 +960,7 @@ void InterpreterMacroAssembler::increment_mdp_data_at(Register mdp_in, if (decrement) { ld(t0, addr); - addi(t0, t0, -DataLayout::counter_increment); + subi(t0, t0, DataLayout::counter_increment); Label L; bltz(t0, L); // skip store if counter underflow sd(t0, addr); @@ -1028,7 +1027,7 @@ void InterpreterMacroAssembler::update_mdp_by_offset(Register mdp_in, void InterpreterMacroAssembler::update_mdp_by_constant(Register mdp_in, int constant) { assert(ProfileInterpreter, "must be profiling interpreter"); - addi(mdp_in, mdp_in, (unsigned)constant); + add(mdp_in, mdp_in, (unsigned)constant); sd(mdp_in, Address(fp, frame::interpreter_frame_mdp_offset * wordSize)); } @@ -1037,7 +1036,7 @@ void InterpreterMacroAssembler::update_mdp_for_ret(Register return_bci) { assert(ProfileInterpreter, "must be profiling interpreter"); // save/restore across call_VM - addi(sp, sp, -2 * wordSize); + subi(sp, sp, 2 * wordSize); sd(zr, Address(sp, 0)); sd(return_bci, Address(sp, wordSize)); call_VM(noreg, @@ -1739,7 +1738,7 @@ void InterpreterMacroAssembler::profile_arguments_type(Register mdp, Register ca add(t0, mdp, t0); ld(t0, Address(t0)); sub(tmp, tmp, t0); - addi(tmp, tmp, -1); + subi(tmp, tmp, 1); Address arg_addr = argument_address(tmp); ld(tmp, arg_addr); @@ -1762,7 +1761,7 @@ void InterpreterMacroAssembler::profile_arguments_type(Register mdp, Register ca if (MethodData::profile_return()) { ld(tmp, Address(mdp, in_bytes(TypeEntriesAtCall::cell_count_offset()))); - addi(tmp, tmp, -TypeProfileArgsLimit*TypeStackSlotEntries::per_arg_count()); + sub(tmp, tmp, TypeProfileArgsLimit * TypeStackSlotEntries::per_arg_count()); } add(t0, mdp, off_to_args); @@ -1849,7 +1848,7 @@ void InterpreterMacroAssembler::profile_parameters_type(Register mdp, Register t // mdo start + parameters offset + array length - 1 add(mdp, mdp, tmp1); ld(tmp1, Address(mdp, ArrayData::array_len_offset())); - add(tmp1, tmp1, - TypeStackSlotEntries::per_arg_count()); + subi(tmp1, tmp1, TypeStackSlotEntries::per_arg_count()); Label loop; bind(loop); @@ -1875,7 +1874,7 @@ void InterpreterMacroAssembler::profile_parameters_type(Register mdp, Register t profile_obj_type(tmp2, arg_type, tmp3); // go to next parameter - add(tmp1, tmp1, - TypeStackSlotEntries::per_arg_count()); + subi(tmp1, tmp1, TypeStackSlotEntries::per_arg_count()); bgez(tmp1, loop); bind(profile_continue); @@ -1890,7 +1889,7 @@ void InterpreterMacroAssembler::load_resolved_indy_entry(Register cache, Registe ld(cache, Address(xcpool, in_bytes(ConstantPoolCache::invokedynamic_entries_offset()))); // Scale the index to be the entry index * sizeof(ResolvedIndyEntry) slli(index, index, log2i_exact(sizeof(ResolvedIndyEntry))); - add(cache, cache, Array::base_offset_in_bytes()); + addi(cache, cache, Array::base_offset_in_bytes()); add(cache, cache, index); } @@ -1906,7 +1905,7 @@ void InterpreterMacroAssembler::load_field_entry(Register cache, Register index, } // Get address of field entries array ld(cache, Address(xcpool, ConstantPoolCache::field_entries_offset())); - add(cache, cache, Array::base_offset_in_bytes()); + addi(cache, cache, Array::base_offset_in_bytes()); add(cache, cache, index); // Prevents stale data from being read after the bytecode is patched to the fast bytecode membar(MacroAssembler::LoadLoad); @@ -1932,7 +1931,7 @@ void InterpreterMacroAssembler::load_method_entry(Register cache, Register index // Get address of field entries array ld(cache, Address(xcpool, ConstantPoolCache::method_entries_offset())); - add(cache, cache, Array::base_offset_in_bytes()); + addi(cache, cache, Array::base_offset_in_bytes()); add(cache, cache, index); } diff --git a/src/hotspot/cpu/riscv/interpreterRT_riscv.cpp b/src/hotspot/cpu/riscv/interpreterRT_riscv.cpp index de34d84fecb00..c8e488d9d6919 100644 --- a/src/hotspot/cpu/riscv/interpreterRT_riscv.cpp +++ b/src/hotspot/cpu/riscv/interpreterRT_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2020, 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. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "interpreter/interp_masm.hpp" #include "interpreter/interpreter.hpp" @@ -138,10 +137,10 @@ void InterpreterRuntime::SignatureHandlerGenerator::pass_object() { Register reg = next_gpr(); if (reg == c_rarg1) { assert(offset() == 0, "argument register 1 can only be (non-null) receiver"); - __ addi(c_rarg1, from(), Interpreter::local_offset_in_bytes(offset())); + __ add(c_rarg1, from(), Interpreter::local_offset_in_bytes(offset())); } else if (reg != noreg) { // c_rarg2-c_rarg7 - __ addi(x10, from(), Interpreter::local_offset_in_bytes(offset())); + __ add(x10, from(), Interpreter::local_offset_in_bytes(offset())); __ mv(reg, zr); //_num_reg_int_args:c_rarg -> 1:c_rarg2, 2:c_rarg3... __ ld(temp(), x10); Label L; @@ -150,7 +149,7 @@ void InterpreterRuntime::SignatureHandlerGenerator::pass_object() { __ bind(L); } else { //to stack - __ addi(x10, from(), Interpreter::local_offset_in_bytes(offset())); + __ add(x10, from(), Interpreter::local_offset_in_bytes(offset())); __ ld(temp(), x10); Label L; __ bnez(temp(), L); diff --git a/src/hotspot/cpu/riscv/jniFastGetField_riscv.cpp b/src/hotspot/cpu/riscv/jniFastGetField_riscv.cpp index 648a665fef5aa..b08e520393ab8 100644 --- a/src/hotspot/cpu/riscv/jniFastGetField_riscv.cpp +++ b/src/hotspot/cpu/riscv/jniFastGetField_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2025, 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. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/barrierSetAssembler.hpp" diff --git a/src/hotspot/cpu/riscv/jvmciCodeInstaller_riscv.cpp b/src/hotspot/cpu/riscv/jvmciCodeInstaller_riscv.cpp index 1c06d0b29aa6d..cbe387eed148c 100644 --- a/src/hotspot/cpu/riscv/jvmciCodeInstaller_riscv.cpp +++ b/src/hotspot/cpu/riscv/jvmciCodeInstaller_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "jvmci/jvmci.hpp" #include "jvmci/jvmciCodeInstaller.hpp" diff --git a/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp b/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp index 804407fd80e68..50b9f8616e7ac 100644 --- a/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp +++ b/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved. * Copyright (c) 2020, 2024, Huawei Technologies Co., Ltd. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" #include "code/compiledIC.hpp" @@ -245,7 +244,7 @@ void MacroAssembler::inc_held_monitor_count(Register tmp) { void MacroAssembler::dec_held_monitor_count(Register tmp) { Address dst(xthread, JavaThread::held_monitor_count_offset()); ld(tmp, dst); - addi(tmp, tmp, -1); + subi(tmp, tmp, 1); sd(tmp, dst); #ifdef ASSERT Label ok; @@ -1333,22 +1332,11 @@ void MacroAssembler::cmov_gtu(Register cmp1, Register cmp2, Register dst, Regist #undef INSN - -#define INSN(NAME, CSR) \ - void MacroAssembler::NAME(Register Rd) { \ - csrr(Rd, CSR); \ - } - - INSN(rdinstret, CSR_INSTRET); - INSN(rdcycle, CSR_CYCLE); - INSN(rdtime, CSR_TIME); - INSN(frcsr, CSR_FCSR); - INSN(frrm, CSR_FRM); - INSN(frflags, CSR_FFLAGS); - -#undef INSN - void MacroAssembler::csrr(Register Rd, unsigned csr) { + // These three are specified in zicntr and are unused. + // Before adding use-cases add the appropriate hwprobe and flag. + assert(csr != CSR_INSTRET && csr != CSR_CYCLE && csr != CSR_TIME, + "Not intended for use without enabling zicntr."); csrrs(Rd, csr, x0); } @@ -1430,7 +1418,7 @@ void MacroAssembler::restore_cpu_control_state_after_jni(Register tmp) { void MacroAssembler::push_reg(Register Rs) { - addi(esp, esp, 0 - wordSize); + subi(esp, esp, wordSize); sd(Rs, Address(esp, 0)); } @@ -1462,7 +1450,7 @@ int MacroAssembler::push_reg(unsigned int bitset, Register stack) { int offset = is_even(count) ? 0 : wordSize; if (count) { - addi(stack, stack, -count * wordSize - offset); + sub(stack, stack, count * wordSize + offset); } for (int i = count - 1; i >= 0; i--) { sd(as_Register(regs[i]), Address(stack, (count - 1 - i) * wordSize + offset)); @@ -1487,7 +1475,7 @@ int MacroAssembler::pop_reg(unsigned int bitset, Register stack) { } if (count) { - addi(stack, stack, count * wordSize + offset); + add(stack, stack, count * wordSize + offset); } assert(words_popped == count, "oops, popped != count"); @@ -1503,7 +1491,7 @@ int MacroAssembler::push_fp(unsigned int bitset, Register stack) { int push_slots = count + (count & 1); if (count) { - addi(stack, stack, -push_slots * wordSize); + subi(stack, stack, push_slots * wordSize); } for (int i = count - 1; i >= 0; i--) { @@ -1632,7 +1620,7 @@ void MacroAssembler::vector_update_crc32(Register crc, Register buf, Register le Label VectorLoop; Label LastBlock; - add(tableN16, table3, 1*single_table_size*sizeof(juint), tmp1); + add(tableN16, table3, 1 * single_table_size * sizeof(juint), tmp1); mv(tmp5, 0xff); if (MaxVectorSize == 16) { @@ -1651,7 +1639,7 @@ void MacroAssembler::vector_update_crc32(Register crc, Register buf, Register le srli(blks, len, 6); slli(t1, blks, 6); sub(len, len, t1); - sub(blks, blks, 1); + subi(blks, blks, 1); blez(blks, LastBlock); bind(VectorLoop); @@ -1683,7 +1671,7 @@ void MacroAssembler::vector_update_crc32(Register crc, Register buf, Register le addi(tmp1, tmp1, 1); } - sub(blks, blks, 1); + subi(blks, blks, 1); bgtz(blks, VectorLoop); } @@ -2046,7 +2034,7 @@ void MacroAssembler::kernel_crc32_vclmul_fold(Register crc, Register buf, Regist Register vclmul_table = tmp3; la(vclmul_table, table_addr); - add(vclmul_table, vclmul_table, table_num*single_table_size*sizeof(juint), tmp1); + add(vclmul_table, vclmul_table, table_num * single_table_size * sizeof(juint), tmp1); la(table0, table_addr); if (MaxVectorSize == 16) { @@ -2092,25 +2080,25 @@ void MacroAssembler::kernel_crc32(Register crc, Register buf, Register len, const ExternalAddress table_addr = StubRoutines::crc_table_addr(); la(table0, table_addr); - add(table1, table0, 1*single_table_size*sizeof(juint), tmp1); - add(table2, table0, 2*single_table_size*sizeof(juint), tmp1); - add(table3, table2, 1*single_table_size*sizeof(juint), tmp1); + add(table1, table0, 1 * single_table_size * sizeof(juint), tmp1); + add(table2, table0, 2 * single_table_size * sizeof(juint), tmp1); + add(table3, table2, 1 * single_table_size * sizeof(juint), tmp1); // Ensure basic 4-byte alignment of input byte buffer mv(tmp1, 4); blt(len, tmp1, L_by1_loop); test_bit(tmp1, buf, 0); beqz(tmp1, L_skip1); - subw(len, len, 1); + subiw(len, len, 1); lbu(tmp1, Address(buf)); - add(buf, buf, 1); + addi(buf, buf, 1); update_byte_crc32(crc, tmp1, table0); bind(L_skip1); test_bit(tmp1, buf, 1); beqz(tmp1, L_skip2); - subw(len, len, 2); + subiw(len, len, 2); lhu(tmp1, Address(buf)); - add(buf, buf, 2); + addi(buf, buf, 2); zext(tmp2, tmp1, 8); update_byte_crc32(crc, tmp2, table0); srli(tmp2, tmp1, 8); @@ -2134,8 +2122,8 @@ void MacroAssembler::kernel_crc32(Register crc, Register buf, Register len, align(CodeEntryAlignment); // Entry for L_unroll_loop - add(loop_buf_end, buf, len); // loop_buf_end will be used as endpoint for loop below - andi(len, len, unroll_words-1); // len = (len % unroll_words) + add(loop_buf_end, buf, len); // loop_buf_end will be used as endpoint for loop below + andi(len, len, unroll_words - 1); // len = (len % unroll_words) sub(loop_buf_end, loop_buf_end, len); bind(L_unroll_loop); for (int i = 0; i < unroll; i++) { @@ -2162,17 +2150,17 @@ void MacroAssembler::kernel_crc32(Register crc, Register buf, Register len, bind(L_by1_loop); beqz(len, L_exit); - subw(len, len, 1); + subiw(len, len, 1); lbu(tmp1, Address(buf)); update_byte_crc32(crc, tmp1, table0); beqz(len, L_exit); - subw(len, len, 1); + subiw(len, len, 1); lbu(tmp1, Address(buf, 1)); update_byte_crc32(crc, tmp1, table0); beqz(len, L_exit); - subw(len, len, 1); + subiw(len, len, 1); lbu(tmp1, Address(buf, 2)); update_byte_crc32(crc, tmp1, table0); @@ -2238,7 +2226,7 @@ void MacroAssembler::push_call_clobbered_registers_except(RegSet exclude) { push_reg(RegSet::of(x7) + RegSet::range(x10, x17) + RegSet::range(x28, x31) - exclude, sp); // Push float registers f0-f7, f10-f17, f28-f31. - addi(sp, sp, - wordSize * 20); + subi(sp, sp, wordSize * 20); int offset = 0; for (int i = 0; i < 32; i++) { if (i <= f7->encoding() || i >= f28->encoding() || (i >= f10->encoding() && i <= f17->encoding())) { @@ -2264,7 +2252,7 @@ void MacroAssembler::push_CPU_state(bool save_vectors, int vector_size_in_bytes) push_reg(RegSet::range(x5, x31), sp); // float registers - addi(sp, sp, - 32 * wordSize); + subi(sp, sp, 32 * wordSize); for (int i = 0; i < 32; i++) { fsd(as_FloatRegister(i), Address(sp, i * wordSize)); } @@ -2605,32 +2593,32 @@ void MacroAssembler::movptr2(Register Rd, uint64_t addr, int32_t &offset, Regist offset = lower12; } -void MacroAssembler::add(Register Rd, Register Rn, int64_t increment, Register temp) { +void MacroAssembler::add(Register Rd, Register Rn, int64_t increment, Register tmp) { if (is_simm12(increment)) { addi(Rd, Rn, increment); } else { - assert_different_registers(Rn, temp); - li(temp, increment); - add(Rd, Rn, temp); + assert_different_registers(Rn, tmp); + mv(tmp, increment); + add(Rd, Rn, tmp); } } -void MacroAssembler::addw(Register Rd, Register Rn, int32_t increment, Register temp) { +void MacroAssembler::sub(Register Rd, Register Rn, int64_t decrement, Register tmp) { + add(Rd, Rn, -decrement, tmp); +} + +void MacroAssembler::addw(Register Rd, Register Rn, int64_t increment, Register tmp) { if (is_simm12(increment)) { addiw(Rd, Rn, increment); } else { - assert_different_registers(Rn, temp); - li(temp, increment); - addw(Rd, Rn, temp); + assert_different_registers(Rn, tmp); + mv(tmp, increment); + addw(Rd, Rn, tmp); } } -void MacroAssembler::sub(Register Rd, Register Rn, int64_t decrement, Register temp) { - add(Rd, Rn, -decrement, temp); -} - -void MacroAssembler::subw(Register Rd, Register Rn, int32_t decrement, Register temp) { - addw(Rd, Rn, -decrement, temp); +void MacroAssembler::subw(Register Rd, Register Rn, int64_t decrement, Register tmp) { + addw(Rd, Rn, -decrement, tmp); } void MacroAssembler::andrw(Register Rd, Register Rs1, Register Rs2) { @@ -2870,7 +2858,25 @@ void MacroAssembler::revb(Register Rd, Register Rs, Register tmp1, Register tmp2 } // rotate right with shift bits -void MacroAssembler::ror_imm(Register dst, Register src, uint32_t shift, Register tmp) +void MacroAssembler::ror(Register dst, Register src, Register shift, Register tmp) +{ + if (UseZbb) { + rorr(dst, src, shift); + return; + } + + assert_different_registers(dst, tmp); + assert_different_registers(src, tmp); + + mv(tmp, 64); + sub(tmp, tmp, shift); + sll(tmp, src, tmp); + srl(dst, src, shift); + orr(dst, dst, tmp); +} + +// rotate right with shift bits +void MacroAssembler::ror(Register dst, Register src, uint32_t shift, Register tmp) { if (UseZbb) { rori(dst, src, shift); @@ -2886,7 +2892,7 @@ void MacroAssembler::ror_imm(Register dst, Register src, uint32_t shift, Registe } // rotate left with shift bits, 32-bit version -void MacroAssembler::rolw_imm(Register dst, Register src, uint32_t shift, Register tmp) { +void MacroAssembler::rolw(Register dst, Register src, uint32_t shift, Register tmp) { if (UseZbb) { // no roliw available roriw(dst, src, 32 - shift); @@ -2901,16 +2907,6 @@ void MacroAssembler::rolw_imm(Register dst, Register src, uint32_t shift, Regist orr(dst, dst, tmp); } -void MacroAssembler::andi(Register Rd, Register Rn, int64_t imm, Register tmp) { - if (is_simm12(imm)) { - and_imm12(Rd, Rn, imm); - } else { - assert_different_registers(Rn, tmp); - mv(tmp, imm); - andr(Rd, Rn, tmp); - } -} - void MacroAssembler::orptr(Address adr, RegisterOrConstant src, Register tmp1, Register tmp2) { ld(tmp1, adr); if (src.is_register()) { @@ -4077,12 +4073,10 @@ void MacroAssembler::check_klass_subtype_fast_path(Register sub_klass, Label* L_failure, Label* L_slow_path, Register super_check_offset) { - assert_different_registers(sub_klass, super_klass, tmp_reg); - bool must_load_sco = (super_check_offset == noreg); + assert_different_registers(sub_klass, super_klass, tmp_reg, super_check_offset); + bool must_load_sco = !super_check_offset->is_valid(); if (must_load_sco) { assert(tmp_reg != noreg, "supply either a temp or a register offset"); - } else { - assert_different_registers(sub_klass, super_klass, super_check_offset); } Label L_fallthrough; @@ -4118,6 +4112,7 @@ void MacroAssembler::check_klass_subtype_fast_path(Register sub_klass, add(t0, sub_klass, super_check_offset); Address super_check_addr(t0); ld(t0, super_check_addr); // load displayed supertype + beq(super_klass, t0, *L_success); // This check has worked decisively for primary supers. // Secondary supers are sought in the super_cache ('super_cache_addr'). @@ -4130,7 +4125,6 @@ void MacroAssembler::check_klass_subtype_fast_path(Register sub_klass, // So if it was a primary super, we can just fail immediately. // Otherwise, it's the slow path for us (no success at this point). - beq(super_klass, t0, *L_success); mv(t1, sc_offset); if (L_failure == &L_fallthrough) { beq(super_check_offset, t1, *L_slow_path); @@ -4153,18 +4147,19 @@ void MacroAssembler::repne_scan(Register addr, Register value, Register count, bind(Lloop); ld(tmp, addr); beq(value, tmp, Lexit); - add(addr, addr, wordSize); - sub(count, count, 1); + addi(addr, addr, wordSize); + subi(count, count, 1); bnez(count, Lloop); bind(Lexit); } -void MacroAssembler::check_klass_subtype_slow_path(Register sub_klass, - Register super_klass, - Register tmp1_reg, - Register tmp2_reg, - Label* L_success, - Label* L_failure) { +void MacroAssembler::check_klass_subtype_slow_path_linear(Register sub_klass, + Register super_klass, + Register tmp1_reg, + Register tmp2_reg, + Label* L_success, + Label* L_failure, + bool set_cond_codes) { assert_different_registers(sub_klass, super_klass, tmp1_reg); if (tmp2_reg != noreg) { assert_different_registers(sub_klass, super_klass, tmp1_reg, tmp2_reg, t0); @@ -4222,7 +4217,7 @@ void MacroAssembler::check_klass_subtype_slow_path(Register sub_klass, // Load the array length. lwu(x12, Address(x15, Array::length_offset_in_bytes())); // Skip to start of data. - add(x15, x15, Array::base_offset_in_bytes()); + addi(x15, x15, Array::base_offset_in_bytes()); // Set t0 to an obvious invalid value, falling through by default mv(t0, -1); @@ -4238,7 +4233,9 @@ void MacroAssembler::check_klass_subtype_slow_path(Register sub_klass, bne(t1, t0, *L_failure); // Success. Cache the super we found an proceed in triumph. - sd(super_klass, super_cache_addr); + if (UseSecondarySupersCache) { + sd(super_klass, super_cache_addr); + } if (L_success != &L_fallthrough) { j(*L_success); @@ -4279,6 +4276,103 @@ void MacroAssembler::population_count(Register dst, Register src, } } +// If Register r is invalid, remove a new register from +// available_regs, and add new register to regs_to_push. +Register MacroAssembler::allocate_if_noreg(Register r, + RegSetIterator &available_regs, + RegSet ®s_to_push) { + if (!r->is_valid()) { + r = *available_regs++; + regs_to_push += r; + } + return r; +} + +// check_klass_subtype_slow_path_table() looks for super_klass in the +// hash table belonging to super_klass, branching to L_success or +// L_failure as appropriate. This is essentially a shim which +// allocates registers as necessary then calls +// lookup_secondary_supers_table() to do the work. Any of the tmp +// regs may be noreg, in which case this logic will chooses some +// registers push and pop them from the stack. +void MacroAssembler::check_klass_subtype_slow_path_table(Register sub_klass, + Register super_klass, + Register tmp1_reg, + Register tmp2_reg, + Label* L_success, + Label* L_failure, + bool set_cond_codes) { + RegSet tmps = RegSet::of(tmp1_reg, tmp2_reg); + + assert_different_registers(sub_klass, super_klass, tmp1_reg, tmp2_reg); + + Label L_fallthrough; + int label_nulls = 0; + if (L_success == nullptr) { L_success = &L_fallthrough; label_nulls++; } + if (L_failure == nullptr) { L_failure = &L_fallthrough; label_nulls++; } + assert(label_nulls <= 1, "at most one null in the batch"); + + BLOCK_COMMENT("check_klass_subtype_slow_path"); + + RegSet caller_save_regs = RegSet::of(x7) + RegSet::range(x10, x17) + RegSet::range(x28, x31); + RegSetIterator available_regs = (caller_save_regs - tmps - sub_klass - super_klass).begin(); + + RegSet pushed_regs; + + tmp1_reg = allocate_if_noreg(tmp1_reg, available_regs, pushed_regs); + tmp2_reg = allocate_if_noreg(tmp2_reg, available_regs, pushed_regs); + + Register tmp3_reg = noreg, tmp4_reg = noreg, result_reg = noreg; + + tmp3_reg = allocate_if_noreg(tmp3_reg, available_regs, pushed_regs); + tmp4_reg = allocate_if_noreg(tmp4_reg, available_regs, pushed_regs); + result_reg = allocate_if_noreg(result_reg, available_regs, pushed_regs); + + push_reg(pushed_regs, sp); + + lookup_secondary_supers_table_var(sub_klass, + super_klass, + result_reg, + tmp1_reg, tmp2_reg, tmp3_reg, + tmp4_reg, nullptr); + + // Move the result to t1 as we are about to unspill the tmp registers. + mv(t1, result_reg); + + // Unspill the tmp. registers: + pop_reg(pushed_regs, sp); + + // NB! Callers may assume that, when set_cond_codes is true, this + // code sets tmp2_reg to a nonzero value. + if (set_cond_codes) { + mv(tmp2_reg, 1); + } + + bnez(t1, *L_failure); + + if (L_success != &L_fallthrough) { + j(*L_success); + } + + bind(L_fallthrough); +} + +void MacroAssembler::check_klass_subtype_slow_path(Register sub_klass, + Register super_klass, + Register tmp1_reg, + Register tmp2_reg, + Label* L_success, + Label* L_failure, + bool set_cond_codes) { + if (UseSecondarySupersTable) { + check_klass_subtype_slow_path_table + (sub_klass, super_klass, tmp1_reg, tmp2_reg, L_success, L_failure, set_cond_codes); + } else { + check_klass_subtype_slow_path_linear + (sub_klass, super_klass, tmp1_reg, tmp2_reg, L_success, L_failure, set_cond_codes); + } +} + // Ensure that the inline code and the stub are using the same registers // as we need to call the stub from inline code when there is a collision // in the hashed lookup in the secondary supers array. @@ -4294,17 +4388,16 @@ do { (r_bitmap == x16 || r_bitmap == noreg), "registers must match riscv.ad"); \ } while(0) -// Return true: we succeeded in generating this code -bool MacroAssembler::lookup_secondary_supers_table(Register r_sub_klass, - Register r_super_klass, - Register result, - Register tmp1, - Register tmp2, - Register tmp3, - Register tmp4, - u1 super_klass_slot, - bool stub_is_near) { - assert_different_registers(r_sub_klass, r_super_klass, result, tmp1, tmp2, tmp3, tmp4, t0); +bool MacroAssembler::lookup_secondary_supers_table_const(Register r_sub_klass, + Register r_super_klass, + Register result, + Register tmp1, + Register tmp2, + Register tmp3, + Register tmp4, + u1 super_klass_slot, + bool stub_is_near) { + assert_different_registers(r_sub_klass, r_super_klass, result, tmp1, tmp2, tmp3, tmp4, t0, t1); Label L_fallthrough; @@ -4359,7 +4452,7 @@ bool MacroAssembler::lookup_secondary_supers_table(Register r_sub_klass, // Linear probe. if (bit != 0) { - ror_imm(r_bitmap, r_bitmap, bit); + ror(r_bitmap, r_bitmap, bit); } // The slot we just inspected is at secondary_supers[r_array_index - 1]. @@ -4379,6 +4472,98 @@ bool MacroAssembler::lookup_secondary_supers_table(Register r_sub_klass, return true; } +// At runtime, return 0 in result if r_super_klass is a superclass of +// r_sub_klass, otherwise return nonzero. Use this version of +// lookup_secondary_supers_table() if you don't know ahead of time +// which superclass will be searched for. Used by interpreter and +// runtime stubs. It is larger and has somewhat greater latency than +// the version above, which takes a constant super_klass_slot. +void MacroAssembler::lookup_secondary_supers_table_var(Register r_sub_klass, + Register r_super_klass, + Register result, + Register tmp1, + Register tmp2, + Register tmp3, + Register tmp4, + Label *L_success) { + assert_different_registers(r_sub_klass, r_super_klass, result, tmp1, tmp2, tmp3, tmp4, t0, t1); + + Label L_fallthrough; + + BLOCK_COMMENT("lookup_secondary_supers_table {"); + + const Register + r_array_index = tmp3, + r_bitmap = tmp4, + slot = t1; + + lbu(slot, Address(r_super_klass, Klass::hash_slot_offset())); + + // Make sure that result is nonzero if the test below misses. + mv(result, 1); + + ld(r_bitmap, Address(r_sub_klass, Klass::secondary_supers_bitmap_offset())); + + // First check the bitmap to see if super_klass might be present. If + // the bit is zero, we are certain that super_klass is not one of + // the secondary supers. + + // This next instruction is equivalent to: + // mv(tmp_reg, (u1)(Klass::SECONDARY_SUPERS_TABLE_SIZE - 1)); + // sub(r_array_index, slot, tmp_reg); + xori(r_array_index, slot, (u1)(Klass::SECONDARY_SUPERS_TABLE_SIZE - 1)); + sll(r_array_index, r_bitmap, r_array_index); + test_bit(t0, r_array_index, Klass::SECONDARY_SUPERS_TABLE_SIZE - 1); + beqz(t0, L_fallthrough); + + // Get the first array index that can contain super_klass into r_array_index. + population_count(r_array_index, r_array_index, tmp1, tmp2); + + // NB! r_array_index is off by 1. It is compensated by keeping r_array_base off by 1 word. + + const Register + r_array_base = tmp1, + r_array_length = tmp2; + + // The value i in r_array_index is >= 1, so even though r_array_base + // points to the length, we don't need to adjust it to point to the data. + assert(Array::base_offset_in_bytes() == wordSize, "Adjust this code"); + assert(Array::length_offset_in_bytes() == 0, "Adjust this code"); + + // We will consult the secondary-super array. + ld(r_array_base, Address(r_sub_klass, in_bytes(Klass::secondary_supers_offset()))); + + shadd(result, r_array_index, r_array_base, result, LogBytesPerWord); + ld(result, Address(result)); + xorr(result, result, r_super_klass); + beqz(result, L_success ? *L_success : L_fallthrough); // Found a match + + // Is there another entry to check? Consult the bitmap. + ror(r_bitmap, r_bitmap, slot); + test_bit(t0, r_bitmap, 1); + beqz(t0, L_fallthrough); + + // The slot we just inspected is at secondary_supers[r_array_index - 1]. + // The next slot to be inspected, by the logic we're about to call, + // is secondary_supers[r_array_index]. Bits 0 and 1 in the bitmap + // have been checked. + lookup_secondary_supers_table_slow_path(r_super_klass, r_array_base, r_array_index, + r_bitmap, result, r_array_length, false /*is_stub*/); + + BLOCK_COMMENT("} lookup_secondary_supers_table"); + + bind(L_fallthrough); + + if (VerifySecondarySupers) { + verify_secondary_supers_table(r_sub_klass, r_super_klass, + result, tmp1, tmp2, tmp3); + } + + if (L_success) { + beqz(result, *L_success); + } +} + // Called by code generated by check_klass_subtype_slow_path // above. This is called when there is a collision in the hashed // lookup in the secondary supers array. @@ -4387,15 +4572,18 @@ void MacroAssembler::lookup_secondary_supers_table_slow_path(Register r_super_kl Register r_array_index, Register r_bitmap, Register result, - Register tmp1) { - assert_different_registers(r_super_klass, r_array_base, r_array_index, r_bitmap, tmp1, result, t0); + Register tmp, + bool is_stub) { + assert_different_registers(r_super_klass, r_array_base, r_array_index, r_bitmap, tmp, result, t0); const Register - r_array_length = tmp1, + r_array_length = tmp, r_sub_klass = noreg; // unused - LOOKUP_SECONDARY_SUPERS_TABLE_REGISTERS(r_super_klass, r_array_base, r_array_length, - r_array_index, r_sub_klass, result, r_bitmap); + if (is_stub) { + LOOKUP_SECONDARY_SUPERS_TABLE_REGISTERS(r_super_klass, r_array_base, r_array_length, + r_array_index, r_sub_klass, result, r_bitmap); + } Label L_matched, L_fallthrough, L_bitmap_full; @@ -4422,8 +4610,10 @@ void MacroAssembler::lookup_secondary_supers_table_slow_path(Register r_super_kl { // This is conventional linear probing, but instead of terminating // when a null entry is found in the table, we maintain a bitmap // in which a 0 indicates missing entries. - // The check above guarantees there are 0s in the bitmap, so the loop - // eventually terminates. + // As long as the bitmap is not completely full, + // array_length == popcount(bitmap). The array_length check above + // guarantees there are 0s in the bitmap, so the loop eventually + // terminates. Label L_loop; bind(L_loop); @@ -4440,7 +4630,7 @@ void MacroAssembler::lookup_secondary_supers_table_slow_path(Register r_super_kl test_bit(t0, r_bitmap, 2); // look-ahead check (Bit 2); result is non-zero beqz(t0, L_fallthrough); - ror_imm(r_bitmap, r_bitmap, 1); + ror(r_bitmap, r_bitmap, 1); addi(r_array_index, r_array_index, 1); j(L_loop); } @@ -4475,9 +4665,6 @@ void MacroAssembler::verify_secondary_supers_table(Register r_sub_klass, r_array_index = noreg, // unused r_bitmap = noreg; // unused - LOOKUP_SECONDARY_SUPERS_TABLE_REGISTERS(r_super_klass, r_array_base, r_array_length, - r_array_index, r_sub_klass, result, r_bitmap); - BLOCK_COMMENT("verify_secondary_supers_table {"); // We will consult the secondary-super array. @@ -4914,11 +5101,11 @@ void MacroAssembler::mul_add(Register out, Register in, Register offset, blt(len, tmp, L_tail_loop); bind(L_unroll); for (int i = 0; i < unroll; i++) { - sub(in, in, BytesPerInt); + subi(in, in, BytesPerInt); lwu(t0, Address(in, 0)); mul(t1, t0, k); add(t0, t1, out); - sub(offset, offset, BytesPerInt); + subi(offset, offset, BytesPerInt); lwu(t1, Address(offset, 0)); add(t0, t0, t1); sw(t0, Address(offset, 0)); @@ -4929,16 +5116,16 @@ void MacroAssembler::mul_add(Register out, Register in, Register offset, bind(L_tail_loop); blez(len, L_end); - sub(in, in, BytesPerInt); + subi(in, in, BytesPerInt); lwu(t0, Address(in, 0)); mul(t1, t0, k); add(t0, t1, out); - sub(offset, offset, BytesPerInt); + subi(offset, offset, BytesPerInt); lwu(t1, Address(offset, 0)); add(t0, t0, t1); sw(t0, Address(offset, 0)); srli(out, t0, 32); - subw(len, len, 1); + subiw(len, len, 1); j(L_tail_loop); bind(L_end); @@ -5015,13 +5202,13 @@ void MacroAssembler::multiply_32_x_32_loop(Register x, Register xstart, Register lwu(x_xstart, Address(t0, 0)); bind(L_first_loop); - subw(idx, idx, 1); + subiw(idx, idx, 1); shadd(t0, idx, y, t0, LogBytesPerInt); lwu(y_idx, Address(t0, 0)); mul(product, x_xstart, y_idx); add(product, product, carry); srli(carry, product, 32); - subw(kdx, kdx, 1); + subiw(kdx, kdx, 1); shadd(t0, kdx, z, t0, LogBytesPerInt); sw(product, Address(t0, 0)); bgtz(idx, L_first_loop); @@ -5049,22 +5236,22 @@ void MacroAssembler::multiply_64_x_64_loop(Register x, Register xstart, Register Label L_first_loop, L_first_loop_exit; Label L_one_x, L_one_y, L_multiply; - subw(xstart, xstart, 1); + subiw(xstart, xstart, 1); bltz(xstart, L_one_x); shadd(t0, xstart, x, t0, LogBytesPerInt); ld(x_xstart, Address(t0, 0)); - ror_imm(x_xstart, x_xstart, 32); // convert big-endian to little-endian + ror(x_xstart, x_xstart, 32); // convert big-endian to little-endian bind(L_first_loop); - subw(idx, idx, 1); + subiw(idx, idx, 1); bltz(idx, L_first_loop_exit); - subw(idx, idx, 1); + subiw(idx, idx, 1); bltz(idx, L_one_y); shadd(t0, idx, y, t0, LogBytesPerInt); ld(y_idx, Address(t0, 0)); - ror_imm(y_idx, y_idx, 32); // convert big-endian to little-endian + ror(y_idx, y_idx, 32); // convert big-endian to little-endian bind(L_multiply); mulhu(t0, x_xstart, y_idx); @@ -5072,8 +5259,8 @@ void MacroAssembler::multiply_64_x_64_loop(Register x, Register xstart, Register cad(product, product, carry, t1); adc(carry, t0, zr, t1); - subw(kdx, kdx, 2); - ror_imm(product, product, 32); // back to big-endian + subiw(kdx, kdx, 2); + ror(product, product, 32); // back to big-endian shadd(t0, kdx, z, t0, LogBytesPerInt); sd(product, Address(t0, 0)); @@ -5134,8 +5321,8 @@ void MacroAssembler::multiply_128_x_128_loop(Register y, Register z, shadd(tmp6, idx, z, t0, LogBytesPerInt); - ror_imm(yz_idx1, yz_idx1, 32); // convert big-endian to little-endian - ror_imm(yz_idx2, yz_idx2, 32); + ror(yz_idx1, yz_idx1, 32); // convert big-endian to little-endian + ror(yz_idx2, yz_idx2, 32); ld(t1, Address(tmp6, 0)); ld(t0, Address(tmp6, wordSize)); @@ -5143,8 +5330,8 @@ void MacroAssembler::multiply_128_x_128_loop(Register y, Register z, mul(tmp3, product_hi, yz_idx1); // yz_idx1 * product_hi -> tmp4:tmp3 mulhu(tmp4, product_hi, yz_idx1); - ror_imm(t0, t0, 32, tmp); // convert big-endian to little-endian - ror_imm(t1, t1, 32, tmp); + ror(t0, t0, 32, tmp); // convert big-endian to little-endian + ror(t1, t1, 32, tmp); mul(tmp, product_hi, yz_idx2); // yz_idx2 * product_hi -> carry2:tmp mulhu(carry2, product_hi, yz_idx2); @@ -5157,8 +5344,8 @@ void MacroAssembler::multiply_128_x_128_loop(Register y, Register z, cad(tmp4, tmp4, t1, carry2); adc(carry, carry, zr, carry2); - ror_imm(tmp3, tmp3, 32); // convert little-endian to big-endian - ror_imm(tmp4, tmp4, 32); + ror(tmp3, tmp3, 32); // convert little-endian to big-endian + ror(tmp4, tmp4, 32); sd(tmp4, Address(tmp6, 0)); sd(tmp3, Address(tmp6, wordSize)); @@ -5170,29 +5357,29 @@ void MacroAssembler::multiply_128_x_128_loop(Register y, Register z, beqz(idx, L_post_third_loop_done); Label L_check_1; - subw(idx, idx, 2); + subiw(idx, idx, 2); bltz(idx, L_check_1); shadd(t0, idx, y, t0, LogBytesPerInt); ld(yz_idx1, Address(t0, 0)); - ror_imm(yz_idx1, yz_idx1, 32); + ror(yz_idx1, yz_idx1, 32); mul(tmp3, product_hi, yz_idx1); // yz_idx1 * product_hi -> tmp4:tmp3 mulhu(tmp4, product_hi, yz_idx1); shadd(t0, idx, z, t0, LogBytesPerInt); ld(yz_idx2, Address(t0, 0)); - ror_imm(yz_idx2, yz_idx2, 32, tmp); + ror(yz_idx2, yz_idx2, 32, tmp); add2_with_carry(carry, tmp4, tmp3, carry, yz_idx2, tmp); - ror_imm(tmp3, tmp3, 32, tmp); + ror(tmp3, tmp3, 32, tmp); sd(tmp3, Address(t0, 0)); bind(L_check_1); andi(idx, idx, 0x1); - subw(idx, idx, 1); + subiw(idx, idx, 1); bltz(idx, L_post_third_loop_done); shadd(t0, idx, y, t0, LogBytesPerInt); lwu(tmp4, Address(t0, 0)); @@ -5252,7 +5439,7 @@ void MacroAssembler::multiply_to_len(Register x, Register xlen, Register y, Regi Label L_multiply_64_x_64_loop, L_done; - subw(xstart, xlen, 1); + subiw(xstart, xlen, 1); bltz(xstart, L_done); const Register jdx = tmp1; @@ -5271,9 +5458,9 @@ void MacroAssembler::multiply_to_len(Register x, Register xlen, Register y, Regi bind(L_second_loop_unaligned); mv(carry, zr); mv(jdx, ylen); - subw(xstart, xstart, 1); + subiw(xstart, xstart, 1); bltz(xstart, L_done); - sub(sp, sp, 2 * wordSize); + subi(sp, sp, 2 * wordSize); sd(z, Address(sp, 0)); sd(zr, Address(sp, wordSize)); shadd(t0, xstart, z, t0, LogBytesPerInt); @@ -5285,7 +5472,7 @@ void MacroAssembler::multiply_to_len(Register x, Register xlen, Register y, Regi blez(jdx, L_third_loop_exit); bind(L_third_loop); - subw(jdx, jdx, 1); + subiw(jdx, jdx, 1); shadd(t0, jdx, y, t0, LogBytesPerInt); lwu(t0, Address(t0, 0)); mul(t1, t0, product); @@ -5313,13 +5500,13 @@ void MacroAssembler::multiply_to_len(Register x, Register xlen, Register y, Regi beqz(kdx, L_second_loop_aligned); Label L_carry; - subw(kdx, kdx, 1); + subiw(kdx, kdx, 1); beqz(kdx, L_carry); shadd(t0, kdx, z, t0, LogBytesPerInt); sw(carry, Address(t0, 0)); srli(carry, carry, 32); - subw(kdx, kdx, 1); + subiw(kdx, kdx, 1); bind(L_carry); shadd(t0, kdx, z, t0, LogBytesPerInt); @@ -5344,21 +5531,21 @@ void MacroAssembler::multiply_to_len(Register x, Register xlen, Register y, Regi mv(carry, zr); // carry = 0; mv(jdx, ylen); // j = ystart+1 - subw(xstart, xstart, 1); // i = xstart-1; + subiw(xstart, xstart, 1); // i = xstart-1; bltz(xstart, L_done); - sub(sp, sp, 4 * wordSize); + subi(sp, sp, 4 * wordSize); sd(z, Address(sp, 0)); Label L_last_x; shadd(t0, xstart, z, t0, LogBytesPerInt); addi(z, t0, 4); - subw(xstart, xstart, 1); // i = xstart-1; + subiw(xstart, xstart, 1); // i = xstart-1; bltz(xstart, L_last_x); shadd(t0, xstart, x, t0, LogBytesPerInt); ld(product_hi, Address(t0, 0)); - ror_imm(product_hi, product_hi, 32); // convert big-endian to little-endian + ror(product_hi, product_hi, 32); // convert big-endian to little-endian Label L_third_loop_prologue; bind(L_third_loop_prologue); @@ -5378,7 +5565,7 @@ void MacroAssembler::multiply_to_len(Register x, Register xlen, Register y, Regi shadd(t0, tmp3, z, t0, LogBytesPerInt); sw(carry, Address(t0, 0)); - subw(tmp3, tmp3, 1); + subiw(tmp3, tmp3, 1); bltz(tmp3, L_done); srli(carry, carry, 32); @@ -5536,13 +5723,13 @@ void MacroAssembler::zero_words(Register base, uint64_t cnt) { Register loop_base = t1; cnt = cnt - remainder; mv(cnt_reg, cnt); - add(loop_base, base, remainder * wordSize); + addi(loop_base, base, remainder * wordSize); bind(loop); sub(cnt_reg, cnt_reg, unroll); for (int i = 0; i < unroll; i++) { sd(zr, Address(loop_base, i * wordSize)); } - add(loop_base, loop_base, unroll * wordSize); + addi(loop_base, loop_base, unroll * wordSize); bnez(cnt_reg, loop); } @@ -5593,12 +5780,12 @@ void MacroAssembler::fill_words(Register base, Register cnt, Register value) { jr(t1); bind(loop); - add(base, base, unroll * 8); + addi(base, base, unroll * wordSize); for (int i = -unroll; i < 0; i++) { sd(value, Address(base, i * 8)); } bind(entry); - sub(cnt, cnt, unroll); + subi(cnt, cnt, unroll); bgez(cnt, loop); bind(fini); @@ -5637,7 +5824,7 @@ void MacroAssembler::zero_dcache_blocks(Register base, Register cnt, Register tm bind(loop); cbo_zero(base); sub(cnt, cnt, tmp1); - add(base, base, CacheLineSize); + addi(base, base, CacheLineSize); bge(cnt, tmp1, loop); } @@ -5699,7 +5886,7 @@ void MacroAssembler::FLOATCVT##_safe(Register dst, FloatRegister src, Register t fclass_##FLOATSIG(tmp, src); \ mv(dst, zr); \ /* check if src is NaN */ \ - andi(tmp, tmp, fclass_mask::nan); \ + andi(tmp, tmp, FClassBits::nan); \ bnez(tmp, done); \ FLOATCVT(dst, src); \ bind(done); \ @@ -5723,7 +5910,7 @@ void MacroAssembler::FLOATTYPE##_compare(Register result, FloatRegister Rs1, /* Rs1 > Rs2, install 1 */ \ bgtz(result, Ldone); \ feq_##FLOATSIG(result, Rs1, Rs2); \ - addi(result, result, -1); \ + subi(result, result, 1); \ /* Rs1 = Rs2, install 0 */ \ /* NaN or Rs1 < Rs2, install -1 */ \ bind(Ldone); \ @@ -5734,7 +5921,7 @@ void MacroAssembler::FLOATTYPE##_compare(Register result, FloatRegister Rs1, /* Rs1 < Rs2, install -1 */ \ bgtz(result, Ldone); \ feq_##FLOATSIG(result, Rs1, Rs2); \ - addi(result, result, -1); \ + subi(result, result, 1); \ /* Rs1 = Rs2, install 0 */ \ /* NaN or Rs1 > Rs2, install 1 */ \ bind(Ldone); \ @@ -6142,10 +6329,10 @@ void MacroAssembler::test_bit(Register Rd, Register Rs, uint32_t bit_pos) { } int64_t imm = (int64_t)(1UL << bit_pos); if (is_simm12(imm)) { - and_imm12(Rd, Rs, imm); + andi(Rd, Rs, imm); } else { srli(Rd, Rs, bit_pos); - and_imm12(Rd, Rd, 1); + andi(Rd, Rd, 1); } } @@ -6198,7 +6385,7 @@ void MacroAssembler::lightweight_lock(Register basic_lock, Register obj, Registe // After successful lock, push object on lock-stack. add(t, xthread, top); sd(obj, Address(t)); - addw(top, top, oopSize); + addiw(top, top, oopSize); sw(top, Address(xthread, JavaThread::lock_stack_top_offset())); } @@ -6230,7 +6417,7 @@ void MacroAssembler::lightweight_unlock(Register obj, Register tmp1, Register tm // Check if obj is top of lock-stack. lwu(top, Address(xthread, JavaThread::lock_stack_top_offset())); - subw(top, top, oopSize); + subiw(top, top, oopSize); add(t, xthread, top); ld(t, Address(t)); bne(obj, t, slow, /* is_far */ true); @@ -6270,7 +6457,7 @@ void MacroAssembler::lightweight_unlock(Register obj, Register tmp1, Register tm // Restore lock-stack and handle the unlock in runtime. DEBUG_ONLY(add(t, xthread, top);) DEBUG_ONLY(sd(obj, Address(t));) - addw(top, top, oopSize); + addiw(top, top, oopSize); sw(top, Address(xthread, JavaThread::lock_stack_top_offset())); j(slow); diff --git a/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp b/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp index 4cfc1c5525480..014297bcb3227 100644 --- a/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp +++ b/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp @@ -60,14 +60,14 @@ class MacroAssembler: public Assembler { // Note that SP must be updated to the right place before saving/restoring RA and FP // because signal based thread suspend/resume could happen asynchronously. void enter() { - addi(sp, sp, - 2 * wordSize); + subi(sp, sp, 2 * wordSize); sd(ra, Address(sp, wordSize)); sd(fp, Address(sp)); addi(fp, sp, 2 * wordSize); } void leave() { - addi(sp, fp, - 2 * wordSize); + subi(sp, fp, 2 * wordSize); ld(fp, Address(sp)); ld(ra, Address(sp, wordSize)); addi(sp, sp, 2 * wordSize); @@ -323,21 +323,55 @@ class MacroAssembler: public Assembler { Register tmp1_reg, Register tmp2_reg, Label* L_success, - Label* L_failure); + Label* L_failure, + bool set_cond_codes = false); + + void check_klass_subtype_slow_path_linear(Register sub_klass, + Register super_klass, + Register tmp1_reg, + Register tmp2_reg, + Label* L_success, + Label* L_failure, + bool set_cond_codes = false); + + void check_klass_subtype_slow_path_table(Register sub_klass, + Register super_klass, + Register tmp1_reg, + Register tmp2_reg, + Label* L_success, + Label* L_failure, + bool set_cond_codes = false); + + // If r is valid, return r. + // If r is invalid, remove a register r2 from available_regs, add r2 + // to regs_to_push, then return r2. + Register allocate_if_noreg(const Register r, + RegSetIterator &available_regs, + RegSet ®s_to_push); + + // Secondary subtype checking + void lookup_secondary_supers_table_var(Register sub_klass, + Register r_super_klass, + Register result, + Register tmp1, + Register tmp2, + Register tmp3, + Register tmp4, + Label *L_success); void population_count(Register dst, Register src, Register tmp1, Register tmp2); // As above, but with a constant super_klass. // The result is in Register result, not the condition codes. - bool lookup_secondary_supers_table(Register r_sub_klass, - Register r_super_klass, - Register result, - Register tmp1, - Register tmp2, - Register tmp3, - Register tmp4, - u1 super_klass_slot, - bool stub_is_near = false); + bool lookup_secondary_supers_table_const(Register r_sub_klass, + Register r_super_klass, + Register result, + Register tmp1, + Register tmp2, + Register tmp3, + Register tmp4, + u1 super_klass_slot, + bool stub_is_near = false); void verify_secondary_supers_table(Register r_sub_klass, Register r_super_klass, @@ -351,7 +385,8 @@ class MacroAssembler: public Assembler { Register r_array_index, Register r_bitmap, Register result, - Register tmp1); + Register tmp, + bool is_stub = true); void check_klass_subtype(Register sub_klass, Register super_klass, @@ -591,9 +626,6 @@ class MacroAssembler: public Assembler { } // Control and status pseudo instructions - void rdinstret(Register Rd); // read instruction-retired counter - void rdcycle(Register Rd); // read cycle counter - void rdtime(Register Rd); // read time void csrr(Register Rd, unsigned csr); // read csr void csrw(unsigned csr, Register Rs); // write csr void csrs(unsigned csr, Register Rs); // set bits in csr @@ -601,19 +633,23 @@ class MacroAssembler: public Assembler { void csrwi(unsigned csr, unsigned imm); void csrsi(unsigned csr, unsigned imm); void csrci(unsigned csr, unsigned imm); - void frcsr(Register Rd); // read float-point csr - void fscsr(Register Rd, Register Rs); // swap float-point csr - void fscsr(Register Rs); // write float-point csr - void frrm(Register Rd); // read float-point rounding mode - void fsrm(Register Rd, Register Rs); // swap float-point rounding mode - void fsrm(Register Rs); // write float-point rounding mode + void frcsr(Register Rd) { csrr(Rd, CSR_FCSR); }; // read float-point csr + void fscsr(Register Rd, Register Rs); // swap float-point csr + void fscsr(Register Rs); // write float-point csr + void frrm(Register Rd) { csrr(Rd, CSR_FRM); }; // read float-point rounding mode + void fsrm(Register Rd, Register Rs); // swap float-point rounding mode + void fsrm(Register Rs); // write float-point rounding mode void fsrmi(Register Rd, unsigned imm); void fsrmi(unsigned imm); - void frflags(Register Rd); // read float-point exception flags - void fsflags(Register Rd, Register Rs); // swap float-point exception flags - void fsflags(Register Rs); // write float-point exception flags + void frflags(Register Rd) { csrr(Rd, CSR_FFLAGS); }; // read float-point exception flags + void fsflags(Register Rd, Register Rs); // swap float-point exception flags + void fsflags(Register Rs); // write float-point exception flags void fsflagsi(Register Rd, unsigned imm); void fsflagsi(unsigned imm); + // Requires Zicntr + void rdinstret(Register Rd) { csrr(Rd, CSR_INSTRET); }; // read instruction-retired counter + void rdcycle(Register Rd) { csrr(Rd, CSR_CYCLE); }; // read cycle counter + void rdtime(Register Rd) { csrr(Rd, CSR_TIME); }; // read time // Restore cpu control state after JNI call void restore_cpu_control_state_after_jni(Register tmp); @@ -886,10 +922,20 @@ class MacroAssembler: public Assembler { public: // arith - void add (Register Rd, Register Rn, int64_t increment, Register temp = t0); - void addw(Register Rd, Register Rn, int32_t increment, Register temp = t0); - void sub (Register Rd, Register Rn, int64_t decrement, Register temp = t0); - void subw(Register Rd, Register Rn, int32_t decrement, Register temp = t0); + void add (Register Rd, Register Rn, int64_t increment, Register tmp = t0); + void sub (Register Rd, Register Rn, int64_t decrement, Register tmp = t0); + void addw(Register Rd, Register Rn, int64_t increment, Register tmp = t0); + void subw(Register Rd, Register Rn, int64_t decrement, Register tmp = t0); + + void subi(Register Rd, Register Rn, int64_t decrement) { + assert(is_simm12(-decrement), "Must be"); + addi(Rd, Rn, -decrement); + } + + void subiw(Register Rd, Register Rn, int64_t decrement) { + assert(is_simm12(-decrement), "Must be"); + addiw(Rd, Rn, -decrement); + } #define INSN(NAME) \ inline void NAME(Register Rd, Register Rs1, Register Rs2) { \ @@ -916,9 +962,10 @@ class MacroAssembler: public Assembler { void revbw(Register Rd, Register Rs, Register tmp1 = t0, Register tmp2= t1); // reverse bytes in lower word, sign-extend void revb(Register Rd, Register Rs, Register tmp1 = t0, Register tmp2 = t1); // reverse bytes in doubleword - void ror_imm(Register dst, Register src, uint32_t shift, Register tmp = t0); - void rolw_imm(Register dst, Register src, uint32_t, Register tmp = t0); - void andi(Register Rd, Register Rn, int64_t imm, Register tmp = t0); + void ror(Register dst, Register src, Register shift, Register tmp = t0); + void ror(Register dst, Register src, uint32_t shift, Register tmp = t0); + void rolw(Register dst, Register src, uint32_t shift, Register tmp = t0); + void orptr(Address adr, RegisterOrConstant src, Register tmp1 = t0, Register tmp2 = t1); // Load and Store Instructions diff --git a/src/hotspot/cpu/riscv/methodHandles_riscv.cpp b/src/hotspot/cpu/riscv/methodHandles_riscv.cpp index 8ed4b93ad4de9..39b6737631dc5 100644 --- a/src/hotspot/cpu/riscv/methodHandles_riscv.cpp +++ b/src/hotspot/cpu/riscv/methodHandles_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 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. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "classfile/javaClasses.inline.hpp" #include "classfile/vmClasses.hpp" diff --git a/src/hotspot/cpu/riscv/nativeInst_riscv.cpp b/src/hotspot/cpu/riscv/nativeInst_riscv.cpp index 48a9a84e481bf..6f20d54b222f2 100644 --- a/src/hotspot/cpu/riscv/nativeInst_riscv.cpp +++ b/src/hotspot/cpu/riscv/nativeInst_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, 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. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "code/compiledIC.hpp" #include "nativeInst_riscv.hpp" diff --git a/src/hotspot/cpu/riscv/registerMap_riscv.cpp b/src/hotspot/cpu/riscv/registerMap_riscv.cpp index e59fca777c1de..fa7b108c6ff12 100644 --- a/src/hotspot/cpu/riscv/registerMap_riscv.cpp +++ b/src/hotspot/cpu/riscv/registerMap_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021, 2022, Huawei Technologies Co., Ltd. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "runtime/registerMap.hpp" #include "vmreg_riscv.inline.hpp" diff --git a/src/hotspot/cpu/riscv/register_riscv.cpp b/src/hotspot/cpu/riscv/register_riscv.cpp index 98aeafbfe9cbe..56a4483a989e6 100644 --- a/src/hotspot/cpu/riscv/register_riscv.cpp +++ b/src/hotspot/cpu/riscv/register_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "register_riscv.hpp" Register::RegisterImpl all_RegisterImpls [Register::number_of_registers + 1]; diff --git a/src/hotspot/cpu/riscv/relocInfo_riscv.cpp b/src/hotspot/cpu/riscv/relocInfo_riscv.cpp index 18b4302c7e68e..7bee372b0ef80 100644 --- a/src/hotspot/cpu/riscv/relocInfo_riscv.cpp +++ b/src/hotspot/cpu/riscv/relocInfo_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, 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. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "code/relocInfo.hpp" #include "nativeInst_riscv.hpp" diff --git a/src/hotspot/cpu/riscv/riscv.ad b/src/hotspot/cpu/riscv/riscv.ad index 7cb42a6b30c3c..6250b88e61ec2 100644 --- a/src/hotspot/cpu/riscv/riscv.ad +++ b/src/hotspot/cpu/riscv/riscv.ad @@ -1918,7 +1918,7 @@ bool Matcher::match_rule_supported(int opcode) { case Op_ConvHF2F: case Op_ConvF2HF: - return UseZfh; + return UseZfh || UseZfhmin; } return true; // Per default match rules are supported. @@ -2364,7 +2364,7 @@ encode %{ Label miss; Label done; __ check_klass_subtype_slow_path(sub_reg, super_reg, temp_reg, result_reg, - nullptr, &miss); + nullptr, &miss, /*set_cond_codes*/ true); if ($primary) { __ mv(result_reg, zr); } else { @@ -6482,9 +6482,9 @@ instruct addP_reg_imm(iRegPNoSp dst, iRegP src1, immLAdd src2) %{ ins_encode %{ // src2 is imm, so actually call the addi - __ add(as_Register($dst$$reg), - as_Register($src1$$reg), - $src2$$constant); + __ addi(as_Register($dst$$reg), + as_Register($src1$$reg), + $src2$$constant); %} ins_pipe(ialu_reg_imm); @@ -6513,9 +6513,9 @@ instruct addL_reg_imm(iRegLNoSp dst, iRegL src1, immLAdd src2) %{ ins_encode %{ // src2 is imm, so actually call the addi - __ add(as_Register($dst$$reg), - as_Register($src1$$reg), - $src2$$constant); + __ addi(as_Register($dst$$reg), + as_Register($src1$$reg), + $src2$$constant); %} ins_pipe(ialu_reg_imm); @@ -6546,9 +6546,9 @@ instruct subI_reg_imm(iRegINoSp dst, iRegIorL2I src1, immISub src2) %{ ins_encode %{ // src2 is imm, so actually call the addiw - __ subw(as_Register($dst$$reg), - as_Register($src1$$reg), - $src2$$constant); + __ subiw(as_Register($dst$$reg), + as_Register($src1$$reg), + $src2$$constant); %} ins_pipe(ialu_reg_imm); @@ -6577,9 +6577,9 @@ instruct subL_reg_imm(iRegLNoSp dst, iRegL src1, immLSub src2) %{ ins_encode %{ // src2 is imm, so actually call the addi - __ sub(as_Register($dst$$reg), - as_Register($src1$$reg), - $src2$$constant); + __ subi(as_Register($dst$$reg), + as_Register($src1$$reg), + $src2$$constant); %} ins_pipe(ialu_reg_imm); @@ -7348,7 +7348,7 @@ instruct isInfiniteF_reg_reg(iRegINoSp dst, fRegF src) format %{ "isInfinite $dst, $src" %} ins_encode %{ __ fclass_s(as_Register($dst$$reg), as_FloatRegister($src$$reg)); - __ andi(as_Register($dst$$reg), as_Register($dst$$reg), Assembler::fclass_mask::inf); + __ andi(as_Register($dst$$reg), as_Register($dst$$reg), Assembler::FClassBits::inf); __ slt(as_Register($dst$$reg), zr, as_Register($dst$$reg)); %} @@ -7363,7 +7363,7 @@ instruct isInfiniteD_reg_reg(iRegINoSp dst, fRegD src) format %{ "isInfinite $dst, $src" %} ins_encode %{ __ fclass_d(as_Register($dst$$reg), as_FloatRegister($src$$reg)); - __ andi(as_Register($dst$$reg), as_Register($dst$$reg), Assembler::fclass_mask::inf); + __ andi(as_Register($dst$$reg), as_Register($dst$$reg), Assembler::FClassBits::inf); __ slt(as_Register($dst$$reg), zr, as_Register($dst$$reg)); %} @@ -7378,7 +7378,7 @@ instruct isFiniteF_reg_reg(iRegINoSp dst, fRegF src) format %{ "isFinite $dst, $src" %} ins_encode %{ __ fclass_s(as_Register($dst$$reg), as_FloatRegister($src$$reg)); - __ andi(as_Register($dst$$reg), as_Register($dst$$reg), Assembler::fclass_mask::finite); + __ andi(as_Register($dst$$reg), as_Register($dst$$reg), Assembler::FClassBits::finite); __ slt(as_Register($dst$$reg), zr, as_Register($dst$$reg)); %} @@ -7393,7 +7393,7 @@ instruct isFiniteD_reg_reg(iRegINoSp dst, fRegD src) format %{ "isFinite $dst, $src" %} ins_encode %{ __ fclass_d(as_Register($dst$$reg), as_FloatRegister($src$$reg)); - __ andi(as_Register($dst$$reg), as_Register($dst$$reg), Assembler::fclass_mask::finite); + __ andi(as_Register($dst$$reg), as_Register($dst$$reg), Assembler::FClassBits::finite); __ slt(as_Register($dst$$reg), zr, as_Register($dst$$reg)); %} @@ -10019,10 +10019,11 @@ instruct CallLeafNoFPDirect(method meth) instruct partialSubtypeCheck(iRegP_R15 result, iRegP_R14 sub, iRegP_R10 super, iRegP_R12 tmp, rFlagsReg cr) %{ + predicate(!UseSecondarySupersTable); match(Set result (PartialSubtypeCheck sub super)); effect(KILL tmp, KILL cr); - ins_cost(11 * DEFAULT_COST); + ins_cost(20 * DEFAULT_COST); format %{ "partialSubtypeCheck $result, $sub, $super\t#@partialSubtypeCheck" %} ins_encode(riscv_enc_partial_subtype_check(sub, super, tmp, result)); @@ -10032,6 +10033,33 @@ instruct partialSubtypeCheck(iRegP_R15 result, iRegP_R14 sub, iRegP_R10 super, i ins_pipe(pipe_class_memory); %} +// Two versions of partialSubtypeCheck, both used when we need to +// search for a super class in the secondary supers array. The first +// is used when we don't know _a priori_ the class being searched +// for. The second, far more common, is used when we do know: this is +// used for instanceof, checkcast, and any case where C2 can determine +// it by constant propagation. + +instruct partialSubtypeCheckVarSuper(iRegP_R14 sub, iRegP_R10 super, iRegP_R15 result, + iRegP_R11 tmpR11, iRegP_R12 tmpR12, iRegP_R13 tmpR13, + iRegP_R16 tmpR16, rFlagsReg cr) +%{ + predicate(UseSecondarySupersTable); + match(Set result (PartialSubtypeCheck sub super)); + effect(TEMP tmpR11, TEMP tmpR12, TEMP tmpR13, TEMP tmpR16, KILL cr); + + ins_cost(10 * DEFAULT_COST); // slightly larger than the next version + format %{ "partialSubtypeCheck $result, $sub, $super" %} + + ins_encode %{ + __ lookup_secondary_supers_table_var($sub$$Register, $super$$Register, $result$$Register, + $tmpR11$$Register, $tmpR12$$Register, $tmpR13$$Register, + $tmpR16$$Register, nullptr /*L_success*/); + %} + + ins_pipe(pipe_class_memory); +%} + instruct partialSubtypeCheckConstSuper(iRegP_R14 sub, iRegP_R10 super_reg, immP super_con, iRegP_R15 result, iRegP_R11 tmpR11, iRegP_R12 tmpR12, iRegP_R13 tmpR13, iRegP_R16 tmpR16, rFlagsReg cr) %{ @@ -10039,16 +10067,16 @@ instruct partialSubtypeCheckConstSuper(iRegP_R14 sub, iRegP_R10 super_reg, immP match(Set result (PartialSubtypeCheck sub (Binary super_reg super_con))); effect(TEMP tmpR11, TEMP tmpR12, TEMP tmpR13, TEMP tmpR16, KILL cr); - ins_cost(7 * DEFAULT_COST); // needs to be less than competing nodes + ins_cost(5 * DEFAULT_COST); // needs to be less than competing nodes format %{ "partialSubtypeCheck $result, $sub, $super_reg, $super_con" %} ins_encode %{ bool success = false; u1 super_klass_slot = ((Klass*)$super_con$$constant)->hash_slot(); if (InlineSecondarySupersTest) { - success = __ lookup_secondary_supers_table($sub$$Register, $super_reg$$Register, $result$$Register, - $tmpR11$$Register, $tmpR12$$Register, $tmpR13$$Register, - $tmpR16$$Register, super_klass_slot); + success = __ lookup_secondary_supers_table_const($sub$$Register, $super_reg$$Register, $result$$Register, + $tmpR11$$Register, $tmpR12$$Register, $tmpR13$$Register, + $tmpR16$$Register, super_klass_slot); } else { address call = __ reloc_call(RuntimeAddress(StubRoutines::lookup_secondary_supers_table_stub(super_klass_slot))); success = (call != nullptr); @@ -10062,22 +10090,6 @@ instruct partialSubtypeCheckConstSuper(iRegP_R14 sub, iRegP_R10 super_reg, immP ins_pipe(pipe_class_memory); %} -instruct partialSubtypeCheckVsZero(iRegP_R15 result, iRegP_R14 sub, iRegP_R10 super, iRegP_R12 tmp, - immP0 zero, rFlagsReg cr) -%{ - match(Set cr (CmpP (PartialSubtypeCheck sub super) zero)); - effect(KILL tmp, KILL result); - - ins_cost(11 * DEFAULT_COST); - format %{ "partialSubtypeCheck $result, $sub, $super == 0\t#@partialSubtypeCheckVsZero" %} - - ins_encode(riscv_enc_partial_subtype_check(sub, super, tmp, result)); - - opcode(0x0); // Don't zero result reg on hit - - ins_pipe(pipe_class_memory); -%} - instruct string_compareU(iRegP_R11 str1, iRegI_R12 cnt1, iRegP_R13 str2, iRegI_R14 cnt2, iRegI_R10 result, iRegP_R28 tmp1, iRegL_R29 tmp2, iRegL_R30 tmp3, rFlagsReg cr) %{ diff --git a/src/hotspot/cpu/riscv/riscv_b.ad b/src/hotspot/cpu/riscv/riscv_b.ad index 535c0fd534ddf..990d9eab87c7b 100644 --- a/src/hotspot/cpu/riscv/riscv_b.ad +++ b/src/hotspot/cpu/riscv/riscv_b.ad @@ -60,7 +60,7 @@ instruct rorI_reg_b(iRegINoSp dst, iRegI src, iRegI shift) %{ format %{ "rorw $dst, $src, $shift\t#@rorI_reg_b" %} ins_cost(ALU_COST); ins_encode %{ - __ rorw(as_Register($dst$$reg), as_Register($src$$reg), as_Register($shift$$reg)); + __ rorrw(as_Register($dst$$reg), as_Register($src$$reg), as_Register($shift$$reg)); %} ins_pipe(ialu_reg_reg); %} @@ -72,7 +72,7 @@ instruct rorL_reg_b(iRegLNoSp dst, iRegL src, iRegI shift) %{ format %{ "ror $dst, $src, $shift\t#@rorL_reg_b" %} ins_cost(ALU_COST); ins_encode %{ - __ ror(as_Register($dst$$reg), as_Register($src$$reg), as_Register($shift$$reg)); + __ rorr(as_Register($dst$$reg), as_Register($src$$reg), as_Register($shift$$reg)); %} ins_pipe(ialu_reg_reg); %} @@ -84,7 +84,7 @@ instruct rolI_reg_b(iRegINoSp dst, iRegI src, iRegI shift) %{ format %{ "rolw $dst, $src, $shift\t#@rolI_reg_b" %} ins_cost(ALU_COST); ins_encode %{ - __ rolw(as_Register($dst$$reg), as_Register($src$$reg), as_Register($shift$$reg)); + __ rolrw(as_Register($dst$$reg), as_Register($src$$reg), as_Register($shift$$reg)); %} ins_pipe(ialu_reg_reg); %} @@ -96,7 +96,7 @@ instruct rolL_reg_b(iRegLNoSp dst, iRegL src, iRegI shift) %{ format %{ "rol $dst, $src, $shift\t#@rolL_reg_b" %} ins_cost(ALU_COST); ins_encode %{ - __ rol(as_Register($dst$$reg), as_Register($src$$reg), as_Register($shift$$reg)); + __ rolr(as_Register($dst$$reg), as_Register($src$$reg), as_Register($shift$$reg)); %} ins_pipe(ialu_reg_reg); %} diff --git a/src/hotspot/cpu/riscv/runtime_riscv.cpp b/src/hotspot/cpu/riscv/runtime_riscv.cpp index 441bd1f241f28..a0879b68053d6 100644 --- a/src/hotspot/cpu/riscv/runtime_riscv.cpp +++ b/src/hotspot/cpu/riscv/runtime_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2024, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #ifdef COMPILER2 #include "asm/macroAssembler.hpp" #include "asm/macroAssembler.inline.hpp" @@ -73,7 +72,7 @@ void OptoRuntime::generate_uncommon_trap_blob() { // Push self-frame. We get here with a return address in RA // and sp should be 16 byte aligned // push fp and retaddr by hand - __ addi(sp, sp, -2 * wordSize); + __ subi(sp, sp, 2 * wordSize); __ sd(ra, Address(sp, wordSize)); __ sd(fp, Address(sp, 0)); // we don't expect an arg reg save area @@ -140,7 +139,7 @@ void OptoRuntime::generate_uncommon_trap_blob() { __ lwu(x12, Address(x14, Deoptimization::UnrollBlock:: size_of_deoptimized_frame_offset())); - __ sub(x12, x12, 2 * wordSize); + __ subi(x12, x12, 2 * wordSize); __ add(sp, sp, x12); __ ld(fp, Address(sp, 0)); __ ld(ra, Address(sp, wordSize)); @@ -188,7 +187,7 @@ void OptoRuntime::generate_uncommon_trap_blob() { Label loop; __ bind(loop); __ ld(x11, Address(x15, 0)); // Load frame size - __ sub(x11, x11, 2 * wordSize); // We'll push pc and fp by hand + __ subi(x11, x11, 2 * wordSize); // We'll push pc and fp by hand __ ld(ra, Address(x12, 0)); // Save return address __ enter(); // and old fp & set new fp __ sub(sp, sp, x11); // Prolog @@ -196,9 +195,9 @@ void OptoRuntime::generate_uncommon_trap_blob() { // This value is corrected by layout_activation_impl __ sd(zr, Address(fp, frame::interpreter_frame_last_sp_offset * wordSize)); __ mv(sender_sp, sp); // Pass sender_sp to next frame - __ add(x15, x15, wordSize); // Bump array pointer (sizes) - __ add(x12, x12, wordSize); // Bump array pointer (pcs) - __ subw(x13, x13, 1); // Decrement counter + __ addi(x15, x15, wordSize); // Bump array pointer (sizes) + __ addi(x12, x12, wordSize); // Bump array pointer (pcs) + __ subiw(x13, x13, 1); // Decrement counter __ bgtz(x13, loop); __ ld(ra, Address(x12, 0)); // save final return address // Re-push self-frame @@ -292,7 +291,7 @@ void OptoRuntime::generate_exception_blob() { // push fp and retaddr by hand // Exception pc is 'return address' for stack walker - __ addi(sp, sp, -2 * wordSize); + __ subi(sp, sp, 2 * wordSize); __ sd(ra, Address(sp, wordSize)); __ sd(fp, Address(sp)); // there are no callee save registers and we don't expect an @@ -346,7 +345,7 @@ void OptoRuntime::generate_exception_blob() { // and we dont' expect an arg reg save area __ ld(fp, Address(sp)); __ ld(x13, Address(sp, wordSize)); - __ addi(sp, sp , 2 * wordSize); + __ addi(sp, sp, 2 * wordSize); // x10: exception handler @@ -378,5 +377,3 @@ void OptoRuntime::generate_exception_blob() { _exception_blob = ExceptionBlob::create(&buffer, oop_maps, SimpleRuntimeFrame::framesize >> 1); } #endif // COMPILER2 - - diff --git a/src/hotspot/cpu/riscv/sharedRuntime_riscv.cpp b/src/hotspot/cpu/riscv/sharedRuntime_riscv.cpp index 9af1b6a9bb128..49e630bbfdf91 100644 --- a/src/hotspot/cpu/riscv/sharedRuntime_riscv.cpp +++ b/src/hotspot/cpu/riscv/sharedRuntime_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "asm/macroAssembler.inline.hpp" #include "code/compiledIC.hpp" @@ -641,7 +640,7 @@ AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm Label L_skip_barrier; { // Bypass the barrier for non-static methods - __ lwu(t0, Address(xmethod, Method::access_flags_offset())); + __ load_unsigned_short(t0, Address(xmethod, Method::access_flags_offset())); __ test_bit(t1, t0, exact_log2(JVM_ACC_STATIC)); __ beqz(t1, L_skip_barrier); // non-static } @@ -802,7 +801,7 @@ static void save_args(MacroAssembler *masm, int arg_count, int first_arg, VMRegP if (args[i].first()->is_Register()) { x = x + args[i].first()->as_Register(); } else if (args[i].first()->is_FloatRegister()) { - __ addi(sp, sp, -2 * wordSize); + __ subi(sp, sp, 2 * wordSize); __ fsd(args[i].first()->as_FloatRegister(), Address(sp, 0)); } } @@ -824,7 +823,7 @@ static void restore_args(MacroAssembler *masm, int arg_count, int first_arg, VMR ; } else if (args[i].first()->is_FloatRegister()) { __ fld(args[i].first()->as_FloatRegister(), Address(sp, 0)); - __ add(sp, sp, 2 * wordSize); + __ addi(sp, sp, 2 * wordSize); } } } @@ -1715,7 +1714,8 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm, // NOTE: the oopMark is in swap_reg % 10 as the result of cmpxchg __ sub(swap_reg, swap_reg, sp); - __ andi(swap_reg, swap_reg, 3 - (int)os::vm_page_size()); + __ mv(t0, 3 - (int)os::vm_page_size()); + __ andr(swap_reg, swap_reg, t0); // Save the test result, for recursive case, the result is zero __ sd(swap_reg, Address(lock_reg, mark_word_offset)); @@ -2336,7 +2336,7 @@ void SharedRuntime::generate_deopt_blob() { // Pop deoptimized frame __ lwu(x12, Address(x15, Deoptimization::UnrollBlock::size_of_deoptimized_frame_offset())); - __ sub(x12, x12, 2 * wordSize); + __ subi(x12, x12, 2 * wordSize); __ add(sp, sp, x12); __ ld(fp, Address(sp, 0)); __ ld(ra, Address(sp, wordSize)); @@ -2379,7 +2379,7 @@ void SharedRuntime::generate_deopt_blob() { __ bind(loop); __ ld(x9, Address(x14, 0)); // Load frame size __ addi(x14, x14, wordSize); - __ sub(x9, x9, 2 * wordSize); // We'll push pc and fp by hand + __ subi(x9, x9, 2 * wordSize); // We'll push pc and fp by hand __ ld(ra, Address(x12, 0)); // Load pc __ addi(x12, x12, wordSize); __ enter(); // Save old & set new fp @@ -2388,7 +2388,7 @@ void SharedRuntime::generate_deopt_blob() { __ sd(zr, Address(fp, frame::interpreter_frame_last_sp_offset * wordSize)); __ sd(sender_sp, Address(fp, frame::interpreter_frame_sender_sp_offset * wordSize)); // Make it walkable __ mv(sender_sp, sp); // Pass sender_sp to next frame - __ addi(x13, x13, -1); // Decrement counter + __ subi(x13, x13, 1); // Decrement counter __ bnez(x13, loop); // Re-push self-frame @@ -2566,7 +2566,7 @@ SafepointBlob* SharedRuntime::generate_handler_blob(SharedStubId id, address cal #endif // Adjust return pc forward to step over the safepoint poll instruction - __ add(x18, x18, NativeInstruction::instruction_size); + __ addi(x18, x18, NativeInstruction::instruction_size); __ sd(x18, Address(fp, frame::return_addr_offset * wordSize)); } @@ -2736,7 +2736,7 @@ RuntimeStub* SharedRuntime::generate_throw_exception(SharedStubId id, address ru assert(is_even(framesize / 2), "sp not 16-byte aligned"); // ra and fp are already in place - __ addi(sp, fp, 0 - ((unsigned)framesize << LogBytesPerInt)); // prolog + __ subi(sp, fp, (unsigned)framesize << LogBytesPerInt); // prolog int frame_complete = __ pc() - start; diff --git a/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp b/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp index 0b619923b06b1..afd1f691f34fa 100644 --- a/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp +++ b/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "asm/macroAssembler.inline.hpp" #include "compiler/oopMap.hpp" @@ -341,7 +340,7 @@ class StubGenerator: public StubCodeGenerator { address loop = __ pc(); __ ld(t0, Address(c_rarg5, 0)); __ addi(c_rarg5, c_rarg5, wordSize); - __ addi(c_rarg6, c_rarg6, -1); + __ subi(c_rarg6, c_rarg6, 1); __ push_reg(t0); __ bgtz(c_rarg6, loop); @@ -623,7 +622,7 @@ class StubGenerator: public StubCodeGenerator { __ la(c_rarg2, ExternalAddress((address) StubRoutines::verify_oop_count_addr())); __ ld(c_rarg3, Address(c_rarg2)); - __ add(c_rarg3, c_rarg3, 1); + __ addi(c_rarg3, c_rarg3, 1); __ sd(c_rarg3, Address(c_rarg2)); // object is in x10 @@ -698,8 +697,8 @@ class StubGenerator: public StubCodeGenerator { for (int i = 0; i < MacroAssembler::zero_words_block_size; i++) { __ sd(zr, Address(base, i * wordSize)); } - __ add(base, base, MacroAssembler::zero_words_block_size * wordSize); - __ sub(cnt, cnt, MacroAssembler::zero_words_block_size); + __ addi(base, base, MacroAssembler::zero_words_block_size * wordSize); + __ subi(cnt, cnt, MacroAssembler::zero_words_block_size); __ bge(cnt, tmp1, loop); __ bind(done); } @@ -779,7 +778,7 @@ class StubGenerator: public StubCodeGenerator { __ ld(tmp_reg7, Address(s, 8 * unit)); __ addi(s, s, 8 * unit); - __ sub(count, count, 16); + __ subi(count, count, 16); __ bltz(count, drain); __ bind(again); @@ -805,7 +804,7 @@ class StubGenerator: public StubCodeGenerator { __ addi(s, s, 8 * unit); __ addi(d, d, 8 * unit); - __ sub(count, count, 8); + __ subi(count, count, 8); __ bgez(count, again); // Drain @@ -959,9 +958,9 @@ class StubGenerator: public StubCodeGenerator { } if (is_aligned) { - __ addi(t0, cnt, -32); + __ subi(t0, cnt, 32); __ bgez(t0, copy32_loop); - __ addi(t0, cnt, -8); + __ subi(t0, cnt, 8); __ bgez(t0, copy8_loop, is_far); __ j(copy_small); } else { @@ -985,7 +984,7 @@ class StubGenerator: public StubCodeGenerator { __ addi(src, src, step); __ addi(dst, dst, step); } - __ addi(cnt, cnt, -granularity); + __ subi(cnt, cnt, granularity); __ beqz(cnt, done, is_far); __ j(same_aligned); @@ -996,8 +995,8 @@ class StubGenerator: public StubCodeGenerator { __ bind(copy32_loop); if (is_backwards) { - __ addi(src, src, -wordSize * 4); - __ addi(dst, dst, -wordSize * 4); + __ subi(src, src, wordSize * 4); + __ subi(dst, dst, wordSize * 4); } // we first load 32 bytes, then write it, so the direction here doesn't matter bs_asm->copy_load_at(_masm, decorators, type, 8, tmp3, Address(src), gct1); @@ -1014,19 +1013,19 @@ class StubGenerator: public StubCodeGenerator { __ addi(src, src, wordSize * 4); __ addi(dst, dst, wordSize * 4); } - __ addi(t0, cnt, -(32 + wordSize * 4)); - __ addi(cnt, cnt, -wordSize * 4); + __ subi(t0, cnt, 32 + wordSize * 4); + __ subi(cnt, cnt, wordSize * 4); __ bgez(t0, copy32_loop); // cnt >= 32, do next loop __ beqz(cnt, done); // if that's all - done - __ addi(t0, cnt, -8); // if not - copy the reminder + __ subi(t0, cnt, 8); // if not - copy the reminder __ bltz(t0, copy_small); // cnt < 8, go to copy_small, else fall through to copy8_loop __ bind(copy8_loop); if (is_backwards) { - __ addi(src, src, -wordSize); - __ addi(dst, dst, -wordSize); + __ subi(src, src, wordSize); + __ subi(dst, dst, wordSize); } bs_asm->copy_load_at(_masm, decorators, type, 8, tmp3, Address(src), gct1); bs_asm->copy_store_at(_masm, decorators, type, 8, Address(dst), tmp3, gct1, gct2, gct3); @@ -1035,8 +1034,8 @@ class StubGenerator: public StubCodeGenerator { __ addi(src, src, wordSize); __ addi(dst, dst, wordSize); } - __ addi(t0, cnt, -(8 + wordSize)); - __ addi(cnt, cnt, -wordSize); + __ subi(t0, cnt, 8 + wordSize); + __ subi(cnt, cnt, wordSize); __ bgez(t0, copy8_loop); // cnt >= 8, do next loop __ beqz(cnt, done); // if that's all - done @@ -1054,7 +1053,7 @@ class StubGenerator: public StubCodeGenerator { __ addi(src, src, step); __ addi(dst, dst, step); } - __ addi(cnt, cnt, -granularity); + __ subi(cnt, cnt, granularity); __ bgtz(cnt, copy_small); __ bind(done); @@ -1454,6 +1453,9 @@ class StubGenerator: public StubCodeGenerator { void generate_type_check(Register sub_klass, Register super_check_offset, Register super_klass, + Register result, + Register tmp1, + Register tmp2, Label& L_success) { assert_different_registers(sub_klass, super_check_offset, super_klass); @@ -1462,7 +1464,7 @@ class StubGenerator: public StubCodeGenerator { Label L_miss; __ check_klass_subtype_fast_path(sub_klass, super_klass, noreg, &L_success, &L_miss, nullptr, super_check_offset); - __ check_klass_subtype_slow_path(sub_klass, super_klass, noreg, noreg, &L_success, nullptr); + __ check_klass_subtype_slow_path(sub_klass, super_klass, tmp1, tmp2, &L_success, nullptr); // Fall through on failure! __ BIND(L_miss); @@ -1578,8 +1580,8 @@ class StubGenerator: public StubCodeGenerator { bs->copy_store_at(_masm, decorators, T_OBJECT, element_size, Address(to, 0), copied_oop, gct1, gct2, gct3); - __ add(to, to, UseCompressedOops ? 4 : 8); - __ sub(count, count, 1); + __ addi(to, to, UseCompressedOops ? 4 : 8); + __ subi(count, count, 1); __ beqz(count, L_do_card_marks); // ======== loop entry is here ======== @@ -1587,11 +1589,22 @@ class StubGenerator: public StubCodeGenerator { bs->copy_load_at(_masm, decorators, T_OBJECT, element_size, copied_oop, Address(from, 0), gct1); - __ add(from, from, UseCompressedOops ? 4 : 8); + __ addi(from, from, UseCompressedOops ? 4 : 8); __ beqz(copied_oop, L_store_element); __ load_klass(r9_klass, copied_oop);// query the object klass - generate_type_check(r9_klass, ckoff, ckval, L_store_element); + + BLOCK_COMMENT("type_check:"); + generate_type_check(r9_klass, /*sub_klass*/ + ckoff, /*super_check_offset*/ + ckval, /*super_klass*/ + x10, /*result*/ + gct1, /*tmp1*/ + gct2, /*tmp2*/ + L_store_element); + + // Fall through on failure! + // ======== end loop ======== // It was a real error; we must depend on the caller to finish the job. @@ -1600,7 +1613,7 @@ class StubGenerator: public StubCodeGenerator { // their number to the caller. __ sub(count, count_save, count); // K = partially copied oop count - __ xori(count, count, -1); // report (-1^K) to caller + __ xori(count, count, -1); // report (-1^K) to caller __ beqz(count, L_done_pop); __ BIND(L_do_card_marks); @@ -1929,9 +1942,9 @@ class StubGenerator: public StubCodeGenerator { t1, L_failed); __ shadd(from, src_pos, src, t0, LogBytesPerHeapOop); - __ add(from, from, arrayOopDesc::base_offset_in_bytes(T_OBJECT)); + __ addi(from, from, arrayOopDesc::base_offset_in_bytes(T_OBJECT)); __ shadd(to, dst_pos, dst, t0, LogBytesPerHeapOop); - __ add(to, to, arrayOopDesc::base_offset_in_bytes(T_OBJECT)); + __ addi(to, to, arrayOopDesc::base_offset_in_bytes(T_OBJECT)); __ sext(count, scratch_length, 32); // length __ BIND(L_plain_copy); __ j(RuntimeAddress(oop_copy_entry)); @@ -1952,9 +1965,9 @@ class StubGenerator: public StubCodeGenerator { // Marshal the base address arguments now, freeing registers. __ shadd(from, src_pos, src, t0, LogBytesPerHeapOop); - __ add(from, from, arrayOopDesc::base_offset_in_bytes(T_OBJECT)); + __ addi(from, from, arrayOopDesc::base_offset_in_bytes(T_OBJECT)); __ shadd(to, dst_pos, dst, t0, LogBytesPerHeapOop); - __ add(to, to, arrayOopDesc::base_offset_in_bytes(T_OBJECT)); + __ addi(to, to, arrayOopDesc::base_offset_in_bytes(T_OBJECT)); __ sext(count, length, 32); // length (reloaded) const Register sco_temp = c_rarg3; // this register is free now assert_different_registers(from, to, count, sco_temp, @@ -1965,7 +1978,7 @@ class StubGenerator: public StubCodeGenerator { __ lwu(sco_temp, Address(dst_klass, sco_offset)); // Smashes t0, t1 - generate_type_check(scratch_src_klass, sco_temp, dst_klass, L_plain_copy); + generate_type_check(scratch_src_klass, sco_temp, dst_klass, noreg, noreg, noreg, L_plain_copy); // Fetch destination element klass from the ObjArrayKlass header. int ek_offset = in_bytes(ObjArrayKlass::element_klass_offset()); @@ -2068,7 +2081,7 @@ class StubGenerator: public StubCodeGenerator { __ beqz(t0, L_skip_align1); __ sb(value, Address(to, 0)); __ addi(to, to, 1); - __ addiw(count, count, -1); + __ subiw(count, count, 1); __ bind(L_skip_align1); // Fallthrough case T_SHORT: @@ -2077,7 +2090,7 @@ class StubGenerator: public StubCodeGenerator { __ beqz(t0, L_skip_align2); __ sh(value, Address(to, 0)); __ addi(to, to, 2); - __ addiw(count, count, -(2 >> shift)); + __ subiw(count, count, 2 >> shift); __ bind(L_skip_align2); // Fallthrough case T_INT: @@ -2086,7 +2099,7 @@ class StubGenerator: public StubCodeGenerator { __ beqz(t0, L_skip_align4); __ sw(value, Address(to, 0)); __ addi(to, to, 4); - __ addiw(count, count, -(4 >> shift)); + __ subiw(count, count, 4 >> shift); __ bind(L_skip_align4); break; default: ShouldNotReachHere(); @@ -2500,7 +2513,7 @@ class StubGenerator: public StubCodeGenerator { __ mv(isLU ? tmp1 : tmp2, tmp3); __ addi(str1, str1, isLU ? wordSize / 2 : wordSize); __ addi(str2, str2, isLU ? wordSize : wordSize / 2); - __ sub(cnt2, cnt2, wordSize / 2); // Already loaded 4 symbols + __ subi(cnt2, cnt2, wordSize / 2); // Already loaded 4 symbols __ xorr(tmp3, tmp1, tmp2); __ bnez(tmp3, CALCULATE_DIFFERENCE); @@ -2523,10 +2536,10 @@ class StubGenerator: public StubCodeGenerator { __ addi(cnt2, cnt2, -wordSize / 2); // we are now 8-bytes aligned on strL - __ sub(cnt2, cnt2, wordSize * 2); + __ subi(cnt2, cnt2, wordSize * 2); __ bltz(cnt2, TAIL); __ bind(SMALL_LOOP); // smaller loop - __ sub(cnt2, cnt2, wordSize * 2); + __ subi(cnt2, cnt2, wordSize * 2); compare_string_8_x_LU(tmpL, tmpU, strL, strU, CALCULATE_DIFFERENCE); compare_string_8_x_LU(tmpL, tmpU, strL, strU, CALCULATE_DIFFERENCE); __ bgez(cnt2, SMALL_LOOP); @@ -2540,11 +2553,11 @@ class StubGenerator: public StubCodeGenerator { __ bltz(t0, LOAD_LAST); // remaining characters are greater than or equals to 8, we can do one compare_string_8_x_LU compare_string_8_x_LU(tmpL, tmpU, strL, strU, CALCULATE_DIFFERENCE); - __ addi(cnt2, cnt2, -wordSize); + __ subi(cnt2, cnt2, wordSize); __ beqz(cnt2, DONE); // no character left __ bind(LOAD_LAST); // cnt2 = 1..7 characters left - __ addi(cnt2, cnt2, -wordSize); // cnt2 is now an offset in strL which points to last 8 bytes + __ subi(cnt2, cnt2, wordSize); // cnt2 is now an offset in strL which points to last 8 bytes __ slli(t0, cnt2, 1); // t0 is now an offset in strU which points to last 16 bytes __ add(strL, strL, cnt2); // Address of last 8 bytes in Latin1 string __ add(strU, strU, t0); // Address of last 16 bytes in UTF-16 string @@ -2610,9 +2623,9 @@ class StubGenerator: public StubCodeGenerator { __ set_last_Java_frame(sp, fp, ra); __ enter(); - __ add(t1, sp, wordSize); + __ addi(t1, sp, wordSize); - __ sub(sp, sp, 4 * wordSize); + __ subi(sp, sp, 4 * wordSize); __ push_call_clobbered_registers(); @@ -2665,22 +2678,22 @@ class StubGenerator: public StubCodeGenerator { // cnt1/cnt2 contains amount of characters to compare. cnt1 can be re-used // update cnt2 counter with already loaded 8 bytes - __ sub(cnt2, cnt2, wordSize / (isLL ? 1 : 2)); + __ subi(cnt2, cnt2, wordSize / (isLL ? 1 : 2)); // update pointers, because of previous read - __ add(str1, str1, wordSize); - __ add(str2, str2, wordSize); + __ addi(str1, str1, wordSize); + __ addi(str2, str2, wordSize); // less than 16 bytes left? - __ sub(cnt2, cnt2, isLL ? 16 : 8); + __ subi(cnt2, cnt2, isLL ? 16 : 8); __ push_reg(spilled_regs, sp); __ bltz(cnt2, TAIL); __ bind(SMALL_LOOP); compare_string_16_bytes_same(DIFF, DIFF2); - __ sub(cnt2, cnt2, isLL ? 16 : 8); + __ subi(cnt2, cnt2, isLL ? 16 : 8); __ bgez(cnt2, SMALL_LOOP); __ bind(TAIL); __ addi(cnt2, cnt2, isLL ? 16 : 8); __ beqz(cnt2, LAST_CHECK_AND_LENGTH_DIFF); - __ sub(cnt2, cnt2, isLL ? 8 : 4); + __ subi(cnt2, cnt2, isLL ? 8 : 4); __ blez(cnt2, CHECK_LAST); __ xorr(tmp4, tmp1, tmp2); __ bnez(tmp4, DIFF); @@ -2688,7 +2701,7 @@ class StubGenerator: public StubCodeGenerator { __ addi(str1, str1, 8); __ ld(tmp2, Address(str2)); __ addi(str2, str2, 8); - __ sub(cnt2, cnt2, isLL ? 8 : 4); + __ subi(cnt2, cnt2, isLL ? 8 : 4); __ bind(CHECK_LAST); if (!isLL) { __ add(cnt2, cnt2, cnt2); // now in bytes @@ -2801,7 +2814,7 @@ class StubGenerator: public StubCodeGenerator { if (needle_isL != haystack_isL) { __ mv(tmp, ch1); } - __ sub(haystack_len, haystack_len, wordSize / haystack_chr_size - 1); + __ subi(haystack_len, haystack_len, wordSize / haystack_chr_size - 1); __ blez(haystack_len, L_SMALL); if (needle_isL != haystack_isL) { @@ -2817,9 +2830,9 @@ class StubGenerator: public StubCodeGenerator { // search first char of needle, if success, goto L_HAS_ZERO; __ bnez(match_mask, L_HAS_ZERO); - __ sub(haystack_len, haystack_len, wordSize / haystack_chr_size); - __ add(result, result, wordSize / haystack_chr_size); - __ add(haystack, haystack, wordSize); + __ subi(haystack_len, haystack_len, wordSize / haystack_chr_size); + __ addi(result, result, wordSize / haystack_chr_size); + __ addi(haystack, haystack, wordSize); __ bltz(haystack_len, L_POST_LOOP); __ bind(L_LOOP); @@ -2828,9 +2841,9 @@ class StubGenerator: public StubCodeGenerator { __ bnez(match_mask, L_HAS_ZERO); __ bind(L_LOOP_PROCEED); - __ sub(haystack_len, haystack_len, wordSize / haystack_chr_size); - __ add(haystack, haystack, wordSize); - __ add(result, result, wordSize / haystack_chr_size); + __ subi(haystack_len, haystack_len, wordSize / haystack_chr_size); + __ addi(haystack, haystack, wordSize); + __ addi(result, result, wordSize / haystack_chr_size); __ bgez(haystack_len, L_LOOP); __ bind(L_POST_LOOP); @@ -2879,7 +2892,7 @@ class StubGenerator: public StubCodeGenerator { __ shadd(ch2, trailing_zeros, haystack, ch2, haystack_chr_shift); needle_isL ? __ lbu(first, Address(first)) : __ lhu(first, Address(first)); haystack_isL ? __ lbu(ch2, Address(ch2)) : __ lhu(ch2, Address(ch2)); - __ add(trailing_zeros, trailing_zeros, 1); + __ addi(trailing_zeros, trailing_zeros, 1); __ bge(trailing_zeros, needle_len, L_SMALL_CMP_LOOP_LAST_CMP); __ beq(first, ch2, L_SMALL_CMP_LOOP); @@ -2888,8 +2901,8 @@ class StubGenerator: public StubCodeGenerator { // count bits of trailing zero chars __ ctzc_bits(trailing_zeros, match_mask, haystack_isL, tmp, ch2); __ addi(trailing_zeros, trailing_zeros, haystack_isL ? 7 : 15); - __ add(result, result, 1); - __ add(haystack, haystack, haystack_chr_size); + __ addi(result, result, 1); + __ addi(haystack, haystack, haystack_chr_size); __ j(L_SMALL_HAS_ZERO_LOOP); __ align(OptoLoopAlignment); @@ -2910,7 +2923,7 @@ class StubGenerator: public StubCodeGenerator { __ addi(trailing_zeros, trailing_zeros, haystack_isL ? 7 : 15); __ slli(needle_len, needle_len, BitsPerByte * wordSize / 2); __ orr(haystack_len, haystack_len, needle_len); // restore needle_len(32bits) - __ sub(result, result, 1); // array index from 0, so result -= 1 + __ subi(result, result, 1); // array index from 0, so result -= 1 __ bind(L_HAS_ZERO_LOOP); __ mv(needle_len, wordSize / haystack_chr_size); @@ -2918,7 +2931,7 @@ class StubGenerator: public StubCodeGenerator { __ bge(needle_len, ch2, L_CMP_LOOP_LAST_CMP2); // load next 8 bytes from haystack, and increase result index __ compute_index(haystack, trailing_zeros, match_mask, result, ch2, tmp, haystack_isL); - __ add(result, result, 1); + __ addi(result, result, 1); __ mv(trailing_zeros, wordSize / haystack_chr_size); __ bne(ch1, ch2, L_CMP_LOOP_NOMATCH); @@ -2928,7 +2941,7 @@ class StubGenerator: public StubCodeGenerator { needle_isL ? __ lbu(needle_len, Address(needle_len)) : __ lhu(needle_len, Address(needle_len)); __ shadd(ch2, trailing_zeros, haystack, ch2, haystack_chr_shift); haystack_isL ? __ lbu(ch2, Address(ch2)) : __ lhu(ch2, Address(ch2)); - __ add(trailing_zeros, trailing_zeros, 1); // next char index + __ addi(trailing_zeros, trailing_zeros, 1); // next char index __ srli(tmp, haystack_len, BitsPerByte * wordSize / 2); __ bge(trailing_zeros, tmp, L_CMP_LOOP_LAST_CMP); __ beq(needle_len, ch2, L_CMP_LOOP); @@ -2938,7 +2951,7 @@ class StubGenerator: public StubCodeGenerator { // count bits of trailing zero chars __ ctzc_bits(trailing_zeros, match_mask, haystack_isL, needle_len, ch2); __ addi(trailing_zeros, trailing_zeros, haystack_isL ? 7 : 15); - __ add(haystack, haystack, haystack_chr_size); + __ addi(haystack, haystack, haystack_chr_size); __ j(L_HAS_ZERO_LOOP); __ align(OptoLoopAlignment); @@ -2949,7 +2962,7 @@ class StubGenerator: public StubCodeGenerator { __ align(OptoLoopAlignment); __ bind(L_CMP_LOOP_LAST_CMP2); __ compute_index(haystack, trailing_zeros, match_mask, result, ch2, tmp, haystack_isL); - __ add(result, result, 1); + __ addi(result, result, 1); __ bne(ch1, ch2, L_CMP_LOOP_NOMATCH); __ j(DONE); @@ -3006,9 +3019,9 @@ class StubGenerator: public StubCodeGenerator { Label L_success; __ enter(); - __ lookup_secondary_supers_table(r_sub_klass, r_super_klass, result, - r_array_base, r_array_length, r_array_index, - r_bitmap, super_klass_index, /*stub_is_near*/true); + __ lookup_secondary_supers_table_const(r_sub_klass, r_super_klass, result, + r_array_base, r_array_length, r_array_index, + r_bitmap, super_klass_index, /*stub_is_near*/ true); __ leave(); __ ret(); @@ -3310,7 +3323,7 @@ class StubGenerator: public StubCodeGenerator { (this->*block)(); bind(odd); (this->*block)(); - addi(count, count, -2); + subi(count, count, 2); bgtz(count, loop); bind(end); } @@ -3326,7 +3339,7 @@ class StubGenerator: public StubCodeGenerator { (this->*block)(d, s, tmp); bind(odd); (this->*block)(d, s, tmp); - addi(count, count, -2); + subi(count, count, 2); bgtz(count, loop); bind(end); } @@ -3378,7 +3391,7 @@ class StubGenerator: public StubCodeGenerator { mul(Rlo_ab, Ra, Rb); addi(Pa, Pa, wordSize); ld(Ra, Address(Pa)); - addi(Pb, Pb, -wordSize); + subi(Pb, Pb, wordSize); ld(Rb, Address(Pb)); acc(Rhi_mn, Rlo_mn, tmp0, tmp1, tmp2); // The pending m*n from the // previous iteration. @@ -3389,7 +3402,7 @@ class StubGenerator: public StubCodeGenerator { mul(Rlo_mn, Rm, Rn); addi(Pm, Pm, wordSize); ld(Rm, Address(Pm)); - addi(Pn, Pn, -wordSize); + subi(Pn, Pn, wordSize); ld(Rn, Address(Pn)); acc(Rhi_ab, Rlo_ab, tmp0, tmp1, tmp2); } @@ -3433,7 +3446,7 @@ class StubGenerator: public StubCodeGenerator { // // mul(Rlo_mn, Rm, Rn); // cad(zr, tmp0, Rlo_mn); - addi(t0, tmp0, -1); + subi(t0, tmp0, 1); sltu(t0, t0, tmp0); // Set carry iff tmp0 is nonzero cadc(tmp0, tmp1, Rhi_mn, t0); adc(tmp1, tmp2, zr, t0); @@ -3462,13 +3475,13 @@ class StubGenerator: public StubCodeGenerator { // Rb = *--Pb; // Rm = *++Pm; // Rn = *--Pn; - add(Pa, Pa, wordSize); + addi(Pa, Pa, wordSize); ld(Ra, Address(Pa)); - add(Pb, Pb, -wordSize); + subi(Pb, Pb, wordSize); ld(Rb, Address(Pb)); - add(Pm, Pm, wordSize); + addi(Pm, Pm, wordSize); ld(Rm, Address(Pm)); - add(Pn, Pn, -wordSize); + subi(Pn, Pn, wordSize); ld(Rn, Address(Pn)); mv(Rhi_mn, zr); @@ -3523,15 +3536,15 @@ class StubGenerator: public StubCodeGenerator { slli(Rn, i, LogBytesPerWord); // Rn as temp register add(Rn, Pm_base, Rn); sd(Rm, Address(Rn)); - add(i, i, 1); + addi(i, i, 1); slli(Rn, i, LogBytesPerWord); add(Rm, Pm_base, Rn); ld(Rm, Address(Rm)); add(Rn, Pn_base, Rn); ld(Rn, Address(Rn)); - sub(cnt, cnt, 1); + subi(cnt, cnt, 1); } bnez(cnt, loop); - addi(tmp0, tmp0, -1); + subi(tmp0, tmp0, 1); add(tmp0, tmp0, t0); } bnez(tmp0, again); } bind(post); @@ -3554,9 +3567,9 @@ class StubGenerator: public StubCodeGenerator { } // [63...0] -> [31...0][63...32] void reverse1(Register d, Register s, Register tmp) { - addi(s, s, -wordSize); + subi(s, s, wordSize); ld(tmp, Address(s)); - ror_imm(tmp, tmp, 32, t0); + ror(tmp, tmp, 32, t0); sd(tmp, Address(d)); addi(d, d, wordSize); } @@ -3591,7 +3604,7 @@ class StubGenerator: public StubCodeGenerator { mul(Rlo_mn, Rm, Rn); addi(Pm, Pm, wordSize); ld(Rm, Address(Pm)); - addi(Pn, Pn, -wordSize); + subi(Pn, Pn, wordSize); ld(Rn, Address(Pn)); } @@ -3626,7 +3639,7 @@ class StubGenerator: public StubCodeGenerator { // // mul(Rlo_mn, Rm, Rn); // cad(zr, tmp, Rlo_mn); - addi(t0, tmp0, -1); + subi(t0, tmp0, 1); sltu(t0, t0, tmp0); // Set carry iff tmp0 is nonzero cadc(tmp0, tmp1, Rhi_mn, t0); adc(tmp1, tmp2, zr, t0); @@ -3732,7 +3745,7 @@ class StubGenerator: public StubCodeGenerator { } block_comment(" } // j"); post1(); - addw(Ri, Ri, 1); + addiw(Ri, Ri, 1); blt(Ri, Rlen, loop); bind(end); block_comment("} // i"); @@ -3750,12 +3763,12 @@ class StubGenerator: public StubCodeGenerator { block_comment(" for (j = len*2-i-1; j; j--) {"); { slliw(Rj, Rlen, 1); subw(Rj, Rj, Ri); - subw(Rj, Rj, 1); + subiw(Rj, Rj, 1); unroll_2(Rj, &MontgomeryMultiplyGenerator::step); } block_comment(" } // j"); post2(Ri, Rlen); - addw(Ri, Ri, 1); + addiw(Ri, Ri, 1); slli(t0, Rlen, 1); blt(Ri, t0, loop); bind(end); @@ -3866,7 +3879,7 @@ class StubGenerator: public StubCodeGenerator { block_comment(" for (j = (2*len-i-1)/2; j; j--) {"); { slli(Rj, Rlen, 1); sub(Rj, Rj, Ri); - sub(Rj, Rj, 1); + subi(Rj, Rj, 1); srliw(Rj, Rj, 1); unroll_2(Rj, &MontgomeryMultiplyGenerator::step_squaring); } block_comment(" } // j"); @@ -3928,7 +3941,7 @@ class StubGenerator: public StubCodeGenerator { if (return_barrier) { // preserve possible return value from a method returning to the return barrier - __ sub(sp, sp, 2 * wordSize); + __ subi(sp, sp, 2 * wordSize); __ fsd(f10, Address(sp, 0 * wordSize)); __ sd(x10, Address(sp, 1 * wordSize)); } @@ -3941,7 +3954,7 @@ class StubGenerator: public StubCodeGenerator { // restore return value (no safepoint in the call to thaw, so even an oop return value should be OK) __ ld(x10, Address(sp, 1 * wordSize)); __ fld(f10, Address(sp, 0 * wordSize)); - __ add(sp, sp, 2 * wordSize); + __ addi(sp, sp, 2 * wordSize); } #ifndef PRODUCT @@ -3966,7 +3979,7 @@ class StubGenerator: public StubCodeGenerator { if (return_barrier) { // save original return value -- again - __ sub(sp, sp, 2 * wordSize); + __ subi(sp, sp, 2 * wordSize); __ fsd(f10, Address(sp, 0 * wordSize)); __ sd(x10, Address(sp, 1 * wordSize)); } @@ -3981,14 +3994,14 @@ class StubGenerator: public StubCodeGenerator { // restore return value (no safepoint in the call to thaw, so even an oop return value should be OK) __ ld(x10, Address(sp, 1 * wordSize)); __ fld(f10, Address(sp, 0 * wordSize)); - __ add(sp, sp, 2 * wordSize); + __ addi(sp, sp, 2 * wordSize); } else { __ mv(x10, zr); // return 0 (success) from doYield } // we're now on the yield frame (which is in an address above us b/c sp has been pushed down) __ mv(fp, t1); - __ sub(sp, t1, 2 * wordSize); // now pointing to fp spill + __ subi(sp, t1, 2 * wordSize); // now pointing to fp spill if (return_barrier_exception) { __ ld(c_rarg1, Address(fp, -1 * wordSize)); // return address @@ -4445,7 +4458,7 @@ class StubGenerator: public StubCodeGenerator { if (multi_block) { int total_adds = vset_sew == Assembler::e32 ? 240 : 608; __ addi(consts, consts, -total_adds); - __ add(ofs, ofs, vset_sew == Assembler::e32 ? 64 : 128); + __ addi(ofs, ofs, vset_sew == Assembler::e32 ? 64 : 128); __ ble(ofs, limit, multi_block_loop); __ mv(c_rarg0, ofs); // return ofs } @@ -4523,7 +4536,7 @@ class StubGenerator: public StubCodeGenerator { __ addw(a, a, value); // a = Integer.rotateLeft(a, s) + b; - __ rolw_imm(a, a, s); + __ rolw(a, a, s); __ addw(a, a, b); } @@ -4939,7 +4952,7 @@ class StubGenerator: public StubCodeGenerator { chacha20_quarter_round(work_vrs[2], work_vrs[7], work_vrs[8], work_vrs[13], tmp_vr); chacha20_quarter_round(work_vrs[3], work_vrs[4], work_vrs[9], work_vrs[14], tmp_vr); - __ sub(loop, loop, 1); + __ subi(loop, loop, 1); __ bnez(loop, L_Rounds); } @@ -5028,7 +5041,7 @@ class StubGenerator: public StubCodeGenerator { __ xorr(cur_w, cur_w, t1); __ xorr(cur_w, cur_w, t0); - __ rolw_imm(cur_w, cur_w, 1, t0); + __ rolw(cur_w, cur_w, 1, t0); // copy the cur_w value to ws[8]. // now, valid w't values are at: @@ -5048,7 +5061,7 @@ class StubGenerator: public StubCodeGenerator { __ 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); + __ rolw(cur_w, cur_w, 1, t0); // copy the cur_w value to ws[8] __ zext(cur_w, cur_w, 32); @@ -5113,7 +5126,7 @@ class StubGenerator: public StubCodeGenerator { Register tmp3 = e; __ add(tmp2, cur_k, tmp2); __ add(tmp3, tmp3, tmp2); - __ rolw_imm(tmp2, a, 5, t0); + __ rolw(tmp2, a, 5, t0); sha1_f(tmp, b, c, d, round); @@ -5128,7 +5141,7 @@ class StubGenerator: public StubCodeGenerator { __ mv(e, d); __ mv(d, c); - __ rolw_imm(c, b, 30); + __ rolw(c, b, 30); __ mv(b, a); __ mv(a, tmp2); } @@ -5519,7 +5532,7 @@ class StubGenerator: public StubCodeGenerator { __ sb(byte2, Address(dst, 2)); __ sb(combined24Bits, Address(dst, 3)); - __ sub(length, length, 3); + __ subi(length, length, 3); __ addi(dst, dst, 4); // loop back __ bnez(length, ScalarLoop); @@ -5796,7 +5809,7 @@ class StubGenerator: public StubCodeGenerator { __ sb(byte1, Address(dst, 1)); __ sb(combined32Bits, Address(dst, 2)); - __ sub(length, length, 4); + __ subi(length, length, 4); __ addi(dst, dst, 3); // loop back __ bnez(length, ScalarLoop); @@ -5979,23 +5992,23 @@ class StubGenerator: public StubCodeGenerator { __ beqz(len, L_combine); // Jumping to L_by1_loop - __ sub(len, len, step_1); + __ subi(len, len, step_1); __ j(L_by1_loop); __ bind(L_nmax); __ sub(len, len, nmax); - __ sub(count, nmax, 16); + __ subi(count, nmax, 16); __ bltz(len, L_by16); // Align L_nmax loop by 64 __ bind(L_nmax_loop_entry); - __ sub(count, count, 32); + __ subi(count, count, 32); __ bind(L_nmax_loop); adler32_process_bytes(buff, s1, s2, vtable_64, vzero, vbytes, vs1acc, vs2acc, temp0, temp1, temp2, temp3, vtemp1, vtemp2, step_64, Assembler::m4); - __ sub(count, count, step_64); + __ subi(count, count, step_64); __ bgtz(count, L_nmax_loop); // There are three iterations left to do @@ -6012,7 +6025,7 @@ class StubGenerator: public StubCodeGenerator { __ remuw(s2, s2, base); __ sub(len, len, nmax); - __ sub(count, nmax, 16); + __ subi(count, nmax, 16); __ bgez(len, L_nmax_loop_entry); __ bind(L_by16); @@ -6026,7 +6039,7 @@ class StubGenerator: public StubCodeGenerator { adler32_process_bytes(buff, s1, s2, vtable_64, vzero, vbytes, vs1acc, vs2acc, temp0, temp1, temp2, temp3, vtemp1, vtemp2, step_64, Assembler::m4); - __ sub(len, len, step_64); + __ subi(len, len, step_64); // By now the temp3 should still be 64 __ bge(len, temp3, L_by16_loop_unroll); @@ -6034,11 +6047,11 @@ class StubGenerator: public StubCodeGenerator { adler32_process_bytes(buff, s1, s2, vtable_16, vzero, vbytes, vs1acc, vs2acc, temp0, temp1, temp2, temp3, vtemp1, vtemp2, step_16, Assembler::m1); - __ sub(len, len, step_16); + __ subi(len, len, step_16); __ bgez(len, L_by16_loop); __ bind(L_by1); - __ add(len, len, 15); + __ addi(len, len, 15); __ bltz(len, L_do_mod); __ bind(L_by1_loop); @@ -6046,7 +6059,7 @@ class StubGenerator: public StubCodeGenerator { __ addi(buff, buff, step_1); __ add(s1, temp0, s1); __ add(s2, s2, s1); - __ sub(len, len, step_1); + __ subi(len, len, step_1); __ bgez(len, L_by1_loop); __ bind(L_do_mod); @@ -6228,7 +6241,7 @@ static const int64_t right_3_bits = right_n_bits(3); // U_2:U_1:U_0: += (U_2 >> 2) * 5 poly1305_reduce(U_2, U_1, U_0, t1, t2); - __ sub(length, length, BLOCK_LENGTH); + __ subi(length, length, BLOCK_LENGTH); __ addi(input_start, input_start, BLOCK_LENGTH); __ mv(t1, BLOCK_LENGTH); __ bge(length, t1, LOOP); diff --git a/src/hotspot/cpu/riscv/stubRoutines_riscv.cpp b/src/hotspot/cpu/riscv/stubRoutines_riscv.cpp index 66a3ac3a994d5..ae2e81f509e10 100644 --- a/src/hotspot/cpu/riscv/stubRoutines_riscv.cpp +++ b/src/hotspot/cpu/riscv/stubRoutines_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "runtime/deoptimization.hpp" #include "runtime/frame.inline.hpp" #include "runtime/javaThread.hpp" diff --git a/src/hotspot/cpu/riscv/templateInterpreterGenerator_riscv.cpp b/src/hotspot/cpu/riscv/templateInterpreterGenerator_riscv.cpp index bc67de54c4bc6..79de9becbaedc 100644 --- a/src/hotspot/cpu/riscv/templateInterpreterGenerator_riscv.cpp +++ b/src/hotspot/cpu/riscv/templateInterpreterGenerator_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2020, 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. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "classfile/javaClasses.hpp" #include "compiler/disassembler.hpp" @@ -85,8 +84,8 @@ address TemplateInterpreterGenerator::generate_slow_signature_handler() { // c_rarg3: first stack arg - wordSize // adjust sp - __ addi(sp, c_rarg3, -18 * wordSize); - __ addi(sp, sp, -2 * wordSize); + __ subi(sp, c_rarg3, 18 * wordSize); + __ subi(sp, sp, 2 * wordSize); __ sd(ra, Address(sp, 0)); __ call_VM(noreg, @@ -189,7 +188,7 @@ address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::M } else { fn = CAST_FROM_FN_PTR(address, StubRoutines::dsin()); } - __ call(fn); + __ rt_call(fn); __ mv(ra, x9); break; case Interpreter::java_lang_math_cos : @@ -202,7 +201,7 @@ address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::M } else { fn = CAST_FROM_FN_PTR(address, StubRoutines::dcos()); } - __ call(fn); + __ rt_call(fn); __ mv(ra, x9); break; case Interpreter::java_lang_math_tan : @@ -215,7 +214,7 @@ address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::M } else { fn = CAST_FROM_FN_PTR(address, StubRoutines::dtan()); } - __ call(fn); + __ rt_call(fn); __ mv(ra, x9); break; case Interpreter::java_lang_math_log : @@ -228,7 +227,7 @@ address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::M } else { fn = CAST_FROM_FN_PTR(address, StubRoutines::dlog()); } - __ call(fn); + __ rt_call(fn); __ mv(ra, x9); break; case Interpreter::java_lang_math_log10 : @@ -241,7 +240,7 @@ address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::M } else { fn = CAST_FROM_FN_PTR(address, StubRoutines::dlog10()); } - __ call(fn); + __ rt_call(fn); __ mv(ra, x9); break; case Interpreter::java_lang_math_exp : @@ -254,7 +253,7 @@ address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::M } else { fn = CAST_FROM_FN_PTR(address, StubRoutines::dexp()); } - __ call(fn); + __ rt_call(fn); __ mv(ra, x9); break; case Interpreter::java_lang_math_pow : @@ -268,7 +267,7 @@ address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::M } else { fn = CAST_FROM_FN_PTR(address, StubRoutines::dpow()); } - __ call(fn); + __ rt_call(fn); __ mv(ra, x9); break; case Interpreter::java_lang_math_fmaD : @@ -714,14 +713,14 @@ void TemplateInterpreterGenerator::lock_method() { const int entry_size = frame::interpreter_frame_monitor_size_in_bytes(); #ifdef ASSERT - __ lwu(x10, access_flags); + __ load_unsigned_short(x10, access_flags); __ verify_access_flags(x10, JVM_ACC_SYNCHRONIZED, "method doesn't need synchronization", false); #endif // ASSERT // get synchronization object { Label done; - __ lwu(x10, access_flags); + __ load_unsigned_short(x10, access_flags); __ andi(t0, x10, JVM_ACC_STATIC); // get receiver (assume this is frequent case) __ ld(x10, Address(xlocals, Interpreter::local_offset_in_bytes(0))); @@ -742,8 +741,8 @@ void TemplateInterpreterGenerator::lock_method() { // add space for monitor & lock __ check_extended_sp(); - __ add(sp, sp, - entry_size); // add space for a monitor entry - __ add(esp, esp, - entry_size); + __ sub(sp, sp, entry_size); // add space for a monitor entry + __ sub(esp, esp, entry_size); __ sub(t0, sp, fp); __ srai(t0, t0, Interpreter::logStackElementSize); __ sd(t0, Address(fp, frame::interpreter_frame_extended_sp_offset * wordSize)); @@ -768,17 +767,17 @@ void TemplateInterpreterGenerator::lock_method() { void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) { // initialize fixed part of activation frame if (native_call) { - __ add(esp, sp, - 14 * wordSize); + __ subi(esp, sp, 14 * wordSize); __ mv(xbcp, zr); - __ add(sp, sp, - 14 * wordSize); + __ subi(sp, sp, 14 * wordSize); // add 2 zero-initialized slots for native calls __ sd(zr, Address(sp, 13 * wordSize)); __ sd(zr, Address(sp, 12 * wordSize)); } else { - __ add(esp, sp, - 12 * wordSize); + __ subi(esp, sp, 12 * wordSize); __ ld(t0, Address(xmethod, Method::const_offset())); // get ConstMethod __ add(xbcp, t0, in_bytes(ConstMethod::codes_offset())); // get codebase - __ add(sp, sp, - 12 * wordSize); + __ subi(sp, sp, 12 * wordSize); } __ sd(xbcp, Address(sp, wordSize)); __ mv(t0, frame::interpreter_frame_initial_sp_offset); @@ -833,7 +832,7 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) { } else { // Make sure there is room for the exception oop pushed in case method throws // an exception (see TemplateInterpreterGenerator::generate_throw_exception()) - __ sub(t0, sp, 2 * wordSize); + __ subi(t0, sp, 2 * wordSize); __ sub(t1, t0, fp); __ srai(t1, t1, Interpreter::logStackElementSize); __ sd(t1, Address(sp, 5 * wordSize)); @@ -1018,7 +1017,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { // compute beginning of parameters (xlocals) __ shadd(xlocals, x12, esp, xlocals, 3); - __ addi(xlocals, xlocals, -wordSize); + __ subi(xlocals, xlocals, wordSize); // Pull SP back to minimum size: this avoids holes in the stack __ andi(sp, esp, -16); @@ -1028,7 +1027,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { // make sure method is native & not abstract #ifdef ASSERT - __ lwu(x10, access_flags); + __ load_unsigned_short(x10, access_flags); __ verify_access_flags(x10, JVM_ACC_NATIVE, "tried to execute non-native method as native", false); __ verify_access_flags(x10, JVM_ACC_ABSTRACT, "tried to execute abstract method in interpreter"); #endif @@ -1066,7 +1065,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { } else { // no synchronization necessary #ifdef ASSERT - __ lwu(x10, access_flags); + __ load_unsigned_short(x10, access_flags); __ verify_access_flags(x10, JVM_ACC_SYNCHRONIZED, "method needs synchronization"); #endif } @@ -1130,7 +1129,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { // pass mirror handle if static call { Label L; - __ lwu(t, Address(xmethod, Method::access_flags_offset())); + __ load_unsigned_short(t, Address(xmethod, Method::access_flags_offset())); __ test_bit(t0, t, exact_log2(JVM_ACC_STATIC)); __ beqz(t0, L); // get mirror @@ -1175,7 +1174,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { { Label L; __ lwu(t, Address(xthread, JavaThread::thread_state_offset())); - __ addi(t0, zr, (u1)_thread_in_Java); + __ mv(t0, (u1)_thread_in_Java); __ beq(t, t0, L); __ stop("Wrong thread state in native stub"); __ bind(L); @@ -1202,7 +1201,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { __ restore_cpu_control_state_after_jni(t0); // make room for the pushes we're about to do - __ sub(t0, esp, 4 * wordSize); + __ subi(t0, esp, 4 * wordSize); __ andi(sp, t0, -16); // NOTE: The order of these pushes is known to frame::interpreter_frame_result @@ -1308,7 +1307,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { { Label no_reguard; __ lwu(t0, Address(xthread, in_bytes(JavaThread::stack_guard_state_offset()))); - __ addi(t1, zr, (u1)StackOverflow::stack_guard_yellow_reserved_disabled); + __ mv(t1, (u1)StackOverflow::stack_guard_yellow_reserved_disabled); __ bne(t0, t1, no_reguard); __ push_call_clobbered_registers(); @@ -1346,7 +1345,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { // do unlocking if necessary { Label L; - __ lwu(t, Address(xmethod, Method::access_flags_offset())); + __ load_unsigned_short(t, Address(xmethod, Method::access_flags_offset())); __ test_bit(t0, t, exact_log2(JVM_ACC_SYNCHRONIZED)); __ beqz(t0, L); // the code below should be shared with interpreter macro @@ -1440,7 +1439,7 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) { // compute beginning of parameters (xlocals) __ shadd(xlocals, x12, esp, t1, 3); - __ add(xlocals, xlocals, -wordSize); + __ subi(xlocals, xlocals, wordSize); // Make room for additional locals __ slli(t1, x13, 3); @@ -1458,8 +1457,8 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) { __ blez(x13, exit); // do nothing if x13 <= 0 __ bind(loop); __ sd(zr, Address(t0)); - __ add(t0, t0, wordSize); - __ add(x13, x13, -1); // until everything initialized + __ addi(t0, t0, wordSize); + __ subi(x13, x13, 1); // until everything initialized __ bnez(x13, loop); __ bind(exit); } @@ -1472,7 +1471,7 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) { // make sure method is not native & not abstract #ifdef ASSERT - __ lwu(x10, access_flags); + __ load_unsigned_short(x10, access_flags); __ verify_access_flags(x10, JVM_ACC_NATIVE, "tried to execute native method as non-native"); __ verify_access_flags(x10, JVM_ACC_ABSTRACT, "tried to execute abstract method in interpreter"); #endif @@ -1519,7 +1518,7 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) { } else { // no synchronization necessary #ifdef ASSERT - __ lwu(x10, access_flags); + __ load_unsigned_short(x10, access_flags); __ verify_access_flags(x10, JVM_ACC_SYNCHRONIZED, "method needs synchronization"); #endif } @@ -1650,7 +1649,7 @@ void TemplateInterpreterGenerator::generate_throw_exception() { __ slli(x10, x10, Interpreter::logStackElementSize); __ restore_locals(); __ sub(xlocals, xlocals, x10); - __ add(xlocals, xlocals, wordSize); + __ addi(xlocals, xlocals, wordSize); // Save these arguments __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, Deoptimization:: @@ -1745,7 +1744,7 @@ void TemplateInterpreterGenerator::generate_throw_exception() { // sp: expression stack of caller // fp: fp of caller // FIXME: There's no point saving ra here because VM calls don't trash it - __ sub(sp, sp, 2 * wordSize); + __ subi(sp, sp, 2 * wordSize); __ sd(x10, Address(sp, 0)); // save exception __ sd(ra, Address(sp, wordSize)); // save return address __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, @@ -1754,7 +1753,7 @@ void TemplateInterpreterGenerator::generate_throw_exception() { __ mv(x11, x10); // save exception handler __ ld(x10, Address(sp, 0)); // restore exception __ ld(ra, Address(sp, wordSize)); // restore return address - __ add(sp, sp, 2 * wordSize); + __ addi(sp, sp, 2 * wordSize); // We might be returning to a deopt handler that expects x13 to // contain the exception pc __ mv(x13, ra); diff --git a/src/hotspot/cpu/riscv/templateTable_riscv.cpp b/src/hotspot/cpu/riscv/templateTable_riscv.cpp index e51604569f688..cb4ded3c330b6 100644 --- a/src/hotspot/cpu/riscv/templateTable_riscv.cpp +++ b/src/hotspot/cpu/riscv/templateTable_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 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. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "compiler/disassembler.hpp" #include "gc/shared/barrierSetAssembler.hpp" @@ -197,7 +196,7 @@ void TemplateTable::patch_bytecode(Bytecodes::Code bc, Register bc_reg, Label L_fast_patch; // if a breakpoint is present we can't rewrite the stream directly __ load_unsigned_byte(temp_reg, at_bcp(0)); - __ addi(temp_reg, temp_reg, -Bytecodes::_breakpoint); // temp_reg is temporary register. + __ subi(temp_reg, temp_reg, Bytecodes::_breakpoint); // temp_reg is temporary register. __ bnez(temp_reg, L_fast_patch); // Let breakpoint table handling rewrite to quicker bytecode __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::set_original_bytecode_at), xmethod, xbcp, bc_reg); @@ -209,7 +208,7 @@ void TemplateTable::patch_bytecode(Bytecodes::Code bc, Register bc_reg, Label L_okay; __ load_unsigned_byte(temp_reg, at_bcp(0)); __ beq(temp_reg, bc_reg, L_okay); - __ addi(temp_reg, temp_reg, -(int) Bytecodes::java_code(bc)); + __ subi(temp_reg, temp_reg, (int)Bytecodes::java_code(bc)); __ beqz(temp_reg, L_okay); __ stop("patching the wrong bytecode"); __ bind(L_okay); @@ -737,7 +736,7 @@ void TemplateTable::iaload() { // x10: array // x11: index index_check(x10, x11); // leaves index in x11 - __ add(x11, x11, arrayOopDesc::base_offset_in_bytes(T_INT) >> 2); + __ addi(x11, x11, arrayOopDesc::base_offset_in_bytes(T_INT) >> 2); __ shadd(x10, x11, x10, t0, 2); __ access_load_at(T_INT, IN_HEAP | IS_ARRAY, x10, Address(x10), noreg, noreg); __ sext(x10, x10, 32); @@ -750,7 +749,7 @@ void TemplateTable::laload() { // x10: array // x11: index index_check(x10, x11); // leaves index in x11 - __ add(x11, x11, arrayOopDesc::base_offset_in_bytes(T_LONG) >> 3); + __ addi(x11, x11, arrayOopDesc::base_offset_in_bytes(T_LONG) >> 3); __ shadd(x10, x11, x10, t0, 3); __ access_load_at(T_LONG, IN_HEAP | IS_ARRAY, x10, Address(x10), noreg, noreg); } @@ -762,7 +761,7 @@ void TemplateTable::faload() { // x10: array // x11: index index_check(x10, x11); // leaves index in x11 - __ add(x11, x11, arrayOopDesc::base_offset_in_bytes(T_FLOAT) >> 2); + __ addi(x11, x11, arrayOopDesc::base_offset_in_bytes(T_FLOAT) >> 2); __ shadd(x10, x11, x10, t0, 2); __ access_load_at(T_FLOAT, IN_HEAP | IS_ARRAY, x10, Address(x10), noreg, noreg); } @@ -774,7 +773,7 @@ void TemplateTable::daload() { // x10: array // x11: index index_check(x10, x11); // leaves index in x11 - __ add(x11, x11, arrayOopDesc::base_offset_in_bytes(T_DOUBLE) >> 3); + __ addi(x11, x11, arrayOopDesc::base_offset_in_bytes(T_DOUBLE) >> 3); __ shadd(x10, x11, x10, t0, 3); __ access_load_at(T_DOUBLE, IN_HEAP | IS_ARRAY, x10, Address(x10), noreg, noreg); } @@ -786,7 +785,7 @@ void TemplateTable::aaload() { // x10: array // x11: index index_check(x10, x11); // leaves index in x11 - __ add(x11, x11, arrayOopDesc::base_offset_in_bytes(T_OBJECT) >> LogBytesPerHeapOop); + __ addi(x11, x11, arrayOopDesc::base_offset_in_bytes(T_OBJECT) >> LogBytesPerHeapOop); __ shadd(x10, x11, x10, t0, LogBytesPerHeapOop); do_oop_load(_masm, Address(x10), x10, IS_ARRAY); } @@ -798,7 +797,7 @@ void TemplateTable::baload() { // x10: array // x11: index index_check(x10, x11); // leaves index in x11 - __ add(x11, x11, arrayOopDesc::base_offset_in_bytes(T_BYTE) >> 0); + __ addi(x11, x11, arrayOopDesc::base_offset_in_bytes(T_BYTE) >> 0); __ shadd(x10, x11, x10, t0, 0); __ access_load_at(T_BYTE, IN_HEAP | IS_ARRAY, x10, Address(x10), noreg, noreg); } @@ -810,7 +809,7 @@ void TemplateTable::caload() { // x10: array // x11: index index_check(x10, x11); // leaves index in x11 - __ add(x11, x11, arrayOopDesc::base_offset_in_bytes(T_CHAR) >> 1); + __ addi(x11, x11, arrayOopDesc::base_offset_in_bytes(T_CHAR) >> 1); __ shadd(x10, x11, x10, t0, 1); __ access_load_at(T_CHAR, IN_HEAP | IS_ARRAY, x10, Address(x10), noreg, noreg); } @@ -826,7 +825,7 @@ void TemplateTable::fast_icaload() { // x10: array // x11: index index_check(x10, x11); // leaves index in x11, kills t0 - __ add(x11, x11, arrayOopDesc::base_offset_in_bytes(T_CHAR) >> 1); // addi, max imm is 2^11 + __ addi(x11, x11, arrayOopDesc::base_offset_in_bytes(T_CHAR) >> 1); // addi, max imm is 2^11 __ shadd(x10, x11, x10, t0, 1); __ access_load_at(T_CHAR, IN_HEAP | IS_ARRAY, x10, Address(x10), noreg, noreg); } @@ -838,7 +837,7 @@ void TemplateTable::saload() { // x10: array // x11: index index_check(x10, x11); // leaves index in x11, kills t0 - __ add(x11, x11, arrayOopDesc::base_offset_in_bytes(T_SHORT) >> 1); + __ addi(x11, x11, arrayOopDesc::base_offset_in_bytes(T_SHORT) >> 1); __ shadd(x10, x11, x10, t0, 1); __ access_load_at(T_SHORT, IN_HEAP | IS_ARRAY, x10, Address(x10), noreg, noreg); } @@ -1017,7 +1016,7 @@ void TemplateTable::iastore() { // x11: index // x13: array index_check(x13, x11); // prefer index in x11 - __ add(x11, x11, arrayOopDesc::base_offset_in_bytes(T_INT) >> 2); + __ addi(x11, x11, arrayOopDesc::base_offset_in_bytes(T_INT) >> 2); __ shadd(t0, x11, x13, t0, 2); __ access_store_at(T_INT, IN_HEAP | IS_ARRAY, Address(t0, 0), x10, noreg, noreg, noreg); } @@ -1030,7 +1029,7 @@ void TemplateTable::lastore() { // x11: index // x13: array index_check(x13, x11); // prefer index in x11 - __ add(x11, x11, arrayOopDesc::base_offset_in_bytes(T_LONG) >> 3); + __ addi(x11, x11, arrayOopDesc::base_offset_in_bytes(T_LONG) >> 3); __ shadd(t0, x11, x13, t0, 3); __ access_store_at(T_LONG, IN_HEAP | IS_ARRAY, Address(t0, 0), x10, noreg, noreg, noreg); } @@ -1043,7 +1042,7 @@ void TemplateTable::fastore() { // x11: index // x13: array index_check(x13, x11); // prefer index in x11 - __ add(x11, x11, arrayOopDesc::base_offset_in_bytes(T_FLOAT) >> 2); + __ addi(x11, x11, arrayOopDesc::base_offset_in_bytes(T_FLOAT) >> 2); __ shadd(t0, x11, x13, t0, 2); __ access_store_at(T_FLOAT, IN_HEAP | IS_ARRAY, Address(t0, 0), noreg /* ftos */, noreg, noreg, noreg); } @@ -1056,7 +1055,7 @@ void TemplateTable::dastore() { // x11: index // x13: array index_check(x13, x11); // prefer index in x11 - __ add(x11, x11, arrayOopDesc::base_offset_in_bytes(T_DOUBLE) >> 3); + __ addi(x11, x11, arrayOopDesc::base_offset_in_bytes(T_DOUBLE) >> 3); __ shadd(t0, x11, x13, t0, 3); __ access_store_at(T_DOUBLE, IN_HEAP | IS_ARRAY, Address(t0, 0), noreg /* dtos */, noreg, noreg, noreg); } @@ -1070,7 +1069,7 @@ void TemplateTable::aastore() { __ ld(x13, at_tos_p2()); // array index_check(x13, x12); // kills x11 - __ add(x14, x12, arrayOopDesc::base_offset_in_bytes(T_OBJECT) >> LogBytesPerHeapOop); + __ addi(x14, x12, arrayOopDesc::base_offset_in_bytes(T_OBJECT) >> LogBytesPerHeapOop); __ shadd(x14, x14, x13, x14, LogBytesPerHeapOop); Address element_address(x14, 0); @@ -1112,7 +1111,7 @@ void TemplateTable::aastore() { // Pop stack arguments __ bind(done); - __ add(esp, esp, 3 * Interpreter::stackElementSize); + __ addi(esp, esp, 3 * Interpreter::stackElementSize); } void TemplateTable::bastore() { @@ -1134,7 +1133,7 @@ void TemplateTable::bastore() { __ andi(x10, x10, 1); // if it is a T_BOOLEAN array, mask the stored value to 0/1 __ bind(L_skip); - __ add(x11, x11, arrayOopDesc::base_offset_in_bytes(T_BYTE) >> 0); + __ addi(x11, x11, arrayOopDesc::base_offset_in_bytes(T_BYTE) >> 0); __ add(x11, x13, x11); __ access_store_at(T_BYTE, IN_HEAP | IS_ARRAY, Address(x11, 0), x10, noreg, noreg, noreg); @@ -1148,7 +1147,7 @@ void TemplateTable::castore() { // x11: index // x13: array index_check(x13, x11); // prefer index in x11 - __ add(x11, x11, arrayOopDesc::base_offset_in_bytes(T_CHAR) >> 1); + __ addi(x11, x11, arrayOopDesc::base_offset_in_bytes(T_CHAR) >> 1); __ shadd(t0, x11, x13, t0, 1); __ access_store_at(T_CHAR, IN_HEAP | IS_ARRAY, Address(t0, 0), x10, noreg, noreg, noreg); } @@ -1883,7 +1882,7 @@ void TemplateTable::ret() { __ profile_ret(x11, x12); __ ld(xbcp, Address(xmethod, Method::const_offset())); __ add(xbcp, xbcp, x11); - __ addi(xbcp, xbcp, in_bytes(ConstMethod::codes_offset())); + __ add(xbcp, xbcp, in_bytes(ConstMethod::codes_offset())); __ dispatch_next(vtos, 0, /*generate_poll*/true); } @@ -1958,7 +1957,7 @@ void TemplateTable::fast_linearswitch() { __ lw(t0, Address(t0, 2 * BytesPerInt)); __ beq(x10, t0, found); __ bind(loop_entry); - __ addi(x11, x11, -1); + __ subi(x11, x11, 1); __ bgez(x11, loop); // default case __ profile_switch_default(x10); @@ -2544,7 +2543,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr __ j(Done); __ bind(notByte); - __ sub(t0, tos_state, (u1)ztos); + __ subi(t0, tos_state, (u1)ztos); __ bnez(t0, notBool); // ztos (same code as btos) @@ -2558,7 +2557,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr __ j(Done); __ bind(notBool); - __ sub(t0, tos_state, (u1)atos); + __ subi(t0, tos_state, (u1)atos); __ bnez(t0, notObj); // atos do_oop_load(_masm, field, x10, IN_HEAP); @@ -2569,7 +2568,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr __ j(Done); __ bind(notObj); - __ sub(t0, tos_state, (u1)itos); + __ subi(t0, tos_state, (u1)itos); __ bnez(t0, notInt); // itos __ access_load_at(T_INT, IN_HEAP, x10, field, noreg, noreg); @@ -2582,7 +2581,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr __ j(Done); __ bind(notInt); - __ sub(t0, tos_state, (u1)ctos); + __ subi(t0, tos_state, (u1)ctos); __ bnez(t0, notChar); // ctos __ access_load_at(T_CHAR, IN_HEAP, x10, field, noreg, noreg); @@ -2594,7 +2593,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr __ j(Done); __ bind(notChar); - __ sub(t0, tos_state, (u1)stos); + __ subi(t0, tos_state, (u1)stos); __ bnez(t0, notShort); // stos __ access_load_at(T_SHORT, IN_HEAP, x10, field, noreg, noreg); @@ -2606,7 +2605,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr __ j(Done); __ bind(notShort); - __ sub(t0, tos_state, (u1)ltos); + __ subi(t0, tos_state, (u1)ltos); __ bnez(t0, notLong); // ltos __ access_load_at(T_LONG, IN_HEAP, x10, field, noreg, noreg); @@ -2618,7 +2617,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr __ j(Done); __ bind(notLong); - __ sub(t0, tos_state, (u1)ftos); + __ subi(t0, tos_state, (u1)ftos); __ bnez(t0, notFloat); // ftos __ access_load_at(T_FLOAT, IN_HEAP, noreg /* ftos */, field, noreg, noreg); @@ -2631,7 +2630,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr __ bind(notFloat); #ifdef ASSERT - __ sub(t0, tos_state, (u1)dtos); + __ subi(t0, tos_state, (u1)dtos); __ bnez(t0, notDouble); #endif // dtos @@ -2696,9 +2695,9 @@ void TemplateTable::jvmti_post_field_mod(Register cache, Register index, bool is __ load_unsigned_byte(c_rarg3, Address(c_rarg2, in_bytes(ResolvedFieldEntry::type_offset()))); Label nope2, done, ok; __ ld(c_rarg1, at_tos_p1()); // initially assume a one word jvalue - __ sub(t0, c_rarg3, ltos); + __ subi(t0, c_rarg3, (u1)ltos); __ beqz(t0, ok); - __ sub(t0, c_rarg3, dtos); + __ subi(t0, c_rarg3, (u1)dtos); __ bnez(t0, nope2); __ bind(ok); __ ld(c_rarg1, at_tos_p2()); // ltos (two word jvalue); @@ -2772,7 +2771,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr } __ bind(notByte); - __ sub(t0, tos_state, (u1)ztos); + __ subi(t0, tos_state, (u1)ztos); __ bnez(t0, notBool); // ztos @@ -2792,7 +2791,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr } __ bind(notBool); - __ sub(t0, tos_state, (u1)atos); + __ subi(t0, tos_state, (u1)atos); __ bnez(t0, notObj); // atos @@ -2813,7 +2812,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr } __ bind(notObj); - __ sub(t0, tos_state, (u1)itos); + __ subi(t0, tos_state, (u1)itos); __ bnez(t0, notInt); // itos @@ -2833,7 +2832,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr } __ bind(notInt); - __ sub(t0, tos_state, (u1)ctos); + __ subi(t0, tos_state, (u1)ctos); __ bnez(t0, notChar); // ctos @@ -2853,7 +2852,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr } __ bind(notChar); - __ sub(t0, tos_state, (u1)stos); + __ subi(t0, tos_state, (u1)stos); __ bnez(t0, notShort); // stos @@ -2873,7 +2872,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr } __ bind(notShort); - __ sub(t0, tos_state, (u1)ltos); + __ subi(t0, tos_state, (u1)ltos); __ bnez(t0, notLong); // ltos @@ -2893,7 +2892,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr } __ bind(notLong); - __ sub(t0, tos_state, (u1)ftos); + __ subi(t0, tos_state, (u1)ftos); __ bnez(t0, notFloat); // ftos @@ -2914,7 +2913,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr __ bind(notFloat); #ifdef ASSERT - __ sub(t0, tos_state, (u1)dtos); + __ subi(t0, tos_state, (u1)dtos); __ bnez(t0, notDouble); #endif @@ -3207,7 +3206,7 @@ void TemplateTable::fast_xaccess(TosState state) { __ bind(notVolatile); } - __ sub(xbcp, xbcp, 1); + __ subi(xbcp, xbcp, 1); } //----------------------------------------------------------------------------- @@ -3521,7 +3520,7 @@ void TemplateTable::_new() { __ la(t0, Address(t0, tags_offset)); __ lbu(t0, t0); __ membar(MacroAssembler::LoadLoad | MacroAssembler::LoadStore); - __ sub(t1, t0, (u1)JVM_CONSTANT_Class); + __ subi(t1, t0, (u1)JVM_CONSTANT_Class); __ bnez(t1, slow_case); // get InstanceKlass @@ -3558,9 +3557,9 @@ void TemplateTable::_new() { // zero, go directly to the header initialization. if (UseCompactObjectHeaders) { assert(is_aligned(oopDesc::base_offset_in_bytes(), BytesPerLong), "oop base offset must be 8-byte-aligned"); - __ sub(x13, x13, oopDesc::base_offset_in_bytes()); + __ subi(x13, x13, oopDesc::base_offset_in_bytes()); } else { - __ sub(x13, x13, sizeof(oopDesc)); + __ subi(x13, x13, sizeof(oopDesc)); } __ beqz(x13, initialize_header); @@ -3568,15 +3567,15 @@ void TemplateTable::_new() { { if (UseCompactObjectHeaders) { assert(is_aligned(oopDesc::base_offset_in_bytes(), BytesPerLong), "oop base offset must be 8-byte-aligned"); - __ add(x12, x10, oopDesc::base_offset_in_bytes()); + __ addi(x12, x10, oopDesc::base_offset_in_bytes()); } else { - __ add(x12, x10, sizeof(oopDesc)); + __ addi(x12, x10, sizeof(oopDesc)); } Label loop; __ bind(loop); __ sd(zr, Address(x12)); - __ add(x12, x12, BytesPerLong); - __ sub(x13, x13, BytesPerLong); + __ addi(x12, x12, BytesPerLong); + __ subi(x13, x13, BytesPerLong); __ bnez(x13, loop); } @@ -3649,11 +3648,11 @@ void TemplateTable::checkcast() { __ get_cpool_and_tags(x12, x13); // x12=cpool, x13=tags array __ get_unsigned_2_byte_index_at_bcp(x9, 1); // x9=index // See if bytecode has already been quicked - __ add(t0, x13, Array::base_offset_in_bytes()); + __ addi(t0, x13, Array::base_offset_in_bytes()); __ add(x11, t0, x9); __ lbu(x11, x11); __ membar(MacroAssembler::LoadLoad | MacroAssembler::LoadStore); - __ sub(t0, x11, (u1)JVM_CONSTANT_Class); + __ subi(t0, x11, (u1)JVM_CONSTANT_Class); __ beqz(t0, quicked); __ push(atos); // save receiver for result, and for GC @@ -3704,11 +3703,11 @@ void TemplateTable::instanceof() { __ get_cpool_and_tags(x12, x13); // x12=cpool, x13=tags array __ get_unsigned_2_byte_index_at_bcp(x9, 1); // x9=index // See if bytecode has already been quicked - __ add(t0, x13, Array::base_offset_in_bytes()); + __ addi(t0, x13, Array::base_offset_in_bytes()); __ add(x11, t0, x9); __ lbu(x11, x11); __ membar(MacroAssembler::LoadLoad | MacroAssembler::LoadStore); - __ sub(t0, x11, (u1)JVM_CONSTANT_Class); + __ subi(t0, x11, (u1)JVM_CONSTANT_Class); __ beqz(t0, quicked); __ push(atos); // save receiver for result, and for GC @@ -3884,7 +3883,7 @@ void TemplateTable::monitorenter() { __ ld(c_rarg2, Address(c_rarg3, entry_size)); // load expression stack // word from old location __ sd(c_rarg2, Address(c_rarg3, 0)); // and store it at new location - __ add(c_rarg3, c_rarg3, wordSize); // advance to next word + __ addi(c_rarg3, c_rarg3, wordSize); // advance to next word __ bind(entry); __ bne(c_rarg3, c_rarg1, loop); // check if bottom reached.if not at bottom // then copy next word @@ -3979,7 +3978,7 @@ void TemplateTable::multianewarray() { // last dim is on top of stack; we want address of first one: // first_addr = last_addr + (ndims - 1) * wordSize __ shadd(c_rarg1, x10, esp, c_rarg1, 3); - __ sub(c_rarg1, c_rarg1, wordSize); + __ subi(c_rarg1, c_rarg1, wordSize); call_VM(x10, CAST_FROM_FN_PTR(address, InterpreterRuntime::multianewarray), c_rarg1); diff --git a/src/hotspot/cpu/riscv/upcallLinker_riscv.cpp b/src/hotspot/cpu/riscv/upcallLinker_riscv.cpp index 8fb0530d98fa1..fa6fe60b71e3d 100644 --- a/src/hotspot/cpu/riscv/upcallLinker_riscv.cpp +++ b/src/hotspot/cpu/riscv/upcallLinker_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "classfile/javaClasses.hpp" #include "logging/logStream.hpp" diff --git a/src/hotspot/cpu/riscv/vm_version_riscv.cpp b/src/hotspot/cpu/riscv/vm_version_riscv.cpp index a30ae45160611..5d7ed4bda601c 100644 --- a/src/hotspot/cpu/riscv/vm_version_riscv.cpp +++ b/src/hotspot/cpu/riscv/vm_version_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2023, Huawei Technologies Co., Ltd. All rights reserved. * Copyright (c) 2023, Rivos Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "runtime/java.hpp" #include "runtime/os.inline.hpp" #include "runtime/vm_version.hpp" diff --git a/src/hotspot/cpu/riscv/vm_version_riscv.hpp b/src/hotspot/cpu/riscv/vm_version_riscv.hpp index 59b41892fef0c..5f51970edf111 100644 --- a/src/hotspot/cpu/riscv/vm_version_riscv.hpp +++ b/src/hotspot/cpu/riscv/vm_version_riscv.hpp @@ -115,6 +115,7 @@ class VM_Version : public Abstract_VM_Version { // Zbs Single-bit instructions // // Zfh Half-Precision Floating-Point instructions + // Zfhmin Minimal Half-Precision Floating-Point instructions // // Zicond Conditional operations // @@ -157,7 +158,9 @@ class VM_Version : public Abstract_VM_Version { decl(ext_Zbs , "Zbs" , RV_NO_FLAG_BIT, true , UPDATE_DEFAULT(UseZbs)) \ decl(ext_Zcb , "Zcb" , RV_NO_FLAG_BIT, true , UPDATE_DEFAULT(UseZcb)) \ decl(ext_Zfh , "Zfh" , RV_NO_FLAG_BIT, true , UPDATE_DEFAULT(UseZfh)) \ + decl(ext_Zfhmin , "Zfhmin" , RV_NO_FLAG_BIT, true , UPDATE_DEFAULT(UseZfhmin)) \ decl(ext_Zicsr , "Zicsr" , RV_NO_FLAG_BIT, true , NO_UPDATE_DEFAULT) \ + decl(ext_Zicntr , "Zicntr" , RV_NO_FLAG_BIT, true , NO_UPDATE_DEFAULT) \ decl(ext_Zifencei , "Zifencei" , RV_NO_FLAG_BIT, true , NO_UPDATE_DEFAULT) \ decl(ext_Zic64b , "Zic64b" , RV_NO_FLAG_BIT, true , UPDATE_DEFAULT(UseZic64b)) \ decl(ext_Ztso , "Ztso" , RV_NO_FLAG_BIT, true , UPDATE_DEFAULT(UseZtso)) \ @@ -223,6 +226,7 @@ class VM_Version : public Abstract_VM_Version { RV_ENABLE_EXTENSION(UseZbb) \ RV_ENABLE_EXTENSION(UseZbs) \ RV_ENABLE_EXTENSION(UseZcb) \ + RV_ENABLE_EXTENSION(UseZfhmin) \ RV_ENABLE_EXTENSION(UseZic64b) \ RV_ENABLE_EXTENSION(UseZicbom) \ RV_ENABLE_EXTENSION(UseZicbop) \ diff --git a/src/hotspot/cpu/riscv/vmreg_riscv.cpp b/src/hotspot/cpu/riscv/vmreg_riscv.cpp index ce11df57f84f3..dfc55062344ee 100644 --- a/src/hotspot/cpu/riscv/vmreg_riscv.cpp +++ b/src/hotspot/cpu/riscv/vmreg_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "code/vmreg.hpp" #include "vmreg_riscv.inline.hpp" diff --git a/src/hotspot/cpu/riscv/vtableStubs_riscv.cpp b/src/hotspot/cpu/riscv/vtableStubs_riscv.cpp index 573c5d901fcfd..d889141c74437 100644 --- a/src/hotspot/cpu/riscv/vtableStubs_riscv.cpp +++ b/src/hotspot/cpu/riscv/vtableStubs_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 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. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.inline.hpp" #include "asm/macroAssembler.inline.hpp" #include "code/compiledIC.hpp" diff --git a/src/hotspot/cpu/s390/abstractInterpreter_s390.cpp b/src/hotspot/cpu/s390/abstractInterpreter_s390.cpp index c24c2b56bf7a9..bddac3953a1e4 100644 --- a/src/hotspot/cpu/s390/abstractInterpreter_s390.cpp +++ b/src/hotspot/cpu/s390/abstractInterpreter_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "interpreter/interpreter.hpp" #include "oops/constMethod.hpp" #include "oops/klass.inline.hpp" diff --git a/src/hotspot/cpu/s390/assembler_s390.cpp b/src/hotspot/cpu/s390/assembler_s390.cpp index 63cc7e28d5919..9a8ba8f296336 100644 --- a/src/hotspot/cpu/s390/assembler_s390.cpp +++ b/src/hotspot/cpu/s390/assembler_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.inline.hpp" #include "compiler/disassembler.hpp" #include "gc/shared/collectedHeap.inline.hpp" diff --git a/src/hotspot/cpu/s390/assembler_s390.hpp b/src/hotspot/cpu/s390/assembler_s390.hpp index 1ba90b69d1748..c0cee5bd55537 100644 --- a/src/hotspot/cpu/s390/assembler_s390.hpp +++ b/src/hotspot/cpu/s390/assembler_s390.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -140,7 +140,7 @@ class RelAddr { return 0; // Yet unknown branch destination. } else { guarantee(is_in_range_of_RelAddr(target, pc, shortForm), - "target not within reach at " INTPTR_FORMAT ", distance = " INTX_FORMAT, p2i(pc), (target - pc) ); + "target not within reach at " INTPTR_FORMAT ", distance = %zd", p2i(pc), (target - pc) ); return (int)((target - pc)>>1); } } diff --git a/src/hotspot/cpu/s390/c1_CodeStubs_s390.cpp b/src/hotspot/cpu/s390/c1_CodeStubs_s390.cpp index e01e4458e38d3..c858a4b8cb14b 100644 --- a/src/hotspot/cpu/s390/c1_CodeStubs_s390.cpp +++ b/src/hotspot/cpu/s390/c1_CodeStubs_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "c1/c1_CodeStubs.hpp" #include "c1/c1_FrameMap.hpp" diff --git a/src/hotspot/cpu/s390/c1_FrameMap_s390.cpp b/src/hotspot/cpu/s390/c1_FrameMap_s390.cpp index 802d794c4e061..9fa6da8341ff8 100644 --- a/src/hotspot/cpu/s390/c1_FrameMap_s390.cpp +++ b/src/hotspot/cpu/s390/c1_FrameMap_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016, 2019 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_FrameMap.hpp" #include "c1/c1_LIR.hpp" #include "runtime/sharedRuntime.hpp" diff --git a/src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp b/src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp index bb0494dc4785a..48bd5c3afdee2 100644 --- a/src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp +++ b/src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "c1/c1_Compilation.hpp" #include "c1/c1_LIRAssembler.hpp" diff --git a/src/hotspot/cpu/s390/c1_LIRGenerator_s390.cpp b/src/hotspot/cpu/s390/c1_LIRGenerator_s390.cpp index c12f883ab58e2..bce2f142aef8c 100644 --- a/src/hotspot/cpu/s390/c1_LIRGenerator_s390.cpp +++ b/src/hotspot/cpu/s390/c1_LIRGenerator_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_Compilation.hpp" #include "c1/c1_FrameMap.hpp" #include "c1/c1_Instruction.hpp" diff --git a/src/hotspot/cpu/s390/c1_LIR_s390.cpp b/src/hotspot/cpu/s390/c1_LIR_s390.cpp index 4788a398de8ab..3d36390a5ce52 100644 --- a/src/hotspot/cpu/s390/c1_LIR_s390.cpp +++ b/src/hotspot/cpu/s390/c1_LIR_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/register.hpp" #include "c1/c1_FrameMap.hpp" #include "c1/c1_LIR.hpp" diff --git a/src/hotspot/cpu/s390/c1_LinearScan_s390.cpp b/src/hotspot/cpu/s390/c1_LinearScan_s390.cpp index f48496f34d3ee..a5edd65ada845 100644 --- a/src/hotspot/cpu/s390/c1_LinearScan_s390.cpp +++ b/src/hotspot/cpu/s390/c1_LinearScan_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_LinearScan.hpp" #include "utilities/debug.hpp" diff --git a/src/hotspot/cpu/s390/c1_MacroAssembler_s390.cpp b/src/hotspot/cpu/s390/c1_MacroAssembler_s390.cpp index bc269f9353ceb..5691a2055b3a2 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, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "c1/c1_MacroAssembler.hpp" #include "c1/c1_Runtime1.hpp" diff --git a/src/hotspot/cpu/s390/c1_Runtime1_s390.cpp b/src/hotspot/cpu/s390/c1_Runtime1_s390.cpp index 0ada76ccef780..34b21ff3d15ca 100644 --- a/src/hotspot/cpu/s390/c1_Runtime1_s390.cpp +++ b/src/hotspot/cpu/s390/c1_Runtime1_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "c1/c1_Defs.hpp" #include "c1/c1_MacroAssembler.hpp" diff --git a/src/hotspot/cpu/s390/c2_MacroAssembler_s390.cpp b/src/hotspot/cpu/s390/c2_MacroAssembler_s390.cpp index faa24bc880796..485efec6b9b68 100644 --- a/src/hotspot/cpu/s390/c2_MacroAssembler_s390.cpp +++ b/src/hotspot/cpu/s390/c2_MacroAssembler_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" #include "opto/c2_MacroAssembler.hpp" diff --git a/src/hotspot/cpu/s390/c2_init_s390.cpp b/src/hotspot/cpu/s390/c2_init_s390.cpp index d2fa9f07f7897..ad18c71ee2f8b 100644 --- a/src/hotspot/cpu/s390/c2_init_s390.cpp +++ b/src/hotspot/cpu/s390/c2_init_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "opto/compile.hpp" #include "opto/node.hpp" diff --git a/src/hotspot/cpu/s390/compiledIC_s390.cpp b/src/hotspot/cpu/s390/compiledIC_s390.cpp index 7891e85b9115e..8501a0cb346a1 100644 --- a/src/hotspot/cpu/s390/compiledIC_s390.cpp +++ b/src/hotspot/cpu/s390/compiledIC_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016, 2019 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "code/compiledIC.hpp" #include "code/nmethod.hpp" diff --git a/src/hotspot/cpu/s390/compressedKlass_s390.cpp b/src/hotspot/cpu/s390/compressedKlass_s390.cpp index 868df0f02d7cb..06077b48f99a1 100644 --- a/src/hotspot/cpu/s390/compressedKlass_s390.cpp +++ b/src/hotspot/cpu/s390/compressedKlass_s390.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2023, Red Hat, Inc. All rights reserved. - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * */ -#include "precompiled.hpp" #include "oops/compressedKlass.hpp" #include "utilities/globalDefinitions.hpp" diff --git a/src/hotspot/cpu/s390/downcallLinker_s390.cpp b/src/hotspot/cpu/s390/downcallLinker_s390.cpp index 85ddc5bf18548..ad375fb20ce82 100644 --- a/src/hotspot/cpu/s390/downcallLinker_s390.cpp +++ b/src/hotspot/cpu/s390/downcallLinker_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, Red Hat, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -22,7 +22,6 @@ * questions. */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "code/codeBlob.hpp" #include "code/codeCache.hpp" diff --git a/src/hotspot/cpu/s390/foreignGlobals_s390.cpp b/src/hotspot/cpu/s390/foreignGlobals_s390.cpp index b716b9126f2c8..1ad0570bad8ab 100644 --- a/src/hotspot/cpu/s390/foreignGlobals_s390.cpp +++ b/src/hotspot/cpu/s390/foreignGlobals_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, Red Hat, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -22,7 +22,6 @@ * questions. */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "code/vmreg.inline.hpp" #include "runtime/jniHandles.hpp" diff --git a/src/hotspot/cpu/s390/frame_s390.cpp b/src/hotspot/cpu/s390/frame_s390.cpp index f461aa67b08f2..01ed22c7d8620 100644 --- a/src/hotspot/cpu/s390/frame_s390.cpp +++ b/src/hotspot/cpu/s390/frame_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "compiler/oopMap.hpp" #include "interpreter/interpreter.hpp" #include "memory/resourceArea.hpp" diff --git a/src/hotspot/cpu/s390/gc/g1/g1BarrierSetAssembler_s390.cpp b/src/hotspot/cpu/s390/gc/g1/g1BarrierSetAssembler_s390.cpp index 544c82d34a769..2054c3db36c50 100644 --- a/src/hotspot/cpu/s390/gc/g1/g1BarrierSetAssembler_s390.cpp +++ b/src/hotspot/cpu/s390/gc/g1/g1BarrierSetAssembler_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "registerSaver_s390.hpp" #include "gc/g1/g1CardTable.hpp" diff --git a/src/hotspot/cpu/s390/gc/shared/barrierSetAssembler_s390.cpp b/src/hotspot/cpu/s390/gc/shared/barrierSetAssembler_s390.cpp index 550bc9ba10938..d6fe10ac9c232 100644 --- a/src/hotspot/cpu/s390/gc/shared/barrierSetAssembler_s390.cpp +++ b/src/hotspot/cpu/s390/gc/shared/barrierSetAssembler_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/barrierSetAssembler.hpp" diff --git a/src/hotspot/cpu/s390/gc/shared/barrierSetNMethod_s390.cpp b/src/hotspot/cpu/s390/gc/shared/barrierSetNMethod_s390.cpp index a912cfcaf8253..85dcc0a4e73f3 100644 --- a/src/hotspot/cpu/s390/gc/shared/barrierSetNMethod_s390.cpp +++ b/src/hotspot/cpu/s390/gc/shared/barrierSetNMethod_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.inline.hpp" #include "code/codeBlob.hpp" #include "code/nativeInst.hpp" diff --git a/src/hotspot/cpu/s390/gc/shared/cardTableBarrierSetAssembler_s390.cpp b/src/hotspot/cpu/s390/gc/shared/cardTableBarrierSetAssembler_s390.cpp index 760f77951fa03..f8f1fe839d232 100644 --- a/src/hotspot/cpu/s390/gc/shared/cardTableBarrierSetAssembler_s390.cpp +++ b/src/hotspot/cpu/s390/gc/shared/cardTableBarrierSetAssembler_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/cardTable.hpp" diff --git a/src/hotspot/cpu/s390/gc/shared/modRefBarrierSetAssembler_s390.cpp b/src/hotspot/cpu/s390/gc/shared/modRefBarrierSetAssembler_s390.cpp index f44a72c27abc1..4d37ae2e4ce5f 100644 --- a/src/hotspot/cpu/s390/gc/shared/modRefBarrierSetAssembler_s390.cpp +++ b/src/hotspot/cpu/s390/gc/shared/modRefBarrierSetAssembler_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "gc/shared/modRefBarrierSetAssembler.hpp" #include "runtime/jniHandles.hpp" diff --git a/src/hotspot/cpu/s390/interp_masm_s390.cpp b/src/hotspot/cpu/s390/interp_masm_s390.cpp index 5e80817aaba7b..cb335e407347b 100644 --- a/src/hotspot/cpu/s390/interp_masm_s390.cpp +++ b/src/hotspot/cpu/s390/interp_masm_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -25,7 +25,6 @@ // Major contributions by AHa, AS, JL, ML. -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/barrierSetAssembler.hpp" @@ -780,7 +779,7 @@ void InterpreterMacroAssembler::unlock_if_synchronized_method(TosState state, get_method(R_method); verify_oop(Z_tos, state); push(state); // Save tos/result. - testbit(method2_(R_method, access_flags), JVM_ACC_SYNCHRONIZED_BIT); + testbit_ushort(method2_(R_method, access_flags), JVM_ACC_SYNCHRONIZED_BIT); z_bfalse(unlocked); // Don't unlock anything if the _do_not_unlock_if_synchronized flag diff --git a/src/hotspot/cpu/s390/interpreterRT_s390.cpp b/src/hotspot/cpu/s390/interpreterRT_s390.cpp index 0f3c18144e9cb..dd5bdc071fc57 100644 --- a/src/hotspot/cpu/s390/interpreterRT_s390.cpp +++ b/src/hotspot/cpu/s390/interpreterRT_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "interpreter/interp_masm.hpp" #include "interpreter/interpreter.hpp" diff --git a/src/hotspot/cpu/s390/jniFastGetField_s390.cpp b/src/hotspot/cpu/s390/jniFastGetField_s390.cpp index 01b0bd528a8aa..f1c8095caa668 100644 --- a/src/hotspot/cpu/s390/jniFastGetField_s390.cpp +++ b/src/hotspot/cpu/s390/jniFastGetField_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/barrierSetAssembler.hpp" diff --git a/src/hotspot/cpu/s390/macroAssembler_s390.cpp b/src/hotspot/cpu/s390/macroAssembler_s390.cpp index a069d6ceafbf0..83a5c61bfc6c1 100644 --- a/src/hotspot/cpu/s390/macroAssembler_s390.cpp +++ b/src/hotspot/cpu/s390/macroAssembler_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016, 2024 SAP SE. All rights reserved. * Copyright 2024 IBM Corporation. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "asm/codeBuffer.hpp" #include "asm/macroAssembler.inline.hpp" #include "code/compiledIC.hpp" @@ -1015,6 +1014,18 @@ void MacroAssembler::load_and_test_long(Register dst, const Address &a) { z_ltg(dst, a); } +// Test a bit in memory for 2 byte datatype. +void MacroAssembler::testbit_ushort(const Address &a, unsigned int bit) { + assert(a.index() == noreg, "no index reg allowed in testbit"); + if (bit <= 7) { + z_tm(a.disp() + 1, a.base(), 1 << bit); + } else if (bit <= 15) { + z_tm(a.disp() + 0, a.base(), 1 << (bit - 8)); + } else { + ShouldNotReachHere(); + } +} + // Test a bit in memory. void MacroAssembler::testbit(const Address &a, unsigned int bit) { assert(a.index() == noreg, "no index reg allowed in testbit"); diff --git a/src/hotspot/cpu/s390/macroAssembler_s390.hpp b/src/hotspot/cpu/s390/macroAssembler_s390.hpp index 159688128189a..d45f1321e0f28 100644 --- a/src/hotspot/cpu/s390/macroAssembler_s390.hpp +++ b/src/hotspot/cpu/s390/macroAssembler_s390.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016, 2024 SAP SE. All rights reserved. * Copyright (c) 2024 IBM Corporation. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -199,6 +199,7 @@ class MacroAssembler: public Assembler { // Test a bit in memory. Result is reflected in CC. void testbit(const Address &a, unsigned int bit); + void testbit_ushort(const Address &a, unsigned int bit); // Test a bit in a register. Result is reflected in CC. void testbit(Register r, unsigned int bitPos); diff --git a/src/hotspot/cpu/s390/macroAssembler_s390.inline.hpp b/src/hotspot/cpu/s390/macroAssembler_s390.inline.hpp index d81562d9e9af0..72724fb66d110 100644 --- a/src/hotspot/cpu/s390/macroAssembler_s390.inline.hpp +++ b/src/hotspot/cpu/s390/macroAssembler_s390.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, 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. * @@ -75,7 +75,7 @@ inline void MacroAssembler::load_address(Register d, const Address &a) { } else if (Displacement::is_validDisp(a.disp())) { z_lay(d, a.disp(), a.indexOrR0(), a.baseOrR0()); } else { - guarantee(false, "displacement = " SIZE_FORMAT_X ", out of range for LA/LAY", a.disp()); + guarantee(false, "displacement = 0x%zx, out of range for LA/LAY", a.disp()); } } diff --git a/src/hotspot/cpu/s390/methodHandles_s390.cpp b/src/hotspot/cpu/s390/methodHandles_s390.cpp index b2071e28478ea..e3de6d911be06 100644 --- a/src/hotspot/cpu/s390/methodHandles_s390.cpp +++ b/src/hotspot/cpu/s390/methodHandles_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "classfile/javaClasses.inline.hpp" #include "classfile/vmClasses.hpp" diff --git a/src/hotspot/cpu/s390/nativeInst_s390.cpp b/src/hotspot/cpu/s390/nativeInst_s390.cpp index 6a6a774dfde58..9990c225a8986 100644 --- a/src/hotspot/cpu/s390/nativeInst_s390.cpp +++ b/src/hotspot/cpu/s390/nativeInst_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -25,7 +25,6 @@ // Major contributions by JL, LS -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "memory/resourceArea.hpp" #include "nativeInst_s390.hpp" diff --git a/src/hotspot/cpu/s390/register_s390.cpp b/src/hotspot/cpu/s390/register_s390.cpp index 7292da43e5e0e..912984c5873dc 100644 --- a/src/hotspot/cpu/s390/register_s390.cpp +++ b/src/hotspot/cpu/s390/register_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "register_s390.hpp" const char* Register::name() const { diff --git a/src/hotspot/cpu/s390/relocInfo_s390.cpp b/src/hotspot/cpu/s390/relocInfo_s390.cpp index 8afd80df6cee6..fdaf00e2bc34a 100644 --- a/src/hotspot/cpu/s390/relocInfo_s390.cpp +++ b/src/hotspot/cpu/s390/relocInfo_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.inline.hpp" #include "code/relocInfo.hpp" #include "nativeInst_s390.hpp" diff --git a/src/hotspot/cpu/s390/runtime_s390.cpp b/src/hotspot/cpu/s390/runtime_s390.cpp index 18f40e87876c7..dfaf73b9a7c24 100644 --- a/src/hotspot/cpu/s390/runtime_s390.cpp +++ b/src/hotspot/cpu/s390/runtime_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #ifdef COMPILER2 #include "asm/macroAssembler.inline.hpp" #include "code/vmreg.hpp" diff --git a/src/hotspot/cpu/s390/sharedRuntime_s390.cpp b/src/hotspot/cpu/s390/sharedRuntime_s390.cpp index 2396a2a71059f..9716a5d71b3e6 100644 --- a/src/hotspot/cpu/s390/sharedRuntime_s390.cpp +++ b/src/hotspot/cpu/s390/sharedRuntime_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "code/debugInfoRec.hpp" #include "code/vtableStubs.hpp" @@ -2395,7 +2394,7 @@ AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm Label L_skip_barrier; { // Bypass the barrier for non-static methods - __ testbit(Address(Z_method, Method::access_flags_offset()), JVM_ACC_STATIC_BIT); + __ testbit_ushort(Address(Z_method, Method::access_flags_offset()), JVM_ACC_STATIC_BIT); __ z_bfalse(L_skip_barrier); // non-static } diff --git a/src/hotspot/cpu/s390/stubGenerator_s390.cpp b/src/hotspot/cpu/s390/stubGenerator_s390.cpp index 0ff7dcbeed2f7..9e82d42e077b4 100644 --- a/src/hotspot/cpu/s390/stubGenerator_s390.cpp +++ b/src/hotspot/cpu/s390/stubGenerator_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "registerSaver_s390.hpp" #include "gc/shared/barrierSet.hpp" diff --git a/src/hotspot/cpu/s390/stubRoutines_s390.cpp b/src/hotspot/cpu/s390/stubRoutines_s390.cpp index 2a60f71557c71..815cffd3f72a6 100644 --- a/src/hotspot/cpu/s390/stubRoutines_s390.cpp +++ b/src/hotspot/cpu/s390/stubRoutines_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "runtime/deoptimization.hpp" #include "runtime/frame.inline.hpp" diff --git a/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp b/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp index 1c4089d5beb07..c40be5edec754 100644 --- a/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp +++ b/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "classfile/javaClasses.hpp" #include "compiler/disassembler.hpp" @@ -164,7 +163,7 @@ address TemplateInterpreterGenerator::generate_slow_signature_handler() { // Therefore add 3 to address that byte within "_flags". // Reload method. VM call above may have destroyed register contents __ get_method(method); - __ testbit(method2_(method, access_flags), JVM_ACC_STATIC_BIT); + __ testbit_ushort(method2_(method, access_flags), JVM_ACC_STATIC_BIT); method = noreg; // end of life __ z_btrue(isStatic); @@ -883,7 +882,7 @@ void TemplateInterpreterGenerator::lock_method(void) { address reentry = nullptr; { Label L; - __ testbit(method2_(method, access_flags), JVM_ACC_SYNCHRONIZED_BIT); + __ testbit_ushort(method2_(method, access_flags), JVM_ACC_SYNCHRONIZED_BIT); __ z_btrue(L); reentry = __ stop_chain_static(reentry, "method doesn't need synchronization"); __ bind(L); @@ -897,7 +896,7 @@ void TemplateInterpreterGenerator::lock_method(void) { Label done; Label static_method; - __ testbit(method2_(method, access_flags), JVM_ACC_STATIC_BIT); + __ testbit_ushort(method2_(method, access_flags), JVM_ACC_STATIC_BIT); __ z_btrue(static_method); // non-static method: Load receiver obj from stack. @@ -1349,15 +1348,17 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { // Make sure method is native and not abstract. #ifdef ASSERT + // _access_flags must be a 16 bit value. + assert(sizeof(AccessFlags) == 2, "testbit_ushort will fail"); address reentry = nullptr; { Label L; - __ testbit(method_(access_flags), JVM_ACC_NATIVE_BIT); + __ testbit_ushort(method_(access_flags), JVM_ACC_NATIVE_BIT); __ z_btrue(L); reentry = __ stop_chain_static(reentry, "tried to execute non-native method as native"); __ bind(L); } { Label L; - __ testbit(method_(access_flags), JVM_ACC_ABSTRACT_BIT); + __ testbit_ushort(method_(access_flags), JVM_ACC_ABSTRACT_BIT); __ z_bfalse(L); reentry = __ stop_chain_static(reentry, "tried to execute abstract method as non-abstract"); __ bind(L); @@ -1403,7 +1404,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { #ifdef ASSERT { Label L; __ get_method(Z_R1_scratch); - __ testbit(method2_(Z_R1_scratch, access_flags), JVM_ACC_SYNCHRONIZED_BIT); + __ testbit_ushort(method2_(Z_R1_scratch, access_flags), JVM_ACC_SYNCHRONIZED_BIT); __ z_bfalse(L); reentry = __ stop_chain_static(reentry, "method needs synchronization"); __ bind(L); @@ -1461,7 +1462,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { // Pass mirror handle if static call. { Label method_is_not_static; - __ testbit(method2_(Rmethod, access_flags), JVM_ACC_STATIC_BIT); + __ testbit_ushort(method2_(Rmethod, access_flags), JVM_ACC_STATIC_BIT); __ z_bfalse(method_is_not_static); // Load mirror from interpreter frame. __ z_lg(Z_R1, _z_ijava_state_neg(mirror), Z_fp); @@ -1719,13 +1720,13 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) { #ifdef ASSERT address reentry = nullptr; { Label L; - __ testbit(method_(access_flags), JVM_ACC_NATIVE_BIT); + __ testbit_ushort(method_(access_flags), JVM_ACC_NATIVE_BIT); __ z_bfalse(L); reentry = __ stop_chain_static(reentry, "tried to execute native method as non-native"); __ bind(L); } { Label L; - __ testbit(method_(access_flags), JVM_ACC_ABSTRACT_BIT); + __ testbit_ushort(method_(access_flags), JVM_ACC_ABSTRACT_BIT); __ z_bfalse(L); reentry = __ stop_chain_static(reentry, "tried to execute abstract method as non-abstract"); __ bind(L); @@ -1775,7 +1776,7 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) { #ifdef ASSERT { Label L; __ get_method(Z_R1_scratch); - __ testbit(method2_(Z_R1_scratch, access_flags), JVM_ACC_SYNCHRONIZED_BIT); + __ testbit_ushort(method2_(Z_R1_scratch, access_flags), JVM_ACC_SYNCHRONIZED_BIT); __ z_bfalse(L); reentry = __ stop_chain_static(reentry, "method needs synchronization"); __ bind(L); diff --git a/src/hotspot/cpu/s390/templateTable_s390.cpp b/src/hotspot/cpu/s390/templateTable_s390.cpp index 3cb1aba810df4..e6c0c7781a3ba 100644 --- a/src/hotspot/cpu/s390/templateTable_s390.cpp +++ b/src/hotspot/cpu/s390/templateTable_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "compiler/disassembler.hpp" #include "gc/shared/barrierSetAssembler.hpp" diff --git a/src/hotspot/cpu/s390/upcallLinker_s390.cpp b/src/hotspot/cpu/s390/upcallLinker_s390.cpp index 8baad40a519a4..ab8bf7718123d 100644 --- a/src/hotspot/cpu/s390/upcallLinker_s390.cpp +++ b/src/hotspot/cpu/s390/upcallLinker_s390.cpp @@ -21,7 +21,6 @@ * questions. */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "classfile/javaClasses.hpp" #include "logging/logStream.hpp" diff --git a/src/hotspot/cpu/s390/vm_version_s390.cpp b/src/hotspot/cpu/s390/vm_version_s390.cpp index f7f21c4c5ac04..157b945e6e1a4 100644 --- a/src/hotspot/cpu/s390/vm_version_s390.cpp +++ b/src/hotspot/cpu/s390/vm_version_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.inline.hpp" #include "compiler/disassembler.hpp" #include "code/compiledIC.hpp" diff --git a/src/hotspot/cpu/s390/vmreg_s390.cpp b/src/hotspot/cpu/s390/vmreg_s390.cpp index d4d230eeb0466..0587cebb19987 100644 --- a/src/hotspot/cpu/s390/vmreg_s390.cpp +++ b/src/hotspot/cpu/s390/vmreg_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "code/vmreg.hpp" diff --git a/src/hotspot/cpu/s390/vtableStubs_s390.cpp b/src/hotspot/cpu/s390/vtableStubs_s390.cpp index d3af7fefcf133..f60d91183da6b 100644 --- a/src/hotspot/cpu/s390/vtableStubs_s390.cpp +++ b/src/hotspot/cpu/s390/vtableStubs_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "code/compiledIC.hpp" #include "code/vtableStubs.hpp" diff --git a/src/hotspot/cpu/x86/abstractInterpreter_x86.cpp b/src/hotspot/cpu/x86/abstractInterpreter_x86.cpp index fef137257b020..68ac5b6ca9a97 100644 --- a/src/hotspot/cpu/x86/abstractInterpreter_x86.cpp +++ b/src/hotspot/cpu/x86/abstractInterpreter_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciMethod.hpp" #include "interpreter/interpreter.hpp" #include "oops/klass.inline.hpp" diff --git a/src/hotspot/cpu/x86/assembler_x86.cpp b/src/hotspot/cpu/x86/assembler_x86.cpp index c2fcbcea71e24..828d8cfda91eb 100644 --- a/src/hotspot/cpu/x86/assembler_x86.cpp +++ b/src/hotspot/cpu/x86/assembler_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" #include "gc/shared/cardTableBarrierSet.hpp" diff --git a/src/hotspot/cpu/x86/c1_CodeStubs_x86.cpp b/src/hotspot/cpu/x86/c1_CodeStubs_x86.cpp index 71ca9351f86c9..71d2898f45c7f 100644 --- a/src/hotspot/cpu/x86/c1_CodeStubs_x86.cpp +++ b/src/hotspot/cpu/x86/c1_CodeStubs_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_CodeStubs.hpp" #include "c1/c1_FrameMap.hpp" #include "c1/c1_LIRAssembler.hpp" diff --git a/src/hotspot/cpu/x86/c1_FpuStackSim_x86.cpp b/src/hotspot/cpu/x86/c1_FpuStackSim_x86.cpp index 3ec182a350b8d..878c94c99da40 100644 --- a/src/hotspot/cpu/x86/c1_FpuStackSim_x86.cpp +++ b/src/hotspot/cpu/x86/c1_FpuStackSim_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_FpuStackSim.hpp" #include "c1/c1_FrameMap.hpp" #include "utilities/growableArray.hpp" diff --git a/src/hotspot/cpu/x86/c1_FrameMap_x86.cpp b/src/hotspot/cpu/x86/c1_FrameMap_x86.cpp index 4153c37729bfc..cff2be393bc9e 100644 --- a/src/hotspot/cpu/x86/c1_FrameMap_x86.cpp +++ b/src/hotspot/cpu/x86/c1_FrameMap_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_FrameMap.hpp" #include "c1/c1_LIR.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 ff6d18e48e1a8..de1fa1a9cc635 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, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "asm/macroAssembler.inline.hpp" #include "c1/c1_CodeStubs.hpp" @@ -2393,21 +2392,13 @@ void LIR_Assembler::intrinsic_op(LIR_Code code, LIR_Opr value, LIR_Opr tmp, LIR_ switch(code) { case lir_abs : { -#ifdef _LP64 - if (UseAVX > 2 && !VM_Version::supports_avx512vl()) { - assert(tmp->is_valid(), "need temporary"); - __ vpandn(dest->as_xmm_double_reg(), tmp->as_xmm_double_reg(), value->as_xmm_double_reg(), 2); - } else -#endif - { - if (dest->as_xmm_double_reg() != value->as_xmm_double_reg()) { - __ movdbl(dest->as_xmm_double_reg(), value->as_xmm_double_reg()); - } - assert(!tmp->is_valid(), "do not need temporary"); - __ andpd(dest->as_xmm_double_reg(), - ExternalAddress((address)double_signmask_pool), - rscratch1); + if (dest->as_xmm_double_reg() != value->as_xmm_double_reg()) { + __ movdbl(dest->as_xmm_double_reg(), value->as_xmm_double_reg()); } + assert(!tmp->is_valid(), "do not need temporary"); + __ andpd(dest->as_xmm_double_reg(), + ExternalAddress((address)double_signmask_pool), + rscratch1); } break; @@ -3798,41 +3789,21 @@ void LIR_Assembler::negate(LIR_Opr left, LIR_Opr dest, LIR_Opr tmp) { #endif // _LP64 } else if (dest->is_single_xmm()) { -#ifdef _LP64 - if (UseAVX > 2 && !VM_Version::supports_avx512vl()) { - assert(tmp->is_valid(), "need temporary"); - assert_different_registers(left->as_xmm_float_reg(), tmp->as_xmm_float_reg()); - __ vpxor(dest->as_xmm_float_reg(), tmp->as_xmm_float_reg(), left->as_xmm_float_reg(), 2); - } - else -#endif - { - assert(!tmp->is_valid(), "do not need temporary"); - if (left->as_xmm_float_reg() != dest->as_xmm_float_reg()) { - __ movflt(dest->as_xmm_float_reg(), left->as_xmm_float_reg()); - } - __ xorps(dest->as_xmm_float_reg(), - ExternalAddress((address)float_signflip_pool), - rscratch1); + assert(!tmp->is_valid(), "do not need temporary"); + if (left->as_xmm_float_reg() != dest->as_xmm_float_reg()) { + __ movflt(dest->as_xmm_float_reg(), left->as_xmm_float_reg()); } + __ xorps(dest->as_xmm_float_reg(), + ExternalAddress((address)float_signflip_pool), + rscratch1); } else if (dest->is_double_xmm()) { -#ifdef _LP64 - if (UseAVX > 2 && !VM_Version::supports_avx512vl()) { - assert(tmp->is_valid(), "need temporary"); - assert_different_registers(left->as_xmm_double_reg(), tmp->as_xmm_double_reg()); - __ vpxor(dest->as_xmm_double_reg(), tmp->as_xmm_double_reg(), left->as_xmm_double_reg(), 2); - } - else -#endif - { - assert(!tmp->is_valid(), "do not need temporary"); - if (left->as_xmm_double_reg() != dest->as_xmm_double_reg()) { - __ movdbl(dest->as_xmm_double_reg(), left->as_xmm_double_reg()); - } - __ xorpd(dest->as_xmm_double_reg(), - ExternalAddress((address)double_signflip_pool), - rscratch1); + assert(!tmp->is_valid(), "do not need temporary"); + if (left->as_xmm_double_reg() != dest->as_xmm_double_reg()) { + __ movdbl(dest->as_xmm_double_reg(), left->as_xmm_double_reg()); } + __ xorpd(dest->as_xmm_double_reg(), + ExternalAddress((address)double_signflip_pool), + rscratch1); #ifndef _LP64 } else if (left->is_single_fpu() || left->is_double_fpu()) { assert(left->fpu() == 0, "arg must be on TOS"); diff --git a/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp b/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp index 36e2021138f2e..262683323ab09 100644 --- a/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp +++ b/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_Compilation.hpp" #include "c1/c1_FrameMap.hpp" #include "c1/c1_Instruction.hpp" @@ -344,20 +343,7 @@ void LIRGenerator::do_NegateOp(NegateOp* x) { value.load_item(); LIR_Opr reg = rlock(x); - LIR_Opr tmp = LIR_OprFact::illegalOpr; -#ifdef _LP64 - if (UseAVX > 2 && !VM_Version::supports_avx512vl()) { - if (x->type()->tag() == doubleTag) { - tmp = new_register(T_DOUBLE); - __ move(LIR_OprFact::doubleConst(-0.0), tmp); - } - else if (x->type()->tag() == floatTag) { - tmp = new_register(T_FLOAT); - __ move(LIR_OprFact::floatConst(-0.0), tmp); - } - } -#endif - __ negate(value.result(), reg, tmp); + __ negate(value.result(), reg); set_result(x, round_item(reg)); } @@ -830,16 +816,8 @@ void LIRGenerator::do_MathIntrinsic(Intrinsic* x) { LIR_Opr calc_result = rlock_result(x); LIR_Opr tmp = LIR_OprFact::illegalOpr; -#ifdef _LP64 - if (UseAVX > 2 && (!VM_Version::supports_avx512vl()) && - (x->id() == vmIntrinsics::_dabs)) { - tmp = new_register(T_DOUBLE); - __ move(LIR_OprFact::doubleConst(-0.0), tmp); - } -#endif if (x->id() == vmIntrinsics::_floatToFloat16) { tmp = new_register(T_FLOAT); - __ move(LIR_OprFact::floatConst(-0.0), tmp); } switch(x->id()) { diff --git a/src/hotspot/cpu/x86/c1_LIR_x86.cpp b/src/hotspot/cpu/x86/c1_LIR_x86.cpp index 6bdbfd1824caa..adcc53c44ce14 100644 --- a/src/hotspot/cpu/x86/c1_LIR_x86.cpp +++ b/src/hotspot/cpu/x86/c1_LIR_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/register.hpp" #include "c1/c1_FrameMap.hpp" #include "c1/c1_LIR.hpp" diff --git a/src/hotspot/cpu/x86/c1_LinearScan_x86.cpp b/src/hotspot/cpu/x86/c1_LinearScan_x86.cpp index 917031faf8962..7c4da998db895 100644 --- a/src/hotspot/cpu/x86/c1_LinearScan_x86.cpp +++ b/src/hotspot/cpu/x86/c1_LinearScan_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_Instruction.hpp" #include "c1/c1_LinearScan.hpp" #include "utilities/bitMap.inline.hpp" @@ -635,6 +634,23 @@ void FpuStackAllocator::handle_op1(LIR_Op1* op1) { break; } + case lir_abs: + case lir_sqrt: + case lir_neg: { + assert(in->is_fpu_register(), "must be"); + assert(res->is_fpu_register(), "must be"); + assert(in->is_last_use(), "old value gets destroyed"); + + insert_free_if_dead(res, in); + insert_exchange(in); + do_rename(in, res); + + new_in = to_fpu_stack_top(res); + new_res = new_in; + + break; + } + default: { assert(!in->is_float_kind() && !res->is_float_kind(), "missed a fpu-operation"); } @@ -756,26 +772,6 @@ void FpuStackAllocator::handle_op2(LIR_Op2* op2) { break; } - case lir_abs: - case lir_sqrt: - case lir_neg: { - // Right argument appears to be unused - assert(right->is_illegal(), "must be"); - assert(left->is_fpu_register(), "must be"); - assert(res->is_fpu_register(), "must be"); - assert(left->is_last_use(), "old value gets destroyed"); - - insert_free_if_dead(res, left); - insert_exchange(left); - do_rename(left, res); - - new_left = to_fpu_stack_top(res); - new_res = new_left; - - op2->set_fpu_stack_size(sim()->stack_size()); - break; - } - default: { assert(false, "missed a fpu-operation"); } diff --git a/src/hotspot/cpu/x86/c1_LinearScan_x86.hpp b/src/hotspot/cpu/x86/c1_LinearScan_x86.hpp index 50cdd14154c42..e40de213e7a8b 100644 --- a/src/hotspot/cpu/x86/c1_LinearScan_x86.hpp +++ b/src/hotspot/cpu/x86/c1_LinearScan_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, 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 @@ -66,35 +66,7 @@ inline bool LinearScan::is_caller_save(int assigned_reg) { inline void LinearScan::pd_add_temps(LIR_Op* op) { - switch (op->code()) { - case lir_tan: { - // The slow path for these functions may need to save and - // restore all live registers but we don't want to save and - // restore everything all the time, so mark the xmms as being - // killed. If the slow path were explicit or we could propagate - // live register masks down to the assembly we could do better - // but we don't have any easy way to do that right now. We - // could also consider not killing all xmm registers if we - // assume that slow paths are uncommon but it's not clear that - // would be a good idea. - if (UseSSE > 0) { -#ifdef ASSERT - if (TraceLinearScanLevel >= 2) { - tty->print_cr("killing XMMs for trig"); - } -#endif - int num_caller_save_xmm_regs = FrameMap::get_num_caller_save_xmms(); - int op_id = op->id(); - for (int xmm = 0; xmm < num_caller_save_xmm_regs; xmm++) { - LIR_Opr opr = FrameMap::caller_save_xmm_reg_at(xmm); - add_temp(reg_num(opr), op_id, noUse, T_ILLEGAL); - } - } - break; - } - default: - break; - } + // No special case behaviours yet } diff --git a/src/hotspot/cpu/x86/c1_MacroAssembler_x86.cpp b/src/hotspot/cpu/x86/c1_MacroAssembler_x86.cpp index f53a25ed3e646..e3c8792decd2b 100644 --- a/src/hotspot/cpu/x86/c1_MacroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/c1_MacroAssembler_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_MacroAssembler.hpp" #include "c1/c1_Runtime1.hpp" #include "code/compiledIC.hpp" diff --git a/src/hotspot/cpu/x86/c1_Runtime1_x86.cpp b/src/hotspot/cpu/x86/c1_Runtime1_x86.cpp index 5cc8ffd9befe4..caa9344e04dde 100644 --- a/src/hotspot/cpu/x86/c1_Runtime1_x86.cpp +++ b/src/hotspot/cpu/x86/c1_Runtime1_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "c1/c1_Defs.hpp" #include "c1/c1_FrameMap.hpp" diff --git a/src/hotspot/cpu/x86/c2_CodeStubs_x86.cpp b/src/hotspot/cpu/x86/c2_CodeStubs_x86.cpp index 44f897529e7ce..83ecdee52199b 100644 --- a/src/hotspot/cpu/x86/c2_CodeStubs_x86.cpp +++ b/src/hotspot/cpu/x86/c2_CodeStubs_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "opto/c2_MacroAssembler.hpp" #include "opto/c2_CodeStubs.hpp" #include "runtime/objectMonitor.hpp" diff --git a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp index 50ed4750d47fd..87583ddabd5e9 100644 --- a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" #include "gc/shared/barrierSet.hpp" diff --git a/src/hotspot/cpu/x86/c2_init_x86.cpp b/src/hotspot/cpu/x86/c2_init_x86.cpp index ee8937230b7b4..b286c3a34f2f1 100644 --- a/src/hotspot/cpu/x86/c2_init_x86.cpp +++ b/src/hotspot/cpu/x86/c2_init_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "opto/compile.hpp" #include "opto/node.hpp" #include "opto/optoreg.hpp" diff --git a/src/hotspot/cpu/x86/c2_intelJccErratum_x86.cpp b/src/hotspot/cpu/x86/c2_intelJccErratum_x86.cpp index f726a831c9f15..909554cdf764d 100644 --- a/src/hotspot/cpu/x86/c2_intelJccErratum_x86.cpp +++ b/src/hotspot/cpu/x86/c2_intelJccErratum_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "c2_intelJccErratum_x86.hpp" #include "opto/compile.hpp" diff --git a/src/hotspot/cpu/x86/c2_stubGenerator_x86_64_string.cpp b/src/hotspot/cpu/x86/c2_stubGenerator_x86_64_string.cpp index 2837a85800f47..7dadb15ef91a8 100644 --- a/src/hotspot/cpu/x86/c2_stubGenerator_x86_64_string.cpp +++ b/src/hotspot/cpu/x86/c2_stubGenerator_x86_64_string.cpp @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "macroAssembler_x86.hpp" #include "stubGenerator_x86_64.hpp" #include "oops/arrayOop.hpp" diff --git a/src/hotspot/cpu/x86/codeBuffer_x86.cpp b/src/hotspot/cpu/x86/codeBuffer_x86.cpp index 3c406ed1b198e..75cc9b9896bb0 100644 --- a/src/hotspot/cpu/x86/codeBuffer_x86.cpp +++ b/src/hotspot/cpu/x86/codeBuffer_x86.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/codeBuffer.inline.hpp" #include "asm/macroAssembler.hpp" diff --git a/src/hotspot/cpu/x86/compiledIC_x86.cpp b/src/hotspot/cpu/x86/compiledIC_x86.cpp index 51563d35d5dfd..53ad9aeec9162 100644 --- a/src/hotspot/cpu/x86/compiledIC_x86.cpp +++ b/src/hotspot/cpu/x86/compiledIC_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "code/codeCache.hpp" #include "code/compiledIC.hpp" diff --git a/src/hotspot/cpu/x86/compressedKlass_x86.cpp b/src/hotspot/cpu/x86/compressedKlass_x86.cpp index 5b5a405bcef86..8a06a7ba3d503 100644 --- a/src/hotspot/cpu/x86/compressedKlass_x86.cpp +++ b/src/hotspot/cpu/x86/compressedKlass_x86.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2023, Red Hat, Inc. All rights reserved. - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * 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,8 +23,6 @@ * */ -#include "precompiled.hpp" - #ifdef _LP64 #include "oops/compressedKlass.hpp" diff --git a/src/hotspot/cpu/x86/downcallLinker_x86_32.cpp b/src/hotspot/cpu/x86/downcallLinker_x86_32.cpp index 4e549552e96da..3c7d93fc79e91 100644 --- a/src/hotspot/cpu/x86/downcallLinker_x86_32.cpp +++ b/src/hotspot/cpu/x86/downcallLinker_x86_32.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "prims/downcallLinker.hpp" RuntimeStub* DowncallLinker::make_downcall_stub(BasicType* signature, diff --git a/src/hotspot/cpu/x86/downcallLinker_x86_64.cpp b/src/hotspot/cpu/x86/downcallLinker_x86_64.cpp index 00cc69651f15f..7f531ca56b143 100644 --- a/src/hotspot/cpu/x86/downcallLinker_x86_64.cpp +++ b/src/hotspot/cpu/x86/downcallLinker_x86_64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "code/codeBlob.hpp" #include "logging/logStream.hpp" diff --git a/src/hotspot/cpu/x86/foreignGlobals_x86_32.cpp b/src/hotspot/cpu/x86/foreignGlobals_x86_32.cpp index c62021c32637c..18aa454e61cbf 100644 --- a/src/hotspot/cpu/x86/foreignGlobals_x86_32.cpp +++ b/src/hotspot/cpu/x86/foreignGlobals_x86_32.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "code/vmreg.hpp" #include "prims/foreignGlobals.hpp" #include "utilities/debug.hpp" diff --git a/src/hotspot/cpu/x86/foreignGlobals_x86_64.cpp b/src/hotspot/cpu/x86/foreignGlobals_x86_64.cpp index 658ff6fecddb9..cc5627f6ffd82 100644 --- a/src/hotspot/cpu/x86/foreignGlobals_x86_64.cpp +++ b/src/hotspot/cpu/x86/foreignGlobals_x86_64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "classfile/javaClasses.hpp" #include "runtime/jniHandles.inline.hpp" #include "oops/typeArrayOop.inline.hpp" diff --git a/src/hotspot/cpu/x86/frame_x86.cpp b/src/hotspot/cpu/x86/frame_x86.cpp index 4e28dc125341a..a5700134f60c7 100644 --- a/src/hotspot/cpu/x86/frame_x86.cpp +++ b/src/hotspot/cpu/x86/frame_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "compiler/oopMap.hpp" #include "interpreter/interpreter.hpp" #include "memory/resourceArea.hpp" @@ -154,6 +153,11 @@ bool frame::safe_for_sender(JavaThread *thread) { } if (Continuation::is_return_barrier_entry(sender_pc)) { + // sender_pc might be invalid so check that the frame + // actually belongs to a Continuation. + if (!Continuation::is_frame_in_continuation(thread, *this)) { + return false; + } // If our sender_pc is the return barrier, then our "real" sender is the continuation entry frame s = Continuation::continuation_bottom_sender(thread, *this, sender_sp); sender_sp = s.sp(); diff --git a/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp b/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp index 5af36d84e6ed8..4aa02c4d6278b 100644 --- a/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "gc/g1/g1BarrierSet.hpp" #include "gc/g1/g1BarrierSetAssembler.hpp" diff --git a/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp b/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp index cd0e43b68bf9e..50dea42d5a300 100644 --- a/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderData.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/barrierSetAssembler.hpp" diff --git a/src/hotspot/cpu/x86/gc/shared/barrierSetNMethod_x86.cpp b/src/hotspot/cpu/x86/gc/shared/barrierSetNMethod_x86.cpp index dfd9d59016f0a..e99774cbc401a 100644 --- a/src/hotspot/cpu/x86/gc/shared/barrierSetNMethod_x86.cpp +++ b/src/hotspot/cpu/x86/gc/shared/barrierSetNMethod_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "code/codeCache.hpp" #include "code/nativeInst.hpp" #include "gc/shared/barrierSetNMethod.hpp" diff --git a/src/hotspot/cpu/x86/gc/shared/cardTableBarrierSetAssembler_x86.cpp b/src/hotspot/cpu/x86/gc/shared/cardTableBarrierSetAssembler_x86.cpp index b04ab35862a3e..7954ce38d03ef 100644 --- a/src/hotspot/cpu/x86/gc/shared/cardTableBarrierSetAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/gc/shared/cardTableBarrierSetAssembler_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/cardTable.hpp" diff --git a/src/hotspot/cpu/x86/gc/shared/modRefBarrierSetAssembler_x86.cpp b/src/hotspot/cpu/x86/gc/shared/modRefBarrierSetAssembler_x86.cpp index 618095bdfa634..76066409a7caa 100644 --- a/src/hotspot/cpu/x86/gc/shared/modRefBarrierSetAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/gc/shared/modRefBarrierSetAssembler_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "gc/shared/modRefBarrierSetAssembler.hpp" diff --git a/src/hotspot/cpu/x86/gc/shenandoah/c1/shenandoahBarrierSetC1_x86.cpp b/src/hotspot/cpu/x86/gc/shenandoah/c1/shenandoahBarrierSetC1_x86.cpp index eb6da25d1bc7a..063f4c2cc5ddf 100644 --- a/src/hotspot/cpu/x86/gc/shenandoah/c1/shenandoahBarrierSetC1_x86.cpp +++ b/src/hotspot/cpu/x86/gc/shenandoah/c1/shenandoahBarrierSetC1_x86.cpp @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_LIRAssembler.hpp" #include "c1/c1_MacroAssembler.hpp" #include "gc/shared/gc_globals.hpp" diff --git a/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp b/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp index a452850b1e814..75ab8fca05152 100644 --- a/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahBarrierSet.hpp" #include "gc/shenandoah/shenandoahBarrierSetAssembler.hpp" #include "gc/shenandoah/shenandoahForwarding.hpp" diff --git a/src/hotspot/cpu/x86/gc/z/zAddress_x86.cpp b/src/hotspot/cpu/x86/gc/z/zAddress_x86.cpp index ed177f37e0d45..3667a52050c7a 100644 --- a/src/hotspot/cpu/x86/gc/z/zAddress_x86.cpp +++ b/src/hotspot/cpu/x86/gc/z/zAddress_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/gc_globals.hpp" #include "gc/z/zAddress.inline.hpp" #include "gc/z/zGlobals.hpp" diff --git a/src/hotspot/cpu/x86/gc/z/zAddress_x86.inline.hpp b/src/hotspot/cpu/x86/gc/z/zAddress_x86.inline.hpp index e0be06395946a..d0816aee74f76 100644 --- a/src/hotspot/cpu/x86/gc/z/zAddress_x86.inline.hpp +++ b/src/hotspot/cpu/x86/gc/z/zAddress_x86.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ inline uintptr_t ZPointer::remap_bits(uintptr_t colored) { inline constexpr int ZPointer::load_shift_lookup(uintptr_t value) { const size_t index = load_shift_lookup_index(value); - assert(index == 0 || is_power_of_2(index), "Incorrect load shift: " SIZE_FORMAT, index); + assert(index == 0 || is_power_of_2(index), "Incorrect load shift: %zu", index); return ZPointerLoadShiftTable[index]; } diff --git a/src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp b/src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp index 1bc8e5c45443b..f7b1e25cf3b5d 100644 --- a/src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "code/codeBlob.hpp" #include "code/vmreg.inline.hpp" diff --git a/src/hotspot/cpu/x86/icache_x86.cpp b/src/hotspot/cpu/x86/icache_x86.cpp index b9ec2f6d18649..45679332ecaca 100644 --- a/src/hotspot/cpu/x86/icache_x86.cpp +++ b/src/hotspot/cpu/x86/icache_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "runtime/icache.hpp" diff --git a/src/hotspot/cpu/x86/interp_masm_x86.cpp b/src/hotspot/cpu/x86/interp_masm_x86.cpp index 3a3f01a640983..44087663a34b5 100644 --- a/src/hotspot/cpu/x86/interp_masm_x86.cpp +++ b/src/hotspot/cpu/x86/interp_masm_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "compiler/compiler_globals.hpp" #include "interp_masm_x86.hpp" #include "interpreter/interpreter.hpp" @@ -1030,7 +1029,7 @@ void InterpreterMacroAssembler::remove_activation( // get method access flags movptr(rcx, Address(rbp, frame::interpreter_frame_method_offset * wordSize)); - movl(rcx, Address(rcx, Method::access_flags_offset())); + load_unsigned_short(rcx, Address(rcx, Method::access_flags_offset())); testl(rcx, JVM_ACC_SYNCHRONIZED); jcc(Assembler::zero, unlocked); diff --git a/src/hotspot/cpu/x86/interpreterRT_x86_32.cpp b/src/hotspot/cpu/x86/interpreterRT_x86_32.cpp index 4f463b1d77140..14f11596924a5 100644 --- a/src/hotspot/cpu/x86/interpreterRT_x86_32.cpp +++ b/src/hotspot/cpu/x86/interpreterRT_x86_32.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "interpreter/interp_masm.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/interpreterRuntime.hpp" diff --git a/src/hotspot/cpu/x86/interpreterRT_x86_64.cpp b/src/hotspot/cpu/x86/interpreterRT_x86_64.cpp index c37287635bab9..8909df5b3f081 100644 --- a/src/hotspot/cpu/x86/interpreterRT_x86_64.cpp +++ b/src/hotspot/cpu/x86/interpreterRT_x86_64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "interpreter/interp_masm.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/interpreterRuntime.hpp" diff --git a/src/hotspot/cpu/x86/jniFastGetField_x86_32.cpp b/src/hotspot/cpu/x86/jniFastGetField_x86_32.cpp index 123362894122c..eee82a5c6820e 100644 --- a/src/hotspot/cpu/x86/jniFastGetField_x86_32.cpp +++ b/src/hotspot/cpu/x86/jniFastGetField_x86_32.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "memory/resourceArea.hpp" #include "prims/jniFastGetField.hpp" diff --git a/src/hotspot/cpu/x86/jniFastGetField_x86_64.cpp b/src/hotspot/cpu/x86/jniFastGetField_x86_64.cpp index e94b7d12b0b3c..09ba4537854fa 100644 --- a/src/hotspot/cpu/x86/jniFastGetField_x86_64.cpp +++ b/src/hotspot/cpu/x86/jniFastGetField_x86_64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "code/codeBlob.hpp" #include "gc/shared/barrierSet.hpp" diff --git a/src/hotspot/cpu/x86/jvmciCodeInstaller_x86.cpp b/src/hotspot/cpu/x86/jvmciCodeInstaller_x86.cpp index 8eff2590bfcea..9e6a4789dc2cd 100644 --- a/src/hotspot/cpu/x86/jvmciCodeInstaller_x86.cpp +++ b/src/hotspot/cpu/x86/jvmciCodeInstaller_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "compiler/disassembler.hpp" #include "oops/compressedKlass.hpp" #include "oops/oop.inline.hpp" diff --git a/src/hotspot/cpu/x86/macroAssembler_x86.cpp b/src/hotspot/cpu/x86/macroAssembler_x86.cpp index a798dea08cc79..0830b6b098387 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" #include "code/compiledIC.hpp" @@ -1194,7 +1193,11 @@ void MacroAssembler::andpd(XMMRegister dst, AddressLiteral src, Register rscratc assert((UseAVX > 0) || (((intptr_t)src.target() & 15) == 0), "SSE mode requires address alignment 16 bytes"); assert(rscratch != noreg || always_reachable(src), "missing"); - if (reachable(src)) { + if (UseAVX > 2 && + (!VM_Version::supports_avx512dq() || !VM_Version::supports_avx512vl()) && + (dst->encoding() >= 16)) { + vpand(dst, dst, src, AVX_512bit, rscratch); + } else if (reachable(src)) { Assembler::andpd(dst, as_Address(src)); } else { lea(rscratch, src); @@ -3332,7 +3335,12 @@ void MacroAssembler::xorpd(XMMRegister dst, AddressLiteral src, Register rscratc // Used in sign-bit flipping with aligned address. assert((UseAVX > 0) || (((intptr_t)src.target() & 15) == 0), "SSE mode requires address alignment 16 bytes"); - if (reachable(src)) { + + if (UseAVX > 2 && + (!VM_Version::supports_avx512dq() || !VM_Version::supports_avx512vl()) && + (dst->encoding() >= 16)) { + vpxor(dst, dst, src, Assembler::AVX_512bit, rscratch); + } else if (reachable(src)) { Assembler::xorpd(dst, as_Address(src)); } else { lea(rscratch, src); @@ -3341,16 +3349,19 @@ void MacroAssembler::xorpd(XMMRegister dst, AddressLiteral src, Register rscratc } void MacroAssembler::xorpd(XMMRegister dst, XMMRegister src) { - if (UseAVX > 2 && !VM_Version::supports_avx512dq() && (dst->encoding() == src->encoding())) { + if (UseAVX > 2 && + (!VM_Version::supports_avx512dq() || !VM_Version::supports_avx512vl()) && + ((dst->encoding() >= 16) || (src->encoding() >= 16))) { Assembler::vpxor(dst, dst, src, Assembler::AVX_512bit); - } - else { + } else { Assembler::xorpd(dst, src); } } void MacroAssembler::xorps(XMMRegister dst, XMMRegister src) { - if (UseAVX > 2 && !VM_Version::supports_avx512dq() && (dst->encoding() == src->encoding())) { + if (UseAVX > 2 && + (!VM_Version::supports_avx512dq() || !VM_Version::supports_avx512vl()) && + ((dst->encoding() >= 16) || (src->encoding() >= 16))) { Assembler::vpxor(dst, dst, src, Assembler::AVX_512bit); } else { Assembler::xorps(dst, src); @@ -3362,7 +3373,12 @@ void MacroAssembler::xorps(XMMRegister dst, AddressLiteral src, Register rscratc // Used in sign-bit flipping with aligned address. assert((UseAVX > 0) || (((intptr_t)src.target() & 15) == 0), "SSE mode requires address alignment 16 bytes"); - if (reachable(src)) { + + if (UseAVX > 2 && + (!VM_Version::supports_avx512dq() || !VM_Version::supports_avx512vl()) && + (dst->encoding() >= 16)) { + vpxor(dst, dst, src, Assembler::AVX_512bit, rscratch); + } else if (reachable(src)) { Assembler::xorps(dst, as_Address(src)); } else { lea(rscratch, src); diff --git a/src/hotspot/cpu/x86/macroAssembler_x86_32_constants.cpp b/src/hotspot/cpu/x86/macroAssembler_x86_32_constants.cpp index e177c7d94624b..6fdda4c2f7130 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86_32_constants.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86_32_constants.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "macroAssembler_x86.hpp" ATTRIBUTE_ALIGNED(16) static const juint _ONES[] = { diff --git a/src/hotspot/cpu/x86/macroAssembler_x86_32_cos.cpp b/src/hotspot/cpu/x86/macroAssembler_x86_32_cos.cpp index ce71bb50d8232..dce16756a6651 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86_32_cos.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86_32_cos.cpp @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" #include "macroAssembler_x86.hpp" diff --git a/src/hotspot/cpu/x86/macroAssembler_x86_32_exp.cpp b/src/hotspot/cpu/x86/macroAssembler_x86_32_exp.cpp index a490510b959d3..2e6c1a617bb85 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86_32_exp.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86_32_exp.cpp @@ -25,7 +25,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" #include "macroAssembler_x86.hpp" diff --git a/src/hotspot/cpu/x86/macroAssembler_x86_32_log.cpp b/src/hotspot/cpu/x86/macroAssembler_x86_32_log.cpp index 515717e2179ca..abaabef674105 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86_32_log.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86_32_log.cpp @@ -25,7 +25,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" #include "macroAssembler_x86.hpp" diff --git a/src/hotspot/cpu/x86/macroAssembler_x86_32_log10.cpp b/src/hotspot/cpu/x86/macroAssembler_x86_32_log10.cpp index fa8c3b4623518..1fc5f49cf7503 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86_32_log10.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86_32_log10.cpp @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" #include "macroAssembler_x86.hpp" diff --git a/src/hotspot/cpu/x86/macroAssembler_x86_32_pow.cpp b/src/hotspot/cpu/x86/macroAssembler_x86_32_pow.cpp index 7afad2fcc73b2..2d8a8ef91ac4f 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86_32_pow.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86_32_pow.cpp @@ -25,7 +25,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" #include "macroAssembler_x86.hpp" diff --git a/src/hotspot/cpu/x86/macroAssembler_x86_32_sin.cpp b/src/hotspot/cpu/x86/macroAssembler_x86_32_sin.cpp index 492d596f84b46..cd593ba335648 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86_32_sin.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86_32_sin.cpp @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" #include "macroAssembler_x86.hpp" diff --git a/src/hotspot/cpu/x86/macroAssembler_x86_32_tan.cpp b/src/hotspot/cpu/x86/macroAssembler_x86_32_tan.cpp index f2bc1efb483f9..4e8be8a1f1dc7 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86_32_tan.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86_32_tan.cpp @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" #include "macroAssembler_x86.hpp" diff --git a/src/hotspot/cpu/x86/macroAssembler_x86_md5.cpp b/src/hotspot/cpu/x86/macroAssembler_x86_md5.cpp index 09d379a4296d4..9d48838ab6e1b 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86_md5.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86_md5.cpp @@ -43,7 +43,6 @@ * Software. */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" #include "runtime/stubRoutines.hpp" diff --git a/src/hotspot/cpu/x86/macroAssembler_x86_sha.cpp b/src/hotspot/cpu/x86/macroAssembler_x86_sha.cpp index e7d728c2e9672..5fd6db868cc8b 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86_sha.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86_sha.cpp @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" #include "runtime/stubRoutines.hpp" diff --git a/src/hotspot/cpu/x86/methodHandles_x86.cpp b/src/hotspot/cpu/x86/methodHandles_x86.cpp index fd738b7333e4f..0d95af133fa81 100644 --- a/src/hotspot/cpu/x86/methodHandles_x86.cpp +++ b/src/hotspot/cpu/x86/methodHandles_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "classfile/vmClasses.hpp" #include "compiler/disassembler.hpp" diff --git a/src/hotspot/cpu/x86/nativeInst_x86.cpp b/src/hotspot/cpu/x86/nativeInst_x86.cpp index d5021c29ed6b0..4ee741077dc06 100644 --- a/src/hotspot/cpu/x86/nativeInst_x86.cpp +++ b/src/hotspot/cpu/x86/nativeInst_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "code/compiledIC.hpp" #include "memory/resourceArea.hpp" diff --git a/src/hotspot/cpu/x86/peephole_x86_64.cpp b/src/hotspot/cpu/x86/peephole_x86_64.cpp index 92a29490edaf8..2197055d1ecc0 100644 --- a/src/hotspot/cpu/x86/peephole_x86_64.cpp +++ b/src/hotspot/cpu/x86/peephole_x86_64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. * */ -#include "precompiled.hpp" #ifdef COMPILER2 diff --git a/src/hotspot/cpu/x86/rdtsc_x86.cpp b/src/hotspot/cpu/x86/rdtsc_x86.cpp index 8a927dd15e4e4..aac336019508d 100644 --- a/src/hotspot/cpu/x86/rdtsc_x86.cpp +++ b/src/hotspot/cpu/x86/rdtsc_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "rdtsc_x86.hpp" #include "runtime/globals_extension.hpp" #include "runtime/javaThread.hpp" diff --git a/src/hotspot/cpu/x86/registerMap_x86.cpp b/src/hotspot/cpu/x86/registerMap_x86.cpp index 34713ec4d38c9..295a8c0eb896b 100644 --- a/src/hotspot/cpu/x86/registerMap_x86.cpp +++ b/src/hotspot/cpu/x86/registerMap_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "runtime/registerMap.hpp" #include "vmreg_x86.inline.hpp" diff --git a/src/hotspot/cpu/x86/register_x86.cpp b/src/hotspot/cpu/x86/register_x86.cpp index dc5aba3c17801..e60834293445b 100644 --- a/src/hotspot/cpu/x86/register_x86.cpp +++ b/src/hotspot/cpu/x86/register_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "register_x86.hpp" diff --git a/src/hotspot/cpu/x86/relocInfo_x86.cpp b/src/hotspot/cpu/x86/relocInfo_x86.cpp index 2df98c4311b2c..a447c5aca9d92 100644 --- a/src/hotspot/cpu/x86/relocInfo_x86.cpp +++ b/src/hotspot/cpu/x86/relocInfo_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "code/relocInfo.hpp" #include "memory/universe.hpp" diff --git a/src/hotspot/cpu/x86/runtime_x86_32.cpp b/src/hotspot/cpu/x86/runtime_x86_32.cpp index 9bd4239d665f3..bcba609387132 100644 --- a/src/hotspot/cpu/x86/runtime_x86_32.cpp +++ b/src/hotspot/cpu/x86/runtime_x86_32.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #ifdef COMPILER2 #include "asm/macroAssembler.hpp" #include "asm/macroAssembler.inline.hpp" diff --git a/src/hotspot/cpu/x86/runtime_x86_64.cpp b/src/hotspot/cpu/x86/runtime_x86_64.cpp index 45f863b697b6b..d7d8fc1895b38 100644 --- a/src/hotspot/cpu/x86/runtime_x86_64.cpp +++ b/src/hotspot/cpu/x86/runtime_x86_64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #ifdef COMPILER2 #include "asm/macroAssembler.hpp" #include "asm/macroAssembler.inline.hpp" diff --git a/src/hotspot/cpu/x86/sharedRuntime_x86.cpp b/src/hotspot/cpu/x86/sharedRuntime_x86.cpp index ebdd47f3a3f87..0a277a4eb69f6 100644 --- a/src/hotspot/cpu/x86/sharedRuntime_x86.cpp +++ b/src/hotspot/cpu/x86/sharedRuntime_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "runtime/interfaceSupport.inline.hpp" #include "runtime/sharedRuntime.hpp" diff --git a/src/hotspot/cpu/x86/sharedRuntime_x86_32.cpp b/src/hotspot/cpu/x86/sharedRuntime_x86_32.cpp index a6a662b3d1e0c..8e5e54f244cf9 100644 --- a/src/hotspot/cpu/x86/sharedRuntime_x86_32.cpp +++ b/src/hotspot/cpu/x86/sharedRuntime_x86_32.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "asm/macroAssembler.inline.hpp" #include "code/compiledIC.hpp" diff --git a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp index ab7cbb9437453..bbe62db33f00e 100644 --- a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp +++ b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #ifndef _WINDOWS #include "alloca.h" #endif @@ -1099,7 +1098,7 @@ AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm { // Bypass the barrier for non-static methods Register flags = rscratch1; - __ movl(flags, Address(method, Method::access_flags_offset())); + __ load_unsigned_short(flags, Address(method, Method::access_flags_offset())); __ testl(flags, JVM_ACC_STATIC); __ jcc(Assembler::zero, L_skip_barrier); // non-static } @@ -3020,7 +3019,7 @@ SafepointBlob* SharedRuntime::generate_handler_blob(SharedStubId id, address cal // Allocate space for the code. Setup code generation tools. const char* name = SharedRuntime::stub_name(id); - CodeBuffer buffer(name, 2348, 1024); + CodeBuffer buffer(name, 2548, 1024); MacroAssembler* masm = new MacroAssembler(&buffer); address start = __ pc(); @@ -3086,11 +3085,11 @@ SafepointBlob* SharedRuntime::generate_handler_blob(SharedStubId id, address cal Label bail; #endif if (!cause_return) { - Label no_prefix, not_special; + Label no_prefix, not_special, check_rex_prefix; // If our stashed return pc was modified by the runtime we avoid touching it __ cmpptr(rbx, Address(rbp, wordSize)); - __ jccb(Assembler::notEqual, no_adjust); + __ jcc(Assembler::notEqual, no_adjust); // Skip over the poll instruction. // See NativeInstruction::is_safepoint_poll() @@ -3113,9 +3112,29 @@ SafepointBlob* SharedRuntime::generate_handler_blob(SharedStubId id, address cal // 41 85 04 24 test %eax,(%r12) // 85 45 00 test %eax,0x0(%rbp) // 41 85 45 00 test %eax,0x0(%r13) - + // + // Notes: + // Format of legacy MAP0 test instruction:- + // [REX/REX2] [OPCODE] [ModRM] [SIB] [DISP] [IMM32] + // o For safepoint polling instruction "test %eax,(%rax)", encoding of first register + // operand and base register of memory operand is b/w [0-8), hence we do not require + // additional REX prefix where REX.B bit stores MSB bit of register encoding, which + // is why two bytes encoding is sufficient here. + // o For safepoint polling instruction like "test %eax,(%r8)", register encoding of BASE + // register of memory operand is 1000, thus we need additional REX prefix in this case, + // there by adding additional byte to instruction encoding. + // o In case BASE register is one of the 32 extended GPR registers available only on targets + // supporting Intel APX extension, then we need to emit two bytes REX2 prefix to hold + // most significant two bits of 5 bit register encoding. + + if (VM_Version::supports_apx_f()) { + __ cmpb(Address(rbx, 0), Assembler::REX2); + __ jccb(Assembler::notEqual, check_rex_prefix); + __ addptr(rbx, 2); + __ bind(check_rex_prefix); + } __ cmpb(Address(rbx, 0), NativeTstRegMem::instruction_rex_b_prefix); - __ jcc(Assembler::notEqual, no_prefix); + __ jccb(Assembler::notEqual, no_prefix); __ addptr(rbx, 1); __ bind(no_prefix); #ifdef ASSERT @@ -3128,7 +3147,7 @@ SafepointBlob* SharedRuntime::generate_handler_blob(SharedStubId id, address cal __ andptr(rcx, 0x07); // looking for 0x04 .. 0x05 __ subptr(rcx, 4); // looking for 0x00 .. 0x01 __ cmpptr(rcx, 1); - __ jcc(Assembler::above, not_special); + __ jccb(Assembler::above, not_special); __ addptr(rbx, 1); __ bind(not_special); #ifdef ASSERT diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp index de13772dcfb0d..d0e611e18d5ce 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "asm/macroAssembler.inline.hpp" #include "compiler/oopMap.hpp" diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp index 3979237619c92..38a8eb6981f5c 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "classfile/javaClasses.hpp" #include "classfile/vmIntrinsics.hpp" diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64_adler.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64_adler.cpp index 84f5cc80b0d3a..287fd005c2c95 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_64_adler.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_64_adler.cpp @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" #include "utilities/globalDefinitions.hpp" diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64_aes.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64_aes.cpp index f14d368c376e1..b6dc046d172a4 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_64_aes.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_64_aes.cpp @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" #include "runtime/stubRoutines.hpp" diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64_arraycopy.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64_arraycopy.cpp index c72c32e796d2d..ad2638dd25620 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_64_arraycopy.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_64_arraycopy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/barrierSetAssembler.hpp" diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64_chacha.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64_chacha.cpp index 47354f4fc7cf7..9175dea0a5b4d 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_64_chacha.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_64_chacha.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * */ -#include "precompiled.hpp" -#include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" #include "runtime/stubRoutines.hpp" #include "macroAssembler_x86.hpp" diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64_constants.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64_constants.cpp index a5b8de75d0fd4..93fa7e650db6a 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_64_constants.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_64_constants.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "stubGenerator_x86_64.hpp" // Constants for libm trigonometric stubs diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64_cos.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64_cos.cpp index 315f705768980..ec6a98ae7b10d 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_64_cos.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_64_cos.cpp @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "macroAssembler_x86.hpp" #include "stubGenerator_x86_64.hpp" diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64_exp.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64_exp.cpp index f716e2a7282d9..335906806ff8f 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_64_exp.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_64_exp.cpp @@ -25,7 +25,6 @@ * */ -#include "precompiled.hpp" #include "macroAssembler_x86.hpp" #include "stubGenerator_x86_64.hpp" diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64_fmod.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64_fmod.cpp index 26b5b594424d2..3bb0b4f6b1f47 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_64_fmod.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_64_fmod.cpp @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "macroAssembler_x86.hpp" #include "stubGenerator_x86_64.hpp" #include "runtime/stubRoutines.hpp" diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64_ghash.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64_ghash.cpp index 5a9b084841376..7ed1b76394684 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_64_ghash.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_64_ghash.cpp @@ -23,8 +23,6 @@ * */ -#include "precompiled.hpp" -#include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" #include "runtime/stubRoutines.hpp" #include "macroAssembler_x86.hpp" diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64_log.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64_log.cpp index c9d339680c44c..1b6c9fdcd37e5 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_64_log.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_64_log.cpp @@ -25,7 +25,6 @@ * */ -#include "precompiled.hpp" #include "macroAssembler_x86.hpp" #include "stubGenerator_x86_64.hpp" diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64_poly1305.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64_poly1305.cpp index 6d3da2e6c759f..6f952a603321a 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_64_poly1305.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_64_poly1305.cpp @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "macroAssembler_x86.hpp" #include "stubGenerator_x86_64.hpp" diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64_poly_mont.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64_poly_mont.cpp index 4e909afbacc70..1732d251c98a4 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_64_poly_mont.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_64_poly_mont.cpp @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "macroAssembler_x86.hpp" #include "stubGenerator_x86_64.hpp" diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64_pow.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64_pow.cpp index 2e9ea125abcb4..4afcea596e88b 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_64_pow.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_64_pow.cpp @@ -25,7 +25,6 @@ * */ -#include "precompiled.hpp" #include "macroAssembler_x86.hpp" #include "stubGenerator_x86_64.hpp" diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64_sha3.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64_sha3.cpp index 49c39226708e3..50c200dbff221 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_64_sha3.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_64_sha3.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" #include "runtime/stubRoutines.hpp" diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64_sin.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64_sin.cpp index 1f07229034dd4..61caf5066fc31 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_64_sin.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_64_sin.cpp @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "macroAssembler_x86.hpp" #include "stubGenerator_x86_64.hpp" diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64_tan.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64_tan.cpp index 58165aa6f9866..11889f627a95d 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_64_tan.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_64_tan.cpp @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "macroAssembler_x86.hpp" #include "stubGenerator_x86_64.hpp" diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64_tanh.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64_tanh.cpp index 92ac78e15cba9..b105fd1088970 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_64_tanh.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_64_tanh.cpp @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "macroAssembler_x86.hpp" #include "stubGenerator_x86_64.hpp" diff --git a/src/hotspot/cpu/x86/stubRoutines_x86.cpp b/src/hotspot/cpu/x86/stubRoutines_x86.cpp index bc1cbdbba26b5..9db3a89d29c51 100644 --- a/src/hotspot/cpu/x86/stubRoutines_x86.cpp +++ b/src/hotspot/cpu/x86/stubRoutines_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "runtime/deoptimization.hpp" #include "runtime/frame.inline.hpp" #include "runtime/javaThread.hpp" diff --git a/src/hotspot/cpu/x86/stubRoutines_x86_32.cpp b/src/hotspot/cpu/x86/stubRoutines_x86_32.cpp index 7916a3b36305a..64e367b4c40fa 100644 --- a/src/hotspot/cpu/x86/stubRoutines_x86_32.cpp +++ b/src/hotspot/cpu/x86/stubRoutines_x86_32.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "runtime/deoptimization.hpp" #include "runtime/frame.inline.hpp" #include "runtime/javaThread.hpp" diff --git a/src/hotspot/cpu/x86/stubRoutines_x86_64.cpp b/src/hotspot/cpu/x86/stubRoutines_x86_64.cpp index f37d6698d39fc..ef3097ebd24cf 100644 --- a/src/hotspot/cpu/x86/stubRoutines_x86_64.cpp +++ b/src/hotspot/cpu/x86/stubRoutines_x86_64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "runtime/deoptimization.hpp" #include "runtime/frame.inline.hpp" #include "runtime/javaThread.hpp" diff --git a/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp b/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp index 823b965a09b51..548243cba838d 100644 --- a/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp +++ b/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "classfile/javaClasses.hpp" #include "compiler/compiler_globals.hpp" @@ -596,7 +595,7 @@ void TemplateInterpreterGenerator::lock_method() { #ifdef ASSERT { Label L; - __ movl(rax, access_flags); + __ load_unsigned_short(rax, access_flags); __ testl(rax, JVM_ACC_SYNCHRONIZED); __ jcc(Assembler::notZero, L); __ stop("method doesn't need synchronization"); @@ -607,7 +606,7 @@ void TemplateInterpreterGenerator::lock_method() { // get synchronization object { Label done; - __ movl(rax, access_flags); + __ load_unsigned_short(rax, access_flags); __ testl(rax, JVM_ACC_STATIC); // get receiver (assume this is frequent case) __ movptr(rax, Address(rlocals, Interpreter::local_offset_in_bytes(0))); @@ -855,7 +854,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { // make sure method is native & not abstract #ifdef ASSERT - __ movl(rax, access_flags); + __ load_unsigned_short(rax, access_flags); { Label L; __ testl(rax, JVM_ACC_NATIVE); @@ -909,7 +908,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { #ifdef ASSERT { Label L; - __ movl(rax, access_flags); + __ load_unsigned_short(rax, access_flags); __ testl(rax, JVM_ACC_SYNCHRONIZED); __ jcc(Assembler::zero, L); __ stop("method needs synchronization"); @@ -999,7 +998,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { // pass mirror handle if static call { Label L; - __ movl(t, Address(method, Method::access_flags_offset())); + __ load_unsigned_short(t, Address(method, Method::access_flags_offset())); __ testl(t, JVM_ACC_STATIC); __ jcc(Assembler::zero, L); // get mirror @@ -1280,7 +1279,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { // do unlocking if necessary { Label L; - __ movl(t, Address(method, Method::access_flags_offset())); + __ load_unsigned_short(t, Address(method, Method::access_flags_offset())); __ testl(t, JVM_ACC_SYNCHRONIZED); __ jcc(Assembler::zero, L); // the code below should be shared with interpreter macro @@ -1432,7 +1431,7 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) { // make sure method is not native & not abstract #ifdef ASSERT - __ movl(rax, access_flags); + __ load_unsigned_short(rax, access_flags); { Label L; __ testl(rax, JVM_ACC_NATIVE); @@ -1489,7 +1488,7 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) { #ifdef ASSERT { Label L; - __ movl(rax, access_flags); + __ load_unsigned_short(rax, access_flags); __ testl(rax, JVM_ACC_SYNCHRONIZED); __ jcc(Assembler::zero, L); __ stop("method needs synchronization"); diff --git a/src/hotspot/cpu/x86/templateInterpreterGenerator_x86_32.cpp b/src/hotspot/cpu/x86/templateInterpreterGenerator_x86_32.cpp index 75611524e3b0a..df8633bdd1502 100644 --- a/src/hotspot/cpu/x86/templateInterpreterGenerator_x86_32.cpp +++ b/src/hotspot/cpu/x86/templateInterpreterGenerator_x86_32.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "compiler/disassembler.hpp" #include "interpreter/interp_masm.hpp" diff --git a/src/hotspot/cpu/x86/templateInterpreterGenerator_x86_64.cpp b/src/hotspot/cpu/x86/templateInterpreterGenerator_x86_64.cpp index 5ea2d8eba259b..af5c0fa94b1c0 100644 --- a/src/hotspot/cpu/x86/templateInterpreterGenerator_x86_64.cpp +++ b/src/hotspot/cpu/x86/templateInterpreterGenerator_x86_64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "compiler/disassembler.hpp" #include "interpreter/interp_masm.hpp" @@ -74,7 +73,7 @@ address TemplateInterpreterGenerator::generate_slow_signature_handler() { // Do Int register here switch ( i ) { case 0: - __ movl(rscratch1, Address(rbx, Method::access_flags_offset())); + __ load_unsigned_short(rscratch1, Address(rbx, Method::access_flags_offset())); __ testl(rscratch1, JVM_ACC_STATIC); __ cmovptr(Assembler::zero, c_rarg1, Address(rsp, 0)); break; @@ -159,7 +158,7 @@ address TemplateInterpreterGenerator::generate_slow_signature_handler() { } // Now handle integrals. Only do c_rarg1 if not static. - __ movl(c_rarg3, Address(rbx, Method::access_flags_offset())); + __ load_unsigned_short(c_rarg3, Address(rbx, Method::access_flags_offset())); __ testl(c_rarg3, JVM_ACC_STATIC); __ cmovptr(Assembler::zero, c_rarg1, Address(rsp, 0)); diff --git a/src/hotspot/cpu/x86/templateTable_x86.cpp b/src/hotspot/cpu/x86/templateTable_x86.cpp index 441e4c8a0b877..55bdb52c442d0 100644 --- a/src/hotspot/cpu/x86/templateTable_x86.cpp +++ b/src/hotspot/cpu/x86/templateTable_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "compiler/disassembler.hpp" #include "gc/shared/collectedHeap.hpp" diff --git a/src/hotspot/cpu/x86/upcallLinker_x86_32.cpp b/src/hotspot/cpu/x86/upcallLinker_x86_32.cpp index 6ccf965a771d3..6dd2ddd58747d 100644 --- a/src/hotspot/cpu/x86/upcallLinker_x86_32.cpp +++ b/src/hotspot/cpu/x86/upcallLinker_x86_32.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "prims/upcallLinker.hpp" address UpcallLinker::make_upcall_stub(jobject receiver, Symbol* signature, diff --git a/src/hotspot/cpu/x86/upcallLinker_x86_64.cpp b/src/hotspot/cpu/x86/upcallLinker_x86_64.cpp index e2dadf7f0ef98..3b1aea5a02425 100644 --- a/src/hotspot/cpu/x86/upcallLinker_x86_64.cpp +++ b/src/hotspot/cpu/x86/upcallLinker_x86_64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "classfile/javaClasses.hpp" #include "code/codeBlob.hpp" diff --git a/src/hotspot/cpu/x86/vm_version_x86.cpp b/src/hotspot/cpu/x86/vm_version_x86.cpp index 688cd4fa5a6d1..cc438ce951f96 100644 --- a/src/hotspot/cpu/x86/vm_version_x86.cpp +++ b/src/hotspot/cpu/x86/vm_version_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "asm/macroAssembler.inline.hpp" #include "classfile/vmIntrinsics.hpp" @@ -1722,9 +1721,9 @@ void VM_Version::get_processor_features() { if (ArrayOperationPartialInlineSize > MaxVectorSize) { ArrayOperationPartialInlineSize = MaxVectorSize >= 16 ? MaxVectorSize : 0; if (ArrayOperationPartialInlineSize) { - warning("Setting ArrayOperationPartialInlineSize as MaxVectorSize" INTX_FORMAT ")", MaxVectorSize); + warning("Setting ArrayOperationPartialInlineSize as MaxVectorSize=%zd", MaxVectorSize); } else { - warning("Setting ArrayOperationPartialInlineSize as " INTX_FORMAT, ArrayOperationPartialInlineSize); + warning("Setting ArrayOperationPartialInlineSize as %zd", ArrayOperationPartialInlineSize); } } } diff --git a/src/hotspot/cpu/x86/vmreg_x86.cpp b/src/hotspot/cpu/x86/vmreg_x86.cpp index d40a6eaa4b2ac..44aee56ef15ce 100644 --- a/src/hotspot/cpu/x86/vmreg_x86.cpp +++ b/src/hotspot/cpu/x86/vmreg_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "code/vmreg.hpp" #include "vmreg_x86.inline.hpp" diff --git a/src/hotspot/cpu/x86/vtableStubs_x86_32.cpp b/src/hotspot/cpu/x86/vtableStubs_x86_32.cpp index 8d3ceca7b4ab1..3e70a45b58b02 100644 --- a/src/hotspot/cpu/x86/vtableStubs_x86_32.cpp +++ b/src/hotspot/cpu/x86/vtableStubs_x86_32.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "code/compiledIC.hpp" #include "code/vtableStubs.hpp" diff --git a/src/hotspot/cpu/x86/vtableStubs_x86_64.cpp b/src/hotspot/cpu/x86/vtableStubs_x86_64.cpp index 20fb035905227..b27755a243f24 100644 --- a/src/hotspot/cpu/x86/vtableStubs_x86_64.cpp +++ b/src/hotspot/cpu/x86/vtableStubs_x86_64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "code/compiledIC.hpp" #include "code/vtableStubs.hpp" diff --git a/src/hotspot/cpu/x86/x86_32.ad b/src/hotspot/cpu/x86/x86_32.ad index 02c0f9362085e..0b8dee7392aea 100644 --- a/src/hotspot/cpu/x86/x86_32.ad +++ b/src/hotspot/cpu/x86/x86_32.ad @@ -1,5 +1,5 @@ // -// Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. // // This code is free software; you can redistribute it and/or modify it @@ -2443,22 +2443,6 @@ encode %{ } %} - enc_class Push_ModD_encoding(regD src0, regD src1) %{ - __ subptr(rsp, 8); - __ movdbl(Address(rsp, 0), $src1$$XMMRegister); - __ fld_d(Address(rsp, 0)); - __ movdbl(Address(rsp, 0), $src0$$XMMRegister); - __ fld_d(Address(rsp, 0)); - %} - - enc_class Push_ModF_encoding(regF src0, regF src1) %{ - __ subptr(rsp, 4); - __ movflt(Address(rsp, 0), $src1$$XMMRegister); - __ fld_s(Address(rsp, 0)); - __ movflt(Address(rsp, 0), $src0$$XMMRegister); - __ fld_s(Address(rsp, 0)); - %} - enc_class Push_ResultD(regD dst) %{ __ fstp_d(Address(rsp, 0)); __ movdbl($dst$$XMMRegister, Address(rsp, 0)); @@ -2490,20 +2474,6 @@ encode %{ __ fld_d(Address(rsp, 0)); %} - enc_class Push_Result_Mod_DPR( regDPR src) %{ - if ($src$$reg != FPR1L_enc) { - // fincstp - emit_opcode (masm, 0xD9); - emit_opcode (masm, 0xF7); - // FXCH FPR1 with src - emit_opcode(masm, 0xD9); - emit_d8(masm, 0xC8-1+$src$$reg ); - // fdecstp - emit_opcode (masm, 0xD9); - emit_opcode (masm, 0xF6); - } - %} - enc_class fnstsw_sahf_skip_parity() %{ // fnstsw ax emit_opcode( masm, 0xDF ); @@ -2515,28 +2485,6 @@ encode %{ emit_opcode( masm, 0x05 ); %} - enc_class emitModDPR() %{ - // fprem must be iterative - // :: loop - // fprem - emit_opcode( masm, 0xD9 ); - emit_opcode( masm, 0xF8 ); - // wait - emit_opcode( masm, 0x9b ); - // fnstsw ax - emit_opcode( masm, 0xDF ); - emit_opcode( masm, 0xE0 ); - // sahf - emit_opcode( masm, 0x9E ); - // jp ::loop - emit_opcode( masm, 0x0F ); - emit_opcode( masm, 0x8A ); - emit_opcode( masm, 0xF4 ); - emit_opcode( masm, 0xFF ); - emit_opcode( masm, 0xFF ); - emit_opcode( masm, 0xFF ); - %} - enc_class fpu_flags() %{ // fnstsw_ax emit_opcode( masm, 0xDF); @@ -9801,45 +9749,6 @@ instruct strictfp_divDPR_reg(regDPR1 dst, regnotDPR1 src) %{ ins_pipe( fpu_reg_reg ); %} -instruct modDPR_reg(regDPR dst, regDPR src, eAXRegI rax, eFlagsReg cr) %{ - predicate(UseSSE<=1); - match(Set dst (ModD dst src)); - effect(KILL rax, KILL cr); // emitModDPR() uses EAX and EFLAGS - - format %{ "DMOD $dst,$src" %} - ins_cost(250); - ins_encode(Push_Reg_Mod_DPR(dst, src), - emitModDPR(), - Push_Result_Mod_DPR(src), - Pop_Reg_DPR(dst)); - ins_pipe( pipe_slow ); -%} - -instruct modD_reg(regD dst, regD src0, regD src1, eAXRegI rax, eFlagsReg cr) %{ - predicate(UseSSE>=2); - match(Set dst (ModD src0 src1)); - effect(KILL rax, KILL cr); - - format %{ "SUB ESP,8\t # DMOD\n" - "\tMOVSD [ESP+0],$src1\n" - "\tFLD_D [ESP+0]\n" - "\tMOVSD [ESP+0],$src0\n" - "\tFLD_D [ESP+0]\n" - "loop:\tFPREM\n" - "\tFWAIT\n" - "\tFNSTSW AX\n" - "\tSAHF\n" - "\tJP loop\n" - "\tFSTP_D [ESP+0]\n" - "\tMOVSD $dst,[ESP+0]\n" - "\tADD ESP,8\n" - "\tFSTP ST0\t # Restore FPU Stack" - %} - ins_cost(250); - ins_encode( Push_ModD_encoding(src0, src1), emitModDPR(), Push_ResultD(dst), PopFPU); - ins_pipe( pipe_slow ); -%} - instruct atanDPR_reg(regDPR dst, regDPR src) %{ predicate (UseSSE<=1); match(Set dst(AtanD dst src)); @@ -10445,59 +10354,6 @@ instruct divFPR_reg(regFPR dst, regFPR src) %{ %} -// Spill to obtain 24-bit precision -instruct modFPR24_reg(stackSlotF dst, regFPR src1, regFPR src2, eAXRegI rax, eFlagsReg cr) %{ - predicate( UseSSE==0 && Compile::current()->select_24_bit_instr()); - match(Set dst (ModF src1 src2)); - effect(KILL rax, KILL cr); // emitModDPR() uses EAX and EFLAGS - - format %{ "FMOD $dst,$src1,$src2" %} - ins_encode( Push_Reg_Mod_DPR(src1, src2), - emitModDPR(), - Push_Result_Mod_DPR(src2), - Pop_Mem_FPR(dst)); - ins_pipe( pipe_slow ); -%} -// -// This instruction does not round to 24-bits -instruct modFPR_reg(regFPR dst, regFPR src, eAXRegI rax, eFlagsReg cr) %{ - predicate( UseSSE==0 && !Compile::current()->select_24_bit_instr()); - match(Set dst (ModF dst src)); - effect(KILL rax, KILL cr); // emitModDPR() uses EAX and EFLAGS - - format %{ "FMOD $dst,$src" %} - ins_encode(Push_Reg_Mod_DPR(dst, src), - emitModDPR(), - Push_Result_Mod_DPR(src), - Pop_Reg_FPR(dst)); - ins_pipe( pipe_slow ); -%} - -instruct modF_reg(regF dst, regF src0, regF src1, eAXRegI rax, eFlagsReg cr) %{ - predicate(UseSSE>=1); - match(Set dst (ModF src0 src1)); - effect(KILL rax, KILL cr); - format %{ "SUB ESP,4\t # FMOD\n" - "\tMOVSS [ESP+0],$src1\n" - "\tFLD_S [ESP+0]\n" - "\tMOVSS [ESP+0],$src0\n" - "\tFLD_S [ESP+0]\n" - "loop:\tFPREM\n" - "\tFWAIT\n" - "\tFNSTSW AX\n" - "\tSAHF\n" - "\tJP loop\n" - "\tFSTP_S [ESP+0]\n" - "\tMOVSS $dst,[ESP+0]\n" - "\tADD ESP,4\n" - "\tFSTP ST0\t # Restore FPU Stack" - %} - ins_cost(250); - ins_encode( Push_ModF_encoding(src0, src1), emitModDPR(), Push_ResultF(dst,0x4), PopFPU); - ins_pipe( pipe_slow ); -%} - - //----------Arithmetic Conversion Instructions--------------------------------- // The conversions operations are all Alpha sorted. Please keep it that way! diff --git a/src/hotspot/cpu/zero/abstractInterpreter_zero.cpp b/src/hotspot/cpu/zero/abstractInterpreter_zero.cpp index bf0d13f02f87e..ec293cfa41ab9 100644 --- a/src/hotspot/cpu/zero/abstractInterpreter_zero.cpp +++ b/src/hotspot/cpu/zero/abstractInterpreter_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "interpreter/zero/bytecodeInterpreter.hpp" #include "interpreter/zero/zeroInterpreter.hpp" #include "runtime/frame.inline.hpp" diff --git a/src/hotspot/cpu/zero/assembler_zero.cpp b/src/hotspot/cpu/zero/assembler_zero.cpp index fe0f168885630..82815a57f8f26 100644 --- a/src/hotspot/cpu/zero/assembler_zero.cpp +++ b/src/hotspot/cpu/zero/assembler_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2009 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.inline.hpp" #include "gc/shared/cardTableBarrierSet.hpp" #include "gc/shared/collectedHeap.inline.hpp" diff --git a/src/hotspot/cpu/zero/bytecodeInterpreter_zero.cpp b/src/hotspot/cpu/zero/bytecodeInterpreter_zero.cpp index 3f02ff573fa72..17e845146e2d5 100644 --- a/src/hotspot/cpu/zero/bytecodeInterpreter_zero.cpp +++ b/src/hotspot/cpu/zero/bytecodeInterpreter_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright 2008 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/interpreterRuntime.hpp" diff --git a/src/hotspot/cpu/zero/compiledIC_zero.cpp b/src/hotspot/cpu/zero/compiledIC_zero.cpp index 869d96e65f844..a32bc2809aeb9 100644 --- a/src/hotspot/cpu/zero/compiledIC_zero.cpp +++ b/src/hotspot/cpu/zero/compiledIC_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "code/codeCache.hpp" #include "code/compiledIC.hpp" #include "code/nmethod.hpp" diff --git a/src/hotspot/cpu/zero/disassembler_zero.cpp b/src/hotspot/cpu/zero/disassembler_zero.cpp index 944a52f5dd963..1fdb09eb73c15 100644 --- a/src/hotspot/cpu/zero/disassembler_zero.cpp +++ b/src/hotspot/cpu/zero/disassembler_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright 2009 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,6 +23,5 @@ * */ -#include "precompiled.hpp" // This file is intentionally empty diff --git a/src/hotspot/cpu/zero/downcallLinker_zero.cpp b/src/hotspot/cpu/zero/downcallLinker_zero.cpp index 4e549552e96da..3c7d93fc79e91 100644 --- a/src/hotspot/cpu/zero/downcallLinker_zero.cpp +++ b/src/hotspot/cpu/zero/downcallLinker_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "prims/downcallLinker.hpp" RuntimeStub* DowncallLinker::make_downcall_stub(BasicType* signature, diff --git a/src/hotspot/cpu/zero/foreignGlobals_zero.cpp b/src/hotspot/cpu/zero/foreignGlobals_zero.cpp index d28a4c7c2f170..57433ffb98c1a 100644 --- a/src/hotspot/cpu/zero/foreignGlobals_zero.cpp +++ b/src/hotspot/cpu/zero/foreignGlobals_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "code/vmreg.hpp" #include "prims/foreignGlobals.hpp" #include "utilities/debug.hpp" diff --git a/src/hotspot/cpu/zero/frame_zero.cpp b/src/hotspot/cpu/zero/frame_zero.cpp index 7c65387f2388d..4b4bd1e2b87af 100644 --- a/src/hotspot/cpu/zero/frame_zero.cpp +++ b/src/hotspot/cpu/zero/frame_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2021, Red Hat, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/collectedHeap.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/interpreterRuntime.hpp" diff --git a/src/hotspot/cpu/zero/gc/shared/barrierSetNMethod_zero.cpp b/src/hotspot/cpu/zero/gc/shared/barrierSetNMethod_zero.cpp index 90f971a315243..62e7134ed61ee 100644 --- a/src/hotspot/cpu/zero/gc/shared/barrierSetNMethod_zero.cpp +++ b/src/hotspot/cpu/zero/gc/shared/barrierSetNMethod_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/barrierSetNMethod.hpp" #include "utilities/debug.hpp" diff --git a/src/hotspot/cpu/zero/icache_zero.cpp b/src/hotspot/cpu/zero/icache_zero.cpp index 3b255befd55ac..25018110d9c98 100644 --- a/src/hotspot/cpu/zero/icache_zero.cpp +++ b/src/hotspot/cpu/zero/icache_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2009 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.inline.hpp" #include "runtime/icache.hpp" diff --git a/src/hotspot/cpu/zero/interpreterRT_zero.cpp b/src/hotspot/cpu/zero/interpreterRT_zero.cpp index 5aeb5a0981de0..85199524a888a 100644 --- a/src/hotspot/cpu/zero/interpreterRT_zero.cpp +++ b/src/hotspot/cpu/zero/interpreterRT_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2010 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/interpreterRuntime.hpp" #include "memory/allocation.inline.hpp" diff --git a/src/hotspot/cpu/zero/jniFastGetField_zero.cpp b/src/hotspot/cpu/zero/jniFastGetField_zero.cpp index dea7d7c3b831b..3c43ccf69c1b4 100644 --- a/src/hotspot/cpu/zero/jniFastGetField_zero.cpp +++ b/src/hotspot/cpu/zero/jniFastGetField_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright 2007 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.inline.hpp" #include "memory/resourceArea.hpp" #include "prims/jniFastGetField.hpp" diff --git a/src/hotspot/cpu/zero/methodHandles_zero.cpp b/src/hotspot/cpu/zero/methodHandles_zero.cpp index 4021d0e74b681..3bf8c46f56c8a 100644 --- a/src/hotspot/cpu/zero/methodHandles_zero.cpp +++ b/src/hotspot/cpu/zero/methodHandles_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright 2009, 2010, 2011 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "classfile/javaClasses.inline.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/interpreterRuntime.hpp" diff --git a/src/hotspot/cpu/zero/nativeInst_zero.cpp b/src/hotspot/cpu/zero/nativeInst_zero.cpp index 53f6fcef83019..0d2747f7fa698 100644 --- a/src/hotspot/cpu/zero/nativeInst_zero.cpp +++ b/src/hotspot/cpu/zero/nativeInst_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright 2008 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.inline.hpp" #include "entry_zero.hpp" #include "interpreter/zero/zeroInterpreter.hpp" diff --git a/src/hotspot/cpu/zero/register_zero.cpp b/src/hotspot/cpu/zero/register_zero.cpp index 812119b66af70..eef89153896a6 100644 --- a/src/hotspot/cpu/zero/register_zero.cpp +++ b/src/hotspot/cpu/zero/register_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright 2007 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "register_zero.hpp" const int ConcreteRegisterImpl::max_gpr = RegisterImpl::number_of_registers; diff --git a/src/hotspot/cpu/zero/relocInfo_zero.cpp b/src/hotspot/cpu/zero/relocInfo_zero.cpp index b926f20cfe7d8..647d5be31314c 100644 --- a/src/hotspot/cpu/zero/relocInfo_zero.cpp +++ b/src/hotspot/cpu/zero/relocInfo_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2009, 2010, 2011 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/codeBuffer.hpp" #include "code/relocInfo.hpp" #include "nativeInst_zero.hpp" diff --git a/src/hotspot/cpu/zero/sharedRuntime_zero.cpp b/src/hotspot/cpu/zero/sharedRuntime_zero.cpp index 672f1d73dc1c0..f141135ff9571 100644 --- a/src/hotspot/cpu/zero/sharedRuntime_zero.cpp +++ b/src/hotspot/cpu/zero/sharedRuntime_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.inline.hpp" #include "code/debugInfoRec.hpp" #include "code/vtableStubs.hpp" diff --git a/src/hotspot/cpu/zero/stack_zero.cpp b/src/hotspot/cpu/zero/stack_zero.cpp index ef986111cf890..67692a2bb7bc0 100644 --- a/src/hotspot/cpu/zero/stack_zero.cpp +++ b/src/hotspot/cpu/zero/stack_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright 2010 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "interpreter/interpreterRuntime.hpp" #include "interpreter/zero/bytecodeInterpreter.hpp" #include "runtime/frame.inline.hpp" diff --git a/src/hotspot/cpu/zero/stubGenerator_zero.cpp b/src/hotspot/cpu/zero/stubGenerator_zero.cpp index b6905791e9884..0ab43ed78f7a3 100644 --- a/src/hotspot/cpu/zero/stubGenerator_zero.cpp +++ b/src/hotspot/cpu/zero/stubGenerator_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2010, 2015 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.inline.hpp" #include "interpreter/interpreter.hpp" #include "nativeInst_zero.hpp" diff --git a/src/hotspot/cpu/zero/stubRoutines_zero.cpp b/src/hotspot/cpu/zero/stubRoutines_zero.cpp index 0a9e3558711dd..4337b2db73042 100644 --- a/src/hotspot/cpu/zero/stubRoutines_zero.cpp +++ b/src/hotspot/cpu/zero/stubRoutines_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright 2008, 2009 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "runtime/deoptimization.hpp" #include "runtime/frame.inline.hpp" #include "runtime/javaThread.hpp" diff --git a/src/hotspot/cpu/zero/upcallLinker_zero.cpp b/src/hotspot/cpu/zero/upcallLinker_zero.cpp index 5dbc3cb62972d..55479a4b34176 100644 --- a/src/hotspot/cpu/zero/upcallLinker_zero.cpp +++ b/src/hotspot/cpu/zero/upcallLinker_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "prims/upcallLinker.hpp" address UpcallLinker::make_upcall_stub(jobject mh, Symbol* signature, diff --git a/src/hotspot/cpu/zero/vm_version_zero.cpp b/src/hotspot/cpu/zero/vm_version_zero.cpp index 1706be3089d78..e38561e19c571 100644 --- a/src/hotspot/cpu/zero/vm_version_zero.cpp +++ b/src/hotspot/cpu/zero/vm_version_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright 2009 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.inline.hpp" #include "memory/resourceArea.hpp" #include "runtime/arguments.hpp" diff --git a/src/hotspot/cpu/zero/vmreg_zero.cpp b/src/hotspot/cpu/zero/vmreg_zero.cpp index f9f410de9c805..dfaec25540fef 100644 --- a/src/hotspot/cpu/zero/vmreg_zero.cpp +++ b/src/hotspot/cpu/zero/vmreg_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright 2007 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "code/vmreg.hpp" diff --git a/src/hotspot/cpu/zero/vtableStubs_zero.cpp b/src/hotspot/cpu/zero/vtableStubs_zero.cpp index 6258762279ee0..12819b484b2b6 100644 --- a/src/hotspot/cpu/zero/vtableStubs_zero.cpp +++ b/src/hotspot/cpu/zero/vtableStubs_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright 2007 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "code/vtableStubs.hpp" #include "utilities/debug.hpp" diff --git a/src/hotspot/cpu/zero/zeroInterpreter_zero.cpp b/src/hotspot/cpu/zero/zeroInterpreter_zero.cpp index 3e05eb1448dd6..029ccbded1366 100644 --- a/src/hotspot/cpu/zero/zeroInterpreter_zero.cpp +++ b/src/hotspot/cpu/zero/zeroInterpreter_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/interpreterRuntime.hpp" diff --git a/src/hotspot/os/aix/attachListener_aix.cpp b/src/hotspot/os/aix/attachListener_aix.cpp index 721901bb0e244..218ee04fdcc0e 100644 --- a/src/hotspot/os/aix/attachListener_aix.cpp +++ b/src/hotspot/os/aix/attachListener_aix.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "logging/log.hpp" #include "os_posix.hpp" #include "runtime/interfaceSupport.inline.hpp" diff --git a/src/hotspot/os/aix/loadlib_aix.cpp b/src/hotspot/os/aix/loadlib_aix.cpp index bc21aef383698..2c38e1b637ca7 100644 --- a/src/hotspot/os/aix/loadlib_aix.cpp +++ b/src/hotspot/os/aix/loadlib_aix.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * Copyright (c) 2022, IBM Corp. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -203,7 +203,7 @@ static bool reload_table() { } } - trcVerbose("loadquery buffer size is " SIZE_FORMAT ".", buflen); + trcVerbose("loadquery buffer size is %zu.", buflen); // Iterate over the loadquery result. For details see sys/ldr.h on AIX. ldi = (struct ld_info*) buffer; @@ -262,7 +262,7 @@ static bool reload_table() { lm->is_in_vm = true; } - trcVerbose("entry: %p " SIZE_FORMAT ", %p " SIZE_FORMAT ", %s %s %s, %d", + trcVerbose("entry: %p %zu, %p %zu, %s %s %s, %d", lm->text, lm->text_len, lm->data, lm->data_len, lm->path, lm->shortname, diff --git a/src/hotspot/os/aix/osThread_aix.cpp b/src/hotspot/os/aix/osThread_aix.cpp index 86d9821e5a520..204b271ceee11 100644 --- a/src/hotspot/os/aix/osThread_aix.cpp +++ b/src/hotspot/os/aix/osThread_aix.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "memory/allocation.hpp" #include "runtime/mutex.hpp" #include "runtime/osThread.hpp" diff --git a/src/hotspot/os/aix/os_aix.cpp b/src/hotspot/os/aix/os_aix.cpp index 26627c2f8fb3b..9222104c6d6b7 100644 --- a/src/hotspot/os/aix/os_aix.cpp +++ b/src/hotspot/os/aix/os_aix.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2024 SAP SE. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,6 @@ * */ -// no precompiled headers #include "classfile/vmSymbols.hpp" #include "code/vtableStubs.hpp" #include "compiler/compileBroker.hpp" @@ -450,7 +449,7 @@ static void query_multipage_support() { if (p != (void*) -1) { const size_t real_pagesize = os::Aix::query_pagesize(p); if (real_pagesize != pagesize) { - log_warning(pagesize)("real page size (" SIZE_FORMAT_X ") differs.", real_pagesize); + log_warning(pagesize)("real page size (0x%zx) differs.", real_pagesize); } else { can_use = true; } @@ -631,8 +630,8 @@ static void *thread_native_entry(Thread *thread) { if (lt.is_enabled()) { address low_address = thread->stack_end(); address high_address = thread->stack_base(); - lt.print("Thread is alive (tid: " UINTX_FORMAT ", kernel thread id: " UINTX_FORMAT - ", stack [" PTR_FORMAT " - " PTR_FORMAT " (" SIZE_FORMAT "k using %luk pages)).", + lt.print("Thread is alive (tid: %zu, kernel thread id: %zu" + ", stack [" PTR_FORMAT " - " PTR_FORMAT " (%zuk using %luk pages)).", os::current_thread_id(), (uintx) kernel_thread_id, p2i(low_address), p2i(high_address), (high_address - low_address) / K, os::Aix::query_pagesize(low_address) / K); } @@ -681,7 +680,7 @@ static void *thread_native_entry(Thread *thread) { // Prevent dereferencing it from here on out. thread = nullptr; - log_info(os, thread)("Thread finished (tid: " UINTX_FORMAT ", kernel thread id: " UINTX_FORMAT ").", + log_info(os, thread)("Thread finished (tid: %zu, kernel thread id: %zu).", os::current_thread_id(), (uintx) kernel_thread_id); return 0; @@ -733,7 +732,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, // guard pages might not fit on the tiny stack created. int ret = pthread_attr_setstacksize(&attr, stack_size); if (ret != 0) { - log_warning(os, thread)("The %sthread stack size specified is invalid: " SIZE_FORMAT "k", + log_warning(os, thread)("The %sthread stack size specified is invalid: %zuk", (thr_type == compiler_thread) ? "compiler " : ((thr_type == java_thread) ? "" : "VM "), stack_size / K); thread->set_osthread(nullptr); @@ -761,7 +760,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, if (ret == 0) { char buf[64]; - log_info(os, thread)("Thread \"%s\" started (pthread id: " UINTX_FORMAT ", attributes: %s). ", + log_info(os, thread)("Thread \"%s\" started (pthread id: %zu, attributes: %s). ", thread->name(), (uintx) tid, os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr)); } else { char buf[64]; @@ -769,7 +768,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, thread->name(), ret, os::errno_name(ret), os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr)); // Log some OS information which might explain why creating the thread failed. log_warning(os, thread)("Number of threads approx. running in the VM: %d", Threads::number_of_threads()); - log_warning(os, thread)("Checking JVM parameter MaxExpectedDataSegmentSize (currently " SIZE_FORMAT "k) might be helpful", MaxExpectedDataSegmentSize/K); + log_warning(os, thread)("Checking JVM parameter MaxExpectedDataSegmentSize (currently %zuk) might be helpful", MaxExpectedDataSegmentSize/K); LogStream st(Log(os, thread)::info()); os::Posix::print_rlimit_info(&st); os::print_memory_info(&st); @@ -839,8 +838,8 @@ bool os::create_attached_thread(JavaThread* thread) { // and save the caller's signal mask PosixSignals::hotspot_sigmask(thread); - log_info(os, thread)("Thread attached (tid: " UINTX_FORMAT ", kernel thread id: " UINTX_FORMAT - ", stack: " PTR_FORMAT " - " PTR_FORMAT " (" SIZE_FORMAT "K) ).", + log_info(os, thread)("Thread attached (tid: %zu, kernel thread id: %zu" + ", stack: " PTR_FORMAT " - " PTR_FORMAT " (%zuK) ).", os::current_thread_id(), (uintx) kernel_thread_id, p2i(thread->stack_base()), p2i(thread->stack_end()), thread->stack_size() / K); @@ -1067,21 +1066,24 @@ static void* dll_load_library(const char *filename, int *eno, char *ebuf, int eb // 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. - int eno=0; + int eno = 0; result = dll_load_library(filename, &eno, ebuf, ebuflen); - // If the load fails,we try to reload by changing the extension to .a for .so files only. + // 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 && eno == ENOENT && 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, &eno, ebuf, ebuflen); + if (result == nullptr && eno == ENOENT) { + const char* pointer_to_dot = strrchr(filename, '.'); + if (pointer_to_dot != nullptr && strcmp(pointer_to_dot, old_extension) == 0) { + STATIC_ASSERT(sizeof(old_extension) >= sizeof(new_extension)); + char* tmp_path = os::strdup(filename); + size_t prefix_size = pointer_delta(pointer_to_dot, filename, 1); + os::snprintf(tmp_path + prefix_size, sizeof(old_extension), "%s", new_extension); + result = dll_load_library(tmp_path, &eno, ebuf, ebuflen); + os::free(tmp_path); + } } - FREE_C_HEAP_ARRAY(char, file_path); return result; } @@ -1191,10 +1193,10 @@ void os::print_memory_info(outputStream* st) { os::Aix::meminfo_t mi; if (os::Aix::get_meminfo(&mi)) { - st->print_cr("physical total : " SIZE_FORMAT, mi.real_total); - st->print_cr("physical free : " SIZE_FORMAT, mi.real_free); - st->print_cr("swap total : " SIZE_FORMAT, mi.pgsp_total); - st->print_cr("swap free : " SIZE_FORMAT, mi.pgsp_free); + st->print_cr("physical total : %zu", mi.real_total); + st->print_cr("physical free : %zu", mi.real_free); + st->print_cr("swap total : %zu", mi.pgsp_total); + st->print_cr("swap free : %zu", mi.pgsp_free); } st->cr(); @@ -1202,10 +1204,10 @@ void os::print_memory_info(outputStream* st) { st->print_cr("Program break at VM startup: " PTR_FORMAT ".", p2i(g_brk_at_startup)); address brk_now = (address)::sbrk(0); if (brk_now != (address)-1) { - st->print_cr("Program break now : " PTR_FORMAT " (distance: " SIZE_FORMAT "k).", + st->print_cr("Program break now : " PTR_FORMAT " (distance: %zuk).", p2i(brk_now), (size_t)((brk_now - g_brk_at_startup) / K)); } - st->print_cr("MaxExpectedDataSegmentSize : " SIZE_FORMAT "k.", MaxExpectedDataSegmentSize / K); + st->print_cr("MaxExpectedDataSegmentSize : %zuk.", MaxExpectedDataSegmentSize / K); st->cr(); // Print segments allocated with os::reserve_memory. @@ -1379,7 +1381,7 @@ struct vmembk_t { } void print_on(outputStream* os) const { - os->print("[" PTR_FORMAT " - " PTR_FORMAT "] (" UINTX_FORMAT + os->print("[" PTR_FORMAT " - " PTR_FORMAT "] (%zu" " bytes, %ld %s pages), %s", p2i(addr), p2i(addr) + size - 1, size, size / pagesize, describe_pagesize(pagesize), (type == VMEM_SHMATED ? "shmat" : "mmap") @@ -1456,7 +1458,7 @@ static void vmembk_print_on(outputStream* os) { // If is null, function will attach the memory anywhere. static char* reserve_shmated_memory (size_t bytes, char* requested_addr) { - trcVerbose("reserve_shmated_memory " UINTX_FORMAT " bytes, wishaddress " + trcVerbose("reserve_shmated_memory %zu bytes, wishaddress " PTR_FORMAT "...", bytes, p2i(requested_addr)); // We must prevent anyone from attaching too close to the @@ -1477,7 +1479,7 @@ static char* reserve_shmated_memory (size_t bytes, char* requested_addr) { int shmid = shmget(IPC_PRIVATE, size, IPC_CREAT | S_IRUSR | S_IWUSR); if (shmid == -1) { ErrnoPreserver ep; - log_trace(os, map)("shmget(.., " UINTX_FORMAT ", ..) failed (errno=%s).", + log_trace(os, map)("shmget(.., %zu, ..) failed (errno=%s).", size, os::strerror(ep.saved_errno())); return nullptr; } @@ -1493,7 +1495,7 @@ static char* reserve_shmated_memory (size_t bytes, char* requested_addr) { shmbuf.shm_pagesize = 64*K; if (shmctl(shmid, SHM_PAGESIZE, &shmbuf) != 0) { assert(false, - "Failed to set page size (need " UINTX_FORMAT + "Failed to set page size (need %zu" " 64K pages) - shmctl failed. (errno=%s).", size / (64 * K), os::strerror(os::get_last_error())); } @@ -1530,13 +1532,13 @@ static char* reserve_shmated_memory (size_t bytes, char* requested_addr) { // work (see above), the system may have given us something other then 4K (LDR_CNTRL). const size_t real_pagesize = os::Aix::query_pagesize(addr); if (real_pagesize != (size_t)shmbuf.shm_pagesize) { - log_trace(os, map)("pagesize is, surprisingly, " SIZE_FORMAT, + log_trace(os, map)("pagesize is, surprisingly, %zu", real_pagesize); } if (addr) { log_trace(os, map)("shm-allocated succeeded: " RANGEFMT - " (" UINTX_FORMAT " %s pages)", + " (%zu %s pages)", RANGEFMTARGS(addr, size), size / real_pagesize, describe_pagesize(real_pagesize)); @@ -1545,7 +1547,7 @@ static char* reserve_shmated_memory (size_t bytes, char* requested_addr) { log_trace(os, map)("shm-allocate failed: " RANGEFMT, RANGEFMTARGS(requested_addr, size)); } else { - log_trace(os, map)("failed to shm-allocate " UINTX_FORMAT + log_trace(os, map)("failed to shm-allocate %zu" " bytes at any address.", size); } @@ -1587,7 +1589,7 @@ static bool uncommit_shmated_memory(char* addr, size_t size) { if (rc != 0) { ErrnoPreserver ep; - log_warning(os)("disclaim64(" PTR_FORMAT ", " UINTX_FORMAT ") failed, %s\n", p2i(addr), size, os::strerror(ep.saved_errno())); + log_warning(os)("disclaim64(" PTR_FORMAT ", %zu) failed, %s\n", p2i(addr), size, os::strerror(ep.saved_errno())); return false; } return true; @@ -1599,7 +1601,7 @@ static bool uncommit_shmated_memory(char* addr, size_t size) { // If is given, an attempt is made to attach at the given address. // Failing that, memory is allocated at any address. static char* reserve_mmaped_memory(size_t bytes, char* requested_addr) { - trcVerbose("reserve_mmaped_memory " UINTX_FORMAT " bytes, wishaddress " PTR_FORMAT "...", + trcVerbose("reserve_mmaped_memory %zu bytes, wishaddress " PTR_FORMAT "...", bytes, p2i(requested_addr)); if (requested_addr && !is_aligned_to(requested_addr, os::vm_page_size()) != 0) { @@ -1689,7 +1691,7 @@ static char* reserve_mmaped_memory(size_t bytes, char* requested_addr) { } addr = addr_aligned; - trcVerbose("mmap-allocated " PTR_FORMAT " .. " PTR_FORMAT " (" UINTX_FORMAT " bytes)", + trcVerbose("mmap-allocated " PTR_FORMAT " .. " PTR_FORMAT " (%zu bytes)", p2i(addr), p2i(addr + bytes), bytes); // bookkeeping @@ -1756,9 +1758,8 @@ static bool uncommit_mmaped_memory(char* addr, size_t size) { #ifdef PRODUCT static void warn_fail_commit_memory(char* addr, size_t size, bool exec, int err) { - warning("INFO: os::commit_memory(" PTR_FORMAT ", " SIZE_FORMAT - ", %d) failed; error='%s' (errno=%d)", p2i(addr), size, exec, - os::errno_name(err), err); + warning("INFO: os::commit_memory(" PTR_FORMAT ", %zu, %d) failed; error='%s' (errno=%d)", + p2i(addr), size, exec, os::errno_name(err), err); } #endif @@ -1775,10 +1776,10 @@ void os::pd_commit_memory_or_exit(char* addr, size_t size, bool exec, bool os::pd_commit_memory(char* addr, size_t size, bool exec) { assert(is_aligned_to(addr, os::vm_page_size()), - "addr " PTR_FORMAT " not aligned to vm_page_size (" SIZE_FORMAT ")", + "addr " PTR_FORMAT " not aligned to vm_page_size (%zu)", p2i(addr), os::vm_page_size()); assert(is_aligned_to(size, os::vm_page_size()), - "size " PTR_FORMAT " not aligned to vm_page_size (" SIZE_FORMAT ")", + "size " PTR_FORMAT " not aligned to vm_page_size (%zu)", size, os::vm_page_size()); vmembk_t* const vmi = vmembk_find(addr); @@ -1810,10 +1811,10 @@ void os::pd_commit_memory_or_exit(char* addr, size_t size, bool os::pd_uncommit_memory(char* addr, size_t size, bool exec) { assert(is_aligned_to(addr, os::vm_page_size()), - "addr " PTR_FORMAT " not aligned to vm_page_size (" SIZE_FORMAT ")", + "addr " PTR_FORMAT " not aligned to vm_page_size (%zu)", p2i(addr), os::vm_page_size()); assert(is_aligned_to(size, os::vm_page_size()), - "size " PTR_FORMAT " not aligned to vm_page_size (" SIZE_FORMAT ")", + "size " PTR_FORMAT " not aligned to vm_page_size (%zu)", size, os::vm_page_size()); // Dynamically do different things for mmap/shmat. @@ -2783,7 +2784,7 @@ bool os::start_debugging(char *buf, int buflen) { jio_snprintf(p, buflen -len, "\n\n" "Do you want to debug the problem?\n\n" - "To debug, run 'dbx -a %d'; then switch to thread tid " INTX_FORMAT ", k-tid " INTX_FORMAT "\n" + "To debug, run 'dbx -a %d'; then switch to thread tid %zd, k-tid %zd\n" "Enter 'yes' to launch dbx automatically (PATH must include dbx)\n" "Otherwise, press RETURN to abort...", os::current_process_id(), diff --git a/src/hotspot/os/aix/os_perf_aix.cpp b/src/hotspot/os/aix/os_perf_aix.cpp index b5ae1a6a725a5..0b008a197ded7 100644 --- a/src/hotspot/os/aix/os_perf_aix.cpp +++ b/src/hotspot/os/aix/os_perf_aix.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2022, 2024, IBM Corp. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "jvm.h" #include "libperfstat_aix.hpp" #include "memory/allocation.inline.hpp" diff --git a/src/hotspot/os/aix/safepointMechanism_aix.cpp b/src/hotspot/os/aix/safepointMechanism_aix.cpp index 0a36c89bec6a9..e1f717cdd1490 100644 --- a/src/hotspot/os/aix/safepointMechanism_aix.cpp +++ b/src/hotspot/os/aix/safepointMechanism_aix.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "logging/log.hpp" #include "nmt/memTracker.hpp" #include "runtime/globals.hpp" diff --git a/src/hotspot/os/bsd/decoder_machO.cpp b/src/hotspot/os/bsd/decoder_machO.cpp index 417e7139a5897..173e030a7b51c 100644 --- a/src/hotspot/os/bsd/decoder_machO.cpp +++ b/src/hotspot/os/bsd/decoder_machO.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #ifdef __APPLE__ #include "decoder_machO.hpp" diff --git a/src/hotspot/os/bsd/gc/z/zLargePages_bsd.cpp b/src/hotspot/os/bsd/gc/z/zLargePages_bsd.cpp index 6e26741a5071f..0c42d7790886e 100644 --- a/src/hotspot/os/bsd/gc/z/zLargePages_bsd.cpp +++ b/src/hotspot/os/bsd/gc/z/zLargePages_bsd.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zLargePages.hpp" #include "runtime/globals.hpp" diff --git a/src/hotspot/os/bsd/gc/z/zNUMA_bsd.cpp b/src/hotspot/os/bsd/gc/z/zNUMA_bsd.cpp index e5b3895c44e6d..3cd9338f1d66d 100644 --- a/src/hotspot/os/bsd/gc/z/zNUMA_bsd.cpp +++ b/src/hotspot/os/bsd/gc/z/zNUMA_bsd.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zNUMA.hpp" #include "utilities/globalDefinitions.hpp" diff --git a/src/hotspot/os/bsd/gc/z/zPhysicalMemoryBacking_bsd.cpp b/src/hotspot/os/bsd/gc/z/zPhysicalMemoryBacking_bsd.cpp index 16835c8303931..37c855c2e2be5 100644 --- a/src/hotspot/os/bsd/gc/z/zPhysicalMemoryBacking_bsd.cpp +++ b/src/hotspot/os/bsd/gc/z/zPhysicalMemoryBacking_bsd.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zAddress.inline.hpp" #include "gc/z/zErrno.hpp" #include "gc/z/zGlobals.hpp" @@ -102,7 +101,7 @@ bool ZPhysicalMemoryBacking::commit_inner(zoffset offset, size_t length) const { assert(is_aligned(untype(offset), os::vm_page_size()), "Invalid offset"); assert(is_aligned(length, os::vm_page_size()), "Invalid length"); - log_trace(gc, heap)("Committing memory: " SIZE_FORMAT "M-" SIZE_FORMAT "M (" SIZE_FORMAT "M)", + log_trace(gc, heap)("Committing memory: %zuM-%zuM (%zuM)", untype(offset) / M, untype(to_zoffset_end(offset, length)) / M, length / M); const uintptr_t addr = _base + untype(offset); @@ -149,7 +148,7 @@ size_t ZPhysicalMemoryBacking::uncommit(zoffset offset, size_t length) const { assert(is_aligned(untype(offset), os::vm_page_size()), "Invalid offset"); assert(is_aligned(length, os::vm_page_size()), "Invalid length"); - log_trace(gc, heap)("Uncommitting memory: " SIZE_FORMAT "M-" SIZE_FORMAT "M (" SIZE_FORMAT "M)", + log_trace(gc, heap)("Uncommitting memory: %zuM-%zuM (%zuM)", untype(offset) / M, untype(to_zoffset_end(offset, length)) / M, length / M); const uintptr_t start = _base + untype(offset); diff --git a/src/hotspot/os/bsd/memMapPrinter_macosx.cpp b/src/hotspot/os/bsd/memMapPrinter_macosx.cpp index 33c30ab6f7099..477803001cb9f 100644 --- a/src/hotspot/os/bsd/memMapPrinter_macosx.cpp +++ b/src/hotspot/os/bsd/memMapPrinter_macosx.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, 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. * @@ -25,8 +25,6 @@ #if defined(__APPLE__) -#include "precompiled.hpp" - #include "nmt/memMapPrinter.hpp" #include "runtime/os.hpp" #include "utilities/align.hpp" @@ -380,4 +378,4 @@ void MemMapPrinter::pd_print_all_mappings(const MappingPrintSession& session) { summary.print_on(session); st->cr(); } -#endif // __APPLE__ \ No newline at end of file +#endif // __APPLE__ diff --git a/src/hotspot/os/bsd/osThread_bsd.cpp b/src/hotspot/os/bsd/osThread_bsd.cpp index d9624040bc740..db476e529ac2b 100644 --- a/src/hotspot/os/bsd/osThread_bsd.cpp +++ b/src/hotspot/os/bsd/osThread_bsd.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "memory/allocation.hpp" #include "runtime/mutex.hpp" #include "runtime/osThread.hpp" diff --git a/src/hotspot/os/bsd/os_bsd.cpp b/src/hotspot/os/bsd/os_bsd.cpp index 5db846275d4b4..b386169138faf 100644 --- a/src/hotspot/os/bsd/os_bsd.cpp +++ b/src/hotspot/os/bsd/os_bsd.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -// no precompiled headers #include "classfile/vmSymbols.hpp" #include "code/vtableStubs.hpp" #include "compiler/compileBroker.hpp" @@ -605,7 +604,7 @@ static void *thread_native_entry(Thread *thread) { } } - log_info(os, thread)("Thread is alive (tid: " UINTX_FORMAT ", pthread id: " UINTX_FORMAT ").", + log_info(os, thread)("Thread is alive (tid: %zu, pthread id: %zu).", os::current_thread_id(), (uintx) pthread_self()); // call one more level start routine @@ -615,7 +614,7 @@ static void *thread_native_entry(Thread *thread) { // Prevent dereferencing it from here on out. thread = nullptr; - log_info(os, thread)("Thread finished (tid: " UINTX_FORMAT ", pthread id: " UINTX_FORMAT ").", + log_info(os, thread)("Thread finished (tid: %zu, pthread id: %zu).", os::current_thread_id(), (uintx) pthread_self()); return 0; @@ -660,7 +659,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, char buf[64]; if (ret == 0) { - log_info(os, thread)("Thread \"%s\" started (pthread id: " UINTX_FORMAT ", attributes: %s). ", + log_info(os, thread)("Thread \"%s\" started (pthread id: %zu, attributes: %s). ", thread->name(), (uintx) tid, os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr)); } else { log_warning(os, thread)("Failed to start thread \"%s\" - pthread_create failed (%s) for attributes: %s.", @@ -744,8 +743,8 @@ bool os::create_attached_thread(JavaThread* thread) { // and save the caller's signal mask PosixSignals::hotspot_sigmask(thread); - log_info(os, thread)("Thread attached (tid: " UINTX_FORMAT ", pthread id: " UINTX_FORMAT - ", stack: " PTR_FORMAT " - " PTR_FORMAT " (" SIZE_FORMAT "K) ).", + log_info(os, thread)("Thread attached (tid: %zu, pthread id: %zu" + ", stack: " PTR_FORMAT " - " PTR_FORMAT " (%zuK) ).", os::current_thread_id(), (uintx) pthread_self(), p2i(thread->stack_base()), p2i(thread->stack_end()), thread->stack_size() / K); return true; @@ -1459,7 +1458,7 @@ void os::print_memory_info(outputStream* st) { size_t size = sizeof(swap_usage); st->print("Memory:"); - st->print(" " SIZE_FORMAT "k page", os::vm_page_size()>>10); + st->print(" %zuk page", os::vm_page_size()>>10); st->print(", physical " UINT64_FORMAT "k", os::physical_memory() >> 10); @@ -1586,7 +1585,7 @@ void os::jvm_path(char *buf, jint buflen) { static void warn_fail_commit_memory(char* addr, size_t size, bool exec, int err) { - warning("INFO: os::commit_memory(" INTPTR_FORMAT ", " SIZE_FORMAT + warning("INFO: os::commit_memory(" INTPTR_FORMAT ", %zu" ", %d) failed; error='%s' (errno=%d)", (intptr_t)addr, size, exec, os::errno_name(err), err); } @@ -2524,7 +2523,7 @@ bool os::start_debugging(char *buf, int buflen) { jio_snprintf(p, buflen-len, "\n\n" "Do you want to debug the problem?\n\n" - "To debug, run 'gdb /proc/%d/exe %d'; then switch to thread " INTX_FORMAT " (" INTPTR_FORMAT ")\n" + "To debug, run 'gdb /proc/%d/exe %d'; then switch to thread %zd (" INTPTR_FORMAT ")\n" "Enter 'yes' to launch gdb automatically (PATH must include gdb)\n" "Otherwise, press RETURN to abort...", os::current_process_id(), os::current_process_id(), diff --git a/src/hotspot/os/bsd/os_perf_bsd.cpp b/src/hotspot/os/bsd/os_perf_bsd.cpp index 631d2135b6475..78d9519c3a71a 100644 --- a/src/hotspot/os/bsd/os_perf_bsd.cpp +++ b/src/hotspot/os/bsd/os_perf_bsd.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. * */ -#include "precompiled.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" #include "runtime/os.hpp" diff --git a/src/hotspot/os/bsd/semaphore_bsd.cpp b/src/hotspot/os/bsd/semaphore_bsd.cpp index 849dafb36ee6d..771756ea5e028 100644 --- a/src/hotspot/os/bsd/semaphore_bsd.cpp +++ b/src/hotspot/os/bsd/semaphore_bsd.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "semaphore_bsd.hpp" #include "runtime/os.hpp" #include "utilities/debug.hpp" diff --git a/src/hotspot/os/linux/cgroupSubsystem_linux.cpp b/src/hotspot/os/linux/cgroupSubsystem_linux.cpp index 4a8fda432d894..bb51d4f3b8ee0 100644 --- a/src/hotspot/os/linux/cgroupSubsystem_linux.cpp +++ b/src/hotspot/os/linux/cgroupSubsystem_linux.cpp @@ -37,7 +37,7 @@ #include "utilities/globalDefinitions.hpp" // controller names have to match the *_IDX indices -static const char* cg_controller_name[] = { "cpu", "cpuset", "cpuacct", "memory", "pids" }; +static const char* cg_controller_name[] = { "cpuset", "cpu", "cpuacct", "memory", "pids" }; CgroupSubsystem* CgroupSubsystemFactory::create() { CgroupV1MemoryController* memory = nullptr; @@ -226,9 +226,10 @@ bool CgroupSubsystemFactory::determine_type(CgroupInfo* cg_infos, char buf[MAXPATHLEN+1]; char *p; bool is_cgroupsV2; - // true iff all required controllers, memory, cpu, cpuset, cpuacct are enabled + // true iff all required controllers, memory, cpu, cpuacct are enabled // at the kernel level. // pids might not be enabled on older Linux distros (SLES 12.1, RHEL 7.1) + // cpuset might not be enabled on newer Linux distros (Fedora 41) bool all_required_controllers_enabled; /* @@ -260,6 +261,7 @@ bool CgroupSubsystemFactory::determine_type(CgroupInfo* cg_infos, cg_infos[MEMORY_IDX]._hierarchy_id = hierarchy_id; cg_infos[MEMORY_IDX]._enabled = (enabled == 1); } else if (strcmp(name, "cpuset") == 0) { + log_debug(os, container)("Detected optional cpuset controller entry in %s", proc_cgroups); cg_infos[CPUSET_IDX]._name = os::strdup(name); cg_infos[CPUSET_IDX]._hierarchy_id = hierarchy_id; cg_infos[CPUSET_IDX]._enabled = (enabled == 1); @@ -283,8 +285,8 @@ bool CgroupSubsystemFactory::determine_type(CgroupInfo* cg_infos, is_cgroupsV2 = true; all_required_controllers_enabled = true; for (int i = 0; i < CG_INFO_LENGTH; i++) { - // pids controller is optional. All other controllers are required - if (i != PIDS_IDX) { + // pids and cpuset controllers are optional. All other controllers are required + if (i != PIDS_IDX && i != CPUSET_IDX) { is_cgroupsV2 = is_cgroupsV2 && cg_infos[i]._hierarchy_id == 0; all_required_controllers_enabled = all_required_controllers_enabled && cg_infos[i]._enabled; } diff --git a/src/hotspot/os/linux/gc/z/zLargePages_linux.cpp b/src/hotspot/os/linux/gc/z/zLargePages_linux.cpp index a00572f08e769..c9f99a4b6db4d 100644 --- a/src/hotspot/os/linux/gc/z/zLargePages_linux.cpp +++ b/src/hotspot/os/linux/gc/z/zLargePages_linux.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zLargePages.hpp" #include "hugepages.hpp" #include "os_linux.hpp" diff --git a/src/hotspot/os/linux/gc/z/zMountPoint_linux.cpp b/src/hotspot/os/linux/gc/z/zMountPoint_linux.cpp index e24367219aa48..60ce39179ff14 100644 --- a/src/hotspot/os/linux/gc/z/zMountPoint_linux.cpp +++ b/src/hotspot/os/linux/gc/z/zMountPoint_linux.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/gcLogPrecious.hpp" #include "gc/z/zArray.inline.hpp" #include "gc/z/zErrno.hpp" diff --git a/src/hotspot/os/linux/gc/z/zPhysicalMemoryBacking_linux.cpp b/src/hotspot/os/linux/gc/z/zPhysicalMemoryBacking_linux.cpp index b648876ac602c..1ae4e18fcf142 100644 --- a/src/hotspot/os/linux/gc/z/zPhysicalMemoryBacking_linux.cpp +++ b/src/hotspot/os/linux/gc/z/zPhysicalMemoryBacking_linux.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/gcLogPrecious.hpp" #include "gc/z/zAddress.inline.hpp" #include "gc/z/zArray.inline.hpp" @@ -185,13 +184,13 @@ ZPhysicalMemoryBacking::ZPhysicalMemoryBacking(size_t max_capacity) // Make sure the filesystem block size is compatible if (ZGranuleSize % _block_size != 0) { - ZInitialize::error("Filesystem backing the heap has incompatible block size (" SIZE_FORMAT ")", + ZInitialize::error("Filesystem backing the heap has incompatible block size (%zu)", _block_size); return; } if (is_hugetlbfs() && _block_size != ZGranuleSize) { - ZInitialize::error("%s filesystem has unexpected block size " SIZE_FORMAT " (expected " SIZE_FORMAT ")", + ZInitialize::error("%s filesystem has unexpected block size %zu (expected %zu)", ZFILESYSTEM_HUGETLBFS, _block_size, ZGranuleSize); return; } @@ -316,7 +315,7 @@ void ZPhysicalMemoryBacking::warn_available_space(size_t max_capacity) const { return; } - log_info_p(gc, init)("Available space on backing filesystem: " SIZE_FORMAT "M", _available / M); + log_info_p(gc, init)("Available space on backing filesystem: %zuM", _available / M); // Warn if the filesystem doesn't currently have enough space available to hold // the max heap size. The max heap size will be capped if we later hit this limit @@ -324,9 +323,9 @@ void ZPhysicalMemoryBacking::warn_available_space(size_t max_capacity) const { if (_available < max_capacity) { log_warning_p(gc)("***** WARNING! INCORRECT SYSTEM CONFIGURATION DETECTED! *****"); log_warning_p(gc)("Not enough space available on the backing filesystem to hold the current max Java heap"); - log_warning_p(gc)("size (" SIZE_FORMAT "M). Please adjust the size of the backing filesystem accordingly " + log_warning_p(gc)("size (%zuM). Please adjust the size of the backing filesystem accordingly " "(available", max_capacity / M); - log_warning_p(gc)("space is currently " SIZE_FORMAT "M). Continuing execution with the current filesystem " + log_warning_p(gc)("space is currently %zuM). Continuing execution with the current filesystem " "size could", _available / M); log_warning_p(gc)("lead to a premature OutOfMemoryError being thrown, due to failure to commit memory."); } @@ -342,7 +341,7 @@ void ZPhysicalMemoryBacking::warn_max_map_count(size_t max_capacity) const { } size_t actual_max_map_count = 0; - const int result = fscanf(file, SIZE_FORMAT, &actual_max_map_count); + const int result = fscanf(file, "%zu", &actual_max_map_count); fclose(file); if (result != 1) { // Failed to read file, skip check @@ -359,9 +358,9 @@ void ZPhysicalMemoryBacking::warn_max_map_count(size_t max_capacity) const { if (actual_max_map_count < required_max_map_count) { log_warning_p(gc)("***** WARNING! INCORRECT SYSTEM CONFIGURATION DETECTED! *****"); log_warning_p(gc)("The system limit on number of memory mappings per process might be too low for the given"); - log_warning_p(gc)("max Java heap size (" SIZE_FORMAT "M). Please adjust %s to allow for at", + log_warning_p(gc)("max Java heap size (%zuM). Please adjust %s to allow for at", max_capacity / M, filename); - log_warning_p(gc)("least " SIZE_FORMAT " mappings (current limit is " SIZE_FORMAT "). Continuing execution " + log_warning_p(gc)("least %zu mappings (current limit is %zu). Continuing execution " "with the current", required_max_map_count, actual_max_map_count); log_warning_p(gc)("limit could lead to a premature OutOfMemoryError being thrown, due to failure to map memory."); } @@ -598,7 +597,7 @@ ZErrno ZPhysicalMemoryBacking::fallocate(bool punch_hole, zoffset offset, size_t } bool ZPhysicalMemoryBacking::commit_inner(zoffset offset, size_t length) const { - log_trace(gc, heap)("Committing memory: " SIZE_FORMAT "M-" SIZE_FORMAT "M (" SIZE_FORMAT "M)", + log_trace(gc, heap)("Committing memory: %zuM-%zuM (%zuM)", untype(offset) / M, untype(to_zoffset_end(offset, length)) / M, length / M); retry: @@ -698,7 +697,7 @@ size_t ZPhysicalMemoryBacking::commit(zoffset offset, size_t length) const { } size_t ZPhysicalMemoryBacking::uncommit(zoffset offset, size_t length) const { - log_trace(gc, heap)("Uncommitting memory: " SIZE_FORMAT "M-" SIZE_FORMAT "M (" SIZE_FORMAT "M)", + log_trace(gc, heap)("Uncommitting memory: %zuM-%zuM (%zuM)", untype(offset) / M, untype(to_zoffset_end(offset, length)) / M, length / M); const ZErrno err = fallocate(true /* punch_hole */, offset, length); diff --git a/src/hotspot/os/linux/gc/z/zSyscall_linux.cpp b/src/hotspot/os/linux/gc/z/zSyscall_linux.cpp index ba26cbfcb2456..83225be506ff1 100644 --- a/src/hotspot/os/linux/gc/z/zSyscall_linux.cpp +++ b/src/hotspot/os/linux/gc/z/zSyscall_linux.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zSyscall_linux.hpp" #include OS_CPU_HEADER(gc/z/zSyscall) diff --git a/src/hotspot/os/linux/hugepages.cpp b/src/hotspot/os/linux/hugepages.cpp index c04ff7a4ca0e3..5472c093d3f30 100644 --- a/src/hotspot/os/linux/hugepages.cpp +++ b/src/hotspot/os/linux/hugepages.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2024, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,9 +23,7 @@ * */ -#include "precompiled.hpp" #include "hugepages.hpp" - #include "logging/log.hpp" #include "logging/logStream.hpp" #include "runtime/globals_extension.hpp" @@ -95,7 +93,7 @@ static bool read_number_file(const char* file, size_t* out) { bool rc = false; if (f != nullptr) { uint64_t i = 0; - if (::fscanf(f, SIZE_FORMAT, out) == 1) { + if (::fscanf(f, "%zu", out) == 1) { rc = true; } ::fclose(f); @@ -155,7 +153,7 @@ void ExplicitHugePageSupport::scan_os() { // that only exposes /proc/meminfo but not /sys/kernel/mm/hugepages. In that case, we are not // sure about the state of hugepage support by the kernel, so we won't use explicit hugepages. if (!_pagesizes.contains(_default_hugepage_size)) { - log_info(pagesize)("Unexpected configuration: default pagesize (" SIZE_FORMAT ") " + log_info(pagesize)("Unexpected configuration: default pagesize (%zu) " "has no associated directory in /sys/kernel/mm/hugepages..", _default_hugepage_size); _inconsistent = true; } diff --git a/src/hotspot/os/linux/mallocInfoDcmd.cpp b/src/hotspot/os/linux/mallocInfoDcmd.cpp index 9fd35e6fe6dbc..ad98d5edece19 100644 --- a/src/hotspot/os/linux/mallocInfoDcmd.cpp +++ b/src/hotspot/os/linux/mallocInfoDcmd.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "mallocInfoDcmd.hpp" #include "os_linux.hpp" #include "utilities/globalDefinitions.hpp" diff --git a/src/hotspot/os/linux/memMapPrinter_linux.cpp b/src/hotspot/os/linux/memMapPrinter_linux.cpp index 0b696b9914efe..b84921dd3bb08 100644 --- a/src/hotspot/os/linux/memMapPrinter_linux.cpp +++ b/src/hotspot/os/linux/memMapPrinter_linux.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, 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. * @@ -23,8 +23,6 @@ * */ -#include "precompiled.hpp" - #include "nmt/memMapPrinter.hpp" #include "procMapsParser.hpp" #include "runtime/os.hpp" diff --git a/src/hotspot/os/linux/osThread_linux.cpp b/src/hotspot/os/linux/osThread_linux.cpp index c9a44eb413f43..88e26a5d69b54 100644 --- a/src/hotspot/os/linux/osThread_linux.cpp +++ b/src/hotspot/os/linux/osThread_linux.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "memory/allocation.hpp" #include "runtime/mutex.hpp" #include "runtime/osThread.hpp" diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp index 094ca2bf2fc91..92996789394e5 100644 --- a/src/hotspot/os/linux/os_linux.cpp +++ b/src/hotspot/os/linux/os_linux.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -// no precompiled headers #include "classfile/vmSymbols.hpp" #include "code/vtableStubs.hpp" #include "compiler/compileBroker.hpp" @@ -847,7 +846,7 @@ static void *thread_native_entry(Thread *thread) { } } - log_info(os, thread)("Thread is alive (tid: " UINTX_FORMAT ", pthread id: " UINTX_FORMAT ").", + log_info(os, thread)("Thread is alive (tid: %zu, pthread id: %zu).", os::current_thread_id(), (uintx) pthread_self()); assert(osthread->pthread_id() != 0, "pthread_id was not set as expected"); @@ -863,7 +862,7 @@ static void *thread_native_entry(Thread *thread) { // Prevent dereferencing it from here on out. thread = nullptr; - log_info(os, thread)("Thread finished (tid: " UINTX_FORMAT ", pthread id: " UINTX_FORMAT ").", + log_info(os, thread)("Thread finished (tid: %zu, pthread id: %zu).", os::current_thread_id(), (uintx) pthread_self()); return nullptr; @@ -925,7 +924,7 @@ static size_t get_static_tls_area_size(const pthread_attr_t *attr) { } } - log_info(os, thread)("Stack size adjustment for TLS is " SIZE_FORMAT, + log_info(os, thread)("Stack size adjustment for TLS is %zu", tls_size); return tls_size; } @@ -1032,7 +1031,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, // pthread_attr_setstacksize() function can fail // if the stack size exceeds a system-imposed limit. assert_status(status == EINVAL, status, "pthread_attr_setstacksize"); - log_warning(os, thread)("The %sthread stack size specified is invalid: " SIZE_FORMAT "k", + log_warning(os, thread)("The %sthread stack size specified is invalid: %zuk", (thr_type == compiler_thread) ? "compiler " : ((thr_type == java_thread) ? "" : "VM "), stack_size / K); thread->set_osthread(nullptr); @@ -1054,7 +1053,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, char buf[64]; if (ret == 0) { - log_info(os, thread)("Thread \"%s\" started (pthread id: " UINTX_FORMAT ", attributes: %s). ", + log_info(os, thread)("Thread \"%s\" started (pthread id: %zu, attributes: %s). ", thread->name(), (uintx) tid, os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr)); // Print current timer slack if override is enabled and timer slack value is available. @@ -1062,7 +1061,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, if (TimerSlack >= 0) { int slack = prctl(PR_GET_TIMERSLACK); if (slack >= 0) { - log_info(os, thread)("Thread \"%s\" (pthread id: " UINTX_FORMAT ") timer slack: %dns", + log_info(os, thread)("Thread \"%s\" (pthread id: %zu) timer slack: %dns", thread->name(), (uintx) tid, slack); } } @@ -1170,8 +1169,8 @@ bool os::create_attached_thread(JavaThread* thread) { // and save the caller's signal mask PosixSignals::hotspot_sigmask(thread); - log_info(os, thread)("Thread attached (tid: " UINTX_FORMAT ", pthread id: " UINTX_FORMAT - ", stack: " PTR_FORMAT " - " PTR_FORMAT " (" SIZE_FORMAT "K) ).", + log_info(os, thread)("Thread attached (tid: %zu, pthread id: %zu" + ", stack: " PTR_FORMAT " - " PTR_FORMAT " (%zuK) ).", os::current_thread_id(), (uintx) pthread_self(), p2i(thread->stack_base()), p2i(thread->stack_end()), thread->stack_size() / K); @@ -1366,12 +1365,9 @@ void os::Linux::capture_initial_stack(size_t max_size) { // Skip blank chars do { s++; } while (s && isspace((unsigned char) *s)); -#define _UFM UINTX_FORMAT -#define _DFM INTX_FORMAT - - // 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 - // 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 - i = sscanf(s, "%c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu %ld %ld %ld %ld %ld %ld " _UFM _UFM _DFM _UFM _UFM _UFM _UFM, + // 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 + // 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 + i = sscanf(s, "%c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu %ld %ld %ld %ld %ld %ld %zu %zu %zd %zu %zu %zu %zu", &state, // 3 %c &ppid, // 4 %d &pgrp, // 5 %d @@ -1391,18 +1387,15 @@ void os::Linux::capture_initial_stack(size_t max_size) { &nice, // 19 %ld &junk, // 20 %ld &it_real, // 21 %ld - &start, // 22 UINTX_FORMAT - &vsize, // 23 UINTX_FORMAT - &rss, // 24 INTX_FORMAT - &rsslim, // 25 UINTX_FORMAT - &scodes, // 26 UINTX_FORMAT - &ecode, // 27 UINTX_FORMAT - &stack_start); // 28 UINTX_FORMAT + &start, // 22 %zu + &vsize, // 23 %zu + &rss, // 24 %zd + &rsslim, // 25 %zu + &scodes, // 26 %zu + &ecode, // 27 %zu + &stack_start); // 28 %zu } -#undef _UFM -#undef _DFM - if (i != 28 - 2) { assert(false, "Bad conversion from /proc/self/stat"); // product mode - assume we are the primordial thread, good luck in the @@ -1463,8 +1456,8 @@ void os::Linux::capture_initial_stack(size_t max_size) { bool primordial = uintptr_t(&rlim) > uintptr_t(_initial_thread_stack_bottom) && uintptr_t(&rlim) < stack_top; - log_info(os, thread)("Capturing initial stack in %s thread: req. size: " SIZE_FORMAT "K, actual size: " - SIZE_FORMAT "K, top=" INTPTR_FORMAT ", bottom=" INTPTR_FORMAT, + log_info(os, thread)("Capturing initial stack in %s thread: req. size: %zuK, actual size: " + "%zuK, top=" INTPTR_FORMAT ", bottom=" INTPTR_FORMAT, primordial ? "primordial" : "user", max_size / K, _initial_thread_stack_size / K, stack_top, intptr_t(_initial_thread_stack_bottom)); } @@ -2312,14 +2305,14 @@ bool os::Linux::query_process_memory_info(os::Linux::meminfo_t* info) { info->rssanon = info->rssfile = info->rssshmem = -1; if (f != nullptr) { while (::fgets(buf, sizeof(buf), f) != nullptr && num_found < num_values) { - if ( (info->vmsize == -1 && sscanf(buf, "VmSize: " SSIZE_FORMAT " kB", &info->vmsize) == 1) || - (info->vmpeak == -1 && sscanf(buf, "VmPeak: " SSIZE_FORMAT " kB", &info->vmpeak) == 1) || - (info->vmswap == -1 && sscanf(buf, "VmSwap: " SSIZE_FORMAT " kB", &info->vmswap) == 1) || - (info->vmhwm == -1 && sscanf(buf, "VmHWM: " SSIZE_FORMAT " kB", &info->vmhwm) == 1) || - (info->vmrss == -1 && sscanf(buf, "VmRSS: " SSIZE_FORMAT " kB", &info->vmrss) == 1) || - (info->rssanon == -1 && sscanf(buf, "RssAnon: " SSIZE_FORMAT " kB", &info->rssanon) == 1) || // Needs Linux 4.5 - (info->rssfile == -1 && sscanf(buf, "RssFile: " SSIZE_FORMAT " kB", &info->rssfile) == 1) || // Needs Linux 4.5 - (info->rssshmem == -1 && sscanf(buf, "RssShmem: " SSIZE_FORMAT " kB", &info->rssshmem) == 1) // Needs Linux 4.5 + if ( (info->vmsize == -1 && sscanf(buf, "VmSize: %zd kB", &info->vmsize) == 1) || + (info->vmpeak == -1 && sscanf(buf, "VmPeak: %zd kB", &info->vmpeak) == 1) || + (info->vmswap == -1 && sscanf(buf, "VmSwap: %zd kB", &info->vmswap) == 1) || + (info->vmhwm == -1 && sscanf(buf, "VmHWM: %zd kB", &info->vmhwm) == 1) || + (info->vmrss == -1 && sscanf(buf, "VmRSS: %zd kB", &info->vmrss) == 1) || + (info->rssanon == -1 && sscanf(buf, "RssAnon: %zd kB", &info->rssanon) == 1) || // Needs Linux 4.5 + (info->rssfile == -1 && sscanf(buf, "RssFile: %zd kB", &info->rssfile) == 1) || // Needs Linux 4.5 + (info->rssshmem == -1 && sscanf(buf, "RssShmem: %zd kB", &info->rssshmem) == 1) // Needs Linux 4.5 ) { num_found ++; @@ -2367,15 +2360,15 @@ void os::Linux::print_process_memory_info(outputStream* st) { // rss its components if the kernel is recent enough. meminfo_t info; if (query_process_memory_info(&info)) { - st->print_cr("Virtual Size: " SSIZE_FORMAT "K (peak: " SSIZE_FORMAT "K)", info.vmsize, info.vmpeak); - st->print("Resident Set Size: " SSIZE_FORMAT "K (peak: " SSIZE_FORMAT "K)", info.vmrss, info.vmhwm); + st->print_cr("Virtual Size: %zdK (peak: %zdK)", info.vmsize, info.vmpeak); + st->print("Resident Set Size: %zdK (peak: %zdK)", info.vmrss, info.vmhwm); if (info.rssanon != -1) { // requires kernel >= 4.5 - st->print(" (anon: " SSIZE_FORMAT "K, file: " SSIZE_FORMAT "K, shmem: " SSIZE_FORMAT "K)", + st->print(" (anon: %zdK, file: %zdK, shmem: %zdK)", info.rssanon, info.rssfile, info.rssshmem); } st->cr(); if (info.vmswap != -1) { // requires kernel >= 2.6.34 - st->print_cr("Swapped out: " SSIZE_FORMAT "K", info.vmswap); + st->print_cr("Swapped out: %zdK", info.vmswap); } } else { st->print_cr("Could not open /proc/self/status to get process memory related information"); @@ -2396,7 +2389,7 @@ void os::Linux::print_process_memory_info(outputStream* st) { // If legacy mallinfo(), we can still print the values if we are sure they cannot have wrapped. might_have_wrapped = might_have_wrapped && (info.vmsize * K) > UINT_MAX; #endif - st->print_cr("C-Heap outstanding allocations: " SIZE_FORMAT "K, retained: " SIZE_FORMAT "K%s", + st->print_cr("C-Heap outstanding allocations: %zuK, retained: %zuK%s", total_allocated / K, free_retained / K, might_have_wrapped ? " (may have wrapped)" : ""); // Tunables @@ -2524,7 +2517,7 @@ void os::Linux::print_steal_info(outputStream* st) { void os::print_memory_info(outputStream* st) { st->print("Memory:"); - st->print(" " SIZE_FORMAT "k page", os::vm_page_size()>>10); + st->print(" %zuk page", os::vm_page_size()>>10); // values in struct sysinfo are "unsigned long" struct sysinfo si; @@ -2889,17 +2882,15 @@ static bool recoverable_mmap_error(int err) { static void warn_fail_commit_memory(char* addr, size_t size, bool exec, int err) { - warning("INFO: os::commit_memory(" PTR_FORMAT ", " SIZE_FORMAT - ", %d) failed; error='%s' (errno=%d)", p2i(addr), size, exec, - os::strerror(err), err); + warning("INFO: os::commit_memory(" PTR_FORMAT ", %zu, %d) failed; error='%s' (errno=%d)", + p2i(addr), size, exec, os::strerror(err), err); } static void warn_fail_commit_memory(char* addr, size_t size, size_t alignment_hint, bool exec, int err) { - warning("INFO: os::commit_memory(" PTR_FORMAT ", " SIZE_FORMAT - ", " SIZE_FORMAT ", %d) failed; error='%s' (errno=%d)", p2i(addr), size, - alignment_hint, exec, os::strerror(err), err); + warning("INFO: os::commit_memory(" PTR_FORMAT ", %zu, %zu, %d) failed; error='%s' (errno=%d)", + p2i(addr), size, alignment_hint, exec, os::strerror(err), err); } // NOTE: Linux kernel does not really reserve the pages for us. @@ -3049,7 +3040,7 @@ size_t os::pd_pretouch_memory(void* first, void* last, size_t page_size) { // OS will initially always use small pages. return os::vm_page_size(); } else if (err != 0) { - log_info(gc, os)("::madvise(" PTR_FORMAT ", " SIZE_FORMAT ", %d) failed; " + log_info(gc, os)("::madvise(" PTR_FORMAT ", %zu, %d) failed; " "error='%s' (errno=%d)", p2i(first), len, MADV_POPULATE_WRITE, os::strerror(err), err); } @@ -3766,7 +3757,7 @@ static bool hugetlbfs_sanity_check(size_t page_size) { munmap(p, page_size); return true; } else { - log_info(pagesize)("Large page size (" SIZE_FORMAT "%s) failed sanity check, " + log_info(pagesize)("Large page size (%zu%s) failed sanity check, " "checking if smaller large page sizes are usable", byte_size_in_exact_unit(page_size), exact_unit_for_byte_size(page_size)); @@ -3778,7 +3769,7 @@ static bool hugetlbfs_sanity_check(size_t page_size) { if (p != MAP_FAILED) { // Mapping succeeded, sanity check passed. munmap(p, page_size_); - log_info(pagesize)("Large page size (" SIZE_FORMAT "%s) passed sanity check", + log_info(pagesize)("Large page size (%zu%s) passed sanity check", byte_size_in_exact_unit(page_size_), exact_unit_for_byte_size(page_size_)); return true; @@ -3977,22 +3968,22 @@ void os::Linux::large_page_init() { LargePageSizeInBytes == 0 || LargePageSizeInBytes == default_large_page_size) { large_page_size = default_large_page_size; - log_info(pagesize)("Using the default large page size: " SIZE_FORMAT "%s", + log_info(pagesize)("Using the default large page size: %zu%s", byte_size_in_exact_unit(large_page_size), exact_unit_for_byte_size(large_page_size)); } else { if (all_large_pages.contains(LargePageSizeInBytes)) { large_page_size = LargePageSizeInBytes; - log_info(pagesize)("Overriding default large page size (" SIZE_FORMAT "%s) " - "using LargePageSizeInBytes: " SIZE_FORMAT "%s", + log_info(pagesize)("Overriding default large page size (%zu%s) " + "using LargePageSizeInBytes: %zu%s", byte_size_in_exact_unit(default_large_page_size), exact_unit_for_byte_size(default_large_page_size), byte_size_in_exact_unit(large_page_size), exact_unit_for_byte_size(large_page_size)); } else { large_page_size = default_large_page_size; - log_info(pagesize)("LargePageSizeInBytes is not a valid large page size (" SIZE_FORMAT "%s) " - "using the default large page size: " SIZE_FORMAT "%s", + log_info(pagesize)("LargePageSizeInBytes is not a valid large page size (%zu%s) " + "using the default large page size: %zu%s", byte_size_in_exact_unit(LargePageSizeInBytes), exact_unit_for_byte_size(LargePageSizeInBytes), byte_size_in_exact_unit(large_page_size), @@ -4037,7 +4028,7 @@ static void log_on_commit_special_failure(char* req_addr, size_t bytes, assert(error == ENOMEM, "Only expect to fail if no memory is available"); log_info(pagesize)("Failed to reserve and commit memory with given page size. req_addr: " PTR_FORMAT - " size: " SIZE_FORMAT "%s, page size: " SIZE_FORMAT "%s, (errno = %d)", + " size: %zu%s, page size: %zu%s, (errno = %d)", p2i(req_addr), byte_size_in_exact_unit(bytes), exact_unit_for_byte_size(bytes), byte_size_in_exact_unit(page_size), exact_unit_for_byte_size(page_size), error); } @@ -4066,8 +4057,7 @@ static bool commit_memory_special(size_t bytes, return false; } - log_debug(pagesize)("Commit special mapping: " PTR_FORMAT ", size=" SIZE_FORMAT "%s, page size=" - SIZE_FORMAT "%s", + log_debug(pagesize)("Commit special mapping: " PTR_FORMAT ", size=%zu%s, page size=%zu%s", p2i(addr), byte_size_in_exact_unit(bytes), exact_unit_for_byte_size(bytes), byte_size_in_exact_unit(page_size), @@ -4483,15 +4473,15 @@ void os::Linux::numa_init() { // bitmask when externally configured to run on all or fewer nodes. if (!Linux::libnuma_init()) { - disable_numa("Failed to initialize libnuma"); + disable_numa("Failed to initialize libnuma", true); } else { Linux::set_configured_numa_policy(Linux::identify_numa_policy()); if (Linux::numa_max_node() < 1) { - disable_numa("Only a single NUMA node is available"); + disable_numa("Only a single NUMA node is available", false); } else if (Linux::is_bound_to_single_mem_node()) { - disable_numa("The process is bound to a single NUMA node"); + disable_numa("The process is bound to a single NUMA node", true); } else if (Linux::mem_and_cpu_node_mismatch()) { - disable_numa("The process memory and cpu node configuration does not match"); + disable_numa("The process memory and cpu node configuration does not match", true); } else { LogTarget(Info,os) log; LogStream ls(log); @@ -4533,11 +4523,15 @@ void os::Linux::numa_init() { } } -void os::Linux::disable_numa(const char* reason) { +void os::Linux::disable_numa(const char* reason, bool warning) { if ((UseNUMA && FLAG_IS_CMDLINE(UseNUMA)) || (UseNUMAInterleaving && FLAG_IS_CMDLINE(UseNUMAInterleaving))) { - // Only issue a warning if the user explicitly asked for NUMA support - log_warning(os)("NUMA support disabled: %s", reason); + // Only issue a message if the user explicitly asked for NUMA support + if (warning) { + log_warning(os)("NUMA support disabled: %s", reason); + } else { + log_info(os)("NUMA support disabled: %s", reason); + } } FLAG_SET_ERGO(UseNUMA, false); FLAG_SET_ERGO(UseNUMAInterleaving, false); @@ -5279,7 +5273,7 @@ bool os::start_debugging(char *buf, int buflen) { jio_snprintf(p, buflen-len, "\n\n" "Do you want to debug the problem?\n\n" - "To debug, run 'gdb /proc/%d/exe %d'; then switch to thread " UINTX_FORMAT " (" INTPTR_FORMAT ")\n" + "To debug, run 'gdb /proc/%d/exe %d'; then switch to thread %zu (" INTPTR_FORMAT ")\n" "Enter 'yes' to launch gdb automatically (PATH must include gdb)\n" "Otherwise, press RETURN to abort...", os::current_process_id(), os::current_process_id(), diff --git a/src/hotspot/os/linux/os_linux.hpp b/src/hotspot/os/linux/os_linux.hpp index 1cd445138899c..29848580c4ad5 100644 --- a/src/hotspot/os/linux/os_linux.hpp +++ b/src/hotspot/os/linux/os_linux.hpp @@ -193,7 +193,7 @@ class os::Linux { private: static void numa_init(); - static void disable_numa(const char* reason); + static void disable_numa(const char* reason, bool warning); typedef int (*sched_getcpu_func_t)(void); typedef int (*numa_node_to_cpus_func_t)(int node, unsigned long *buffer, int bufferlen); typedef int (*numa_node_to_cpus_v2_func_t)(int node, void *mask); diff --git a/src/hotspot/os/linux/os_perf_linux.cpp b/src/hotspot/os/linux/os_perf_linux.cpp index 996f83611b048..ea7535edb870f 100644 --- a/src/hotspot/os/linux/os_perf_linux.cpp +++ b/src/hotspot/os/linux/os_perf_linux.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jvm.h" #include "memory/allocation.inline.hpp" #include "os_linux.inline.hpp" diff --git a/src/hotspot/os/linux/procMapsParser.cpp b/src/hotspot/os/linux/procMapsParser.cpp index 6dfd49a0596e3..71b828bcefbc5 100644 --- a/src/hotspot/os/linux/procMapsParser.cpp +++ b/src/hotspot/os/linux/procMapsParser.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2024, Red Hat, Inc. and/or its affiliates. - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * 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,8 +23,6 @@ * */ -#include "precompiled.hpp" - #include "procMapsParser.hpp" #include "runtime/os.hpp" #include "utilities/globalDefinitions.hpp" diff --git a/src/hotspot/os/linux/systemMemoryBarrier_linux.cpp b/src/hotspot/os/linux/systemMemoryBarrier_linux.cpp index 2398beb736033..870b3f5016a97 100644 --- a/src/hotspot/os/linux/systemMemoryBarrier_linux.cpp +++ b/src/hotspot/os/linux/systemMemoryBarrier_linux.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "logging/log.hpp" #include "os_linux.hpp" #include "utilities/debug.hpp" diff --git a/src/hotspot/os/linux/trimCHeapDCmd.cpp b/src/hotspot/os/linux/trimCHeapDCmd.cpp index 26c066ffe5b6e..6b4cad03c1b55 100644 --- a/src/hotspot/os/linux/trimCHeapDCmd.cpp +++ b/src/hotspot/os/linux/trimCHeapDCmd.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2022 SAP SE. All rights reserved. - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * */ -#include "precompiled.hpp" #include "logging/log.hpp" #include "runtime/os.inline.hpp" #include "trimCHeapDCmd.hpp" diff --git a/src/hotspot/os/linux/waitBarrier_linux.cpp b/src/hotspot/os/linux/waitBarrier_linux.cpp index 2be31ce8366bb..f1f5be0515213 100644 --- a/src/hotspot/os/linux/waitBarrier_linux.cpp +++ b/src/hotspot/os/linux/waitBarrier_linux.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "runtime/orderAccess.hpp" #include "runtime/os.hpp" #include "utilities/debug.hpp" diff --git a/src/hotspot/os/posix/attachListener_posix.cpp b/src/hotspot/os/posix/attachListener_posix.cpp index fea2075296a40..27728d0ca1f6e 100644 --- a/src/hotspot/os/posix/attachListener_posix.cpp +++ b/src/hotspot/os/posix/attachListener_posix.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "logging/log.hpp" #include "memory/allocation.inline.hpp" #include "runtime/interfaceSupport.inline.hpp" diff --git a/src/hotspot/os/posix/gc/z/zArguments_posix.cpp b/src/hotspot/os/posix/gc/z/zArguments_posix.cpp index 4e6d43b16e918..dd84ef169907e 100644 --- a/src/hotspot/os/posix/gc/z/zArguments_posix.cpp +++ b/src/hotspot/os/posix/gc/z/zArguments_posix.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zArguments.hpp" bool ZArguments::is_os_supported() { diff --git a/src/hotspot/os/posix/gc/z/zInitialize_posix.cpp b/src/hotspot/os/posix/gc/z/zInitialize_posix.cpp index ad4af504d8daf..193cae28a4cce 100644 --- a/src/hotspot/os/posix/gc/z/zInitialize_posix.cpp +++ b/src/hotspot/os/posix/gc/z/zInitialize_posix.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zInitialize.hpp" void ZInitialize::pd_initialize() { diff --git a/src/hotspot/os/posix/gc/z/zVirtualMemory_posix.cpp b/src/hotspot/os/posix/gc/z/zVirtualMemory_posix.cpp index 936e734e8ff07..a177fe2b63647 100644 --- a/src/hotspot/os/posix/gc/z/zVirtualMemory_posix.cpp +++ b/src/hotspot/os/posix/gc/z/zVirtualMemory_posix.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zAddress.inline.hpp" #include "gc/z/zVirtualMemory.hpp" #include "logging/log.hpp" diff --git a/src/hotspot/os/posix/jvm_posix.cpp b/src/hotspot/os/posix/jvm_posix.cpp index a552e2695b59e..d34f2fc198b61 100644 --- a/src/hotspot/os/posix/jvm_posix.cpp +++ b/src/hotspot/os/posix/jvm_posix.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jvm.h" #include "runtime/interfaceSupport.inline.hpp" #include "runtime/osThread.hpp" diff --git a/src/hotspot/os/posix/os_posix.cpp b/src/hotspot/os/posix/os_posix.cpp index 61214a4296998..6f756fbf64831 100644 --- a/src/hotspot/os/posix/os_posix.cpp +++ b/src/hotspot/os/posix/os_posix.cpp @@ -972,7 +972,7 @@ char* os::Posix::describe_pthread_attr(char* buf, size_t buflen, const pthread_a // Work around glibc stack guard issue, see os::create_thread() in os_linux.cpp. LINUX_ONLY(if (os::Linux::adjustStackSizeForGuardPages()) stack_size -= guard_size;) pthread_attr_getdetachstate(attr, &detachstate); - jio_snprintf(buf, buflen, "stacksize: " SIZE_FORMAT "k, guardsize: " SIZE_FORMAT "k, %s", + jio_snprintf(buf, buflen, "stacksize: %zuk, guardsize: %zuk, %s", stack_size / K, guard_size / K, (detachstate == PTHREAD_CREATE_DETACHED ? "detached" : "joinable")); return buf; diff --git a/src/hotspot/os/posix/perfMemory_posix.cpp b/src/hotspot/os/posix/perfMemory_posix.cpp index 5fbd5e76c5aca..72f5311622bb1 100644 --- a/src/hotspot/os/posix/perfMemory_posix.cpp +++ b/src/hotspot/os/posix/perfMemory_posix.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2021 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "classfile/vmSymbols.hpp" #include "jvm_io.h" #include "logging/log.hpp" @@ -1086,7 +1085,7 @@ static char* mmap_create_shared(size_t size) { static void unmap_shared(char* addr, size_t bytes) { int res; if (MemTracker::enabled()) { - ThreadCritical tc; + MemTracker::NmtVirtualMemoryLocker nvml; res = ::munmap(addr, bytes); if (res == 0) { MemTracker::record_virtual_memory_release((address)addr, bytes); @@ -1095,7 +1094,7 @@ static void unmap_shared(char* addr, size_t bytes) { res = ::munmap(addr, bytes); } if (res != 0) { - log_info(os)("os::release_memory failed (" PTR_FORMAT ", " SIZE_FORMAT ")", p2i(addr), bytes); + log_info(os)("os::release_memory failed (" PTR_FORMAT ", %zu)", p2i(addr), bytes); } } @@ -1227,7 +1226,7 @@ static void mmap_attach_shared(int vmid, char** addr, size_t* sizep, TRAPS) { *addr = mapAddress; *sizep = size; - log_debug(perf, memops)("mapped " SIZE_FORMAT " bytes for vmid %d at " + log_debug(perf, memops)("mapped %zu bytes for vmid %d at " INTPTR_FORMAT, size, vmid, p2i((void*)mapAddress)); } diff --git a/src/hotspot/os/posix/safefetch_sigjmp.cpp b/src/hotspot/os/posix/safefetch_sigjmp.cpp index e141b8fb57317..57f0f8460bf7d 100644 --- a/src/hotspot/os/posix/safefetch_sigjmp.cpp +++ b/src/hotspot/os/posix/safefetch_sigjmp.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2022 SAP SE. All rights reserved. - * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * */ -#include "precompiled.hpp" #include "runtime/safefetch.hpp" #include "sanitizers/address.hpp" diff --git a/src/hotspot/os/posix/safefetch_static_posix.cpp b/src/hotspot/os/posix/safefetch_static_posix.cpp index 5685a9e09f920..0e8f47fb2667d 100644 --- a/src/hotspot/os/posix/safefetch_static_posix.cpp +++ b/src/hotspot/os/posix/safefetch_static_posix.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2022 SAP SE. All rights reserved. - * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * */ -#include "precompiled.hpp" #include "os_posix.hpp" #include "runtime/os.hpp" diff --git a/src/hotspot/os/posix/semaphore_posix.cpp b/src/hotspot/os/posix/semaphore_posix.cpp index 625abdf335b8b..23a5225eba3ef 100644 --- a/src/hotspot/os/posix/semaphore_posix.cpp +++ b/src/hotspot/os/posix/semaphore_posix.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #ifndef __APPLE__ #include "os_posix.hpp" #include "runtime/os.hpp" diff --git a/src/hotspot/os/posix/signals_posix.cpp b/src/hotspot/os/posix/signals_posix.cpp index ddc7a05c2ff57..2c0ab6732c168 100644 --- a/src/hotspot/os/posix/signals_posix.cpp +++ b/src/hotspot/os/posix/signals_posix.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "code/codeCache.hpp" #include "code/nativeInst.hpp" #include "code/nmethod.hpp" diff --git a/src/hotspot/os/posix/suspendResume_posix.cpp b/src/hotspot/os/posix/suspendResume_posix.cpp index 5256d9d888113..dbd0e791d77af 100644 --- a/src/hotspot/os/posix/suspendResume_posix.cpp +++ b/src/hotspot/os/posix/suspendResume_posix.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "runtime/atomic.hpp" #include "suspendResume_posix.hpp" diff --git a/src/hotspot/os/posix/threadCrashProtection_posix.cpp b/src/hotspot/os/posix/threadCrashProtection_posix.cpp index 7d19b060479bc..06ecc844317e6 100644 --- a/src/hotspot/os/posix/threadCrashProtection_posix.cpp +++ b/src/hotspot/os/posix/threadCrashProtection_posix.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "runtime/thread.hpp" #include "runtime/threadCrashProtection.hpp" diff --git a/src/hotspot/os/posix/threadCritical_posix.cpp b/src/hotspot/os/posix/threadCritical_posix.cpp index cd3b42e71ba8b..47fe98c7429f3 100644 --- a/src/hotspot/os/posix/threadCritical_posix.cpp +++ b/src/hotspot/os/posix/threadCritical_posix.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2014 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "runtime/javaThread.hpp" #include "runtime/threadCritical.hpp" #include "utilities/compilerWarnings.hpp" diff --git a/src/hotspot/os/posix/vmError_posix.cpp b/src/hotspot/os/posix/vmError_posix.cpp index c1d89efa85596..9d6cd175c669b 100644 --- a/src/hotspot/os/posix/vmError_posix.cpp +++ b/src/hotspot/os/posix/vmError_posix.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "cds/cdsConfig.hpp" #include "cds/metaspaceShared.hpp" #include "os_posix.hpp" diff --git a/src/hotspot/os/windows/attachListener_windows.cpp b/src/hotspot/os/windows/attachListener_windows.cpp index 8423fe42b7560..4e6f39b8f8189 100644 --- a/src/hotspot/os/windows/attachListener_windows.cpp +++ b/src/hotspot/os/windows/attachListener_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "logging/log.hpp" #include "runtime/interfaceSupport.inline.hpp" #include "runtime/os.hpp" diff --git a/src/hotspot/os/windows/decoder_windows.cpp b/src/hotspot/os/windows/decoder_windows.cpp index 6a67a4eba9f2f..9bcab878e874f 100644 --- a/src/hotspot/os/windows/decoder_windows.cpp +++ b/src/hotspot/os/windows/decoder_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "utilities/decoder.hpp" #include "symbolengine.hpp" #include "windbghelp.hpp" diff --git a/src/hotspot/os/windows/gc/z/zArguments_windows.cpp b/src/hotspot/os/windows/gc/z/zArguments_windows.cpp index e10a06648f0e7..f5449d6232071 100644 --- a/src/hotspot/os/windows/gc/z/zArguments_windows.cpp +++ b/src/hotspot/os/windows/gc/z/zArguments_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zArguments.hpp" #include "gc/z/zSyscall_windows.hpp" diff --git a/src/hotspot/os/windows/gc/z/zInitialize_windows.cpp b/src/hotspot/os/windows/gc/z/zInitialize_windows.cpp index 06b15c7db4172..a4751617ce7bd 100644 --- a/src/hotspot/os/windows/gc/z/zInitialize_windows.cpp +++ b/src/hotspot/os/windows/gc/z/zInitialize_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zInitialize.hpp" #include "gc/z/zSyscall_windows.hpp" diff --git a/src/hotspot/os/windows/gc/z/zLargePages_windows.cpp b/src/hotspot/os/windows/gc/z/zLargePages_windows.cpp index f5455cbc58b80..dcd178da8212b 100644 --- a/src/hotspot/os/windows/gc/z/zLargePages_windows.cpp +++ b/src/hotspot/os/windows/gc/z/zLargePages_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/gcLogPrecious.hpp" #include "gc/z/zLargePages.hpp" #include "gc/z/zSyscall_windows.hpp" diff --git a/src/hotspot/os/windows/gc/z/zMapper_windows.cpp b/src/hotspot/os/windows/gc/z/zMapper_windows.cpp index b2923a300e4bc..eadabcbb03026 100644 --- a/src/hotspot/os/windows/gc/z/zMapper_windows.cpp +++ b/src/hotspot/os/windows/gc/z/zMapper_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zAddress.inline.hpp" #include "gc/z/zMapper_windows.hpp" #include "gc/z/zSyscall_windows.hpp" @@ -57,7 +56,7 @@ // they will be split before being used. #define fatal_error(msg, addr, size) \ - fatal(msg ": " PTR_FORMAT " " SIZE_FORMAT "M (%d)", \ + fatal(msg ": " PTR_FORMAT " %zuM (%d)", \ (addr), (size) / M, GetLastError()) zaddress_unsafe ZMapper::reserve(zaddress_unsafe addr, size_t size) { @@ -251,7 +250,7 @@ void ZMapper::unreserve_for_shared_awe(zaddress_unsafe addr, size_t size) { ); if (!res) { - fatal("Failed to unreserve memory: " PTR_FORMAT " " SIZE_FORMAT "M (%d)", + fatal("Failed to unreserve memory: " PTR_FORMAT " %zuM (%d)", untype(addr), size / M, GetLastError()); } } diff --git a/src/hotspot/os/windows/gc/z/zNUMA_windows.cpp b/src/hotspot/os/windows/gc/z/zNUMA_windows.cpp index a0fe34c65041e..8a93b66f38902 100644 --- a/src/hotspot/os/windows/gc/z/zNUMA_windows.cpp +++ b/src/hotspot/os/windows/gc/z/zNUMA_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zNUMA.hpp" void ZNUMA::pd_initialize() { diff --git a/src/hotspot/os/windows/gc/z/zPhysicalMemoryBacking_windows.cpp b/src/hotspot/os/windows/gc/z/zPhysicalMemoryBacking_windows.cpp index 0a66f04d31c30..2764f51c13b98 100644 --- a/src/hotspot/os/windows/gc/z/zPhysicalMemoryBacking_windows.cpp +++ b/src/hotspot/os/windows/gc/z/zPhysicalMemoryBacking_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zAddress.inline.hpp" #include "gc/z/zGlobals.hpp" #include "gc/z/zGranuleMap.inline.hpp" @@ -157,10 +156,10 @@ class ZPhysicalMemoryBackingLargePages : public ZPhysicalMemoryBackingImpl { size_t npages_res = npages; const bool res = AllocateUserPhysicalPages(ZAWESection, &npages_res, &_page_array[index]); if (!res) { - fatal("Failed to allocate physical memory " SIZE_FORMAT "M @ " PTR_FORMAT " (%d)", + fatal("Failed to allocate physical memory %zuM @ " PTR_FORMAT " (%d)", size / M, untype(offset), GetLastError()); } else { - log_debug(gc)("Allocated physical memory: " SIZE_FORMAT "M @ " PTR_FORMAT, size / M, untype(offset)); + log_debug(gc)("Allocated physical memory: %zuM @ " PTR_FORMAT, size / M, untype(offset)); } // AllocateUserPhysicalPages might not be able to allocate the requested amount of memory. @@ -175,7 +174,7 @@ class ZPhysicalMemoryBackingLargePages : public ZPhysicalMemoryBackingImpl { size_t npages_res = npages; const bool res = FreeUserPhysicalPages(ZAWESection, &npages_res, &_page_array[index]); if (!res) { - fatal("Failed to uncommit physical memory " SIZE_FORMAT "M @ " PTR_FORMAT " (%d)", + fatal("Failed to uncommit physical memory %zuM @ " PTR_FORMAT " (%d)", size, untype(offset), GetLastError()); } @@ -188,7 +187,7 @@ class ZPhysicalMemoryBackingLargePages : public ZPhysicalMemoryBackingImpl { const bool res = MapUserPhysicalPages((char*)untype(addr), npages, &_page_array[index]); if (!res) { - fatal("Failed to map view " PTR_FORMAT " " SIZE_FORMAT "M @ " PTR_FORMAT " (%d)", + fatal("Failed to map view " PTR_FORMAT " %zuM @ " PTR_FORMAT " (%d)", untype(addr), size / M, untype(offset), GetLastError()); } } @@ -198,7 +197,7 @@ class ZPhysicalMemoryBackingLargePages : public ZPhysicalMemoryBackingImpl { const bool res = MapUserPhysicalPages((char*)untype(addr), npages, nullptr); if (!res) { - fatal("Failed to unmap view " PTR_FORMAT " " SIZE_FORMAT "M (%d)", + fatal("Failed to unmap view " PTR_FORMAT " %zuM (%d)", addr, size / M, GetLastError()); } } @@ -224,14 +223,14 @@ void ZPhysicalMemoryBacking::warn_commit_limits(size_t max_capacity) const { } size_t ZPhysicalMemoryBacking::commit(zoffset offset, size_t length) { - log_trace(gc, heap)("Committing memory: " SIZE_FORMAT "M-" SIZE_FORMAT "M (" SIZE_FORMAT "M)", + log_trace(gc, heap)("Committing memory: %zuM-%zuM (%zuM)", untype(offset) / M, untype(to_zoffset_end(offset, length)) / M, length / M); return _impl->commit(offset, length); } size_t ZPhysicalMemoryBacking::uncommit(zoffset offset, size_t length) { - log_trace(gc, heap)("Uncommitting memory: " SIZE_FORMAT "M-" SIZE_FORMAT "M (" SIZE_FORMAT "M)", + log_trace(gc, heap)("Uncommitting memory: %zuM-%zuM (%zuM)", untype(offset) / M, untype(to_zoffset_end(offset, length)) / M, length / M); return _impl->uncommit(offset, length); diff --git a/src/hotspot/os/windows/gc/z/zSyscall_windows.cpp b/src/hotspot/os/windows/gc/z/zSyscall_windows.cpp index 68ebee5e655cc..527958770c0ea 100644 --- a/src/hotspot/os/windows/gc/z/zSyscall_windows.cpp +++ b/src/hotspot/os/windows/gc/z/zSyscall_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/gcLogPrecious.hpp" #include "gc/z/zSyscall_windows.hpp" #include "runtime/java.hpp" diff --git a/src/hotspot/os/windows/gc/z/zVirtualMemory_windows.cpp b/src/hotspot/os/windows/gc/z/zVirtualMemory_windows.cpp index 294935eda866c..392b16e38a308 100644 --- a/src/hotspot/os/windows/gc/z/zVirtualMemory_windows.cpp +++ b/src/hotspot/os/windows/gc/z/zVirtualMemory_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zAddress.inline.hpp" #include "gc/z/zGlobals.hpp" #include "gc/z/zLargePages.inline.hpp" diff --git a/src/hotspot/os/windows/include/jvm_md.h b/src/hotspot/os/windows/include/jvm_md.h index a0e44a4561365..165b25a82f919 100644 --- a/src/hotspot/os/windows/include/jvm_md.h +++ b/src/hotspot/os/windows/include/jvm_md.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * 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,12 +31,12 @@ * JNI conversion, which should be sorted out later. */ +#include "jni.h" + #include #include #include -#include "jni.h" - typedef int socklen_t; #define JNI_LIB_PREFIX "" diff --git a/src/hotspot/os/windows/iphlp_interface.cpp b/src/hotspot/os/windows/iphlp_interface.cpp index 0d6a08b0bd0d4..d30def1749004 100644 --- a/src/hotspot/os/windows/iphlp_interface.cpp +++ b/src/hotspot/os/windows/iphlp_interface.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "iphlp_interface.hpp" #include "os_windows.hpp" #include "runtime/os.hpp" diff --git a/src/hotspot/os/windows/jvm_windows.cpp b/src/hotspot/os/windows/jvm_windows.cpp index c3fa1645fcc58..da29b156ad688 100644 --- a/src/hotspot/os/windows/jvm_windows.cpp +++ b/src/hotspot/os/windows/jvm_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jvm.h" #include "os_windows.hpp" #include "runtime/interfaceSupport.inline.hpp" diff --git a/src/hotspot/os/windows/memMapPrinter_windows.cpp b/src/hotspot/os/windows/memMapPrinter_windows.cpp index ff27aea02c592..075a64f5863b2 100644 --- a/src/hotspot/os/windows/memMapPrinter_windows.cpp +++ b/src/hotspot/os/windows/memMapPrinter_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2024, Red Hat, Inc. and/or its affiliates. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "nmt/memMapPrinter.hpp" #include "os_windows.hpp" #include "runtime/vm_version.hpp" diff --git a/src/hotspot/os/windows/osThread_windows.cpp b/src/hotspot/os/windows/osThread_windows.cpp index abbff6b3a78f9..f36e95c51c106 100644 --- a/src/hotspot/os/windows/osThread_windows.cpp +++ b/src/hotspot/os/windows/osThread_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "runtime/osThread.hpp" #include diff --git a/src/hotspot/os/windows/os_perf_windows.cpp b/src/hotspot/os/windows/os_perf_windows.cpp index 57dcd2710c876..9d04ae65954cc 100644 --- a/src/hotspot/os/windows/os_perf_windows.cpp +++ b/src/hotspot/os/windows/os_perf_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "iphlp_interface.hpp" #include "jvm_io.h" #include "logging/log.hpp" diff --git a/src/hotspot/os/windows/os_windows.cpp b/src/hotspot/os/windows/os_windows.cpp index afd8fe01752b0..b0676e9268d52 100644 --- a/src/hotspot/os/windows/os_windows.cpp +++ b/src/hotspot/os/windows/os_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ // API level must be at least Windows Vista or Server 2008 to use InitOnceExecuteOnce -// no precompiled headers #include "classfile/vmSymbols.hpp" #include "code/codeCache.hpp" #include "code/nativeInst.hpp" @@ -146,26 +145,34 @@ LPTOP_LEVEL_EXCEPTION_FILTER previousUnhandledExceptionFilter = nullptr; HINSTANCE vm_lib_handle; +static void windows_preinit(HINSTANCE hinst) { + vm_lib_handle = hinst; + if (ForceTimeHighResolution) { + timeBeginPeriod(1L); + } + WindowsDbgHelp::pre_initialize(); + SymbolEngine::pre_initialize(); +} + +static void windows_atexit() { + if (ForceTimeHighResolution) { + timeEndPeriod(1L); + } +#if defined(USE_VECTORED_EXCEPTION_HANDLING) + if (topLevelVectoredExceptionHandler != nullptr) { + RemoveVectoredExceptionHandler(topLevelVectoredExceptionHandler); + topLevelVectoredExceptionHandler = nullptr; + } +#endif +} + BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved) { switch (reason) { case DLL_PROCESS_ATTACH: - vm_lib_handle = hinst; - if (ForceTimeHighResolution) { - timeBeginPeriod(1L); - } - WindowsDbgHelp::pre_initialize(); - SymbolEngine::pre_initialize(); + windows_preinit(hinst); break; case DLL_PROCESS_DETACH: - if (ForceTimeHighResolution) { - timeEndPeriod(1L); - } -#if defined(USE_VECTORED_EXCEPTION_HANDLING) - if (topLevelVectoredExceptionHandler != nullptr) { - RemoveVectoredExceptionHandler(topLevelVectoredExceptionHandler); - topLevelVectoredExceptionHandler = nullptr; - } -#endif + windows_atexit(); break; default: break; @@ -198,12 +205,12 @@ struct PreserveLastError { static LPVOID virtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect) { LPVOID result = ::VirtualAlloc(lpAddress, dwSize, flAllocationType, flProtect); if (result != nullptr) { - log_trace(os)("VirtualAlloc(" PTR_FORMAT ", " SIZE_FORMAT ", %x, %x) returned " PTR_FORMAT "%s.", + log_trace(os)("VirtualAlloc(" PTR_FORMAT ", %zu, %x, %x) returned " PTR_FORMAT "%s.", p2i(lpAddress), dwSize, flAllocationType, flProtect, p2i(result), ((lpAddress != nullptr && result != lpAddress) ? " " : "")); } else { PreserveLastError ple; - log_info(os)("VirtualAlloc(" PTR_FORMAT ", " SIZE_FORMAT ", %x, %x) failed (%u).", + log_info(os)("VirtualAlloc(" PTR_FORMAT ", %zu, %x, %x) failed (%u).", p2i(lpAddress), dwSize, flAllocationType, flProtect, ple.v); } return result; @@ -213,11 +220,11 @@ static LPVOID virtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationTy static BOOL virtualFree(LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType) { BOOL result = ::VirtualFree(lpAddress, dwSize, dwFreeType); if (result != FALSE) { - log_trace(os)("VirtualFree(" PTR_FORMAT ", " SIZE_FORMAT ", %x) succeeded", + log_trace(os)("VirtualFree(" PTR_FORMAT ", %zu, %x) succeeded", p2i(lpAddress), dwSize, dwFreeType); } else { PreserveLastError ple; - log_info(os)("VirtualFree(" PTR_FORMAT ", " SIZE_FORMAT ", %x) failed (%u).", + log_info(os)("VirtualFree(" PTR_FORMAT ", %zu, %x) failed (%u).", p2i(lpAddress), dwSize, dwFreeType, ple.v); } return result; @@ -228,12 +235,12 @@ static LPVOID virtualAllocExNuma(HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSiz DWORD flProtect, DWORD nndPreferred) { LPVOID result = ::VirtualAllocExNuma(hProcess, lpAddress, dwSize, flAllocationType, flProtect, nndPreferred); if (result != nullptr) { - log_trace(os)("VirtualAllocExNuma(" PTR_FORMAT ", " SIZE_FORMAT ", %x, %x, %x) returned " PTR_FORMAT "%s.", + log_trace(os)("VirtualAllocExNuma(" PTR_FORMAT ", %zu, %x, %x, %x) returned " PTR_FORMAT "%s.", p2i(lpAddress), dwSize, flAllocationType, flProtect, nndPreferred, p2i(result), ((lpAddress != nullptr && result != lpAddress) ? " " : "")); } else { PreserveLastError ple; - log_info(os)("VirtualAllocExNuma(" PTR_FORMAT ", " SIZE_FORMAT ", %x, %x, %x) failed (%u).", + log_info(os)("VirtualAllocExNuma(" PTR_FORMAT ", %zu, %x, %x, %x) failed (%u).", p2i(lpAddress), dwSize, flAllocationType, flProtect, nndPreferred, ple.v); } return result; @@ -245,12 +252,12 @@ static LPVOID mapViewOfFileEx(HANDLE hFileMappingObject, DWORD dwDesiredAccess, LPVOID result = ::MapViewOfFileEx(hFileMappingObject, dwDesiredAccess, dwFileOffsetHigh, dwFileOffsetLow, dwNumberOfBytesToMap, lpBaseAddress); if (result != nullptr) { - log_trace(os)("MapViewOfFileEx(" PTR_FORMAT ", " SIZE_FORMAT ") returned " PTR_FORMAT "%s.", + log_trace(os)("MapViewOfFileEx(" PTR_FORMAT ", %zu) returned " PTR_FORMAT "%s.", p2i(lpBaseAddress), dwNumberOfBytesToMap, p2i(result), ((lpBaseAddress != nullptr && result != lpBaseAddress) ? " " : "")); } else { PreserveLastError ple; - log_info(os)("MapViewOfFileEx(" PTR_FORMAT ", " SIZE_FORMAT ") failed (%u).", + log_info(os)("MapViewOfFileEx(" PTR_FORMAT ", %zu) failed (%u).", p2i(lpBaseAddress), dwNumberOfBytesToMap, ple.v); } return result; @@ -285,6 +292,8 @@ void os::run_periodic_checks(outputStream* st) { static LONG WINAPI Uncaught_Exception_Handler(struct _EXCEPTION_POINTERS* exceptionInfo); +#define JVM_LIB_NAME "jvm.dll" + void os::init_system_properties_values() { // sysclasspath, java_home, dll_dir { @@ -300,15 +309,27 @@ void os::init_system_properties_values() { home_dir[MAX_PATH] = '\0'; } else { os::jvm_path(home_dir, sizeof(home_dir)); - // Found the full path to jvm.dll. - // Now cut the path to /jre if we can. - *(strrchr(home_dir, '\\')) = '\0'; // get rid of \jvm.dll + // Found the full path to the binary. It is normally of this structure: + // /bin//jvm.dll + // but can also be like this for a statically linked binary: + // /bin/.exe pslash = strrchr(home_dir, '\\'); if (pslash != nullptr) { - *pslash = '\0'; // get rid of \{client|server} + if (strncmp(pslash + 1, JVM_LIB_NAME, strlen(JVM_LIB_NAME)) == 0) { + // Binary name is jvm.dll. Get rid of \jvm.dll. + *pslash = '\0'; + } + + // Get rid of \hotspot_variant>, if binary is jvm.dll, + // or cut off \, if it is a statically linked binary. pslash = strrchr(home_dir, '\\'); if (pslash != nullptr) { - *pslash = '\0'; // get rid of \bin + *pslash = '\0'; + // Get rid of \bin + pslash = strrchr(home_dir, '\\'); + if (pslash != nullptr) { + *pslash = '\0'; + } } } } @@ -530,7 +551,7 @@ static unsigned thread_native_entry(void* t) { res = 20115; // java thread } - log_info(os, thread)("Thread is alive (tid: " UINTX_FORMAT ", stacksize: " SIZE_FORMAT "k).", os::current_thread_id(), thread->stack_size() / K); + log_info(os, thread)("Thread is alive (tid: %zu, stacksize: %zuk).", os::current_thread_id(), thread->stack_size() / K); #ifdef USE_VECTORED_EXCEPTION_HANDLING // Any exception is caught by the Vectored Exception Handler, so VM can @@ -552,7 +573,7 @@ static unsigned thread_native_entry(void* t) { // Note: at this point the thread object may already have deleted itself. // Do not dereference it from here on out. - log_info(os, thread)("Thread finished (tid: " UINTX_FORMAT ").", os::current_thread_id()); + log_info(os, thread)("Thread finished (tid: %zu).", os::current_thread_id()); // Thread must not return from exit_process_or_thread(), but if it does, // let it proceed to exit normally @@ -615,8 +636,8 @@ bool os::create_attached_thread(JavaThread* thread) { thread->set_osthread(osthread); - log_info(os, thread)("Thread attached (tid: " UINTX_FORMAT ", stack: " - PTR_FORMAT " - " PTR_FORMAT " (" SIZE_FORMAT "K) ).", + log_info(os, thread)("Thread attached (tid: %zu, stack: " + PTR_FORMAT " - " PTR_FORMAT " (%zuK) ).", os::current_thread_id(), p2i(thread->stack_base()), p2i(thread->stack_end()), thread->stack_size() / K); @@ -649,7 +670,7 @@ static char* describe_beginthreadex_attributes(char* buf, size_t buflen, if (stacksize == 0) { ss.print("stacksize: default, "); } else { - ss.print("stacksize: " SIZE_FORMAT "k, ", stacksize / K); + ss.print("stacksize: %zuk, ", stacksize / K); } ss.print("flags: "); #define PRINT_FLAG(f) if (initflag & f) ss.print( #f " "); @@ -1402,9 +1423,7 @@ void* os::dll_lookup(void *lib, const char *name) { } void* os::lookup_function(const char* name) { - // This is needed only for static builds which are not supported on Windows - ShouldNotReachHere(); - return nullptr; // Satisfy compiler + return ::GetProcAddress(nullptr, name); } // Directory routines copied from src/win32/native/java/io/dirent_md.c @@ -2071,7 +2090,7 @@ void os::get_summary_cpu_info(char* buf, size_t buflen) { void os::print_memory_info(outputStream* st) { st->print("Memory:"); - st->print(" " SIZE_FORMAT "k page", os::vm_page_size()>>10); + st->print(" %zuk page", os::vm_page_size()>>10); // Use GlobalMemoryStatusEx() because GlobalMemoryStatus() may return incorrect // value if total memory is larger than 4GB @@ -3337,7 +3356,7 @@ char* os::pd_attempt_reserve_memory_at(char* addr, size_t bytes, bool exec) { } if (Verbose && PrintMiscellaneous) { reserveTimer.stop(); - tty->print_cr("reserve_memory of %Ix bytes took " JLONG_FORMAT " ms (" JLONG_FORMAT " ticks)", bytes, + tty->print_cr("reserve_memory of %zx bytes took " JLONG_FORMAT " ms (" JLONG_FORMAT " ticks)", bytes, reserveTimer.milliseconds(), reserveTimer.ticks()); } } @@ -3421,7 +3440,7 @@ static char* find_aligned_address(size_t size, size_t alignment) { } static char* reserve_large_pages_aligned(size_t size, size_t alignment, bool exec) { - log_debug(pagesize)("Reserving large pages at an aligned address, alignment=" SIZE_FORMAT "%s", + log_debug(pagesize)("Reserving large pages at an aligned address, alignment=%zu%s", byte_size_in_exact_unit(alignment), exact_unit_for_byte_size(alignment)); // Will try to find a suitable address at most 20 times. The reason we need to try @@ -3483,7 +3502,7 @@ static void warn_fail_commit_memory(char* addr, size_t bytes, bool exec) { int err = os::get_last_error(); char buf[256]; size_t buf_len = os::lasterror(buf, sizeof(buf)); - warning("INFO: os::commit_memory(" PTR_FORMAT ", " SIZE_FORMAT + warning("INFO: os::commit_memory(" PTR_FORMAT ", %zu" ", %d) failed; error='%s' (DOS error/errno=%d)", addr, bytes, exec, buf_len != 0 ? buf : "", err); } @@ -3619,10 +3638,7 @@ bool os::pd_release_memory(char* addr, size_t bytes) { // Handle mapping error. We assert in debug, unconditionally print a warning in release. if (err != nullptr) { log_warning(os)("bad release: [" PTR_FORMAT "-" PTR_FORMAT "): %s", p2i(start), p2i(end), err); -#ifdef ASSERT - os::print_memory_mappings((char*)start, bytes, tty); assert(false, "bad release: [" PTR_FORMAT "-" PTR_FORMAT "): %s", p2i(start), p2i(end), err); -#endif return false; } // Free this range @@ -3713,7 +3729,7 @@ bool os::protect_memory(char* addr, size_t bytes, ProtType prot, int err = os::get_last_error(); char buf[256]; size_t buf_len = os::lasterror(buf, sizeof(buf)); - warning("INFO: os::protect_memory(" PTR_FORMAT ", " SIZE_FORMAT + warning("INFO: os::protect_memory(" PTR_FORMAT ", %zu" ") failed; error='%s' (DOS error/errno=%d)", addr, bytes, buf_len != 0 ? buf : "", err); } @@ -4415,6 +4431,14 @@ bool os::message_box(const char* title, const char* message) { // This is called _before_ the global arguments have been parsed void os::init(void) { + if (is_vm_statically_linked()) { + // Mimick what is done in DllMain for non-static builds + HMODULE hModule = NULL; + GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, NULL, &hModule); + windows_preinit(hModule); + atexit(windows_atexit); + } + _initial_pid = _getpid(); win32::initialize_windows_version(); diff --git a/src/hotspot/os/windows/pdh_interface.cpp b/src/hotspot/os/windows/pdh_interface.cpp index 3134dc3f24cce..6f63452e7d9d7 100644 --- a/src/hotspot/os/windows/pdh_interface.cpp +++ b/src/hotspot/os/windows/pdh_interface.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "os_windows.hpp" #include "pdh_interface.hpp" #include "runtime/os.hpp" diff --git a/src/hotspot/os/windows/perfMemory_windows.cpp b/src/hotspot/os/windows/perfMemory_windows.cpp index 06b057315cbdd..7a3791ced1a00 100644 --- a/src/hotspot/os/windows/perfMemory_windows.cpp +++ b/src/hotspot/os/windows/perfMemory_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/vmSymbols.hpp" #include "logging/log.hpp" #include "memory/allocation.inline.hpp" @@ -1561,7 +1560,7 @@ static size_t sharedmem_filesize(const char* filename, TRAPS) { if ((statbuf.st_size == 0) || (statbuf.st_size % os::vm_page_size() != 0)) { if (PrintMiscellaneous && Verbose) { - warning("unexpected file size: size = " SIZE_FORMAT "\n", + warning("unexpected file size: size = %zu\n", statbuf.st_size); } THROW_MSG_0(vmSymbols::java_io_IOException(), @@ -1660,7 +1659,7 @@ static void open_file_mapping(int vmid, char** addrp, size_t* sizep, TRAPS) { // invalidating the mapped view of the file CloseHandle(fmh); - log_debug(perf, memops)("mapped " SIZE_FORMAT " bytes for vmid %d at " + log_debug(perf, memops)("mapped %zu bytes for vmid %d at " INTPTR_FORMAT, size, vmid, mapAddress); } @@ -1803,7 +1802,7 @@ void PerfMemory::detach(char* addr, size_t bytes) { if (MemTracker::enabled()) { // it does not go through os api, the operation has to record from here - ThreadCritical tc; + MemTracker::NmtVirtualMemoryLocker nvml; remove_file_mapping(addr); MemTracker::record_virtual_memory_release((address)addr, bytes); } else { diff --git a/src/hotspot/os/windows/semaphore_windows.cpp b/src/hotspot/os/windows/semaphore_windows.cpp index 22b06241841ff..098ca526803a1 100644 --- a/src/hotspot/os/windows/semaphore_windows.cpp +++ b/src/hotspot/os/windows/semaphore_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "semaphore_windows.hpp" #include "utilities/debug.hpp" diff --git a/src/hotspot/os/windows/sharedRuntimeRem.cpp b/src/hotspot/os/windows/sharedRuntimeRem.cpp index 62a85e55a0107..aae93f701ec7b 100644 --- a/src/hotspot/os/windows/sharedRuntimeRem.cpp +++ b/src/hotspot/os/windows/sharedRuntimeRem.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "runtime/sharedRuntime.hpp" // These are copied defines originally from fdlibm.h. diff --git a/src/hotspot/os/windows/symbolengine.cpp b/src/hotspot/os/windows/symbolengine.cpp index 0d461e671bb34..83cb930f7bfec 100644 --- a/src/hotspot/os/windows/symbolengine.cpp +++ b/src/hotspot/os/windows/symbolengine.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "utilities/globalDefinitions.hpp" #include "symbolengine.hpp" #include "utilities/debug.hpp" @@ -526,7 +525,7 @@ namespace { // Do not export. }; } -// Called at DLL_PROCESS_ATTACH. +// Called at DLL_PROCESS_ATTACH for dynamic builds, and from os::init() for static builds. void SymbolEngine::pre_initialize() { ::InitializeCriticalSection(&g_cs); } diff --git a/src/hotspot/os/windows/symbolengine.hpp b/src/hotspot/os/windows/symbolengine.hpp index 02d3ba9487d44..6f0f671f982e7 100644 --- a/src/hotspot/os/windows/symbolengine.hpp +++ b/src/hotspot/os/windows/symbolengine.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -58,7 +58,7 @@ namespace SymbolEngine { // missing - if any, and the dbhelp API version) void print_state_on(outputStream* st); - // Call at DLL_PROCESS_ATTACH. + // Called at DLL_PROCESS_ATTACH for dynamic builds, and from os::init() for static builds. void pre_initialize(); }; diff --git a/src/hotspot/os/windows/systemMemoryBarrier_windows.cpp b/src/hotspot/os/windows/systemMemoryBarrier_windows.cpp index 1ba27c4ced577..03811fcd64b69 100644 --- a/src/hotspot/os/windows/systemMemoryBarrier_windows.cpp +++ b/src/hotspot/os/windows/systemMemoryBarrier_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "systemMemoryBarrier_windows.hpp" #include diff --git a/src/hotspot/os/windows/threadCrashProtection_windows.cpp b/src/hotspot/os/windows/threadCrashProtection_windows.cpp index b8caa7aff5e78..07248c07426ac 100644 --- a/src/hotspot/os/windows/threadCrashProtection_windows.cpp +++ b/src/hotspot/os/windows/threadCrashProtection_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "runtime/thread.hpp" #include "runtime/threadCrashProtection.hpp" diff --git a/src/hotspot/os/windows/threadCritical_windows.cpp b/src/hotspot/os/windows/threadCritical_windows.cpp index c85143f80930d..35aa0839089bf 100644 --- a/src/hotspot/os/windows/threadCritical_windows.cpp +++ b/src/hotspot/os/windows/threadCritical_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "runtime/atomic.hpp" #include "runtime/javaThread.hpp" #include "runtime/threadCritical.hpp" diff --git a/src/hotspot/os/windows/threadLocalStorage_windows.cpp b/src/hotspot/os/windows/threadLocalStorage_windows.cpp index 7d809518aab33..f18c3fcb0a39f 100644 --- a/src/hotspot/os/windows/threadLocalStorage_windows.cpp +++ b/src/hotspot/os/windows/threadLocalStorage_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "runtime/threadLocalStorage.hpp" #include "utilities/debug.hpp" #include diff --git a/src/hotspot/os/windows/vmError_windows.cpp b/src/hotspot/os/windows/vmError_windows.cpp index 705e04e77db45..1613f52136fb1 100644 --- a/src/hotspot/os/windows/vmError_windows.cpp +++ b/src/hotspot/os/windows/vmError_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/cdsConfig.hpp" #include "cds/metaspaceShared.hpp" #include "runtime/arguments.hpp" diff --git a/src/hotspot/os/windows/windbghelp.cpp b/src/hotspot/os/windows/windbghelp.cpp index 92c88d08cfc17..0de702580a306 100644 --- a/src/hotspot/os/windows/windbghelp.cpp +++ b/src/hotspot/os/windows/windbghelp.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "utilities/ostream.hpp" #include "windbghelp.hpp" @@ -141,7 +140,7 @@ namespace { // Do not export. }; } -// Called at DLL_PROCESS_ATTACH. +// Called at DLL_PROCESS_ATTACH for dynamic builds, and from os::init() for static builds. void WindowsDbgHelp::pre_initialize() { ::InitializeCriticalSection(&g_cs); } diff --git a/src/hotspot/os/windows/windbghelp.hpp b/src/hotspot/os/windows/windbghelp.hpp index e3e3826db29aa..cdfe781c3435a 100644 --- a/src/hotspot/os/windows/windbghelp.hpp +++ b/src/hotspot/os/windows/windbghelp.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -67,7 +67,7 @@ namespace WindowsDbgHelp { // missing - if any, and the dbhelp API version) void print_state_on(outputStream* st); - // Call at DLL_PROCESS_ATTACH. + // Called at DLL_PROCESS_ATTACH for dynamic builds, and from os::init() for static builds. void pre_initialize(); }; diff --git a/src/hotspot/os_cpu/aix_ppc/javaThread_aix_ppc.cpp b/src/hotspot/os_cpu/aix_ppc/javaThread_aix_ppc.cpp index 94e0c387a81dc..7cd57b65d32b3 100644 --- a/src/hotspot/os_cpu/aix_ppc/javaThread_aix_ppc.cpp +++ b/src/hotspot/os_cpu/aix_ppc/javaThread_aix_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * Copyright (c) 2022, IBM Corp. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "memory/metaspace.hpp" #include "runtime/frame.inline.hpp" #include "runtime/javaThread.hpp" diff --git a/src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp b/src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp index 45d91c60ed42a..720c732327ea4 100644 --- a/src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp +++ b/src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -// no precompiled headers #include "assembler_ppc.hpp" #include "asm/assembler.inline.hpp" #include "classfile/vmSymbols.hpp" diff --git a/src/hotspot/os_cpu/bsd_aarch64/javaThread_bsd_aarch64.cpp b/src/hotspot/os_cpu/bsd_aarch64/javaThread_bsd_aarch64.cpp index 336f194e276e4..fa40ef2b8f1c4 100644 --- a/src/hotspot/os_cpu/bsd_aarch64/javaThread_bsd_aarch64.cpp +++ b/src/hotspot/os_cpu/bsd_aarch64/javaThread_bsd_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * Copyright (c) 2021, Azul Systems, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "cds/metaspaceShared.hpp" #include "runtime/frame.inline.hpp" #include "runtime/javaThread.hpp" diff --git a/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp b/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp index 1e3602d08f428..7b35317882da8 100644 --- a/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp +++ b/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * Copyright (c) 2021, Azul Systems, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -24,7 +24,6 @@ * */ -// no precompiled headers #include "asm/macroAssembler.hpp" #include "classfile/classLoader.hpp" #include "classfile/vmSymbols.hpp" diff --git a/src/hotspot/os_cpu/bsd_aarch64/vm_version_bsd_aarch64.cpp b/src/hotspot/os_cpu/bsd_aarch64/vm_version_bsd_aarch64.cpp index cbfda539321f3..5424b58da6d10 100644 --- a/src/hotspot/os_cpu/bsd_aarch64/vm_version_bsd_aarch64.cpp +++ b/src/hotspot/os_cpu/bsd_aarch64/vm_version_bsd_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2019, Red Hat Inc. All rights reserved. * Copyright (c) 2021, Azul Systems, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "runtime/java.hpp" #include "runtime/os.hpp" #include "runtime/vm_version.hpp" diff --git a/src/hotspot/os_cpu/bsd_x86/assembler_bsd_x86.cpp b/src/hotspot/os_cpu/bsd_x86/assembler_bsd_x86.cpp index dd20ea833c8d2..2dc6b32998ac5 100644 --- a/src/hotspot/os_cpu/bsd_x86/assembler_bsd_x86.cpp +++ b/src/hotspot/os_cpu/bsd_x86/assembler_bsd_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "asm/macroAssembler.inline.hpp" #include "runtime/os.hpp" diff --git a/src/hotspot/os_cpu/bsd_x86/javaThread_bsd_x86.cpp b/src/hotspot/os_cpu/bsd_x86/javaThread_bsd_x86.cpp index c636d147768d0..0b5e5b6e7bdd6 100644 --- a/src/hotspot/os_cpu/bsd_x86/javaThread_bsd_x86.cpp +++ b/src/hotspot/os_cpu/bsd_x86/javaThread_bsd_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "runtime/frame.inline.hpp" #include "runtime/javaThread.hpp" diff --git a/src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp b/src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp index 153c5ad7e2b76..d11e7d8b90b62 100644 --- a/src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp +++ b/src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -// no precompiled headers #include "asm/macroAssembler.hpp" #include "classfile/vmSymbols.hpp" #include "code/codeCache.hpp" diff --git a/src/hotspot/os_cpu/bsd_x86/vm_version_bsd_x86.cpp b/src/hotspot/os_cpu/bsd_x86/vm_version_bsd_x86.cpp index 3455a845eb97f..2d84caf2e84a6 100644 --- a/src/hotspot/os_cpu/bsd_x86/vm_version_bsd_x86.cpp +++ b/src/hotspot/os_cpu/bsd_x86/vm_version_bsd_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "runtime/os.hpp" #include "runtime/vm_version.hpp" diff --git a/src/hotspot/os_cpu/bsd_zero/javaThread_bsd_zero.cpp b/src/hotspot/os_cpu/bsd_zero/javaThread_bsd_zero.cpp index d09516ff9eab6..0300103f72772 100644 --- a/src/hotspot/os_cpu/bsd_zero/javaThread_bsd_zero.cpp +++ b/src/hotspot/os_cpu/bsd_zero/javaThread_bsd_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright 2009, 2010 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "runtime/frame.inline.hpp" #include "runtime/javaThread.hpp" diff --git a/src/hotspot/os_cpu/bsd_zero/os_bsd_zero.cpp b/src/hotspot/os_cpu/bsd_zero/os_bsd_zero.cpp index fa64c857eeeaa..29efae1adc874 100644 --- a/src/hotspot/os_cpu/bsd_zero/os_bsd_zero.cpp +++ b/src/hotspot/os_cpu/bsd_zero/os_bsd_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -// no precompiled headers #include "asm/assembler.inline.hpp" #include "atomic_bsd_zero.hpp" #include "classfile/vmSymbols.hpp" diff --git a/src/hotspot/os_cpu/bsd_zero/vm_version_bsd_zero.cpp b/src/hotspot/os_cpu/bsd_zero/vm_version_bsd_zero.cpp index eaf1b85e4be58..48a9d1f835220 100644 --- a/src/hotspot/os_cpu/bsd_zero/vm_version_bsd_zero.cpp +++ b/src/hotspot/os_cpu/bsd_zero/vm_version_bsd_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright 2009 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "runtime/os.hpp" #include "runtime/vm_version.hpp" diff --git a/src/hotspot/os_cpu/linux_aarch64/javaThread_linux_aarch64.cpp b/src/hotspot/os_cpu/linux_aarch64/javaThread_linux_aarch64.cpp index 533151096b341..d4d428c9ddca3 100644 --- a/src/hotspot/os_cpu/linux_aarch64/javaThread_linux_aarch64.cpp +++ b/src/hotspot/os_cpu/linux_aarch64/javaThread_linux_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "runtime/frame.inline.hpp" #include "runtime/javaThread.hpp" diff --git a/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp b/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp index a7ec163f78553..171b40e414e25 100644 --- a/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp +++ b/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -// no precompiled headers #include "asm/macroAssembler.hpp" #include "classfile/vmSymbols.hpp" #include "code/codeCache.hpp" diff --git a/src/hotspot/os_cpu/linux_aarch64/vm_version_linux_aarch64.cpp b/src/hotspot/os_cpu/linux_aarch64/vm_version_linux_aarch64.cpp index 6102f70f06b7a..dabc69403f3d5 100644 --- a/src/hotspot/os_cpu/linux_aarch64/vm_version_linux_aarch64.cpp +++ b/src/hotspot/os_cpu/linux_aarch64/vm_version_linux_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "runtime/os.hpp" #include "runtime/os.inline.hpp" #include "runtime/vm_version.hpp" diff --git a/src/hotspot/os_cpu/linux_arm/javaThread_linux_arm.cpp b/src/hotspot/os_cpu/linux_arm/javaThread_linux_arm.cpp index 738017a08957a..3dc0035ed8716 100644 --- a/src/hotspot/os_cpu/linux_arm/javaThread_linux_arm.cpp +++ b/src/hotspot/os_cpu/linux_arm/javaThread_linux_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/cardTable.hpp" #include "gc/shared/cardTableBarrierSet.inline.hpp" diff --git a/src/hotspot/os_cpu/linux_arm/macroAssembler_linux_arm_32.cpp b/src/hotspot/os_cpu/linux_arm/macroAssembler_linux_arm_32.cpp index 0a3968ffa7064..e74daaa6d666a 100644 --- a/src/hotspot/os_cpu/linux_arm/macroAssembler_linux_arm_32.cpp +++ b/src/hotspot/os_cpu/linux_arm/macroAssembler_linux_arm_32.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "runtime/os.hpp" diff --git a/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp b/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp index 861d0d20153f7..4debfaa077f06 100644 --- a/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp +++ b/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -// no precompiled headers #include "asm/assembler.inline.hpp" #include "classfile/vmSymbols.hpp" #include "code/vtableStubs.hpp" diff --git a/src/hotspot/os_cpu/linux_arm/vm_version_linux_arm_32.cpp b/src/hotspot/os_cpu/linux_arm/vm_version_linux_arm_32.cpp index f1d29556e13cb..d1ef511d9d45c 100644 --- a/src/hotspot/os_cpu/linux_arm/vm_version_linux_arm_32.cpp +++ b/src/hotspot/os_cpu/linux_arm/vm_version_linux_arm_32.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "runtime/os.hpp" #include "runtime/vm_version.hpp" diff --git a/src/hotspot/os_cpu/linux_ppc/javaThread_linux_ppc.cpp b/src/hotspot/os_cpu/linux_ppc/javaThread_linux_ppc.cpp index f9fc6cec7fac9..a1c3d616eea5d 100644 --- a/src/hotspot/os_cpu/linux_ppc/javaThread_linux_ppc.cpp +++ b/src/hotspot/os_cpu/linux_ppc/javaThread_linux_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "memory/metaspace.hpp" #include "runtime/frame.inline.hpp" #include "runtime/javaThread.hpp" diff --git a/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp b/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp index f3f9a3a88df67..11ac1b0178433 100644 --- a/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp +++ b/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -// no precompiled headers #include "assembler_ppc.hpp" #include "asm/assembler.inline.hpp" #include "classfile/vmSymbols.hpp" diff --git a/src/hotspot/os_cpu/linux_riscv/javaThread_linux_riscv.cpp b/src/hotspot/os_cpu/linux_riscv/javaThread_linux_riscv.cpp index c0dcba0ec51ea..4490ebcfdbf08 100644 --- a/src/hotspot/os_cpu/linux_riscv/javaThread_linux_riscv.cpp +++ b/src/hotspot/os_cpu/linux_riscv/javaThread_linux_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2021, Huawei Technologies Co., Ltd. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "runtime/frame.inline.hpp" #include "runtime/javaThread.hpp" diff --git a/src/hotspot/os_cpu/linux_riscv/os_linux_riscv.cpp b/src/hotspot/os_cpu/linux_riscv/os_linux_riscv.cpp index a00659f37cb42..945280bca10b9 100644 --- a/src/hotspot/os_cpu/linux_riscv/os_linux_riscv.cpp +++ b/src/hotspot/os_cpu/linux_riscv/os_linux_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. 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. * @@ -23,7 +23,6 @@ * */ -// no precompiled headers #include "asm/macroAssembler.hpp" #include "classfile/vmSymbols.hpp" #include "code/codeCache.hpp" @@ -56,8 +55,9 @@ // put OS-includes here # include -# include # include +# include +# include # include # include # include @@ -350,6 +350,72 @@ void os::print_context(outputStream *st, const void *context) { st->print_cr("%-*.*s=" INTPTR_FORMAT, 8, 8, reg_abi_names[r], (uintptr_t)uc->uc_mcontext.__gregs[r]); } st->cr(); + const struct __riscv_mc_d_ext_state * const f_ext_state = &(uc->uc_mcontext.__fpregs.__d); + st->print_cr("Floating point state:"); + st->print_cr("fcsr=" UINT32_FORMAT, f_ext_state->__fcsr); + st->print_cr("Floating point registers:"); + for (int r = 0; r < 32; r++) { + st->print_cr("f%d=" INTPTR_FORMAT, r, (intptr_t)f_ext_state->__f[r]); + } + st->cr(); + +#ifdef NO_RVV_SIGCONTEXT + st->print_cr("Vector state: JVM compiled without vector sigcontext support"); +#else // ifndef NO_RVV_SIGCONTEXT +// This magic number is not in any user-space header. +// No other choice but to define it (arch/riscv/include/uapi/asm/sigcontext.h). +#ifndef RISCV_V_MAGIC +#define RISCV_V_MAGIC 0x53465457 +#endif + + // Find the vector context + struct __riscv_extra_ext_header *ext = (struct __riscv_extra_ext_header *)(&uc->uc_mcontext.__fpregs); + if (ext->hdr.magic != RISCV_V_MAGIC) { + st->print_cr("Vector state: not found"); + return; + } + + // The size passed to user-space is calculated accordingly: + // size = sizeof(struct __riscv_ctx_hdr) + sizeof(struct __riscv_v_ext_state) + riscv_v_vsize; + uint32_t ext_size = ext->hdr.size; + + if (ext_size < (sizeof(struct __riscv_ctx_hdr) + sizeof(struct __riscv_v_ext_state))) { + st->print_cr("Vector state: not found, invalid size"); + return; + } + + struct __riscv_v_ext_state *v_ext_state = (struct __riscv_v_ext_state *)((char *)(ext) + sizeof(struct __riscv_extra_ext_header)); + + st->print_cr("Vector state:"); + st->print_cr("vstart=" INTPTR_FORMAT, v_ext_state->vstart); + st->print_cr("vl =" INTPTR_FORMAT, v_ext_state->vl); + st->print_cr("vtype =" INTPTR_FORMAT, v_ext_state->vtype); + st->print_cr("vcsr =" INTPTR_FORMAT, v_ext_state->vcsr); + st->print_cr("vlenb =" INTPTR_FORMAT, v_ext_state->vlenb); + st->print_cr("Vector registers:"); + + uint64_t vr_size = v_ext_state->vlenb; + + // Registers are after the v extensions header. + ext_size -= (sizeof(struct __riscv_ctx_hdr) + sizeof(struct __riscv_v_ext_state)); + + if (ext_size != (32 * vr_size)) { + st->print_cr("Vector registers: not found, invalid size"); + return; + } + + // datap format is undocumented, but is generated by kernel function riscv_v_vstate_save(). + uint8_t *regp = (uint8_t *)v_ext_state->datap; + for (int r = 0; r < 32; r++) { + st->print("v%d=0x", r); + for (int i = vr_size; i > 0; i--) { + st->print("%02" PRIx8, regp[i-1]); + } + st->print_cr(""); + regp += vr_size; + } + st->cr(); +#endif // #ifndef NO_RVV_SIGCONTEXT } void os::print_register_info(outputStream *st, const void *context, int& continuation) { diff --git a/src/hotspot/os_cpu/linux_riscv/riscv_flush_icache.cpp b/src/hotspot/os_cpu/linux_riscv/riscv_flush_icache.cpp index 4ca977bd57609..16c1445179bb8 100644 --- a/src/hotspot/os_cpu/linux_riscv/riscv_flush_icache.cpp +++ b/src/hotspot/os_cpu/linux_riscv/riscv_flush_icache.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2023, Rivos Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "logging/log.hpp" #include "riscv_flush_icache.hpp" #include "runtime/os.hpp" diff --git a/src/hotspot/os_cpu/linux_riscv/riscv_hwprobe.cpp b/src/hotspot/os_cpu/linux_riscv/riscv_hwprobe.cpp index e65254fc5718f..10652660c7362 100644 --- a/src/hotspot/os_cpu/linux_riscv/riscv_hwprobe.cpp +++ b/src/hotspot/os_cpu/linux_riscv/riscv_hwprobe.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2023, Rivos Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "logging/log.hpp" #include "riscv_hwprobe.hpp" #include "runtime/os.hpp" @@ -178,6 +177,9 @@ void RiscvHwprobe::add_features_from_query_result() { if (is_set(RISCV_HWPROBE_KEY_IMA_EXT_0, RISCV_HWPROBE_EXT_ZFH)) { VM_Version::ext_Zfh.enable_feature(); } + if (is_set(RISCV_HWPROBE_KEY_IMA_EXT_0, RISCV_HWPROBE_EXT_ZFHMIN)) { + VM_Version::ext_Zfhmin.enable_feature(); + } if (is_set(RISCV_HWPROBE_KEY_IMA_EXT_0, RISCV_HWPROBE_EXT_ZVBC)) { VM_Version::ext_Zvbc.enable_feature(); } diff --git a/src/hotspot/os_cpu/linux_riscv/vm_version_linux_riscv.cpp b/src/hotspot/os_cpu/linux_riscv/vm_version_linux_riscv.cpp index 323cab446274a..b6095c279cbf0 100644 --- a/src/hotspot/os_cpu/linux_riscv/vm_version_linux_riscv.cpp +++ b/src/hotspot/os_cpu/linux_riscv/vm_version_linux_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021, Huawei Technologies Co., Ltd. All rights reserved. * Copyright (c) 2023, Rivos Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "asm/register.hpp" #include "logging/log.hpp" #include "riscv_hwprobe.hpp" diff --git a/src/hotspot/os_cpu/linux_s390/javaThread_linux_s390.cpp b/src/hotspot/os_cpu/linux_s390/javaThread_linux_s390.cpp index 2e930396ce460..5da39b13a144e 100644 --- a/src/hotspot/os_cpu/linux_s390/javaThread_linux_s390.cpp +++ b/src/hotspot/os_cpu/linux_s390/javaThread_linux_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016, 2022 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "memory/metaspace.hpp" #include "runtime/frame.inline.hpp" #include "runtime/javaThread.hpp" diff --git a/src/hotspot/os_cpu/linux_s390/os_linux_s390.cpp b/src/hotspot/os_cpu/linux_s390/os_linux_s390.cpp index d599359d52903..192bfb6d537c2 100644 --- a/src/hotspot/os_cpu/linux_s390/os_linux_s390.cpp +++ b/src/hotspot/os_cpu/linux_s390/os_linux_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -25,7 +25,6 @@ // This file is organized as os_linux_x86.cpp. -// no precompiled headers #include "asm/assembler.inline.hpp" #include "classfile/vmSymbols.hpp" #include "code/nativeInst.hpp" diff --git a/src/hotspot/os_cpu/linux_x86/assembler_linux_x86.cpp b/src/hotspot/os_cpu/linux_x86/assembler_linux_x86.cpp index dd20ea833c8d2..2dc6b32998ac5 100644 --- a/src/hotspot/os_cpu/linux_x86/assembler_linux_x86.cpp +++ b/src/hotspot/os_cpu/linux_x86/assembler_linux_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "asm/macroAssembler.inline.hpp" #include "runtime/os.hpp" diff --git a/src/hotspot/os_cpu/linux_x86/javaThread_linux_x86.cpp b/src/hotspot/os_cpu/linux_x86/javaThread_linux_x86.cpp index 145b9a3f0220a..6f0cd49951d6a 100644 --- a/src/hotspot/os_cpu/linux_x86/javaThread_linux_x86.cpp +++ b/src/hotspot/os_cpu/linux_x86/javaThread_linux_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "runtime/frame.inline.hpp" #include "runtime/javaThread.hpp" diff --git a/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp b/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp index e357747bfea46..3eb91412d8c48 100644 --- a/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp +++ b/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -// no precompiled headers #include "asm/macroAssembler.hpp" #include "classfile/vmSymbols.hpp" #include "code/codeCache.hpp" diff --git a/src/hotspot/os_cpu/linux_x86/vm_version_linux_x86.cpp b/src/hotspot/os_cpu/linux_x86/vm_version_linux_x86.cpp index ef85f6fb920f8..6907d2bf72790 100644 --- a/src/hotspot/os_cpu/linux_x86/vm_version_linux_x86.cpp +++ b/src/hotspot/os_cpu/linux_x86/vm_version_linux_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "runtime/os.hpp" #include "runtime/vm_version.hpp" diff --git a/src/hotspot/os_cpu/linux_zero/javaThread_linux_zero.cpp b/src/hotspot/os_cpu/linux_zero/javaThread_linux_zero.cpp index 4f4f4efad2eb6..0aadd9db18921 100644 --- a/src/hotspot/os_cpu/linux_zero/javaThread_linux_zero.cpp +++ b/src/hotspot/os_cpu/linux_zero/javaThread_linux_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2009, 2021, Red Hat, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "runtime/frame.inline.hpp" #include "runtime/javaThread.hpp" diff --git a/src/hotspot/os_cpu/linux_zero/os_linux_zero.cpp b/src/hotspot/os_cpu/linux_zero/os_linux_zero.cpp index e8d67bcdddc28..01e207b73c863 100644 --- a/src/hotspot/os_cpu/linux_zero/os_linux_zero.cpp +++ b/src/hotspot/os_cpu/linux_zero/os_linux_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -// no precompiled headers #include "asm/assembler.inline.hpp" #include "atomic_linux_zero.hpp" #include "classfile/vmSymbols.hpp" diff --git a/src/hotspot/os_cpu/linux_zero/vm_version_linux_zero.cpp b/src/hotspot/os_cpu/linux_zero/vm_version_linux_zero.cpp index eaf1b85e4be58..48a9d1f835220 100644 --- a/src/hotspot/os_cpu/linux_zero/vm_version_linux_zero.cpp +++ b/src/hotspot/os_cpu/linux_zero/vm_version_linux_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright 2009 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "runtime/os.hpp" #include "runtime/vm_version.hpp" diff --git a/src/hotspot/os_cpu/windows_aarch64/assembler_windows_aarch64.cpp b/src/hotspot/os_cpu/windows_aarch64/assembler_windows_aarch64.cpp index 965613fd1e5bd..fefcfcb496d0c 100644 --- a/src/hotspot/os_cpu/windows_aarch64/assembler_windows_aarch64.cpp +++ b/src/hotspot/os_cpu/windows_aarch64/assembler_windows_aarch64.cpp @@ -23,4 +23,3 @@ */ // nothing required here -#include "precompiled.hpp" diff --git a/src/hotspot/os_cpu/windows_aarch64/javaThread_windows_aarch64.cpp b/src/hotspot/os_cpu/windows_aarch64/javaThread_windows_aarch64.cpp index df434398deb5c..8f6f1ccd38abe 100644 --- a/src/hotspot/os_cpu/windows_aarch64/javaThread_windows_aarch64.cpp +++ b/src/hotspot/os_cpu/windows_aarch64/javaThread_windows_aarch64.cpp @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "runtime/frame.inline.hpp" #include "runtime/javaThread.hpp" diff --git a/src/hotspot/os_cpu/windows_aarch64/os_windows_aarch64.cpp b/src/hotspot/os_cpu/windows_aarch64/os_windows_aarch64.cpp index 24410ed920314..df77502b8606d 100644 --- a/src/hotspot/os_cpu/windows_aarch64/os_windows_aarch64.cpp +++ b/src/hotspot/os_cpu/windows_aarch64/os_windows_aarch64.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2020, Microsoft Corporation. All rights reserved. - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "classfile/vmSymbols.hpp" #include "code/codeCache.hpp" diff --git a/src/hotspot/os_cpu/windows_aarch64/vm_version_windows_aarch64.cpp b/src/hotspot/os_cpu/windows_aarch64/vm_version_windows_aarch64.cpp index 3813287af0591..de9bf76fdb0ce 100644 --- a/src/hotspot/os_cpu/windows_aarch64/vm_version_windows_aarch64.cpp +++ b/src/hotspot/os_cpu/windows_aarch64/vm_version_windows_aarch64.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "logging/log.hpp" #include "runtime/os.hpp" #include "runtime/vm_version.hpp" diff --git a/src/hotspot/os_cpu/windows_x86/assembler_windows_x86.cpp b/src/hotspot/os_cpu/windows_x86/assembler_windows_x86.cpp index c541213615cac..c0dd1ca23aae3 100644 --- a/src/hotspot/os_cpu/windows_x86/assembler_windows_x86.cpp +++ b/src/hotspot/os_cpu/windows_x86/assembler_windows_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" void MacroAssembler::int3() { diff --git a/src/hotspot/os_cpu/windows_x86/javaThread_windows_x86.cpp b/src/hotspot/os_cpu/windows_x86/javaThread_windows_x86.cpp index 23819d594a3e2..63edd9d8eda1b 100644 --- a/src/hotspot/os_cpu/windows_x86/javaThread_windows_x86.cpp +++ b/src/hotspot/os_cpu/windows_x86/javaThread_windows_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "runtime/frame.inline.hpp" #include "runtime/javaThread.hpp" diff --git a/src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp b/src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp index 9a23ac6733521..2617a0b5f2cf9 100644 --- a/src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp +++ b/src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -// no precompiled headers #include "asm/macroAssembler.hpp" #include "classfile/vmSymbols.hpp" #include "code/vtableStubs.hpp" diff --git a/src/hotspot/os_cpu/windows_x86/vm_version_windows_x86.cpp b/src/hotspot/os_cpu/windows_x86/vm_version_windows_x86.cpp index ef85f6fb920f8..6907d2bf72790 100644 --- a/src/hotspot/os_cpu/windows_x86/vm_version_windows_x86.cpp +++ b/src/hotspot/os_cpu/windows_x86/vm_version_windows_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "runtime/os.hpp" #include "runtime/vm_version.hpp" diff --git a/src/hotspot/share/adlc/main.cpp b/src/hotspot/share/adlc/main.cpp index f15b6e8813ff1..16fd4ddcf93c6 100644 --- a/src/hotspot/share/adlc/main.cpp +++ b/src/hotspot/share/adlc/main.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -210,7 +210,6 @@ int main(int argc, char *argv[]) AD.addIncludeGuardStart(AD._HPP_file, "GENERATED_ADFILES_AD_HPP"); // .hpp AD.addIncludeGuardStart(AD._VM_file, "GENERATED_ADFILES_ADGLOBALS_HPP"); // .hpp // Add includes - AD.addInclude(AD._CPP_file, "precompiled.hpp"); AD.addInclude(AD._CPP_file, "adfiles", get_basename(AD._VM_file._name)); AD.addInclude(AD._CPP_file, "adfiles", get_basename(AD._HPP_file._name)); AD.addInclude(AD._CPP_file, "memory/allocation.inline.hpp"); @@ -245,26 +244,18 @@ int main(int argc, char *argv[]) AD.addInclude(AD._HPP_file, "opto/regalloc.hpp"); AD.addInclude(AD._HPP_file, "opto/subnode.hpp"); AD.addInclude(AD._HPP_file, "opto/vectornode.hpp"); - AD.addInclude(AD._CPP_CLONE_file, "precompiled.hpp"); AD.addInclude(AD._CPP_CLONE_file, "adfiles", get_basename(AD._HPP_file._name)); - AD.addInclude(AD._CPP_EXPAND_file, "precompiled.hpp"); AD.addInclude(AD._CPP_EXPAND_file, "adfiles", get_basename(AD._HPP_file._name)); AD.addInclude(AD._CPP_EXPAND_file, "oops/compressedOops.hpp"); - AD.addInclude(AD._CPP_FORMAT_file, "precompiled.hpp"); AD.addInclude(AD._CPP_FORMAT_file, "adfiles", get_basename(AD._HPP_file._name)); AD.addInclude(AD._CPP_FORMAT_file, "compiler/oopMap.hpp"); - AD.addInclude(AD._CPP_GEN_file, "precompiled.hpp"); AD.addInclude(AD._CPP_GEN_file, "adfiles", get_basename(AD._HPP_file._name)); AD.addInclude(AD._CPP_GEN_file, "opto/cfgnode.hpp"); AD.addInclude(AD._CPP_GEN_file, "opto/locknode.hpp"); AD.addInclude(AD._CPP_GEN_file, "opto/rootnode.hpp"); - AD.addInclude(AD._CPP_MISC_file, "precompiled.hpp"); AD.addInclude(AD._CPP_MISC_file, "adfiles", get_basename(AD._HPP_file._name)); - AD.addInclude(AD._CPP_PEEPHOLE_file, "precompiled.hpp"); AD.addInclude(AD._CPP_PEEPHOLE_file, "adfiles", get_basename(AD._HPP_file._name)); - AD.addInclude(AD._CPP_PIPELINE_file, "precompiled.hpp"); AD.addInclude(AD._CPP_PIPELINE_file, "adfiles", get_basename(AD._HPP_file._name)); - AD.addInclude(AD._DFA_file, "precompiled.hpp"); AD.addInclude(AD._DFA_file, "adfiles", get_basename(AD._HPP_file._name)); AD.addInclude(AD._DFA_file, "oops/compressedOops.hpp"); AD.addInclude(AD._DFA_file, "opto/cfgnode.hpp"); // Use PROB_MAX in predicate. diff --git a/src/hotspot/share/asm/assembler.cpp b/src/hotspot/share/asm/assembler.cpp index 4e19effff61ac..d415ddf004a25 100644 --- a/src/hotspot/share/asm/assembler.cpp +++ b/src/hotspot/share/asm/assembler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/codeBuffer.hpp" #include "asm/macroAssembler.hpp" #include "asm/macroAssembler.inline.hpp" diff --git a/src/hotspot/share/asm/codeBuffer.cpp b/src/hotspot/share/asm/codeBuffer.cpp index 4aaf8b6daa248..2aa77abc5f2e7 100644 --- a/src/hotspot/share/asm/codeBuffer.cpp +++ b/src/hotspot/share/asm/codeBuffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/codeBuffer.hpp" #include "code/compiledIC.hpp" #include "code/oopRecorder.inline.hpp" diff --git a/src/hotspot/share/asm/codeBuffer.hpp b/src/hotspot/share/asm/codeBuffer.hpp index 343981e1a7bc5..025aa641d2c8b 100644 --- a/src/hotspot/share/asm/codeBuffer.hpp +++ b/src/hotspot/share/asm/codeBuffer.hpp @@ -607,7 +607,6 @@ class CodeBuffer: public StackObj DEBUG_ONLY(COMMA private Scrubber) { // Properties const char* name() const { return _name; } - void set_name(const char* name) { _name = name; } CodeBuffer* before_expand() const { return _before_expand; } BufferBlob* blob() const { return _blob; } void set_blob(BufferBlob* blob); diff --git a/src/hotspot/share/asm/register.cpp b/src/hotspot/share/asm/register.cpp index 85da369ca2098..c6ea693e4a9f5 100644 --- a/src/hotspot/share/asm/register.cpp +++ b/src/hotspot/share/asm/register.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/register.hpp" diff --git a/src/hotspot/share/c1/c1_CFGPrinter.cpp b/src/hotspot/share/c1/c1_CFGPrinter.cpp index 5e167f5660c39..d178b69923864 100644 --- a/src/hotspot/share/c1/c1_CFGPrinter.cpp +++ b/src/hotspot/share/c1/c1_CFGPrinter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_CFGPrinter.hpp" #include "c1/c1_IR.hpp" #include "c1/c1_InstructionPrinter.hpp" @@ -63,7 +62,7 @@ CFGPrinterOutput::CFGPrinterOutput(Compilation* compilation) _do_print_LIR(false) { char file_name[O_BUFLEN]; - jio_snprintf(file_name, sizeof(file_name), "output_tid" UINTX_FORMAT "_pid%u.cfg", + jio_snprintf(file_name, sizeof(file_name), "output_tid%zu_pid%u.cfg", os::current_thread_id(), os::current_process_id()); _output = new (mtCompiler) fileStream(file_name, "at"); } diff --git a/src/hotspot/share/c1/c1_Canonicalizer.cpp b/src/hotspot/share/c1/c1_Canonicalizer.cpp index 87657038a4ce0..9a8d517822fcc 100644 --- a/src/hotspot/share/c1/c1_Canonicalizer.cpp +++ b/src/hotspot/share/c1/c1_Canonicalizer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_Canonicalizer.hpp" #include "c1/c1_InstructionPrinter.hpp" #include "c1/c1_ValueStack.hpp" diff --git a/src/hotspot/share/c1/c1_Compilation.cpp b/src/hotspot/share/c1/c1_Compilation.cpp index 7e0d439aff4ef..9b80c8a20a852 100644 --- a/src/hotspot/share/c1/c1_Compilation.cpp +++ b/src/hotspot/share/c1/c1_Compilation.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_CFGPrinter.hpp" #include "c1/c1_Compilation.hpp" #include "c1/c1_IR.hpp" diff --git a/src/hotspot/share/c1/c1_Compilation.hpp b/src/hotspot/share/c1/c1_Compilation.hpp index 5f554496f932b..dab584ac3b084 100644 --- a/src/hotspot/share/c1/c1_Compilation.hpp +++ b/src/hotspot/share/c1/c1_Compilation.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,7 @@ #include "code/exceptionHandlerTable.hpp" #include "compiler/compiler_globals.hpp" #include "compiler/compilerDefinitions.inline.hpp" +#include "compiler/compilerDirectives.hpp" #include "runtime/deoptimization.hpp" class CompilationFailureInfo; diff --git a/src/hotspot/share/c1/c1_Compiler.cpp b/src/hotspot/share/c1/c1_Compiler.cpp index a0944c864e68f..a07a92b4419ae 100644 --- a/src/hotspot/share/c1/c1_Compiler.cpp +++ b/src/hotspot/share/c1/c1_Compiler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_Compilation.hpp" #include "c1/c1_Compiler.hpp" #include "c1/c1_FrameMap.hpp" diff --git a/src/hotspot/share/c1/c1_FrameMap.cpp b/src/hotspot/share/c1/c1_FrameMap.cpp index a38e55572d4cd..f42a9f7035b67 100644 --- a/src/hotspot/share/c1/c1_FrameMap.cpp +++ b/src/hotspot/share/c1/c1_FrameMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_FrameMap.hpp" #include "c1/c1_LIR.hpp" #include "code/vmreg.inline.hpp" diff --git a/src/hotspot/share/c1/c1_GraphBuilder.cpp b/src/hotspot/share/c1/c1_GraphBuilder.cpp index 9925c592f6f10..e918aa7d19ae7 100644 --- a/src/hotspot/share/c1/c1_GraphBuilder.cpp +++ b/src/hotspot/share/c1/c1_GraphBuilder.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_CFGPrinter.hpp" #include "c1/c1_Canonicalizer.hpp" #include "c1/c1_Compilation.hpp" diff --git a/src/hotspot/share/c1/c1_IR.cpp b/src/hotspot/share/c1/c1_IR.cpp index b3faa54cc69b8..7f006c0b3ff5d 100644 --- a/src/hotspot/share/c1/c1_IR.cpp +++ b/src/hotspot/share/c1/c1_IR.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_Compilation.hpp" #include "c1/c1_FrameMap.hpp" #include "c1/c1_GraphBuilder.hpp" diff --git a/src/hotspot/share/c1/c1_IR.hpp b/src/hotspot/share/c1/c1_IR.hpp index 9dfcb8419c3f1..a9a7a02639095 100644 --- a/src/hotspot/share/c1/c1_IR.hpp +++ b/src/hotspot/share/c1/c1_IR.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * 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 "c1/c1_Instruction.hpp" #include "ci/ciExceptionHandler.hpp" +#include "ci/ciStreams.hpp" #include "memory/allocation.hpp" // An XHandler is a C1 internal description for an exception handler diff --git a/src/hotspot/share/c1/c1_Instruction.cpp b/src/hotspot/share/c1/c1_Instruction.cpp index 431bcea42cb5b..92affba99b24e 100644 --- a/src/hotspot/share/c1/c1_Instruction.cpp +++ b/src/hotspot/share/c1/c1_Instruction.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_IR.hpp" #include "c1/c1_Instruction.hpp" #include "c1/c1_InstructionPrinter.hpp" diff --git a/src/hotspot/share/c1/c1_InstructionPrinter.cpp b/src/hotspot/share/c1/c1_InstructionPrinter.cpp index 5f865ae518d00..35818188496f8 100644 --- a/src/hotspot/share/c1/c1_InstructionPrinter.cpp +++ b/src/hotspot/share/c1/c1_InstructionPrinter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/vmSymbols.hpp" #include "c1/c1_InstructionPrinter.hpp" #include "c1/c1_ValueStack.hpp" diff --git a/src/hotspot/share/c1/c1_LIR.cpp b/src/hotspot/share/c1/c1_LIR.cpp index 048eb6047ede9..fc90530ec95d8 100644 --- a/src/hotspot/share/c1/c1_LIR.cpp +++ b/src/hotspot/share/c1/c1_LIR.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_CodeStubs.hpp" #include "c1/c1_InstructionPrinter.hpp" #include "c1/c1_LIR.hpp" @@ -452,12 +451,18 @@ void LIR_OpVisitState::visit(LIR_Op* op) { case lir_monaddr: // input and result always valid, info always invalid case lir_null_check: // input and info always valid, result always invalid case lir_move: // input and result always valid, may have info + case lir_sqrt: // FP Ops have no info, but input and result + case lir_abs: + case lir_neg: + case lir_f2hf: + case lir_hf2f: { assert(op->as_Op1() != nullptr, "must be"); LIR_Op1* op1 = (LIR_Op1*)op; if (op1->_info) do_info(op1->_info); if (op1->_opr->is_valid()) do_input(op1->_opr); + if (op1->_tmp->is_valid()) do_temp(op1->_tmp); if (op1->_result->is_valid()) do_output(op1->_result); break; @@ -483,6 +488,7 @@ void LIR_OpVisitState::visit(LIR_Op* op) { assert(op1->_info != nullptr, ""); do_info(op1->_info); if (op1->_opr->is_valid()) do_temp(op1->_opr); // safepoints on SPARC need temporary register + assert(op1->_tmp->is_illegal(), "not used"); assert(op1->_result->is_illegal(), "safepoint does not produce value"); break; @@ -566,11 +572,6 @@ void LIR_OpVisitState::visit(LIR_Op* op) { case lir_add: case lir_sub: case lir_rem: - case lir_sqrt: - case lir_abs: - case lir_neg: - case lir_f2hf: - case lir_hf2f: case lir_logic_and: case lir_logic_or: case lir_logic_xor: @@ -667,6 +668,7 @@ void LIR_OpVisitState::visit(LIR_Op* op) { assert(op1->_info == nullptr, "no info"); assert(op1->_opr->is_valid(), "exception oop"); do_input(op1->_opr); + assert(op1->_tmp->is_illegal(), "not used"); assert(op1->_result->is_illegal(), "no result"); break; @@ -1614,7 +1616,7 @@ void LIR_Address::print_value_on(outputStream* out) const { case times_8: out->print(" * 8"); break; } } - out->print(" Disp: " INTX_FORMAT, _disp); + out->print(" Disp: %zd", _disp); } // debug output of block header without InstructionPrinter @@ -1730,6 +1732,11 @@ const char * LIR_Op::name() const { case lir_cond_float_branch: s = "flt_cond_br"; break; case lir_move: s = "move"; break; case lir_roundfp: s = "roundfp"; break; + case lir_abs: s = "abs"; break; + case lir_neg: s = "neg"; break; + case lir_sqrt: s = "sqrt"; break; + case lir_f2hf: s = "f2hf"; break; + case lir_hf2f: s = "hf2f"; break; case lir_rtcall: s = "rtcall"; break; case lir_throw: s = "throw"; break; case lir_unwind: s = "unwind"; break; @@ -1746,11 +1753,6 @@ const char * LIR_Op::name() const { case lir_mul: s = "mul"; break; case lir_div: s = "div"; break; case lir_rem: s = "rem"; break; - case lir_abs: s = "abs"; break; - case lir_neg: s = "neg"; break; - case lir_sqrt: s = "sqrt"; break; - case lir_f2hf: s = "f2hf"; break; - case lir_hf2f: s = "hf2f"; break; case lir_logic_and: s = "logic_and"; break; case lir_logic_or: s = "logic_or"; break; case lir_logic_xor: s = "logic_xor"; break; diff --git a/src/hotspot/share/c1/c1_LIR.hpp b/src/hotspot/share/c1/c1_LIR.hpp index c568caeca4b30..d9005c49c89d4 100644 --- a/src/hotspot/share/c1/c1_LIR.hpp +++ b/src/hotspot/share/c1/c1_LIR.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -939,6 +939,11 @@ enum LIR_Code { , lir_alloc_object , lir_monaddr , lir_roundfp + , lir_sqrt + , lir_abs + , lir_neg + , lir_f2hf + , lir_hf2f , lir_safepoint , lir_unwind , lir_load_klass @@ -955,13 +960,6 @@ enum LIR_Code { , lir_mul , lir_div , lir_rem - , lir_sqrt - , lir_abs - , lir_neg - , lir_tan - , lir_f2hf - , lir_hf2f - , lir_log10 , lir_logic_and , lir_logic_or , lir_logic_xor @@ -1018,7 +1016,7 @@ enum LIR_Code { , begin_opAssert , lir_assert , end_opAssert -#ifdef INCLUDE_ZGC +#if INCLUDE_ZGC , begin_opXLoadBarrierTest , lir_xloadbarrier_test , end_opXLoadBarrierTest @@ -1357,6 +1355,7 @@ class LIR_Op1: public LIR_Op { protected: LIR_Opr _opr; // input operand + LIR_Opr _tmp; BasicType _type; // Operand types LIR_PatchCode _patch; // only required with patchin (NEEDS_CLEANUP: do we want a special instruction for patching?) @@ -1371,12 +1370,21 @@ class LIR_Op1: public LIR_Op { LIR_Op1(LIR_Code code, LIR_Opr opr, LIR_Opr result = LIR_OprFact::illegalOpr, BasicType type = T_ILLEGAL, LIR_PatchCode patch = lir_patch_none, CodeEmitInfo* info = nullptr) : LIR_Op(code, result, info) , _opr(opr) + , _tmp(LIR_OprFact::illegalOpr) + , _type(type) + , _patch(patch) { assert(is_in_range(code, begin_op1, end_op1), "code check"); } + + LIR_Op1(LIR_Code code, LIR_Opr opr, LIR_Opr result, LIR_Opr tmp, BasicType type = T_ILLEGAL, LIR_PatchCode patch = lir_patch_none, CodeEmitInfo* info = nullptr) + : LIR_Op(code, result, info) + , _opr(opr) + , _tmp(tmp) , _type(type) , _patch(patch) { assert(is_in_range(code, begin_op1, end_op1), "code check"); } LIR_Op1(LIR_Code code, LIR_Opr opr, LIR_Opr result, BasicType type, LIR_PatchCode patch, CodeEmitInfo* info, LIR_MoveKind kind) : LIR_Op(code, result, info) , _opr(opr) + , _tmp(LIR_OprFact::illegalOpr) , _type(type) , _patch(patch) { assert(code == lir_move, "must be"); @@ -1386,10 +1394,12 @@ class LIR_Op1: public LIR_Op { LIR_Op1(LIR_Code code, LIR_Opr opr, CodeEmitInfo* info) : LIR_Op(code, LIR_OprFact::illegalOpr, info) , _opr(opr) + , _tmp(LIR_OprFact::illegalOpr) , _type(T_ILLEGAL) , _patch(lir_patch_none) { assert(is_in_range(code, begin_op1, end_op1), "code check"); } LIR_Opr in_opr() const { return _opr; } + LIR_Opr tmp_opr() const { return _tmp; } LIR_PatchCode patch_code() const { return _patch; } BasicType type() const { return _type; } @@ -1589,8 +1599,6 @@ class LIR_OpTypeCheck: public LIR_Op { class LIR_Op2: public LIR_Op { friend class LIR_OpVisitState; - int _fpu_stack_size; // for sin/cos implementation on Intel - protected: LIR_Opr _opr1; LIR_Opr _opr2; @@ -1607,7 +1615,6 @@ class LIR_Op2: public LIR_Op { public: LIR_Op2(LIR_Code code, LIR_Condition condition, LIR_Opr opr1, LIR_Opr opr2, CodeEmitInfo* info = nullptr, BasicType type = T_ILLEGAL) : LIR_Op(code, LIR_OprFact::illegalOpr, info) - , _fpu_stack_size(0) , _opr1(opr1) , _opr2(opr2) , _tmp1(LIR_OprFact::illegalOpr) @@ -1622,7 +1629,6 @@ class LIR_Op2: public LIR_Op { LIR_Op2(LIR_Code code, LIR_Condition condition, LIR_Opr opr1, LIR_Opr opr2, LIR_Opr result, BasicType type) : LIR_Op(code, result, nullptr) - , _fpu_stack_size(0) , _opr1(opr1) , _opr2(opr2) , _tmp1(LIR_OprFact::illegalOpr) @@ -1639,7 +1645,6 @@ class LIR_Op2: public LIR_Op { LIR_Op2(LIR_Code code, LIR_Opr opr1, LIR_Opr opr2, LIR_Opr result = LIR_OprFact::illegalOpr, CodeEmitInfo* info = nullptr, BasicType type = T_ILLEGAL) : LIR_Op(code, result, info) - , _fpu_stack_size(0) , _opr1(opr1) , _opr2(opr2) , _tmp1(LIR_OprFact::illegalOpr) @@ -1655,7 +1660,6 @@ class LIR_Op2: public LIR_Op { LIR_Op2(LIR_Code code, LIR_Opr opr1, LIR_Opr opr2, LIR_Opr result, LIR_Opr tmp1, LIR_Opr tmp2 = LIR_OprFact::illegalOpr, LIR_Opr tmp3 = LIR_OprFact::illegalOpr, LIR_Opr tmp4 = LIR_OprFact::illegalOpr, LIR_Opr tmp5 = LIR_OprFact::illegalOpr) : LIR_Op(code, result, nullptr) - , _fpu_stack_size(0) , _opr1(opr1) , _opr2(opr2) , _tmp1(tmp1) @@ -1683,9 +1687,6 @@ class LIR_Op2: public LIR_Op { assert(code() == lir_cmp || code() == lir_branch || code() == lir_cond_float_branch, "only valid for branch"); _condition = condition; } - void set_fpu_stack_size(int size) { _fpu_stack_size = size; } - int fpu_stack_size() const { return _fpu_stack_size; } - void set_in_opr1(LIR_Opr opr) { _opr1 = opr; } void set_in_opr2(LIR_Opr opr) { _opr2 = opr; } @@ -2272,15 +2273,13 @@ class LIR_List: public CompilationResourceObj { void cas_int(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value, LIR_Opr t1, LIR_Opr t2, LIR_Opr result = LIR_OprFact::illegalOpr); - void abs (LIR_Opr from, LIR_Opr to, LIR_Opr tmp) { append(new LIR_Op2(lir_abs , from, tmp, to)); } - void negate(LIR_Opr from, LIR_Opr to, LIR_Opr tmp = LIR_OprFact::illegalOpr) { append(new LIR_Op2(lir_neg, from, tmp, to)); } - void sqrt(LIR_Opr from, LIR_Opr to, LIR_Opr tmp) { append(new LIR_Op2(lir_sqrt, from, tmp, to)); } + void abs (LIR_Opr from, LIR_Opr to, LIR_Opr tmp) { append(new LIR_Op1(lir_abs , from, to, tmp)); } + void negate(LIR_Opr from, LIR_Opr to, LIR_Opr tmp = LIR_OprFact::illegalOpr) { append(new LIR_Op1(lir_neg, from, to, tmp)); } + void sqrt(LIR_Opr from, LIR_Opr to, LIR_Opr tmp) { append(new LIR_Op1(lir_sqrt, from, to, tmp)); } void fmad(LIR_Opr from, LIR_Opr from1, LIR_Opr from2, LIR_Opr to) { append(new LIR_Op3(lir_fmad, from, from1, from2, to)); } void fmaf(LIR_Opr from, LIR_Opr from1, LIR_Opr from2, LIR_Opr to) { append(new LIR_Op3(lir_fmaf, from, from1, from2, to)); } - void log10 (LIR_Opr from, LIR_Opr to, LIR_Opr tmp) { append(new LIR_Op2(lir_log10, from, LIR_OprFact::illegalOpr, to, tmp)); } - void tan (LIR_Opr from, LIR_Opr to, LIR_Opr tmp1, LIR_Opr tmp2) { append(new LIR_Op2(lir_tan , from, tmp1, to, tmp2)); } - void f2hf(LIR_Opr from, LIR_Opr to, LIR_Opr tmp) { append(new LIR_Op2(lir_f2hf, from, tmp, to)); } - void hf2f(LIR_Opr from, LIR_Opr to, LIR_Opr tmp) { append(new LIR_Op2(lir_hf2f, from, tmp, to)); } + void f2hf(LIR_Opr from, LIR_Opr to, LIR_Opr tmp) { append(new LIR_Op1(lir_f2hf, from, to, tmp)); } + void hf2f(LIR_Opr from, LIR_Opr to, LIR_Opr tmp) { append(new LIR_Op1(lir_hf2f, from, to, tmp)); } void add (LIR_Opr left, LIR_Opr right, LIR_Opr res) { append(new LIR_Op2(lir_add, left, right, res)); } void sub (LIR_Opr left, LIR_Opr right, LIR_Opr res, CodeEmitInfo* info = nullptr) { append(new LIR_Op2(lir_sub, left, right, res, info)); } diff --git a/src/hotspot/share/c1/c1_LIRAssembler.cpp b/src/hotspot/share/c1/c1_LIRAssembler.cpp index 0fa4b3a4c93d7..a5930ba54d880 100644 --- a/src/hotspot/share/c1/c1_LIRAssembler.cpp +++ b/src/hotspot/share/c1/c1_LIRAssembler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.inline.hpp" #include "c1/c1_Compilation.hpp" #include "c1/c1_Instruction.hpp" @@ -526,6 +525,17 @@ void LIR_Assembler::emit_op1(LIR_Op1* op) { break; } + case lir_abs: + case lir_sqrt: + case lir_f2hf: + case lir_hf2f: + intrinsic_op(op->code(), op->in_opr(), op->tmp_opr(), op->result_opr(), op); + break; + + case lir_neg: + negate(op->in_opr(), op->result_opr(), op->tmp_opr()); + break; + case lir_return: { assert(op->as_OpReturn() != nullptr, "sanity"); LIR_OpReturn *ret_op = (LIR_OpReturn*)op; @@ -723,19 +733,6 @@ void LIR_Assembler::emit_op2(LIR_Op2* op) { op->fpu_pop_count() == 1); break; - case lir_abs: - case lir_sqrt: - case lir_tan: - case lir_log10: - case lir_f2hf: - case lir_hf2f: - intrinsic_op(op->code(), op->in_opr1(), op->in_opr2(), op->result_opr(), op); - break; - - case lir_neg: - negate(op->in_opr1(), op->result_opr(), op->in_opr2()); - break; - case lir_logic_and: case lir_logic_or: case lir_logic_xor: diff --git a/src/hotspot/share/c1/c1_LIRAssembler.hpp b/src/hotspot/share/c1/c1_LIRAssembler.hpp index eb89e3ea24870..34aa679daedd0 100644 --- a/src/hotspot/share/c1/c1_LIRAssembler.hpp +++ b/src/hotspot/share/c1/c1_LIRAssembler.hpp @@ -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 @@ -208,7 +208,7 @@ class LIR_Assembler: public CompilationResourceObj { void arith_op(LIR_Code code, LIR_Opr left, LIR_Opr right, LIR_Opr dest, CodeEmitInfo* info, bool pop_fpu_stack); void arithmetic_idiv(LIR_Code code, LIR_Opr left, LIR_Opr right, LIR_Opr temp, LIR_Opr result, CodeEmitInfo* info); - void intrinsic_op(LIR_Code code, LIR_Opr value, LIR_Opr unused, LIR_Opr dest, LIR_Op* op); + void intrinsic_op(LIR_Code code, LIR_Opr value, LIR_Opr temp, LIR_Opr dest, LIR_Op* op); #ifdef ASSERT void emit_assert(LIR_OpAssert* op); #endif diff --git a/src/hotspot/share/c1/c1_LIRGenerator.cpp b/src/hotspot/share/c1/c1_LIRGenerator.cpp index 74fdf7a5b76a3..930e5e9df1bf7 100644 --- a/src/hotspot/share/c1/c1_LIRGenerator.cpp +++ b/src/hotspot/share/c1/c1_LIRGenerator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_Compilation.hpp" #include "c1/c1_Defs.hpp" #include "c1/c1_FrameMap.hpp" @@ -1337,7 +1336,7 @@ void LIRGenerator::do_getModifiers(Intrinsic* x) { __ cmove(lir_cond_equal, prim_klass, recv_klass, klass, T_ADDRESS); // Get the answer. - __ move(new LIR_Address(klass, in_bytes(Klass::modifier_flags_offset()), T_INT), result); + __ move(new LIR_Address(klass, in_bytes(Klass::modifier_flags_offset()), T_CHAR), result); } void LIRGenerator::do_getObjectSize(Intrinsic* x) { diff --git a/src/hotspot/share/c1/c1_LinearScan.cpp b/src/hotspot/share/c1/c1_LinearScan.cpp index a4d955e52a004..c099bb47d9726 100644 --- a/src/hotspot/share/c1/c1_LinearScan.cpp +++ b/src/hotspot/share/c1/c1_LinearScan.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_CFGPrinter.hpp" #include "c1/c1_CodeStubs.hpp" #include "c1/c1_Compilation.hpp" @@ -6739,7 +6738,6 @@ void LinearScanStatistic::collect(LinearScan* allocator) { case lir_abs: case lir_f2hf: case lir_hf2f: - case lir_log10: case lir_logic_and: case lir_logic_or: case lir_logic_xor: diff --git a/src/hotspot/share/c1/c1_Optimizer.cpp b/src/hotspot/share/c1/c1_Optimizer.cpp index d33e4d28bd0dd..f8339b0004993 100644 --- a/src/hotspot/share/c1/c1_Optimizer.cpp +++ b/src/hotspot/share/c1/c1_Optimizer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_Optimizer.hpp" #include "c1/c1_ValueSet.hpp" #include "c1/c1_ValueStack.hpp" diff --git a/src/hotspot/share/c1/c1_RangeCheckElimination.cpp b/src/hotspot/share/c1/c1_RangeCheckElimination.cpp index a4c2976d26f13..6320fc15efefe 100644 --- a/src/hotspot/share/c1/c1_RangeCheckElimination.cpp +++ b/src/hotspot/share/c1/c1_RangeCheckElimination.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_ValueStack.hpp" #include "c1/c1_RangeCheckElimination.hpp" #include "c1/c1_IR.hpp" diff --git a/src/hotspot/share/c1/c1_Runtime1.cpp b/src/hotspot/share/c1/c1_Runtime1.cpp index 4ef2f8f3b0a80..d1b0818701cc1 100644 --- a/src/hotspot/share/c1/c1_Runtime1.cpp +++ b/src/hotspot/share/c1/c1_Runtime1.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/codeBuffer.hpp" #include "c1/c1_CodeStubs.hpp" #include "c1/c1_Defs.hpp" diff --git a/src/hotspot/share/c1/c1_ValueMap.cpp b/src/hotspot/share/c1/c1_ValueMap.cpp index d9e1e11a3b876..2d7634f6308a5 100644 --- a/src/hotspot/share/c1/c1_ValueMap.cpp +++ b/src/hotspot/share/c1/c1_ValueMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_IR.hpp" #include "c1/c1_ValueMap.hpp" #include "c1/c1_ValueSet.hpp" diff --git a/src/hotspot/share/c1/c1_ValueStack.cpp b/src/hotspot/share/c1/c1_ValueStack.cpp index 41424e36d0784..f1ac940bf162c 100644 --- a/src/hotspot/share/c1/c1_ValueStack.cpp +++ b/src/hotspot/share/c1/c1_ValueStack.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_IR.hpp" #include "c1/c1_InstructionPrinter.hpp" #include "c1/c1_ValueStack.hpp" diff --git a/src/hotspot/share/c1/c1_ValueType.cpp b/src/hotspot/share/c1/c1_ValueType.cpp index d35d8adadfa99..7bfb884e8c804 100644 --- a/src/hotspot/share/c1/c1_ValueType.cpp +++ b/src/hotspot/share/c1/c1_ValueType.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_ValueType.hpp" #include "ci/ciArray.hpp" #include "ci/ciInstance.hpp" diff --git a/src/hotspot/share/cds/aotArtifactFinder.cpp b/src/hotspot/share/cds/aotArtifactFinder.cpp new file mode 100644 index 0000000000000..48f31635c63b9 --- /dev/null +++ b/src/hotspot/share/cds/aotArtifactFinder.cpp @@ -0,0 +1,262 @@ +/* + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * 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 "cds/aotClassLinker.hpp" +#include "cds/aotArtifactFinder.hpp" +#include "cds/aotClassInitializer.hpp" +#include "cds/dumpTimeClassInfo.inline.hpp" +#include "cds/heapShared.hpp" +#include "classfile/systemDictionaryShared.hpp" +#include "logging/log.hpp" +#include "memory/metaspaceClosure.hpp" +#include "oops/instanceKlass.hpp" +#include "oops/objArrayKlass.hpp" +#include "utilities/resourceHash.hpp" + +// All the classes that should be included in the AOT cache (in at least the "allocated" state) +static GrowableArrayCHeap* _all_cached_classes = nullptr; + +// This is a stack that tracks all the AOT-inited classes that are waiting to be passed +// to HeapShared::copy_and_rescan_aot_inited_mirror(). +static GrowableArrayCHeap* _pending_aot_inited_classes = nullptr; + +static const int TABLE_SIZE = 15889; // prime number +using ClassesTable = ResourceHashtable; +static ClassesTable* _seen_classes; // all classes that have been seen by AOTArtifactFinder +static ClassesTable* _aot_inited_classes; // all classes that need to be AOT-initialized. + +void AOTArtifactFinder::initialize() { + _all_cached_classes = new GrowableArrayCHeap(); + _pending_aot_inited_classes = new GrowableArrayCHeap(); + _seen_classes = new (mtClass)ClassesTable(); + _aot_inited_classes = new (mtClass)ClassesTable(); +} + +void AOTArtifactFinder::dispose() { + delete _all_cached_classes; + delete _seen_classes; + delete _aot_inited_classes; + delete _pending_aot_inited_classes; + _all_cached_classes = nullptr; + _seen_classes = nullptr; + _aot_inited_classes = nullptr; + _pending_aot_inited_classes = nullptr; +} + +// Find all Klasses and oops that should be included in the AOT cache. See aotArtifactFinder.hpp +void AOTArtifactFinder::find_artifacts() { + // Some classes might have been marked as excluded as a side effect of running + // AOTConstantPoolResolver. Make sure we check all the remaining ones. + // + // Note, if a class is not excluded, it does NOT mean it will be automatically included + // into the AOT cache -- that will be decided by the code below. + SystemDictionaryShared::finish_exclusion_checks(); + + start_scanning_for_oops(); + + // Add the primitive array classes + for (int i = T_BOOLEAN; i < T_VOID+1; i++) { + BasicType bt = (BasicType)i; + if (is_java_primitive(bt)) { + add_cached_type_array_class(Universe::typeArrayKlass(bt)); + } + } + +#if INCLUDE_CDS_JAVA_HEAP + // Add the mirrors that aren't associated with a Klass + // - primitive mirrors (E.g., "int.class" in Java code) + // - mirror of fillerArrayKlass + if (CDSConfig::is_dumping_heap()) { + for (int i = T_BOOLEAN; i < T_VOID+1; i++) { + BasicType bt = (BasicType)i; + if (!is_reference_type(bt)) { + oop orig_mirror = Universe::java_mirror(bt); + oop scratch_mirror = HeapShared::scratch_java_mirror(bt); + HeapShared::scan_java_mirror(orig_mirror); + log_trace(cds, heap, mirror)( + "Archived %s mirror object from " PTR_FORMAT, + type2name(bt), p2i(scratch_mirror)); + Universe::set_archived_basic_type_mirror_index(bt, HeapShared::append_root(scratch_mirror)); + } + } + + // Universe::fillerArrayKlass() isn't in the class hierarchy, so handle it specially. + HeapShared::scan_java_mirror(Universe::fillerArrayKlass()->java_mirror()); + } +#endif + + // Add all the InstanceKlasses (and their array classes) that are always included. + SystemDictionaryShared::dumptime_table()->iterate_all_live_classes([&] (InstanceKlass* ik, DumpTimeClassInfo& info) { + if (!info.is_excluded()) { + bool add = false; + if (!ik->is_hidden()) { + // All non-hidden classes are always included into the AOT cache + add = true; + } else { + if (!CDSConfig::is_dumping_invokedynamic()) { + // Legacy support of lambda proxies -- these are always included into the AOT cache + if (SystemDictionaryShared::is_registered_lambda_proxy_class(ik)) { + add = true; + } + } else { + assert(!SystemDictionaryShared::is_registered_lambda_proxy_class(ik), + "registered lambda proxies are only for legacy lambda proxy support"); + } + } + + if (add) { + add_cached_instance_class(ik); + if (AOTClassInitializer::can_archive_initialized_mirror(ik)) { + add_aot_inited_class(ik); + } + } + } + }); + +#if INCLUDE_CDS_JAVA_HEAP + // Keep scanning until we discover no more class that need to be AOT-initialized. + if (CDSConfig::is_initing_classes_at_dump_time()) { + while (_pending_aot_inited_classes->length() > 0) { + InstanceKlass* ik = _pending_aot_inited_classes->pop(); + HeapShared::copy_and_rescan_aot_inited_mirror(ik); + } + } +#endif + + // Exclude all the (hidden) classes that have not been discovered by the code above. + SystemDictionaryShared::dumptime_table()->iterate_all_live_classes([&] (InstanceKlass* k, DumpTimeClassInfo& info) { + if (!info.is_excluded() && _seen_classes->get(k) == nullptr) { + info.set_excluded(); + assert(k->is_hidden(), "must be"); + if (log_is_enabled(Info, cds)) { + ResourceMark rm; + log_info(cds)("Skipping %s: Hidden class", k->name()->as_C_string()); + } + } + }); + + end_scanning_for_oops(); +} + +void AOTArtifactFinder::start_scanning_for_oops() { +#if INCLUDE_CDS_JAVA_HEAP + if (CDSConfig::is_dumping_heap()) { + HeapShared::start_scanning_for_oops(); + } +#endif +} + +void AOTArtifactFinder::end_scanning_for_oops() { +#if INCLUDE_CDS_JAVA_HEAP + if (CDSConfig::is_dumping_heap()) { + HeapShared::end_scanning_for_oops(); + } +#endif +} + +void AOTArtifactFinder::add_aot_inited_class(InstanceKlass* ik) { + if (CDSConfig::is_initing_classes_at_dump_time()) { + assert(ik->is_initialized(), "must be"); + add_cached_instance_class(ik); + + bool created; + _aot_inited_classes->put_if_absent(ik, &created); + if (created) { + _pending_aot_inited_classes->push(ik); + + InstanceKlass* s = ik->java_super(); + if (s != nullptr) { + add_aot_inited_class(s); + } + + Array* interfaces = ik->local_interfaces(); + int len = interfaces->length(); + for (int i = 0; i < len; i++) { + InstanceKlass* intf = interfaces->at(i); + if (intf->is_initialized()) { + add_aot_inited_class(intf); + } + } + } + } +} + +void AOTArtifactFinder::add_cached_instance_class(InstanceKlass* ik) { + bool created; + _seen_classes->put_if_absent(ik, &created); + if (created) { + _all_cached_classes->append(ik); + scan_oops_in_instance_class(ik); + if (ik->is_hidden() && CDSConfig::is_initing_classes_at_dump_time()) { + bool succeed = AOTClassLinker::try_add_candidate(ik); + guarantee(succeed, "All cached hidden classes must be aot-linkable"); + add_aot_inited_class(ik); + } + } +} + +void AOTArtifactFinder::add_cached_type_array_class(TypeArrayKlass* tak) { + bool created; + _seen_classes->put_if_absent(tak, &created); + if (created) { + _all_cached_classes->append(tak); + scan_oops_in_array_class(tak); + } +} + +void AOTArtifactFinder::add_cached_class(Klass* k) { + if (k->is_typeArray_klass()) { + add_cached_type_array_class(TypeArrayKlass::cast(k)); + } else if (k->is_objArray_klass()) { + add_cached_class(ObjArrayKlass::cast(k)->element_klass()); + } else { + add_cached_instance_class(InstanceKlass::cast(k)); + } +} + +void AOTArtifactFinder::scan_oops_in_instance_class(InstanceKlass* ik) { +#if INCLUDE_CDS_JAVA_HEAP + if (CDSConfig::is_dumping_heap()) { + HeapShared::scan_java_class(ik); + scan_oops_in_array_class(ik->array_klasses()); + } +#endif +} + +void AOTArtifactFinder::scan_oops_in_array_class(ArrayKlass* ak) { +#if INCLUDE_CDS_JAVA_HEAP + if (CDSConfig::is_dumping_heap()) { + while (ak != nullptr) { + HeapShared::scan_java_class(ak); + ak = ak->array_klass_or_null(); + } + } +#endif +} + +void AOTArtifactFinder::all_cached_classes_do(MetaspaceClosure* it) { + for (int i = 0; i < _all_cached_classes->length(); i++) { + it->push(_all_cached_classes->adr_at(i)); + } +} diff --git a/src/hotspot/share/cds/aotArtifactFinder.hpp b/src/hotspot/share/cds/aotArtifactFinder.hpp new file mode 100644 index 0000000000000..d890d874af9ef --- /dev/null +++ b/src/hotspot/share/cds/aotArtifactFinder.hpp @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef SHARE_CDS_AOTARTIFACTFINDER_HPP +#define SHARE_CDS_AOTARTIFACTFINDER_HPP + +#include "memory/allStatic.hpp" +#include "utilities/exceptions.hpp" + +class ArrayKlass; +class InstanceKlass; +class MetaspaceClosure; +class TypeArrayKlass; + +// AOTArtifactFinder finds (the roots of) all artifacts that should be included in the AOT cache. These include: +// [1] C++ Klasses +// [2] Java heap objects +// It also decides what Klasses must be cached in aot-initialized state. +// +// ArchiveBuilder uses [1] as roots to scan for all MetaspaceObjs that need to be cached. +// ArchiveHeapWriter uses [2] to create an image of the archived heap. +// +// [1] is stored in _all_cached_classes in aotArtifactFinder.cpp. +// [2] is stored in HeapShared::archived_object_cache(). +// +// Although many Klasses and heap objects are created in the assembly phase, we only store a subset of them into +// the AOT cache. For example: +// - Klasses that fail verification are excluded +// - Many Klasses are stored in non-initialized state, so any initialized static fields in their +// java mirrors must be cleared. +// - To conserve space, we exclude any hidden classes that are not referenced. +// +// The discovery of [1] and [2] is interdependent, and is done inside AOTArtifactFinder::find() +// - We first add a set of roots that must be included in the AOT cache +// - mirrors of primitive classes (e.g., int.class in Java source code). +// - primitive array classes +// - non hidden classes +// - registered lambda proxy classes +// - Whenever a class is added, we scan its constant pool. This will discover references +// to hidden classes. All such hidden classes are added. +// - As heap objects (**Note2) and classes are discovered, we find out what classes must +// be AOT-initialized: +// - If we discover at least one instance of class X, then class X is AOT-initialized (** Note1). +// - If AOTClassInitializer::can_archive_initialized_mirror(X) is true, then X is AOT-initialized. +// - For each AOT-initialized class, we scan all the static fields in its java mirror. This will in +// turn discover more Klasses and java heap objects. +// - The scanning continues until we reach a steady state. +// +// Note1: See TODO comments in HeapShared::archive_object() for exceptions to this rule. +// +// Note2: The scanning of Java objects is done in heapShared.cpp. Please see calls into the HeapShared class +// from AOTArtifactFinder. + +class AOTArtifactFinder : AllStatic { + static void start_scanning_for_oops(); + static void end_scanning_for_oops(); + static void scan_oops_in_instance_class(InstanceKlass* ik); + static void scan_oops_in_array_class(ArrayKlass* ak); + static void add_cached_type_array_class(TypeArrayKlass* tak); + static void add_cached_instance_class(InstanceKlass* ik); +public: + static void initialize(); + static void find_artifacts(); + static void add_cached_class(Klass* k); + static void add_aot_inited_class(InstanceKlass* ik); + static void all_cached_classes_do(MetaspaceClosure* it); + static void dispose(); +}; + +#endif // SHARE_CDS_AOTARTIFACTFINDER_HPP diff --git a/src/hotspot/share/cds/aotClassInitializer.cpp b/src/hotspot/share/cds/aotClassInitializer.cpp index b09dfcde6b105..5b022cae24465 100644 --- a/src/hotspot/share/cds/aotClassInitializer.cpp +++ b/src/hotspot/share/cds/aotClassInitializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/aotClassInitializer.hpp" #include "cds/archiveBuilder.hpp" #include "cds/cdsConfig.hpp" @@ -103,25 +102,17 @@ bool AOTClassInitializer::can_archive_initialized_mirror(InstanceKlass* ik) { return false; } - if (ik->is_hidden()) { - return HeapShared::is_archivable_hidden_klass(ik); - } - - if (ik->is_enum_subclass()) { - return true; - } - // About "static field that may hold a different value" errors: // // Automatic selection for aot-inited classes // ========================================== // // When CDSConfig::is_initing_classes_at_dump_time() is enabled, - // HeapShared::find_all_aot_initialized_classes() finds the classes of all + // AOTArtifactFinder::find_artifacts() finds the classes of all // heap objects that are reachable from HeapShared::_run_time_special_subgraph, // and mark these classes as aot-inited. This preserves the initialized // mirrors of these classes, and their methods are NOT executed - // at runtime. + // at runtime. See aotArtifactFinder.hpp for more info. // // For example, with -XX:+AOTInvokeDynamicLinking, _run_time_special_subgraph // will contain some DirectMethodHandle objects. As a result, the DirectMethodHandle @@ -268,9 +259,7 @@ bool AOTClassInitializer::can_archive_initialized_mirror(InstanceKlass* ik) { // everybody's favorite super {"java/lang/Object"}, - // above we selected all enums; we must include their super as well - {"java/lang/Enum"}, - {nullptr} + {nullptr} }; if (is_allowed(specs, ik)) { return true; @@ -356,4 +345,3 @@ void AOTClassInitializer::call_runtime_setup(JavaThread* current, InstanceKlass* } } } - diff --git a/src/hotspot/share/cds/aotClassLinker.cpp b/src/hotspot/share/cds/aotClassLinker.cpp index 8525ce928a817..a1cacd735dd68 100644 --- a/src/hotspot/share/cds/aotClassLinker.cpp +++ b/src/hotspot/share/cds/aotClassLinker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/aotClassLinker.hpp" #include "cds/aotConstantPoolResolver.hpp" #include "cds/aotLinkedClassTable.hpp" @@ -146,9 +145,6 @@ bool AOTClassLinker::try_add_candidate(InstanceKlass* ik) { if (!CDSConfig::is_dumping_invokedynamic()) { return false; } - if (!SystemDictionaryShared::should_hidden_class_be_archived(ik)) { - return false; - } if (HeapShared::is_lambda_proxy_klass(ik)) { InstanceKlass* nest_host = ik->nest_host_not_null(); if (!try_add_candidate(nest_host)) { @@ -316,4 +312,3 @@ const char* AOTClassLinker::class_category_name(AOTLinkedClassCategory category) return "unreg"; } } - diff --git a/src/hotspot/share/cds/aotConstantPoolResolver.cpp b/src/hotspot/share/cds/aotConstantPoolResolver.cpp index 584be7085cef3..15ca2b2c2a0d7 100644 --- a/src/hotspot/share/cds/aotConstantPoolResolver.cpp +++ b/src/hotspot/share/cds/aotConstantPoolResolver.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/aotClassLinker.hpp" #include "cds/aotConstantPoolResolver.hpp" #include "cds/archiveBuilder.hpp" diff --git a/src/hotspot/share/cds/aotLinkedClassBulkLoader.cpp b/src/hotspot/share/cds/aotLinkedClassBulkLoader.cpp index 9bab6042436d5..31d95024e3bfd 100644 --- a/src/hotspot/share/cds/aotLinkedClassBulkLoader.cpp +++ b/src/hotspot/share/cds/aotLinkedClassBulkLoader.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/aotClassInitializer.hpp" #include "cds/aotClassLinker.hpp" #include "cds/aotLinkedClassBulkLoader.hpp" @@ -89,7 +88,7 @@ void AOTLinkedClassBulkLoader::exit_on_exception(JavaThread* current) { ResourceMark rm(current); if (current->pending_exception()->is_a(vmClasses::OutOfMemoryError_klass())) { log_error(cds)("Out of memory. Please run with a larger Java heap, current MaxHeapSize = " - SIZE_FORMAT "M", MaxHeapSize/M); + "%zuM", MaxHeapSize/M); } else { log_error(cds)("%s: %s", current->pending_exception()->klass()->external_name(), java_lang_String::as_utf8_string(java_lang_Throwable::message(current->pending_exception()))); diff --git a/src/hotspot/share/cds/aotLinkedClassTable.cpp b/src/hotspot/share/cds/aotLinkedClassTable.cpp index bed090f00a972..b602c599f542f 100644 --- a/src/hotspot/share/cds/aotLinkedClassTable.cpp +++ b/src/hotspot/share/cds/aotLinkedClassTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/aotLinkedClassTable.hpp" #include "cds/cdsConfig.hpp" #include "cds/serializeClosure.hpp" diff --git a/src/hotspot/share/cds/archiveBuilder.cpp b/src/hotspot/share/cds/archiveBuilder.cpp index 233b333ce6822..afd2d909595f5 100644 --- a/src/hotspot/share/cds/archiveBuilder.cpp +++ b/src/hotspot/share/cds/archiveBuilder.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,7 @@ * */ -#include "precompiled.hpp" +#include "cds/aotArtifactFinder.hpp" #include "cds/aotClassLinker.hpp" #include "cds/aotLinkedClassBulkLoader.hpp" #include "cds/archiveBuilder.hpp" @@ -153,9 +153,7 @@ void ArchiveBuilder::SourceObjList::relocate(int i, ArchiveBuilder* builder) { ArchiveBuilder::ArchiveBuilder() : _current_dump_region(nullptr), _buffer_bottom(nullptr), - _last_verified_top(nullptr), _num_dump_regions_used(0), - _other_region_used_bytes(0), _requested_static_archive_bottom(nullptr), _requested_static_archive_top(nullptr), _requested_dynamic_archive_bottom(nullptr), @@ -172,9 +170,7 @@ ArchiveBuilder::ArchiveBuilder() : _ro_src_objs(), _src_obj_table(INITIAL_TABLE_SIZE, MAX_TABLE_SIZE), _buffered_to_src_table(INITIAL_TABLE_SIZE, MAX_TABLE_SIZE), - _total_heap_region_size(0), - _estimated_metaspaceobj_bytes(0), - _estimated_hashtable_bytes(0) + _total_heap_region_size(0) { _klasses = new (mtClassShared) GrowableArray(4 * K, mtClassShared); _symbols = new (mtClassShared) GrowableArray(256 * K, mtClassShared); @@ -196,6 +192,8 @@ ArchiveBuilder::~ArchiveBuilder() { if (_shared_rs.is_reserved()) { MemoryReserver::release(_shared_rs); } + + AOTArtifactFinder::dispose(); } // Returns a deterministic sequence of pseudo random numbers. The main purpose is NOT @@ -233,13 +231,8 @@ bool ArchiveBuilder::gather_klass_and_symbol(MetaspaceClosure::Ref* ref, bool re _klasses->append(klass); if (klass->is_hidden()) { assert(klass->is_instance_klass(), "must be"); - assert(SystemDictionaryShared::should_hidden_class_be_archived(InstanceKlass::cast(klass)), "must be"); } } - // See RunTimeClassInfo::get_for(): make sure we have enough space for both maximum - // Klass alignment as well as the RuntimeInfo* pointer we will embed in front of a Klass. - _estimated_metaspaceobj_bytes += align_up(BytesPerWord, CompressedKlassPointers::klass_alignment_in_bytes()) + - align_up(sizeof(void*), SharedSpaceObjectAlignment); } else if (ref->msotype() == MetaspaceObj::SymbolType) { // Make sure the symbol won't be GC'ed while we are dumping the archive. Symbol* sym = (Symbol*)ref->obj(); @@ -247,14 +240,15 @@ bool ArchiveBuilder::gather_klass_and_symbol(MetaspaceClosure::Ref* ref, bool re _symbols->append(sym); } - int bytes = ref->size() * BytesPerWord; - _estimated_metaspaceobj_bytes += align_up(bytes, SharedSpaceObjectAlignment); - return true; // recurse } void ArchiveBuilder::gather_klasses_and_symbols() { ResourceMark rm; + + AOTArtifactFinder::initialize(); + AOTArtifactFinder::find_artifacts(); + log_info(cds)("Gathering classes and symbols ... "); GatherKlassesAndSymbols doit(this); iterate_roots(&doit); @@ -288,10 +282,6 @@ void ArchiveBuilder::gather_klasses_and_symbols() { log_info(cds)("Sorting symbols ... "); _symbols->sort(compare_symbols_by_address); sort_klasses(); - - // TODO -- we need a proper estimate for the archived modules, etc, - // but this should be enough for now - _estimated_metaspaceobj_bytes += 200 * 1024 * 1024; } AOTClassLinker::add_candidates(); @@ -315,59 +305,26 @@ void ArchiveBuilder::sort_klasses() { _klasses->sort(compare_klass_by_name); } -size_t ArchiveBuilder::estimate_archive_size() { - // size of the symbol table and two dictionaries, plus the RunTimeClassInfo's - size_t symbol_table_est = SymbolTable::estimate_size_for_archive(); - size_t dictionary_est = SystemDictionaryShared::estimate_size_for_archive(); - _estimated_hashtable_bytes = symbol_table_est + dictionary_est; - - if (CDSConfig::is_dumping_aot_linked_classes()) { - // This is difficult to estimate when dumping the dynamic archive, as the - // AOTLinkedClassTable may need to contain classes in the static archive as well. - // - // Just give a generous estimate for now. We will remove estimate_archive_size() - // in JDK-8340416 - _estimated_hashtable_bytes += 20 * 1024 * 1024; - } - - size_t total = 0; - - total += _estimated_metaspaceobj_bytes; - total += _estimated_hashtable_bytes; - - // allow fragmentation at the end of each dump region - total += _total_dump_regions * MetaspaceShared::core_region_alignment(); - - log_info(cds)("_estimated_hashtable_bytes = " SIZE_FORMAT " + " SIZE_FORMAT " = " SIZE_FORMAT, - symbol_table_est, dictionary_est, _estimated_hashtable_bytes); - log_info(cds)("_estimated_metaspaceobj_bytes = " SIZE_FORMAT, _estimated_metaspaceobj_bytes); - log_info(cds)("total estimate bytes = " SIZE_FORMAT, total); - - return align_up(total, MetaspaceShared::core_region_alignment()); -} - address ArchiveBuilder::reserve_buffer() { - size_t buffer_size = estimate_archive_size(); + size_t buffer_size = LP64_ONLY(CompressedClassSpaceSize) NOT_LP64(256 * M); ReservedSpace rs = MemoryReserver::reserve(buffer_size, MetaspaceShared::core_region_alignment(), os::vm_page_size()); if (!rs.is_reserved()) { - log_error(cds)("Failed to reserve " SIZE_FORMAT " bytes of output buffer.", buffer_size); + log_error(cds)("Failed to reserve %zu bytes of output buffer.", buffer_size); MetaspaceShared::unrecoverable_writing_error(); } // buffer_bottom is the lowest address of the 2 core regions (rw, ro) when // we are copying the class metadata into the buffer. address buffer_bottom = (address)rs.base(); - log_info(cds)("Reserved output buffer space at " PTR_FORMAT " [" SIZE_FORMAT " bytes]", + log_info(cds)("Reserved output buffer space at " PTR_FORMAT " [%zu bytes]", p2i(buffer_bottom), buffer_size); _shared_rs = rs; _buffer_bottom = buffer_bottom; - _last_verified_top = buffer_bottom; _current_dump_region = &_rw_region; _num_dump_regions_used = 1; - _other_region_used_bytes = 0; _current_dump_region->init(&_shared_rs, &_shared_vs); ArchivePtrMarker::initialize(&_ptrmap, &_shared_vs); @@ -586,28 +543,9 @@ ArchiveBuilder::FollowMode ArchiveBuilder::get_follow_mode(MetaspaceClosure::Ref } void ArchiveBuilder::start_dump_region(DumpRegion* next) { - address bottom = _last_verified_top; - address top = (address)(current_dump_region()->top()); - _other_region_used_bytes += size_t(top - bottom); - current_dump_region()->pack(next); _current_dump_region = next; _num_dump_regions_used ++; - - _last_verified_top = (address)(current_dump_region()->top()); -} - -void ArchiveBuilder::verify_estimate_size(size_t estimate, const char* which) { - address bottom = _last_verified_top; - address top = (address)(current_dump_region()->top()); - size_t used = size_t(top - bottom) + _other_region_used_bytes; - int diff = int(estimate) - int(used); - - log_info(cds)("%s estimate = " SIZE_FORMAT " used = " SIZE_FORMAT "; diff = %d bytes", which, estimate, used, diff); - assert(diff >= 0, "Estimate is too small"); - - _last_verified_top = top; - _other_region_used_bytes = 0; } char* ArchiveBuilder::ro_strdup(const char* s) { @@ -1245,7 +1183,7 @@ class ArchiveBuilder::CDSMapLogger : AllStatic { log_as_hex(last_obj_base, last_obj_end, last_obj_base + buffer_to_runtime_delta()); if (last_obj_end < region_end) { - log_debug(cds, map)(PTR_FORMAT ": @@ Misc data " SIZE_FORMAT " bytes", + log_debug(cds, map)(PTR_FORMAT ": @@ Misc data %zu bytes", p2i(last_obj_end + buffer_to_runtime_delta()), size_t(region_end - last_obj_end)); log_as_hex(last_obj_end, region_end, last_obj_end + buffer_to_runtime_delta()); @@ -1265,7 +1203,7 @@ class ArchiveBuilder::CDSMapLogger : AllStatic { size_t size = top - base; base = requested_base; top = requested_base + size; - log_info(cds, map)("[%-18s " PTR_FORMAT " - " PTR_FORMAT " " SIZE_FORMAT_W(9) " bytes]", + log_info(cds, map)("[%-18s " PTR_FORMAT " - " PTR_FORMAT " %9zu bytes]", name, p2i(base), p2i(top), size); } @@ -1306,7 +1244,7 @@ class ArchiveBuilder::CDSMapLogger : AllStatic { // We have a filler oop, which also does not exist in BufferOffsetToSourceObjectTable. // Example: // 0x00000007ffc3ffd8: @@ Object filler 40 bytes - st.print_cr("filler " SIZE_FORMAT " bytes", byte_size); + st.print_cr("filler %zu bytes", byte_size); } else { ShouldNotReachHere(); } @@ -1409,7 +1347,7 @@ class ArchiveBuilder::CDSMapLogger : AllStatic { print_oop_info_cr(&st, obj); } } else { - st.print_cr(" - fields (" SIZE_FORMAT " words):", source_oop->size()); + st.print_cr(" - fields (%zu words):", source_oop->size()); ArchivedFieldPrinter print_field(heap_info, &st, source_oop, buffered_addr); InstanceKlass::cast(source_klass)->print_nonstatic_fields(&print_field); @@ -1634,12 +1572,12 @@ void ArchiveBuilder::print_region_stats(FileMapInfo *mapinfo, ArchiveHeapInfo* h print_heap_region_stats(heap_info, total_reserved); } - log_debug(cds)("total : " SIZE_FORMAT_W(9) " [100.0%% of total] out of " SIZE_FORMAT_W(9) " bytes [%5.1f%% used]", + log_debug(cds)("total : %9zu [100.0%% of total] out of %9zu bytes [%5.1f%% used]", total_bytes, total_reserved, total_u_perc); } void ArchiveBuilder::print_bitmap_region_stats(size_t size, size_t total_size) { - log_debug(cds)("bm space: " SIZE_FORMAT_W(9) " [ %4.1f%% of total] out of " SIZE_FORMAT_W(9) " bytes [100.0%% used]", + log_debug(cds)("bm space: %9zu [ %4.1f%% of total] out of %9zu bytes [100.0%% used]", size, size/double(total_size)*100.0, size); } @@ -1647,7 +1585,7 @@ void ArchiveBuilder::print_heap_region_stats(ArchiveHeapInfo *info, size_t total char* start = info->buffer_start(); size_t size = info->buffer_byte_size(); char* top = start + size; - log_debug(cds)("hp space: " SIZE_FORMAT_W(9) " [ %4.1f%% of total] out of " SIZE_FORMAT_W(9) " bytes [100.0%% used] at " INTPTR_FORMAT, + log_debug(cds)("hp space: %9zu [ %4.1f%% of total] out of %9zu bytes [100.0%% used] at " INTPTR_FORMAT, size, size/double(total_size)*100.0, size, p2i(start)); } diff --git a/src/hotspot/share/cds/archiveBuilder.hpp b/src/hotspot/share/cds/archiveBuilder.hpp index 0c5262321d086..e3efedd46f14c 100644 --- a/src/hotspot/share/cds/archiveBuilder.hpp +++ b/src/hotspot/share/cds/archiveBuilder.hpp @@ -96,9 +96,7 @@ class ArchiveBuilder : public StackObj { protected: DumpRegion* _current_dump_region; address _buffer_bottom; // for writing the contents of rw/ro regions - address _last_verified_top; int _num_dump_regions_used; - size_t _other_region_used_bytes; // These are the addresses where we will request the static and dynamic archives to be // mapped at run time. If the request fails (due to ASLR), we will map the archives at @@ -273,16 +271,9 @@ class ArchiveBuilder : public StackObj { protected: virtual void iterate_roots(MetaspaceClosure* it) = 0; - // Conservative estimate for number of bytes needed for: - size_t _estimated_metaspaceobj_bytes; // all archived MetaspaceObj's. - size_t _estimated_hashtable_bytes; // symbol table and dictionaries - static const int _total_dump_regions = 2; - size_t estimate_archive_size(); - void start_dump_region(DumpRegion* next); - void verify_estimate_size(size_t estimate, const char* which); public: address reserve_buffer(); diff --git a/src/hotspot/share/cds/archiveHeapLoader.cpp b/src/hotspot/share/cds/archiveHeapLoader.cpp index b05fd20f4f59f..68015e319c3f8 100644 --- a/src/hotspot/share/cds/archiveHeapLoader.cpp +++ b/src/hotspot/share/cds/archiveHeapLoader.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/archiveHeapLoader.inline.hpp" #include "cds/cdsConfig.hpp" #include "cds/heapShared.hpp" @@ -308,7 +307,7 @@ bool ArchiveHeapLoader::load_heap_region_impl(FileMapInfo* mapinfo, LoadedArchiv } assert(r->mapped_base() == (char*)load_address, "sanity"); log_info(cds)("Loaded heap region #%d at base " INTPTR_FORMAT " top " INTPTR_FORMAT - " size " SIZE_FORMAT_W(6) " delta " INTX_FORMAT, + " size %6zu delta %zd", loaded_region->_region_index, load_address, load_address + loaded_region->_region_size, loaded_region->_region_size, loaded_region->_runtime_offset); diff --git a/src/hotspot/share/cds/archiveHeapWriter.cpp b/src/hotspot/share/cds/archiveHeapWriter.cpp index be821044a96ba..c71d99984e0ab 100644 --- a/src/hotspot/share/cds/archiveHeapWriter.cpp +++ b/src/hotspot/share/cds/archiveHeapWriter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * 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,12 +22,12 @@ * */ -#include "precompiled.hpp" #include "cds/archiveHeapWriter.hpp" #include "cds/cdsConfig.hpp" #include "cds/filemap.hpp" #include "cds/heapShared.hpp" #include "classfile/javaClasses.hpp" +#include "classfile/modules.hpp" #include "classfile/systemDictionary.hpp" #include "gc/shared/collectedHeap.hpp" #include "memory/iterator.inline.hpp" @@ -217,7 +217,7 @@ void ArchiveHeapWriter::copy_roots_to_buffer(GrowableArrayCHeapat(root_index++)); } - log_info(cds, heap)("archived obj root segment [%d] = " SIZE_FORMAT " bytes, obj = " PTR_FORMAT, + log_info(cds, heap)("archived obj root segment [%d] = %zu bytes, obj = " PTR_FORMAT, size_elems, size_bytes, p2i(seg_oop)); } @@ -323,9 +323,13 @@ void ArchiveHeapWriter::copy_source_objs_to_buffer(GrowableArrayCHeapput_when_absent(buffer_offset, src_obj); _buffer_offset_to_source_obj_table->maybe_grow(); + + if (java_lang_Module::is_instance(src_obj)) { + Modules::check_archived_module_oop(src_obj); + } } - log_info(cds)("Size of heap region = " SIZE_FORMAT " bytes, %d objects, %d roots, %d native ptrs", + log_info(cds)("Size of heap region = %zu bytes, %d objects, %d roots, %d native ptrs", _buffer_used, _source_objs->length() + 1, roots->length(), _num_native_ptrs); } @@ -391,7 +395,7 @@ void ArchiveHeapWriter::maybe_fill_gc_region_gap(size_t required_byte_size) { ensure_buffer_space(filler_end); int array_length = filler_array_length(fill_bytes); - log_info(cds, heap)("Inserting filler obj array of %d elements (" SIZE_FORMAT " bytes total) @ buffer offset " SIZE_FORMAT, + log_info(cds, heap)("Inserting filler obj array of %d elements (%zu bytes total) @ buffer offset %zu", array_length, fill_bytes, _buffer_used); HeapWord* filler = init_filler_array_at_buffer_top(array_length, fill_bytes); _buffer_used = filler_end; @@ -622,7 +626,7 @@ static void log_bitmap_usage(const char* which, BitMap* bitmap, size_t total_bit // The whole heap is covered by total_bits, but there are only non-zero bits within [start ... end). size_t start = bitmap->find_first_set_bit(0); size_t end = bitmap->size(); - log_info(cds)("%s = " SIZE_FORMAT_W(7) " ... " SIZE_FORMAT_W(7) " (%3zu%% ... %3zu%% = %3zu%%)", which, + log_info(cds)("%s = %7zu ... %7zu (%3zu%% ... %3zu%% = %3zu%%)", which, start, end, start * 100 / total_bits, end * 100 / total_bits, @@ -749,7 +753,7 @@ void ArchiveHeapWriter::compute_ptrmap(ArchiveHeapInfo* heap_info) { } heap_info->ptrmap()->resize(max_idx + 1); - log_info(cds, heap)("calculate_ptrmap: marked %d non-null native pointers for heap region (" SIZE_FORMAT " bits)", + log_info(cds, heap)("calculate_ptrmap: marked %d non-null native pointers for heap region (%zu bits)", num_non_null_ptrs, size_t(heap_info->ptrmap()->size())); } diff --git a/src/hotspot/share/cds/archiveHeapWriter.hpp b/src/hotspot/share/cds/archiveHeapWriter.hpp index 70c1207bb91f7..1e1319cccc34a 100644 --- a/src/hotspot/share/cds/archiveHeapWriter.hpp +++ b/src/hotspot/share/cds/archiveHeapWriter.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -72,8 +72,9 @@ class ArchiveHeapWriter : AllStatic { // - "source objects" are regular Java objects allocated during the execution // of "java -Xshare:dump". They can be used as regular oops. // - // HeapShared::archive_objects() recursively searches for the oops that need to be - // stored into the CDS archive. These are entered into HeapShared::archived_object_cache(). + // Between HeapShared::start_scanning_for_oops() and HeapShared::end_scanning_for_oops(), + // we recursively search for the oops that need to be stored into the CDS archive. + // These are entered into HeapShared::archived_object_cache(). // // - "buffered objects" are copies of the "source objects", and are stored in into // ArchiveHeapWriter::_buffer, which is a GrowableArray that sits outside of diff --git a/src/hotspot/share/cds/archiveUtils.cpp b/src/hotspot/share/cds/archiveUtils.cpp index 3530fcff2b3f9..90eefd13d469a 100644 --- a/src/hotspot/share/cds/archiveUtils.cpp +++ b/src/hotspot/share/cds/archiveUtils.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/archiveBuilder.hpp" #include "cds/archiveHeapLoader.inline.hpp" #include "cds/archiveUtils.hpp" @@ -124,7 +123,7 @@ void ArchivePtrMarker::mark_pointer(address* ptr_loc) { } assert(idx < _ptrmap->size(), "must be"); _ptrmap->set_bit(idx); - //tty->print_cr("Marking pointer [" PTR_FORMAT "] -> " PTR_FORMAT " @ " SIZE_FORMAT_W(5), p2i(ptr_loc), p2i(*ptr_loc), idx); + //tty->print_cr("Marking pointer [" PTR_FORMAT "] -> " PTR_FORMAT " @ %5zu", p2i(ptr_loc), p2i(*ptr_loc), idx); } } } @@ -138,7 +137,7 @@ void ArchivePtrMarker::clear_pointer(address* ptr_loc) { size_t idx = ptr_loc - ptr_base(); assert(idx < _ptrmap->size(), "cannot clear pointers that have not been marked"); _ptrmap->clear_bit(idx); - //tty->print_cr("Clearing pointer [" PTR_FORMAT "] -> " PTR_FORMAT " @ " SIZE_FORMAT_W(5), p2i(ptr_loc), p2i(*ptr_loc), idx); + //tty->print_cr("Clearing pointer [" PTR_FORMAT "] -> " PTR_FORMAT " @ %5zu", p2i(ptr_loc), p2i(*ptr_loc), idx); } class ArchivePtrBitmapCleaner: public BitMapClosure { @@ -163,7 +162,7 @@ class ArchivePtrBitmapCleaner: public BitMapClosure { } } else { _ptrmap->clear_bit(offset); - DEBUG_ONLY(log_trace(cds, reloc)("Clearing pointer [" PTR_FORMAT "] -> null @ " SIZE_FORMAT_W(9), p2i(ptr_loc), offset)); + DEBUG_ONLY(log_trace(cds, reloc)("Clearing pointer [" PTR_FORMAT "] -> null @ %9zu", p2i(ptr_loc), offset)); } return true; @@ -228,7 +227,7 @@ void DumpRegion::commit_to(char* newtop) { assert(commit <= uncommitted, "sanity"); if (!_vs->expand_by(commit, false)) { - log_error(cds)("Failed to expand shared space to " SIZE_FORMAT " bytes", + log_error(cds)("Failed to expand shared space to %zu bytes", need_committed_size); MetaspaceShared::unrecoverable_writing_error(); } @@ -239,7 +238,7 @@ void DumpRegion::commit_to(char* newtop) { } else { which = "shared"; } - log_debug(cds)("Expanding %s spaces by " SIZE_FORMAT_W(7) " bytes [total " SIZE_FORMAT_W(9) " bytes ending at %p]", + log_debug(cds)("Expanding %s spaces by %7zu bytes [total %9zu bytes ending at %p]", which, commit, _vs->actual_committed_size(), _vs->high()); } @@ -265,7 +264,7 @@ void DumpRegion::append_intptr_t(intptr_t n, bool need_to_mark) { } void DumpRegion::print(size_t total_bytes) const { - log_debug(cds)("%s space: " SIZE_FORMAT_W(9) " [ %4.1f%% of total] out of " SIZE_FORMAT_W(9) " bytes [%5.1f%% used] at " INTPTR_FORMAT, + log_debug(cds)("%s space: %9zu [ %4.1f%% of total] out of %9zu bytes [%5.1f%% used] at " INTPTR_FORMAT, _name, used(), percent_of(used(), total_bytes), reserved(), percent_of(used(), reserved()), p2i(ArchiveBuilder::current()->to_requested(_base))); } diff --git a/src/hotspot/share/cds/cdsConfig.cpp b/src/hotspot/share/cds/cdsConfig.cpp index 6ab77bf000746..a86995adb2ded 100644 --- a/src/hotspot/share/cds/cdsConfig.cpp +++ b/src/hotspot/share/cds/cdsConfig.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/archiveHeapLoader.hpp" #include "cds/cdsConfig.hpp" #include "cds/classListWriter.hpp" diff --git a/src/hotspot/share/cds/cdsConstants.cpp b/src/hotspot/share/cds/cdsConstants.cpp index 6dbacb2774f12..364f6d74c43e5 100644 --- a/src/hotspot/share/cds/cdsConstants.cpp +++ b/src/hotspot/share/cds/cdsConstants.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/cdsConstants.hpp" #include "cds/dynamicArchive.hpp" #include "cds/filemap.hpp" diff --git a/src/hotspot/share/cds/cdsEnumKlass.cpp b/src/hotspot/share/cds/cdsEnumKlass.cpp index 17438428c8092..ffce9fb269a89 100644 --- a/src/hotspot/share/cds/cdsEnumKlass.cpp +++ b/src/hotspot/share/cds/cdsEnumKlass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/archiveHeapLoader.hpp" #include "cds/cdsEnumKlass.hpp" #include "cds/heapShared.hpp" @@ -37,7 +36,6 @@ bool CDSEnumKlass::is_enum_obj(oop orig_obj) { Klass* k = orig_obj->klass(); - Klass* buffered_k = ArchiveBuilder::get_buffered_klass(k); return k->is_instance_klass() && InstanceKlass::cast(k)->is_enum_subclass(); } @@ -73,7 +71,6 @@ void CDSEnumKlass::handle_enum_obj(int level, } ik->set_has_archived_enum_objs(); - ArchiveBuilder::get_buffered_klass(ik)->set_has_archived_enum_objs(); oop mirror = ik->java_mirror(); for (JavaFieldStream fs(ik); !fs.done(); fs.next()) { diff --git a/src/hotspot/share/cds/cdsHeapVerifier.cpp b/src/hotspot/share/cds/cdsHeapVerifier.cpp index fbc58e503ca36..f9e613a74cee8 100644 --- a/src/hotspot/share/cds/cdsHeapVerifier.cpp +++ b/src/hotspot/share/cds/cdsHeapVerifier.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/aotClassInitializer.hpp" #include "cds/archiveBuilder.hpp" #include "cds/cdsHeapVerifier.hpp" @@ -258,20 +257,19 @@ void CDSHeapVerifier::add_static_obj_field(InstanceKlass* ik, oop field, Symbol* _table.put(field, info); } +// This function is called once for every archived heap object. Warn if this object is referenced by +// a static field of a class that's not aot-initialized. inline bool CDSHeapVerifier::do_entry(oop& orig_obj, HeapShared::CachedOopInfo& value) { _archived_objs++; + if (java_lang_String::is_instance(orig_obj) && HeapShared::is_dumped_interned_string(orig_obj)) { + // It's quite often for static fields to have interned strings. These are most likely not + // problematic (and are hard to filter). So we will ignore them. + return true; /* keep on iterating */ + } + StaticFieldInfo* info = _table.get(orig_obj); if (info != nullptr) { - if (value.orig_referrer() == nullptr && java_lang_String::is_instance(orig_obj)) { - // This string object is not referenced by any of the archived object graphs. It's archived - // only because it's in the interned string table. So we are not in a condition that - // should be flagged by CDSHeapVerifier. - return true; /* keep on iterating */ - } - if (info->_holder->is_hidden()) { - return true; - } ResourceMark rm; char* class_name = info->_holder->name()->as_C_string(); char* field_name = info->_name->as_C_string(); diff --git a/src/hotspot/share/cds/cdsProtectionDomain.cpp b/src/hotspot/share/cds/cdsProtectionDomain.cpp index 2eb47ff2788d9..49152753a831d 100644 --- a/src/hotspot/share/cds/cdsProtectionDomain.cpp +++ b/src/hotspot/share/cds/cdsProtectionDomain.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/cdsConfig.hpp" #include "cds/cdsProtectionDomain.hpp" #include "classfile/classLoader.hpp" diff --git a/src/hotspot/share/cds/classListParser.cpp b/src/hotspot/share/cds/classListParser.cpp index 47925f578ea1f..ed2a3c61b9c4b 100644 --- a/src/hotspot/share/cds/classListParser.cpp +++ b/src/hotspot/share/cds/classListParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/aotConstantPoolResolver.hpp" #include "cds/archiveUtils.hpp" #include "cds/classListParser.hpp" diff --git a/src/hotspot/share/cds/classListWriter.cpp b/src/hotspot/share/cds/classListWriter.cpp index 78a6857ff73a7..2a3513c45f5f4 100644 --- a/src/hotspot/share/cds/classListWriter.cpp +++ b/src/hotspot/share/cds/classListWriter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/cds_globals.hpp" #include "cds/classListWriter.hpp" #include "cds/lambdaFormInvokers.inline.hpp" diff --git a/src/hotspot/share/cds/cppVtables.cpp b/src/hotspot/share/cds/cppVtables.cpp index 3de858d32997a..155bc08dc2de6 100644 --- a/src/hotspot/share/cds/cppVtables.cpp +++ b/src/hotspot/share/cds/cppVtables.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/archiveUtils.hpp" #include "cds/archiveBuilder.hpp" #include "cds/cdsConfig.hpp" diff --git a/src/hotspot/share/cds/dumpAllocStats.cpp b/src/hotspot/share/cds/dumpAllocStats.cpp index e88a77de7adb7..5587ac2fac82a 100644 --- a/src/hotspot/share/cds/dumpAllocStats.cpp +++ b/src/hotspot/share/cds/dumpAllocStats.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/aotClassLinker.hpp" #include "cds/dumpAllocStats.hpp" #include "logging/log.hpp" diff --git a/src/hotspot/share/cds/dumpTimeClassInfo.cpp b/src/hotspot/share/cds/dumpTimeClassInfo.cpp index 6ee18c17a57da..18136d6eeec66 100644 --- a/src/hotspot/share/cds/dumpTimeClassInfo.cpp +++ b/src/hotspot/share/cds/dumpTimeClassInfo.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/archiveBuilder.hpp" #include "cds/dumpTimeClassInfo.inline.hpp" #include "cds/runTimeClassInfo.hpp" diff --git a/src/hotspot/share/cds/dumpTimeClassInfo.hpp b/src/hotspot/share/cds/dumpTimeClassInfo.hpp index c060601f1fb01..79ede224bb6e7 100644 --- a/src/hotspot/share/cds/dumpTimeClassInfo.hpp +++ b/src/hotspot/share/cds/dumpTimeClassInfo.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * 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,8 +42,6 @@ class DumpTimeClassInfo: public CHeapObj { bool _excluded; bool _is_early_klass; bool _has_checked_exclusion; - bool _is_required_hidden_class; - bool _has_scanned_constant_pool; class DTLoaderConstraint { Symbol* _name; char _loader_type1; @@ -123,7 +121,7 @@ class DumpTimeClassInfo: public CHeapObj { InstanceKlass* _klass; InstanceKlass* _nest_host; bool _failed_verification; - bool _is_archived_lambda_proxy; + bool _is_registered_lambda_proxy; int _id; int _clsfile_size; int _clsfile_crc32; @@ -136,10 +134,8 @@ class DumpTimeClassInfo: public CHeapObj { _klass = nullptr; _nest_host = nullptr; _failed_verification = false; - _is_archived_lambda_proxy = false; + _is_registered_lambda_proxy = false; _has_checked_exclusion = false; - _is_required_hidden_class = false; - _has_scanned_constant_pool = false; _id = -1; _clsfile_size = -1; _clsfile_crc32 = -1; @@ -217,11 +213,6 @@ class DumpTimeClassInfo: public CHeapObj { InstanceKlass* nest_host() const { return _nest_host; } void set_nest_host(InstanceKlass* nest_host) { _nest_host = nest_host; } - bool is_required_hidden_class() const { return _is_required_hidden_class; } - void set_is_required_hidden_class() { _is_required_hidden_class = true; } - bool has_scanned_constant_pool() const { return _has_scanned_constant_pool; } - void set_has_scanned_constant_pool() { _has_scanned_constant_pool = true; } - size_t runtime_info_bytesize() const; }; diff --git a/src/hotspot/share/cds/dynamicArchive.cpp b/src/hotspot/share/cds/dynamicArchive.cpp index f102282f68201..acdb330d91bcc 100644 --- a/src/hotspot/share/cds/dynamicArchive.cpp +++ b/src/hotspot/share/cds/dynamicArchive.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,7 @@ * */ -#include "precompiled.hpp" +#include "cds/aotArtifactFinder.hpp" #include "cds/aotClassLinker.hpp" #include "cds/archiveBuilder.hpp" #include "cds/archiveHeapWriter.hpp" @@ -112,7 +112,6 @@ class DynamicArchiveBuilder : public ArchiveBuilder { // Block concurrent class unloading from changing the _dumptime_table MutexLocker ml(DumpTimeTable_lock, Mutex::_no_safepoint_check_flag); - SystemDictionaryShared::find_all_archivable_classes(); if (SystemDictionaryShared::is_dumptime_table_empty()) { log_warning(cds, dynamic)("There is no class to be included in the dynamic archive."); @@ -133,8 +132,6 @@ class DynamicArchiveBuilder : public ArchiveBuilder { dump_ro_metadata(); relocate_metaspaceobj_embedded_pointers(); - verify_estimate_size(_estimated_metaspaceobj_bytes, "MetaspaceObjs"); - sort_methods(); log_info(cds)("Make classes shareable"); @@ -159,8 +156,6 @@ class DynamicArchiveBuilder : public ArchiveBuilder { ArchiveBuilder::serialize_dynamic_archivable_items(&wc); } - verify_estimate_size(_estimated_hashtable_bytes, "Hashtables"); - log_info(cds)("Adjust lambda proxy class dictionary"); SystemDictionaryShared::adjust_lambda_proxy_class_dictionary(); @@ -178,6 +173,7 @@ class DynamicArchiveBuilder : public ArchiveBuilder { virtual void iterate_roots(MetaspaceClosure* it) { FileMapInfo::metaspace_pointers_do(it); + AOTArtifactFinder::all_cached_classes_do(it); SystemDictionaryShared::dumptime_classes_do(it); iterate_primitive_array_klasses(it); } @@ -355,7 +351,7 @@ void DynamicArchiveBuilder::write_archive(char* serialized_data) { size_t file_size = pointer_delta(top, base, sizeof(char)); log_info(cds, dynamic)("Written dynamic archive " PTR_FORMAT " - " PTR_FORMAT - " [" UINT32_FORMAT " bytes header, " SIZE_FORMAT " bytes total]", + " [" UINT32_FORMAT " bytes header, %zu bytes total]", p2i(base), p2i(top), _header->header_size(), file_size); log_info(cds, dynamic)("%d klasses; %d symbols", klasses()->length(), symbols()->length()); @@ -509,12 +505,9 @@ void DynamicArchive::dump_at_exit(JavaThread* current, const char* archive_name) JavaThread* THREAD = current; // For TRAPS processing related to link_shared_classes MetaspaceShared::link_shared_classes(false/*not from jcmd*/, THREAD); if (!HAS_PENDING_EXCEPTION) { - // copy shared path table to saved. - if (!HAS_PENDING_EXCEPTION) { - VM_PopulateDynamicDumpSharedSpace op(archive_name); - VMThread::execute(&op); - return; - } + VM_PopulateDynamicDumpSharedSpace op(archive_name); + VMThread::execute(&op); + return; } // One of the prepatory steps failed diff --git a/src/hotspot/share/cds/filemap.cpp b/src/hotspot/share/cds/filemap.cpp index c87081d9d14e6..e82313bb84d92 100644 --- a/src/hotspot/share/cds/filemap.cpp +++ b/src/hotspot/share/cds/filemap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/archiveBuilder.hpp" #include "cds/archiveHeapLoader.inline.hpp" #include "cds/archiveHeapWriter.hpp" @@ -279,23 +278,23 @@ void FileMapHeader::print(outputStream* st) { } st->print_cr("============ end regions ======== "); - st->print_cr("- core_region_alignment: " SIZE_FORMAT, _core_region_alignment); + st->print_cr("- core_region_alignment: %zu", _core_region_alignment); st->print_cr("- obj_alignment: %d", _obj_alignment); st->print_cr("- narrow_oop_base: " INTPTR_FORMAT, p2i(_narrow_oop_base)); st->print_cr("- narrow_oop_shift %d", _narrow_oop_shift); st->print_cr("- compact_strings: %d", _compact_strings); st->print_cr("- compact_headers: %d", _compact_headers); - st->print_cr("- max_heap_size: " UINTX_FORMAT, _max_heap_size); + st->print_cr("- max_heap_size: %zu", _max_heap_size); st->print_cr("- narrow_oop_mode: %d", _narrow_oop_mode); st->print_cr("- compressed_oops: %d", _compressed_oops); st->print_cr("- compressed_class_ptrs: %d", _compressed_class_ptrs); st->print_cr("- narrow_klass_pointer_bits: %d", _narrow_klass_pointer_bits); st->print_cr("- narrow_klass_shift: %d", _narrow_klass_shift); - st->print_cr("- cloned_vtables_offset: " SIZE_FORMAT_X, _cloned_vtables_offset); - st->print_cr("- early_serialized_data_offset: " SIZE_FORMAT_X, _early_serialized_data_offset); - st->print_cr("- serialized_data_offset: " SIZE_FORMAT_X, _serialized_data_offset); + st->print_cr("- cloned_vtables_offset: 0x%zx", _cloned_vtables_offset); + st->print_cr("- early_serialized_data_offset: 0x%zx", _early_serialized_data_offset); + st->print_cr("- serialized_data_offset: 0x%zx", _serialized_data_offset); st->print_cr("- jvm_ident: %s", _jvm_ident); - st->print_cr("- shared_path_table_offset: " SIZE_FORMAT_X, _shared_path_table_offset); + st->print_cr("- shared_path_table_offset: 0x%zx", _shared_path_table_offset); st->print_cr("- app_class_paths_start_index: %d", _app_class_paths_start_index); st->print_cr("- app_module_paths_start_index: %d", _app_module_paths_start_index); st->print_cr("- num_module_paths: %d", _num_module_paths); @@ -307,14 +306,14 @@ void FileMapHeader::print(outputStream* st) { st->print_cr("- requested_base_address: " INTPTR_FORMAT, p2i(_requested_base_address)); st->print_cr("- mapped_base_address: " INTPTR_FORMAT, p2i(_mapped_base_address)); st->print_cr("- heap_root_segments.roots_count: %d" , _heap_root_segments.roots_count()); - st->print_cr("- heap_root_segments.base_offset: " SIZE_FORMAT_X, _heap_root_segments.base_offset()); - st->print_cr("- heap_root_segments.count: " SIZE_FORMAT, _heap_root_segments.count()); + st->print_cr("- heap_root_segments.base_offset: 0x%zx", _heap_root_segments.base_offset()); + st->print_cr("- heap_root_segments.count: %zu", _heap_root_segments.count()); st->print_cr("- heap_root_segments.max_size_elems: %d", _heap_root_segments.max_size_in_elems()); st->print_cr("- heap_root_segments.max_size_bytes: %d", _heap_root_segments.max_size_in_bytes()); - st->print_cr("- _heap_oopmap_start_pos: " SIZE_FORMAT, _heap_oopmap_start_pos); - st->print_cr("- _heap_ptrmap_start_pos: " SIZE_FORMAT, _heap_ptrmap_start_pos); - st->print_cr("- _rw_ptrmap_start_pos: " SIZE_FORMAT, _rw_ptrmap_start_pos); - st->print_cr("- _ro_ptrmap_start_pos: " SIZE_FORMAT, _ro_ptrmap_start_pos); + st->print_cr("- _heap_oopmap_start_pos: %zu", _heap_oopmap_start_pos); + st->print_cr("- _heap_ptrmap_start_pos: %zu", _heap_ptrmap_start_pos); + st->print_cr("- _rw_ptrmap_start_pos: %zu", _rw_ptrmap_start_pos); + st->print_cr("- _ro_ptrmap_start_pos: %zu", _ro_ptrmap_start_pos); st->print_cr("- allow_archiving_with_java_agent:%d", _allow_archiving_with_java_agent); st->print_cr("- use_optimized_module_handling: %d", _use_optimized_module_handling); st->print_cr("- has_full_module_graph %d", _has_full_module_graph); @@ -1420,7 +1419,7 @@ bool FileMapInfo::init_from_file(int fd) { void FileMapInfo::seek_to_position(size_t pos) { if (os::lseek(_fd, (long)pos, SEEK_SET) < 0) { - log_error(cds)("Unable to seek to position " SIZE_FORMAT, pos); + log_error(cds)("Unable to seek to position %zu", pos); MetaspaceShared::unrecoverable_loading_error(); } } @@ -1508,6 +1507,7 @@ void FileMapRegion::init(int region_index, size_t mapping_offset, size_t size, b _crc = crc; _mapped_from_file = false; _mapped_base = nullptr; + _in_reserved_space = false; } void FileMapRegion::init_oopmap(size_t offset, size_t size_in_bits) { @@ -1554,7 +1554,7 @@ BitMapView FileMapInfo::bitmap_view(int region_index, bool is_oopmap) { bitmap_base += is_oopmap ? r->oopmap_offset() : r->ptrmap_offset(); size_t size_in_bits = is_oopmap ? r->oopmap_size_in_bits() : r->ptrmap_size_in_bits(); - log_debug(cds, reloc)("mapped %s relocation %smap @ " INTPTR_FORMAT " (" SIZE_FORMAT " bits)", + log_debug(cds, reloc)("mapped %s relocation %smap @ " INTPTR_FORMAT " (%zu bits)", region_name(region_index), is_oopmap ? "oop" : "ptr", p2i(bitmap_base), size_in_bits); @@ -1577,13 +1577,13 @@ void FileMapRegion::print(outputStream* st, int region_index) { st->print_cr("- is_heap_region: %d", _is_heap_region); st->print_cr("- is_bitmap_region: %d", _is_bitmap_region); st->print_cr("- mapped_from_file: %d", _mapped_from_file); - st->print_cr("- file_offset: " SIZE_FORMAT_X, _file_offset); - st->print_cr("- mapping_offset: " SIZE_FORMAT_X, _mapping_offset); - st->print_cr("- used: " SIZE_FORMAT, _used); - st->print_cr("- oopmap_offset: " SIZE_FORMAT_X, _oopmap_offset); - st->print_cr("- oopmap_size_in_bits: " SIZE_FORMAT, _oopmap_size_in_bits); - st->print_cr("- ptrmap_offset: " SIZE_FORMAT_X, _ptrmap_offset); - st->print_cr("- ptrmap_size_in_bits: " SIZE_FORMAT, _ptrmap_size_in_bits); + st->print_cr("- file_offset: 0x%zx", _file_offset); + st->print_cr("- mapping_offset: 0x%zx", _mapping_offset); + st->print_cr("- used: %zu", _used); + st->print_cr("- oopmap_offset: 0x%zx", _oopmap_offset); + st->print_cr("- oopmap_size_in_bits: %zu", _oopmap_size_in_bits); + st->print_cr("- ptrmap_offset: 0x%zx", _ptrmap_offset); + st->print_cr("- ptrmap_size_in_bits: %zu", _ptrmap_size_in_bits); st->print_cr("- mapped_base: " INTPTR_FORMAT, p2i(_mapped_base)); } @@ -1622,7 +1622,7 @@ void FileMapInfo::write_region(int region, char* base, size_t size, r->set_file_offset(_file_offset); int crc = ClassLoader::crc32(0, base, (jint)size); if (size > 0) { - log_info(cds)("Shared file region (%s) %d: " SIZE_FORMAT_W(8) + log_info(cds)("Shared file region (%s) %d: %8zu" " bytes, addr " INTPTR_FORMAT " file offset 0x%08" PRIxPTR " crc 0x%08x", region_name(region), region, size, p2i(requested_base), _file_offset, crc); @@ -1889,10 +1889,11 @@ MapArchiveResult FileMapInfo::map_region(int i, intx addr_delta, char* mapped_ba FileMapRegion* r = region_at(i); size_t size = r->used_aligned(); char *requested_addr = mapped_base_address + r->mapping_offset(); - assert(r->mapped_base() == nullptr, "must be not mapped yet"); + assert(!is_mapped(), "must be not mapped yet"); assert(requested_addr != nullptr, "must be specified"); r->set_mapped_from_file(false); + r->set_in_reserved_space(false); if (MetaspaceShared::use_windows_memory_mapping()) { // Windows cannot remap read-only shared memory to read-write when required for @@ -1917,7 +1918,6 @@ MapArchiveResult FileMapInfo::map_region(int i, intx addr_delta, char* mapped_ba return MAP_ARCHIVE_OTHER_FAILURE; // oom or I/O error. } else { assert(r->mapped_base() != nullptr, "must be initialized"); - return MAP_ARCHIVE_SUCCESS; } } else { // Note that this may either be a "fresh" mapping into unreserved address @@ -1939,9 +1939,16 @@ MapArchiveResult FileMapInfo::map_region(int i, intx addr_delta, char* mapped_ba r->set_mapped_from_file(true); r->set_mapped_base(requested_addr); + } - return MAP_ARCHIVE_SUCCESS; + if (rs.is_reserved()) { + char* mapped_base = r->mapped_base(); + assert(rs.base() <= mapped_base && mapped_base + size <= rs.end(), + PTR_FORMAT " <= " PTR_FORMAT " < " PTR_FORMAT " <= " PTR_FORMAT, + p2i(rs.base()), p2i(mapped_base), p2i(mapped_base + size), p2i(rs.end())); + r->set_in_reserved_space(rs.is_reserved()); } + return MAP_ARCHIVE_SUCCESS; } // The return value is the location of the archive relocation bitmap. @@ -2101,7 +2108,7 @@ MemRegion FileMapInfo::get_heap_region_requested_range() { address start = heap_region_requested_address(); address end = start + size; - log_info(cds)("Requested heap region [" INTPTR_FORMAT " - " INTPTR_FORMAT "] = " SIZE_FORMAT_W(8) " bytes", + log_info(cds)("Requested heap region [" INTPTR_FORMAT " - " INTPTR_FORMAT "] = %8zu bytes", p2i(start), p2i(end), size); return MemRegion((HeapWord*)start, (HeapWord*)end); @@ -2163,13 +2170,13 @@ bool FileMapInfo::can_use_heap_region() { const int archive_narrow_klass_pointer_bits = header()->narrow_klass_pointer_bits(); const int archive_narrow_klass_shift = header()->narrow_klass_shift(); - log_info(cds)("CDS archive was created with max heap size = " SIZE_FORMAT "M, and the following configuration:", + log_info(cds)("CDS archive was created with max heap size = %zuM, and the following configuration:", max_heap_size()/M); log_info(cds)(" narrow_klass_base at mapping start address, narrow_klass_pointer_bits = %d, narrow_klass_shift = %d", archive_narrow_klass_pointer_bits, archive_narrow_klass_shift); log_info(cds)(" narrow_oop_mode = %d, narrow_oop_base = " PTR_FORMAT ", narrow_oop_shift = %d", narrow_oop_mode(), p2i(narrow_oop_base()), narrow_oop_shift()); - log_info(cds)("The current max heap size = " SIZE_FORMAT "M, G1HeapRegion::GrainBytes = " SIZE_FORMAT, + log_info(cds)("The current max heap size = %zuM, G1HeapRegion::GrainBytes = %zu", MaxHeapSize/M, G1HeapRegion::GrainBytes); log_info(cds)(" narrow_klass_base = " PTR_FORMAT ", arrow_klass_pointer_bits = %d, narrow_klass_shift = %d", p2i(CompressedKlassPointers::base()), CompressedKlassPointers::narrow_klass_pointer_bits(), CompressedKlassPointers::shift()); @@ -2326,7 +2333,7 @@ bool FileMapInfo::map_heap_region_impl() { if (base == nullptr || base != addr) { dealloc_heap_region(); log_info(cds)("UseSharedSpaces: Unable to map at required address in java heap. " - INTPTR_FORMAT ", size = " SIZE_FORMAT " bytes", + INTPTR_FORMAT ", size = %zu bytes", p2i(addr), _mapped_heap_memregion.byte_size()); return false; } @@ -2359,14 +2366,13 @@ bool FileMapInfo::map_heap_region_impl() { if (bitmap_base == nullptr) { log_info(cds)("CDS heap cannot be used because bitmap region cannot be mapped"); dealloc_heap_region(); - unmap_region(MetaspaceShared::hp); _heap_pointers_need_patching = false; return false; } } - log_info(cds)("Heap data mapped at " INTPTR_FORMAT ", size = " SIZE_FORMAT_W(8) " bytes", + log_info(cds)("Heap data mapped at " INTPTR_FORMAT ", size = %8zu bytes", p2i(mapped_start), _mapped_heap_memregion.byte_size()); - log_info(cds)("CDS heap data relocation delta = " INTX_FORMAT " bytes", delta); + log_info(cds)("CDS heap data relocation delta = %zd bytes", delta); return true; } @@ -2428,8 +2434,14 @@ void FileMapInfo::unmap_region(int i) { if (size > 0 && r->mapped_from_file()) { log_info(cds)("Unmapping region #%d at base " INTPTR_FORMAT " (%s)", i, p2i(mapped_base), shared_region_name[i]); - if (!os::unmap_memory(mapped_base, size)) { - fatal("os::unmap_memory failed"); + if (r->in_reserved_space()) { + // This region was mapped inside a ReservedSpace. Its memory will be freed when the ReservedSpace + // is released. Zero it so that we don't accidentally read its content. + log_info(cds)("Region #%d (%s) is in a reserved space, it will be freed when the space is released", i, shared_region_name[i]); + } else { + if (!os::unmap_memory(mapped_base, size)) { + fatal("os::unmap_memory failed"); + } } } r->set_mapped_base(nullptr); diff --git a/src/hotspot/share/cds/filemap.hpp b/src/hotspot/share/cds/filemap.hpp index d097cb0eda6c9..ae11c6c81cc17 100644 --- a/src/hotspot/share/cds/filemap.hpp +++ b/src/hotspot/share/cds/filemap.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -163,11 +163,13 @@ class FileMapRegion: private CDSFileMapRegion { size_t oopmap_size_in_bits() const { assert_is_heap_region(); return _oopmap_size_in_bits; } size_t ptrmap_offset() const { return _ptrmap_offset; } size_t ptrmap_size_in_bits() const { return _ptrmap_size_in_bits; } + bool in_reserved_space() const { return _in_reserved_space; } void set_file_offset(size_t s) { _file_offset = s; } void set_read_only(bool v) { _read_only = v; } void set_mapped_base(char* p) { _mapped_base = p; } void set_mapped_from_file(bool v) { _mapped_from_file = v; } + void set_in_reserved_space(bool is_reserved) { _in_reserved_space = is_reserved; } void init(int region_index, size_t mapping_offset, size_t size, bool read_only, bool allow_exec, int crc); void init_oopmap(size_t offset, size_t size_in_bits); diff --git a/src/hotspot/share/cds/heapShared.cpp b/src/hotspot/share/cds/heapShared.cpp index d2ab109cc7267..96adf8d240dd9 100644 --- a/src/hotspot/share/cds/heapShared.cpp +++ b/src/hotspot/share/cds/heapShared.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,7 @@ * */ -#include "precompiled.hpp" +#include "cds/aotArtifactFinder.hpp" #include "cds/aotClassInitializer.hpp" #include "cds/archiveBuilder.hpp" #include "cds/archiveHeapLoader.hpp" @@ -220,7 +220,9 @@ bool HeapShared::has_been_archived(oop obj) { int HeapShared::append_root(oop obj) { assert(CDSConfig::is_dumping_heap(), "dump-time only"); - + if (obj != nullptr) { + assert(has_been_archived(obj), "must be"); + } // No GC should happen since we aren't scanning _pending_roots. assert(Thread::current() == (Thread*)VMThread::vm_thread(), "should be in vm thread"); @@ -290,7 +292,7 @@ void HeapShared::clear_root(int index) { } } -bool HeapShared::archive_object(oop obj) { +bool HeapShared::archive_object(oop obj, KlassSubGraphInfo* subgraph_info) { assert(CDSConfig::is_dumping_heap(), "dump-time only"); assert(!obj->is_stackChunk(), "do not archive stack chunks"); @@ -299,7 +301,7 @@ bool HeapShared::archive_object(oop obj) { } if (ArchiveHeapWriter::is_too_large_to_archive(obj->size())) { - log_debug(cds, heap)("Cannot archive, object (" PTR_FORMAT ") is too large: " SIZE_FORMAT, + log_debug(cds, heap)("Cannot archive, object (" PTR_FORMAT ") is too large: %zu", p2i(obj), obj->size()); debug_trace(); return false; @@ -311,6 +313,36 @@ bool HeapShared::archive_object(oop obj) { archived_object_cache()->maybe_grow(); mark_native_pointers(obj); + Klass* k = obj->klass(); + if (k->is_instance_klass()) { + // Whenever we see a non-array Java object of type X, we mark X to be aot-initialized. + // This ensures that during the production run, whenever Java code sees a cached object + // of type X, we know that X is already initialized. (see TODO comment below ...) + + if (InstanceKlass::cast(k)->is_enum_subclass() + // We can't rerun of enum classes (see cdsEnumKlass.cpp) so + // we must store them as AOT-initialized. + || (subgraph_info == _dump_time_special_subgraph)) + // TODO: we do this only for the special subgraph for now. Extending this to + // other subgraphs would require more refactoring of the core library (such as + // move some initialization logic into runtimeSetup()). + // + // For the other subgraphs, we have a weaker mechanism to ensure that + // all classes in a subgraph are initialized before the subgraph is programmatically + // returned from jdk.internal.misc.CDS::initializeFromArchive(). + // See HeapShared::initialize_from_archived_subgraph(). + { + AOTArtifactFinder::add_aot_inited_class(InstanceKlass::cast(k)); + } + + if (java_lang_Class::is_instance(obj)) { + Klass* mirror_k = java_lang_Class::as_Klass(obj); + if (mirror_k != nullptr) { + AOTArtifactFinder::add_cached_class(mirror_k); + } + } + } + if (log_is_enabled(Debug, cds, heap)) { ResourceMark rm; LogTarget(Debug, cds, heap) log; @@ -328,10 +360,6 @@ bool HeapShared::archive_object(oop obj) { out.cr(); } - if (java_lang_Module::is_instance(obj) && Modules::check_archived_module_oop(obj)) { - Modules::update_oops_in_archived_module(obj, append_root(obj)); - } - return true; } } @@ -367,7 +395,9 @@ class MetaspaceObjToOopHandleTable: public ResourceHashtableset_oop(src, dest); + if (SystemDictionaryShared::is_builtin_loader(src->pool_holder()->class_loader_data())) { + _scratch_references_table->set_oop(src, dest); + } } objArrayOop HeapShared::scratch_resolved_references(ConstantPool* src) { @@ -466,11 +496,15 @@ bool HeapShared::is_archivable_hidden_klass(InstanceKlass* ik) { (is_lambda_form_klass(ik) || is_lambda_proxy_klass(ik) || is_string_concat_klass(ik)); } -void HeapShared::copy_aot_initialized_mirror(Klass* orig_k, oop orig_mirror, oop m) { - assert(orig_k->is_instance_klass(), "sanity"); - InstanceKlass* ik = InstanceKlass::cast(orig_k); - InstanceKlass* buffered_ik = ArchiveBuilder::current()->get_buffered_addr(ik); +void HeapShared::copy_and_rescan_aot_inited_mirror(InstanceKlass* ik) { + ik->set_has_aot_initialized_mirror(); + if (AOTClassInitializer::is_runtime_setup_required(ik)) { + ik->set_is_runtime_setup_required(); + } + + oop orig_mirror = ik->java_mirror(); + oop m = scratch_java_mirror(ik); assert(ik->is_initialized(), "must be"); int nfields = 0; @@ -481,7 +515,19 @@ void HeapShared::copy_aot_initialized_mirror(Klass* orig_k, oop orig_mirror, oop switch (fd.field_type()) { case T_OBJECT: case T_ARRAY: - m->obj_field_put(offset, orig_mirror->obj_field(offset)); + { + oop field_obj = orig_mirror->obj_field(offset); + if (offset == java_lang_Class::reflection_data_offset()) { + // Class::reflectData use SoftReference, which cannot be archived. Set it + // to null and it will be recreated at runtime. + field_obj = nullptr; + } + m->obj_field_put(offset, field_obj); + if (field_obj != nullptr) { + bool success = archive_reachable_objects_from(1, _dump_time_special_subgraph, field_obj); + assert(success, "sanity"); + } + } break; case T_BOOLEAN: m->bool_field_put(offset, orig_mirror->bool_field(offset)); @@ -514,16 +560,18 @@ void HeapShared::copy_aot_initialized_mirror(Klass* orig_k, oop orig_mirror, oop } } - java_lang_Class::set_class_data(m, java_lang_Class::class_data(orig_mirror)); - - // Class::reflectData use SoftReference, which cannot be archived. Set it - // to null and it will be recreated at runtime. - java_lang_Class::set_reflection_data(m, nullptr); + oop class_data = java_lang_Class::class_data(orig_mirror); + java_lang_Class::set_class_data(m, class_data); + if (class_data != nullptr) { + bool success = archive_reachable_objects_from(1, _dump_time_special_subgraph, class_data); + assert(success, "sanity"); + } if (log_is_enabled(Info, cds, init)) { ResourceMark rm; - log_debug(cds, init)("copied %3d field(s) in aot-initialized mirror %s%s", nfields, ik->external_name(), - ik->is_hidden() ? " (hidden)" : ""); + log_debug(cds, init)("copied %3d field(s) in aot-initialized mirror %s%s%s", nfields, ik->external_name(), + ik->is_hidden() ? " (hidden)" : "", + ik->is_enum_subclass() ? " (enum)" : ""); } } @@ -546,10 +594,7 @@ static void copy_java_mirror_hashcode(oop orig_mirror, oop scratch_m) { } static objArrayOop get_archived_resolved_references(InstanceKlass* src_ik) { - InstanceKlass* buffered_ik = ArchiveBuilder::current()->get_buffered_addr(src_ik); - if (buffered_ik->is_shared_boot_class() || - buffered_ik->is_shared_platform_class() || - buffered_ik->is_shared_app_class()) { + if (SystemDictionaryShared::is_builtin_loader(src_ik->class_loader_data())) { objArrayOop rr = src_ik->constants()->resolved_references_or_null(); if (rr != nullptr && !ArchiveHeapWriter::is_too_large_to_archive(rr)) { return HeapShared::scratch_resolved_references(src_ik->constants()); @@ -558,68 +603,8 @@ static objArrayOop get_archived_resolved_references(InstanceKlass* src_ik) { return nullptr; } -void HeapShared::archive_java_mirrors() { - for (int i = T_BOOLEAN; i < T_VOID+1; i++) { - BasicType bt = (BasicType)i; - if (!is_reference_type(bt)) { - oop orig_mirror = Universe::java_mirror(bt); - oop m = _scratch_basic_type_mirrors[i].resolve(); - assert(m != nullptr, "sanity"); - copy_java_mirror_hashcode(orig_mirror, m); - bool success = archive_reachable_objects_from(1, _dump_time_special_subgraph, m); - assert(success, "sanity"); - - log_trace(cds, heap, mirror)( - "Archived %s mirror object from " PTR_FORMAT, - type2name(bt), p2i(m)); - - Universe::set_archived_basic_type_mirror_index(bt, append_root(m)); - } - } - - GrowableArray* klasses = ArchiveBuilder::current()->klasses(); - assert(klasses != nullptr, "sanity"); - - for (int i = 0; i < klasses->length(); i++) { - Klass* orig_k = klasses->at(i); - oop orig_mirror = orig_k->java_mirror(); - oop m = scratch_java_mirror(orig_k); - if (m != nullptr) { - copy_java_mirror_hashcode(orig_mirror, m); - } - } - - for (int i = 0; i < klasses->length(); i++) { - Klass* orig_k = klasses->at(i); - oop orig_mirror = orig_k->java_mirror(); - oop m = scratch_java_mirror(orig_k); - if (m != nullptr) { - Klass* buffered_k = ArchiveBuilder::get_buffered_klass(orig_k); - bool success = archive_reachable_objects_from(1, _dump_time_special_subgraph, m); - guarantee(success, "scratch mirrors must point to only archivable objects"); - buffered_k->set_archived_java_mirror(append_root(m)); - ResourceMark rm; - log_trace(cds, heap, mirror)( - "Archived %s mirror object from " PTR_FORMAT, - buffered_k->external_name(), p2i(m)); - - // archive the resolved_referenes array - if (buffered_k->is_instance_klass()) { - InstanceKlass* ik = InstanceKlass::cast(buffered_k); - objArrayOop rr = get_archived_resolved_references(InstanceKlass::cast(orig_k)); - if (rr != nullptr) { - bool success = HeapShared::archive_reachable_objects_from(1, _dump_time_special_subgraph, rr); - assert(success, "must be"); - int root_index = append_root(rr); - ik->constants()->cache()->set_archived_references(root_index); - } - } - } - } -} - void HeapShared::archive_strings() { - oop shared_strings_array = StringTable::init_shared_table(_dumped_interned_strings); + oop shared_strings_array = StringTable::init_shared_strings_array(_dumped_interned_strings); bool success = archive_reachable_objects_from(1, _dump_time_special_subgraph, shared_strings_array); // We must succeed because: // - _dumped_interned_strings do not contain any large strings. @@ -656,115 +641,9 @@ void HeapShared::set_has_native_pointers(oop src_obj) { info->set_has_native_pointers(); } -void HeapShared::start_finding_required_hidden_classes() { - if (!CDSConfig::is_dumping_invokedynamic()) { - return; - } - NoSafepointVerifier nsv; - - init_seen_objects_table(); - - // We first scan the objects that are known to be archived (from the archive_subgraph - // tables) - find_required_hidden_classes_helper(archive_subgraph_entry_fields); - if (CDSConfig::is_dumping_full_module_graph()) { - find_required_hidden_classes_helper(fmg_archive_subgraph_entry_fields); - } - - // Later, SystemDictionaryShared::find_all_archivable_classes_impl() will start - // scanning the constant pools of all classes that it decides to archive. -} - -void HeapShared::end_finding_required_hidden_classes() { - if (!CDSConfig::is_dumping_invokedynamic()) { - return; - } - NoSafepointVerifier nsv; - - delete_seen_objects_table(); -} - -void HeapShared::find_required_hidden_classes_helper(ArchivableStaticFieldInfo fields[]) { - if (!CDSConfig::is_dumping_heap()) { - return; - } - for (int i = 0; fields[i].valid(); i++) { - ArchivableStaticFieldInfo* f = &fields[i]; - InstanceKlass* k = f->klass; - oop m = k->java_mirror(); - oop o = m->obj_field(f->offset); - if (o != nullptr) { - find_required_hidden_classes_in_object(o); - } - } -} - -class HeapShared::FindRequiredHiddenClassesOopClosure: public BasicOopIterateClosure { - GrowableArray _stack; - template void do_oop_work(T *p) { - // Recurse on a GrowableArray to avoid overflowing the C stack. - oop o = RawAccess<>::oop_load(p); - if (o != nullptr) { - _stack.append(o); - } - } - - public: - - void do_oop(narrowOop *p) { FindRequiredHiddenClassesOopClosure::do_oop_work(p); } - void do_oop( oop *p) { FindRequiredHiddenClassesOopClosure::do_oop_work(p); } - - FindRequiredHiddenClassesOopClosure(oop o) { - _stack.append(o); - } - oop pop() { - if (_stack.length() == 0) { - return nullptr; - } else { - return _stack.pop(); - } - } -}; - -static void mark_required_if_hidden_class(Klass* k) { - if (k != nullptr && k->is_instance_klass()) { - InstanceKlass* ik = InstanceKlass::cast(k); - if (ik->is_hidden()) { - SystemDictionaryShared::mark_required_hidden_class(ik); - } - } -} - - -void HeapShared::find_required_hidden_classes_in_object(oop root) { - ResourceMark rm; - FindRequiredHiddenClassesOopClosure c(root); - oop o; - while ((o = c.pop()) != nullptr) { - if (!has_been_seen_during_subgraph_recording(o)) { - set_has_been_seen_during_subgraph_recording(o); - - // Mark the klass of this object - mark_required_if_hidden_class(o->klass()); - - // For special objects, mark the klass that they contain information about. - // - a Class that refers to an hidden class - // - a ResolvedMethodName that refers to a method declared in a hidden class - if (java_lang_Class::is_instance(o)) { - mark_required_if_hidden_class(java_lang_Class::as_Klass(o)); - } else if (java_lang_invoke_ResolvedMethodName::is_instance(o)) { - Method* m = java_lang_invoke_ResolvedMethodName::vmtarget(o); - if (m != nullptr) { - mark_required_if_hidden_class(m->method_holder()); - } - } - - o->oop_iterate(&c); - } - } -} - -void HeapShared::archive_objects(ArchiveHeapInfo *heap_info) { +// Between start_scanning_for_oops() and end_scanning_for_oops(), we discover all Java heap objects that +// should be stored in the AOT cache. The scanning is coordinated by AOTArtifactFinder. +void HeapShared::start_scanning_for_oops() { { NoSafepointVerifier nsv; @@ -782,62 +661,61 @@ void HeapShared::archive_objects(ArchiveHeapInfo *heap_info) { UseCompressedOops ? p2i(CompressedOops::end()) : p2i((address)G1CollectedHeap::heap()->reserved().end())); } - copy_objects(); - CDSHeapVerifier::verify(); - check_special_subgraph_classes(); + archive_subgraphs(); } - ArchiveHeapWriter::write(_pending_roots, heap_info); -} - -void HeapShared::copy_interned_strings() { init_seen_objects_table(); + Universe::archive_exception_instances(); +} - auto copier = [&] (oop s, bool value_ignored) { - assert(s != nullptr, "sanity"); - assert(!ArchiveHeapWriter::is_string_too_large_to_archive(s), "large strings must have been filtered"); - bool success = archive_reachable_objects_from(1, _dump_time_special_subgraph, s); - assert(success, "must be"); - // Prevent string deduplication from changing the value field to - // something not in the archive. - java_lang_String::set_deduplication_forbidden(s); - }; - _dumped_interned_strings->iterate_all(copier); - +void HeapShared::end_scanning_for_oops() { + archive_strings(); delete_seen_objects_table(); } -void HeapShared::copy_special_subgraph() { - copy_interned_strings(); - - init_seen_objects_table(); +void HeapShared::write_heap(ArchiveHeapInfo *heap_info) { { - archive_java_mirrors(); - archive_strings(); - Universe::archive_exception_instances(); + NoSafepointVerifier nsv; + CDSHeapVerifier::verify(); + check_special_subgraph_classes(); } - delete_seen_objects_table(); + + StringTable::write_shared_table(_dumped_interned_strings); + ArchiveHeapWriter::write(_pending_roots, heap_info); + + ArchiveBuilder::OtherROAllocMark mark; + write_subgraph_info_table(); } -void HeapShared::prepare_resolved_references() { - GrowableArray* klasses = ArchiveBuilder::current()->klasses(); - for (int i = 0; i < klasses->length(); i++) { - Klass* src_k = klasses->at(i); - if (src_k->is_instance_klass()) { - InstanceKlass* buffered_ik = ArchiveBuilder::current()->get_buffered_addr(InstanceKlass::cast(src_k)); - buffered_ik->constants()->prepare_resolved_references_for_archiving(); +void HeapShared::scan_java_mirror(oop orig_mirror) { + oop m = scratch_java_mirror(orig_mirror); + if (m != nullptr) { // nullptr if for custom class loader + copy_java_mirror_hashcode(orig_mirror, m); + bool success = archive_reachable_objects_from(1, _dump_time_special_subgraph, m); + assert(success, "sanity"); + } +} + +void HeapShared::scan_java_class(Klass* orig_k) { + scan_java_mirror(orig_k->java_mirror()); + + if (orig_k->is_instance_klass()) { + InstanceKlass* orig_ik = InstanceKlass::cast(orig_k); + orig_ik->constants()->prepare_resolved_references_for_archiving(); + objArrayOop rr = get_archived_resolved_references(orig_ik); + if (rr != nullptr) { + bool success = HeapShared::archive_reachable_objects_from(1, _dump_time_special_subgraph, rr); + assert(success, "must be"); } + + orig_ik->constants()->add_dumped_interned_strings(); } } -void HeapShared::copy_objects() { +void HeapShared::archive_subgraphs() { assert(HeapShared::can_write(), "must be"); - prepare_resolved_references(); - find_all_aot_initialized_classes(); - copy_special_subgraph(); - archive_object_subgraphs(archive_subgraph_entry_fields, false /* is_full_module_graph */); @@ -848,198 +726,6 @@ void HeapShared::copy_objects() { } } -// Closure used by HeapShared::scan_for_aot_initialized_classes() to look for all objects -// that are reachable from a given root. -class HeapShared::AOTInitializedClassScanner : public BasicOopIterateClosure { - bool _made_progress; - - template void check(T *p) { - oop obj = HeapAccess<>::oop_load(p); - if (!java_lang_Class::is_instance(obj)) { - // Don't scan the mirrors, as we may see an orig_mirror while scanning - // the object graph, .... TODO more info - _made_progress |= HeapShared::scan_for_aot_initialized_classes(obj); - } - } - -public: - AOTInitializedClassScanner() : _made_progress(false) {} - void do_oop(narrowOop *p) { check(p); } - void do_oop( oop *p) { check(p); } - bool made_progress() { return _made_progress; } -}; - -// If has been initialized during the assembly phase, mark its -// has_aot_initialized_mirror bit. And then do the same for all supertypes of -// . -// -// Note: a super interface of may not have been initialized, if -// has not declared any default methods. -// -// Note: this function doesn not call InstanceKlass::initialize() -- we are inside -// a safepoint. -// -// Returns true if one or more classes have been newly marked. -static bool mark_for_aot_initialization(InstanceKlass* buffered_ik) { - assert(SafepointSynchronize::is_at_safepoint(), "sanity"); - assert(ArchiveBuilder::current()->is_in_buffer_space(buffered_ik), "sanity"); - - if (buffered_ik->has_aot_initialized_mirror()) { // already marked - return false; - } - - bool made_progress = false; - if (buffered_ik->is_initialized()) { - if (log_is_enabled(Info, cds, init)) { - ResourceMark rm; - log_info(cds, init)("Mark class for aot-init: %s", buffered_ik->external_name()); - } - - InstanceKlass* src_ik = ArchiveBuilder::current()->get_source_addr(buffered_ik); - - // If we get here with a "wild" user class, which may have - // uncontrolled code, exit with an error. Obviously - // filtering logic upstream needs to detect APP classes and not mark - // them for aot-init in the first place, but this will be the final - // firewall. - -#ifndef PRODUCT - // ArchiveHeapTestClass is used for a very small number of internal regression - // tests (non-product builds only). It may initialize some unexpected classes. - if (ArchiveHeapTestClass == nullptr) -#endif - { - if (!src_ik->in_javabase_module()) { - // Class/interface types in the boot loader may have been initialized as side effects - // of JVM bootstrap code, so they are fine. But we need to check all other classes. - if (buffered_ik->is_interface()) { - // This probably means a bug in AOTConstantPoolResolver.::is_indy_resolution_deterministic() - guarantee(!buffered_ik->interface_needs_clinit_execution_as_super(), - "should not have initialized an interface whose might have unpredictable side effects"); - } else { - // "normal" classes - guarantee(HeapShared::is_archivable_hidden_klass(buffered_ik), - "should not have initialized any non-interface, non-hidden classes outside of java.base"); - } - } - } - - buffered_ik->set_has_aot_initialized_mirror(); - if (AOTClassInitializer::is_runtime_setup_required(src_ik)) { - buffered_ik->set_is_runtime_setup_required(); - } - made_progress = true; - - InstanceKlass* super = buffered_ik->java_super(); - if (super != nullptr) { - mark_for_aot_initialization(super); - } - - Array* interfaces = buffered_ik->transitive_interfaces(); - for (int i = 0; i < interfaces->length(); i++) { - InstanceKlass* intf = interfaces->at(i); - mark_for_aot_initialization(intf); - if (!intf->is_initialized()) { - assert(!intf->interface_needs_clinit_execution_as_super(/*also_check_supers*/false), "sanity"); - assert(!intf->has_aot_initialized_mirror(), "must not be marked"); - } - } - } - - return made_progress; -} - -void HeapShared::find_all_aot_initialized_classes() { - if (!CDSConfig::is_dumping_aot_linked_classes()) { - return; - } - - init_seen_objects_table(); - find_all_aot_initialized_classes_helper(); - delete_seen_objects_table(); -} - -// Recursively find all class that should be aot-initialized: -// - the class has at least one instance that can be reachable from the special subgraph; or -// - the class is hard-coded in AOTClassInitializer::can_archive_initialized_mirror() -void HeapShared::find_all_aot_initialized_classes_helper() { - GrowableArray* klasses = ArchiveBuilder::current()->klasses(); - assert(klasses != nullptr, "sanity"); - - // First scan all resolved constant pools references. - for (int i = 0; i < klasses->length(); i++) { - Klass* src_k = klasses->at(i); - if (src_k->is_instance_klass()) { - InstanceKlass* src_ik = InstanceKlass::cast(src_k); - InstanceKlass* buffered_ik = ArchiveBuilder::current()->get_buffered_addr(src_ik); - objArrayOop rr = get_archived_resolved_references(src_ik); - if (rr != nullptr) { - objArrayOop scratch_rr = scratch_resolved_references(src_ik->constants()); - for (int i = 0; i < scratch_rr->length(); i++) { - scan_for_aot_initialized_classes(scratch_rr->obj_at(i)); - } - } - - // If a class is hard-coded to be aot-initialize, mark it as such. - if (AOTClassInitializer::can_archive_initialized_mirror(src_ik)) { - mark_for_aot_initialization(buffered_ik); - } - } - } - - // These objects also belong to the special subgraph - scan_for_aot_initialized_classes(Universe::null_ptr_exception_instance()); - scan_for_aot_initialized_classes(Universe::arithmetic_exception_instance()); - scan_for_aot_initialized_classes(Universe::internal_error_instance()); - scan_for_aot_initialized_classes(Universe::array_index_out_of_bounds_exception_instance()); - scan_for_aot_initialized_classes(Universe::array_store_exception_instance()); - scan_for_aot_initialized_classes(Universe::class_cast_exception_instance()); - - bool made_progress; - do { - // In each pass, we copy the scratch mirrors of the classes that were marked - // as aot-init in the previous pass. We then scan these mirrors, which may - // mark more classes. Keep iterating until no more progress can be made. - made_progress = false; - for (int i = 0; i < klasses->length(); i++) { - Klass* orig_k = klasses->at(i); - if (orig_k->is_instance_klass()) { - InstanceKlass* orig_ik = InstanceKlass::cast(orig_k); - if (ArchiveBuilder::current()->get_buffered_addr(orig_ik)->has_aot_initialized_mirror()) { - oop orig_mirror = orig_ik->java_mirror(); - oop scratch_mirror = scratch_java_mirror(orig_k); - if (!has_been_seen_during_subgraph_recording(scratch_mirror)) { - // Scan scratch_mirror instead of orig_mirror (which has fields like ClassLoader that - // are not archived). - copy_aot_initialized_mirror(orig_k, orig_mirror, scratch_mirror); - made_progress |= scan_for_aot_initialized_classes(scratch_mirror); - } - } - } - } - } while (made_progress); -} - -bool HeapShared::scan_for_aot_initialized_classes(oop obj) { - if (obj == nullptr || has_been_seen_during_subgraph_recording(obj)) { - return false; - } - set_has_been_seen_during_subgraph_recording(obj); - - bool made_progress = false; - Klass* k = obj->klass(); - if (k->is_instance_klass()) { - InstanceKlass* orig_ik = InstanceKlass::cast(k); - InstanceKlass* buffered_ik = ArchiveBuilder::current()->get_buffered_addr(orig_ik); - made_progress = mark_for_aot_initialization(buffered_ik); - } - - AOTInitializedClassScanner scanner; - obj->oop_iterate(&scanner); - made_progress |= scanner.made_progress(); - return made_progress; -} - // // Subgraph archiving support // @@ -1052,9 +738,8 @@ HeapShared::RunTimeKlassSubGraphInfoTable HeapShared::_run_time_subgraph_info_ KlassSubGraphInfo* HeapShared::init_subgraph_info(Klass* k, bool is_full_module_graph) { assert(CDSConfig::is_dumping_heap(), "dump time only"); bool created; - Klass* buffered_k = ArchiveBuilder::get_buffered_klass(k); KlassSubGraphInfo* info = - _dump_time_subgraph_info_table->put_if_absent(k, KlassSubGraphInfo(buffered_k, is_full_module_graph), + _dump_time_subgraph_info_table->put_if_absent(k, KlassSubGraphInfo(k, is_full_module_graph), &created); assert(created, "must not initialize twice"); return info; @@ -1082,30 +767,29 @@ void KlassSubGraphInfo::add_subgraph_entry_field(int static_field_offset, oop v) // Only objects of boot classes can be included in sub-graph. void KlassSubGraphInfo::add_subgraph_object_klass(Klass* orig_k) { assert(CDSConfig::is_dumping_heap(), "dump time only"); - Klass* buffered_k = ArchiveBuilder::get_buffered_klass(orig_k); if (_subgraph_object_klasses == nullptr) { _subgraph_object_klasses = new (mtClass) GrowableArray(50, mtClass); } - assert(ArchiveBuilder::current()->is_in_buffer_space(buffered_k), "must be a shared class"); - - if (_k == buffered_k) { + if (_k == orig_k) { // Don't add the Klass containing the sub-graph to it's own klass // initialization list. return; } - if (buffered_k->is_instance_klass()) { + if (orig_k->is_instance_klass()) { +#ifdef ASSERT + InstanceKlass* ik = InstanceKlass::cast(orig_k); if (CDSConfig::is_dumping_invokedynamic()) { - assert(InstanceKlass::cast(buffered_k)->is_shared_boot_class() || - HeapShared::is_lambda_proxy_klass(InstanceKlass::cast(buffered_k)), + assert(ik->class_loader() == nullptr || + HeapShared::is_lambda_proxy_klass(ik), "we can archive only instances of boot classes or lambda proxy classes"); } else { - assert(InstanceKlass::cast(buffered_k)->is_shared_boot_class(), - "must be boot class"); + assert(ik->class_loader() == nullptr, "must be boot class"); } +#endif // vmClasses::xxx_klass() are not updated, need to check // the original Klass* if (orig_k == vmClasses::String_klass() || @@ -1114,37 +798,33 @@ void KlassSubGraphInfo::add_subgraph_object_klass(Klass* orig_k) { // to the sub-graph object class list. return; } - if (buffered_k->has_aot_initialized_mirror()) { - // No need to add to the runtime-init list. - return; - } check_allowed_klass(InstanceKlass::cast(orig_k)); - } else if (buffered_k->is_objArray_klass()) { - Klass* abk = ObjArrayKlass::cast(buffered_k)->bottom_klass(); + } else if (orig_k->is_objArray_klass()) { + Klass* abk = ObjArrayKlass::cast(orig_k)->bottom_klass(); if (abk->is_instance_klass()) { assert(InstanceKlass::cast(abk)->is_shared_boot_class(), "must be boot class"); check_allowed_klass(InstanceKlass::cast(ObjArrayKlass::cast(orig_k)->bottom_klass())); } - if (buffered_k == Universe::objectArrayKlass()) { + if (orig_k == Universe::objectArrayKlass()) { // Initialized early during Universe::genesis. No need to be added // to the list. return; } } else { - assert(buffered_k->is_typeArray_klass(), "must be"); + assert(orig_k->is_typeArray_klass(), "must be"); // Primitive type arrays are created early during Universe::genesis. return; } if (log_is_enabled(Debug, cds, heap)) { - if (!_subgraph_object_klasses->contains(buffered_k)) { + if (!_subgraph_object_klasses->contains(orig_k)) { ResourceMark rm; log_debug(cds, heap)("Adding klass %s", orig_k->external_name()); } } - _subgraph_object_klasses->append_if_missing(buffered_k); + _subgraph_object_klasses->append_if_missing(orig_k); _has_non_early_klasses |= is_non_early_klass(orig_k); } @@ -1200,7 +880,7 @@ bool KlassSubGraphInfo::is_non_early_klass(Klass* k) { // Initialize an archived subgraph_info_record from the given KlassSubGraphInfo. void ArchivedKlassSubGraphInfoRecord::init(KlassSubGraphInfo* info) { - _k = info->klass(); + _k = ArchiveBuilder::get_buffered_klass(info->klass()); _entry_field_records = nullptr; _subgraph_object_klasses = nullptr; _is_full_module_graph = info->is_full_module_graph(); @@ -1233,15 +913,28 @@ void ArchivedKlassSubGraphInfoRecord::init(KlassSubGraphInfo* info) { } } - // the Klasses of the objects in the sub-graphs - GrowableArray* subgraph_object_klasses = info->subgraph_object_klasses(); - if (subgraph_object_klasses != nullptr) { - int num_subgraphs_klasses = subgraph_object_klasses->length(); - _subgraph_object_klasses = - ArchiveBuilder::new_ro_array(num_subgraphs_klasses); + // has the Klasses of all the objects that are referenced by this subgraph. + // Copy those that need to be explicitly initialized into <_subgraph_object_klasses>. + GrowableArray* recorded_klasses = info->subgraph_object_klasses(); + if (recorded_klasses != nullptr) { + // AOT-inited classes are automatically marked as "initialized" during bootstrap. When + // programmatically loading a subgraph, we only need to explicitly initialize the classes + // that are not aot-inited. + int num_to_copy = 0; + for (int i = 0; i < recorded_klasses->length(); i++) { + Klass* subgraph_k = ArchiveBuilder::get_buffered_klass(recorded_klasses->at(i)); + if (!subgraph_k->has_aot_initialized_mirror()) { + num_to_copy ++; + } + } + + _subgraph_object_klasses = ArchiveBuilder::new_ro_array(num_to_copy); bool is_special = (_k == ArchiveBuilder::get_buffered_klass(vmClasses::Object_klass())); - for (int i = 0; i < num_subgraphs_klasses; i++) { - Klass* subgraph_k = subgraph_object_klasses->at(i); + for (int i = 0, n = 0; i < recorded_klasses->length(); i++) { + Klass* subgraph_k = ArchiveBuilder::get_buffered_klass(recorded_klasses->at(i)); + if (subgraph_k->has_aot_initialized_mirror()) { + continue; + } if (log_is_enabled(Info, cds, heap)) { ResourceMark rm; const char* owner_name = is_special ? "" : _k->external_name(); @@ -1250,10 +943,11 @@ void ArchivedKlassSubGraphInfoRecord::init(KlassSubGraphInfo* info) { } log_info(cds, heap)( "Archived object klass %s (%2d) => %s", - owner_name, i, subgraph_k->external_name()); + owner_name, n, subgraph_k->external_name()); } - _subgraph_object_klasses->at_put(i, subgraph_k); - ArchivePtrMarker::mark_pointer(_subgraph_object_klasses->adr_at(i)); + _subgraph_object_klasses->at_put(n, subgraph_k); + ArchivePtrMarker::mark_pointer(_subgraph_object_klasses->adr_at(n)); + n++; } } @@ -1693,7 +1387,7 @@ class WalkOopAndArchiveClosure: public BasicOopIterateClosure { if (!_record_klasses_only && log_is_enabled(Debug, cds, heap)) { ResourceMark rm; - log_debug(cds, heap)("(%d) %s[" SIZE_FORMAT "] ==> " PTR_FORMAT " size " SIZE_FORMAT " %s", _level, + log_debug(cds, heap)("(%d) %s[%zu] ==> " PTR_FORMAT " size %zu %s", _level, _referencing_obj->klass()->external_name(), field_delta, p2i(obj), obj->size() * HeapWordSize, obj->klass()->external_name()); if (log_is_enabled(Trace, cds, heap)) { @@ -1831,12 +1525,12 @@ bool HeapShared::archive_reachable_objects_from(int level, bool record_klasses_only = already_archived; if (!already_archived) { ++_num_new_archived_objs; - if (!archive_object(orig_obj)) { + if (!archive_object(orig_obj, subgraph_info)) { // Skip archiving the sub-graph referenced from the current entry field. ResourceMark rm; log_error(cds, heap)( "Cannot archive the sub-graph referenced from %s object (" - PTR_FORMAT ") size " SIZE_FORMAT ", skipped.", + PTR_FORMAT ") size %zu, skipped.", orig_obj->klass()->external_name(), p2i(orig_obj), orig_obj->size() * HeapWordSize); if (level == 1) { // Don't archive a subgraph root that's too big. For archives static fields, that's OK @@ -2011,7 +1705,7 @@ void HeapShared::check_special_subgraph_classes() { int num = klasses->length(); for (int i = 0; i < num; i++) { Klass* subgraph_k = klasses->at(i); - Symbol* name = ArchiveBuilder::current()->get_source_addr(subgraph_k->name()); + Symbol* name = subgraph_k->name(); if (subgraph_k->is_instance_klass() && name != vmSymbols::java_lang_Class() && name != vmSymbols::java_lang_String() && @@ -2337,10 +2031,17 @@ void HeapShared::add_to_dumped_interned_strings(oop string) { bool created; _dumped_interned_strings->put_if_absent(string, true, &created); if (created) { + // Prevent string deduplication from changing the value field to + // something not in the archive. + java_lang_String::set_deduplication_forbidden(string); _dumped_interned_strings->maybe_grow(); } } +bool HeapShared::is_dumped_interned_string(oop o) { + return _dumped_interned_strings->get(o) != nullptr; +} + void HeapShared::debug_trace() { ResourceMark rm; WalkOopAndArchiveClosure* walker = WalkOopAndArchiveClosure::current(); @@ -2417,18 +2118,18 @@ void HeapShared::print_stats() { size_t byte_size_limit = (size_t(1) << i) * HeapWordSize; size_t count = _alloc_count[i]; size_t size = _alloc_size[i]; - log_info(cds, heap)(SIZE_FORMAT_W(8) " objects are <= " SIZE_FORMAT_W(-6) - " bytes (total " SIZE_FORMAT_W(8) " bytes, avg %8.1f bytes)", + log_info(cds, heap)("%8zu objects are <= %-6zu" + " bytes (total %8zu bytes, avg %8.1f bytes)", count, byte_size_limit, size * HeapWordSize, avg_size(size, count)); huge_count -= count; huge_size -= size; } - log_info(cds, heap)(SIZE_FORMAT_W(8) " huge objects (total " SIZE_FORMAT_W(8) " bytes" + log_info(cds, heap)("%8zu huge objects (total %8zu bytes" ", avg %8.1f bytes)", huge_count, huge_size * HeapWordSize, avg_size(huge_size, huge_count)); - log_info(cds, heap)(SIZE_FORMAT_W(8) " total objects (total " SIZE_FORMAT_W(8) " bytes" + log_info(cds, heap)("%8zu total objects (total %8zu bytes" ", avg %8.1f bytes)", _total_obj_count, _total_obj_size * HeapWordSize, avg_size(_total_obj_size, _total_obj_count)); diff --git a/src/hotspot/share/cds/heapShared.hpp b/src/hotspot/share/cds/heapShared.hpp index 618adeb308f94..08541a273e6b7 100644 --- a/src/hotspot/share/cds/heapShared.hpp +++ b/src/hotspot/share/cds/heapShared.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -171,11 +171,6 @@ class HeapShared: AllStatic { static oop scratch_java_mirror(oop java_mirror) NOT_CDS_JAVA_HEAP_RETURN_(nullptr); static bool is_archived_boot_layer_available(JavaThread* current) NOT_CDS_JAVA_HEAP_RETURN_(false); - // Look for all hidden classes that are referenced by archived objects. - static void start_finding_required_hidden_classes() NOT_CDS_JAVA_HEAP_RETURN; - static void find_required_hidden_classes_in_object(oop o) NOT_CDS_JAVA_HEAP_RETURN; - static void end_finding_required_hidden_classes() NOT_CDS_JAVA_HEAP_RETURN; - private: #if INCLUDE_CDS_JAVA_HEAP static bool _disable_writing; @@ -260,9 +255,6 @@ class HeapShared: AllStatic { static DumpTimeKlassSubGraphInfoTable* _dump_time_subgraph_info_table; static RunTimeKlassSubGraphInfoTable _run_time_subgraph_info_table; - class FindRequiredHiddenClassesOopClosure; - static void find_required_hidden_classes_helper(ArchivableStaticFieldInfo fields[]); - static CachedOopInfo make_cached_oop_info(oop obj); static ArchivedKlassSubGraphInfoRecord* archive_subgraph_info(KlassSubGraphInfo* info); static void archive_object_subgraphs(ArchivableStaticFieldInfo fields[], @@ -344,9 +336,7 @@ class HeapShared: AllStatic { static bool has_been_seen_during_subgraph_recording(oop obj); static void set_has_been_seen_during_subgraph_recording(oop obj); - static bool archive_object(oop obj); - static void copy_aot_initialized_mirror(Klass* orig_k, oop orig_mirror, oop m); - static void copy_interned_strings(); + static bool archive_object(oop obj, KlassSubGraphInfo* subgraph_info); static void resolve_classes_for_subgraphs(JavaThread* current, ArchivableStaticFieldInfo fields[]); static void resolve_classes_for_subgraph_of(JavaThread* current, Klass* k); @@ -369,14 +359,8 @@ class HeapShared: AllStatic { static void mark_native_pointers(oop orig_obj); static bool has_been_archived(oop orig_obj); static void prepare_resolved_references(); - static void archive_java_mirrors(); static void archive_strings(); - static void copy_special_subgraph(); - - class AOTInitializedClassScanner; - static void find_all_aot_initialized_classes(); - static void find_all_aot_initialized_classes_helper(); - static bool scan_for_aot_initialized_classes(oop obj); + static void archive_subgraphs(); public: static void reset_archived_object_states(TRAPS); @@ -393,14 +377,14 @@ class HeapShared: AllStatic { } static int archive_exception_instance(oop exception); - static void archive_objects(ArchiveHeapInfo* heap_info); - static void copy_objects(); + static void write_heap(ArchiveHeapInfo* heap_info); static bool archive_reachable_objects_from(int level, KlassSubGraphInfo* subgraph_info, oop orig_obj); static void add_to_dumped_interned_strings(oop string); + static bool is_dumped_interned_string(oop o); // Scratch objects for archiving Klass::java_mirror() static void set_scratch_java_mirror(Klass* k, oop mirror); @@ -470,6 +454,13 @@ class HeapShared: AllStatic { static bool is_lambda_proxy_klass(InstanceKlass* ik) NOT_CDS_JAVA_HEAP_RETURN_(false); static bool is_string_concat_klass(InstanceKlass* ik) NOT_CDS_JAVA_HEAP_RETURN_(false); static bool is_archivable_hidden_klass(InstanceKlass* ik) NOT_CDS_JAVA_HEAP_RETURN_(false); + + // Used by AOTArtifactFinder + static void start_scanning_for_oops(); + static void end_scanning_for_oops(); + static void scan_java_class(Klass* k); + static void scan_java_mirror(oop orig_mirror); + static void copy_and_rescan_aot_inited_mirror(InstanceKlass* ik); }; #if INCLUDE_CDS_JAVA_HEAP diff --git a/src/hotspot/share/cds/lambdaFormInvokers.cpp b/src/hotspot/share/cds/lambdaFormInvokers.cpp index 7765bc26aa3ec..ee3e9cff782ae 100644 --- a/src/hotspot/share/cds/lambdaFormInvokers.cpp +++ b/src/hotspot/share/cds/lambdaFormInvokers.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/archiveBuilder.hpp" #include "cds/lambdaFormInvokers.hpp" #include "cds/metaspaceShared.hpp" diff --git a/src/hotspot/share/cds/lambdaProxyClassDictionary.cpp b/src/hotspot/share/cds/lambdaProxyClassDictionary.cpp index b8220a34047e3..91f677055a68d 100644 --- a/src/hotspot/share/cds/lambdaProxyClassDictionary.cpp +++ b/src/hotspot/share/cds/lambdaProxyClassDictionary.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/archiveBuilder.hpp" #include "cds/lambdaProxyClassDictionary.hpp" #include "classfile/systemDictionaryShared.hpp" diff --git a/src/hotspot/share/cds/metaspaceShared.cpp b/src/hotspot/share/cds/metaspaceShared.cpp index 753160e7ec126..2020a477d73a8 100644 --- a/src/hotspot/share/cds/metaspaceShared.cpp +++ b/src/hotspot/share/cds/metaspaceShared.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,7 @@ * */ -#include "precompiled.hpp" +#include "cds/aotArtifactFinder.hpp" #include "cds/aotClassLinker.hpp" #include "cds/aotConstantPoolResolver.hpp" #include "cds/aotLinkedClassBulkLoader.hpp" @@ -122,7 +122,7 @@ bool MetaspaceShared::_use_optimized_module_handling = true; // [5] SymbolTable, StringTable, SystemDictionary, and a few other read-only data // are copied into the ro region as read-only tables. // -// The heap region is populated by HeapShared::archive_objects. +// The heap region is written by HeapShared::write_heap(). // // The bitmap region is used to relocate the ro/rw/hp regions. @@ -264,7 +264,7 @@ static char* compute_shared_base(size_t cds_max) { void MetaspaceShared::initialize_for_static_dump() { assert(CDSConfig::is_dumping_static_archive(), "sanity"); - log_info(cds)("Core region alignment: " SIZE_FORMAT, core_region_alignment()); + log_info(cds)("Core region alignment: %zu", core_region_alignment()); // The max allowed size for CDS archive. We use this to limit SharedBaseAddress // to avoid address space wrap around. size_t cds_max; @@ -285,7 +285,7 @@ void MetaspaceShared::initialize_for_static_dump() { size_t symbol_rs_size = LP64_ONLY(3 * G) NOT_LP64(128 * M); _symbol_rs = MemoryReserver::reserve(symbol_rs_size, mtClassShared); if (!_symbol_rs.is_reserved()) { - log_error(cds)("Unable to reserve memory for symbols: " SIZE_FORMAT " bytes.", symbol_rs_size); + log_error(cds)("Unable to reserve memory for symbols: %zu bytes.", symbol_rs_size); MetaspaceShared::unrecoverable_writing_error(); } _symbol_region.init(&_symbol_rs, &_symbol_vs); @@ -544,6 +544,7 @@ class StaticArchiveBuilder : public ArchiveBuilder { virtual void iterate_roots(MetaspaceClosure* it) { FileMapInfo::metaspace_pointers_do(it); + AOTArtifactFinder::all_cached_classes_do(it); SystemDictionaryShared::dumptime_classes_do(it); Universe::metaspace_pointers_do(it); vmSymbols::metaspace_pointers_do(it); @@ -614,7 +615,15 @@ void VM_PopulateDumpSharedSpace::doit() { // Block concurrent class unloading from changing the _dumptime_table MutexLocker ml(DumpTimeTable_lock, Mutex::_no_safepoint_check_flag); - SystemDictionaryShared::find_all_archivable_classes(); + +#if INCLUDE_CDS_JAVA_HEAP + if (HeapShared::can_write() && _extra_interned_strings != nullptr) { + for (int i = 0; i < _extra_interned_strings->length(); i ++) { + OopHandle string = _extra_interned_strings->at(i); + HeapShared::add_to_dumped_interned_strings(string.resolve()); + } + } +#endif _builder.gather_source_objs(); _builder.reserve_buffer(); @@ -626,13 +635,13 @@ void VM_PopulateDumpSharedSpace::doit() { _builder.dump_ro_metadata(); _builder.relocate_metaspaceobj_embedded_pointers(); - dump_java_heap_objects(_builder.klasses()); - dump_shared_symbol_table(_builder.symbols()); - log_info(cds)("Make classes shareable"); _builder.make_klasses_shareable(); MetaspaceShared::make_method_handle_intrinsics_shareable(); + dump_java_heap_objects(_builder.klasses()); + dump_shared_symbol_table(_builder.symbols()); + char* early_serialized_data = dump_early_read_only_tables(); char* serialized_data = dump_read_only_tables(); @@ -759,7 +768,7 @@ void MetaspaceShared::preload_and_dump(TRAPS) { if (HAS_PENDING_EXCEPTION) { if (PENDING_EXCEPTION->is_a(vmClasses::OutOfMemoryError_klass())) { log_error(cds)("Out of memory. Please run with a larger Java heap, current MaxHeapSize = " - SIZE_FORMAT "M", MaxHeapSize/M); + "%zuM", MaxHeapSize/M); MetaspaceShared::writing_error(); } else { log_error(cds)("%s: %s", PENDING_EXCEPTION->klass()->external_name(), @@ -788,15 +797,15 @@ void MetaspaceShared::adjust_heap_sizes_for_dumping() { julong max_heap_size = (julong)(4 * G); if (MinHeapSize > max_heap_size) { - log_debug(cds)("Setting MinHeapSize to 4G for CDS dumping, original size = " SIZE_FORMAT "M", MinHeapSize/M); + log_debug(cds)("Setting MinHeapSize to 4G for CDS dumping, original size = %zuM", MinHeapSize/M); FLAG_SET_ERGO(MinHeapSize, max_heap_size); } if (InitialHeapSize > max_heap_size) { - log_debug(cds)("Setting InitialHeapSize to 4G for CDS dumping, original size = " SIZE_FORMAT "M", InitialHeapSize/M); + log_debug(cds)("Setting InitialHeapSize to 4G for CDS dumping, original size = %zuM", InitialHeapSize/M); FLAG_SET_ERGO(InitialHeapSize, max_heap_size); } if (MaxHeapSize > max_heap_size) { - log_debug(cds)("Setting MaxHeapSize to 4G for CDS dumping, original size = " SIZE_FORMAT "M", MaxHeapSize/M); + log_debug(cds)("Setting MaxHeapSize to 4G for CDS dumping, original size = %zuM", MaxHeapSize/M); FLAG_SET_ERGO(MaxHeapSize, max_heap_size); } } @@ -987,8 +996,10 @@ bool MetaspaceShared::try_link_class(JavaThread* current, InstanceKlass* ik) { ik->external_name()); CLEAR_PENDING_EXCEPTION; SystemDictionaryShared::set_class_has_failed_verification(ik); + } else { + assert(!SystemDictionaryShared::has_class_failed_verification(ik), "sanity"); + ik->compute_has_loops_flag_for_methods(); } - ik->compute_has_loops_flag_for_methods(); BytecodeVerificationLocal = saved; return true; } else { @@ -998,7 +1009,7 @@ bool MetaspaceShared::try_link_class(JavaThread* current, InstanceKlass* ik) { #if INCLUDE_CDS_JAVA_HEAP void VM_PopulateDumpSharedSpace::dump_java_heap_objects(GrowableArray* klasses) { - if(!HeapShared::can_write()) { + if (!HeapShared::can_write()) { log_info(cds)( "Archived java heap is not supported as UseG1GC " "and UseCompressedClassPointers are required." @@ -1006,25 +1017,7 @@ void VM_PopulateDumpSharedSpace::dump_java_heap_objects(GrowableArray* k BOOL_TO_STR(UseG1GC), BOOL_TO_STR(UseCompressedClassPointers)); return; } - // Find all the interned strings that should be dumped. - int i; - for (i = 0; i < klasses->length(); i++) { - Klass* k = klasses->at(i); - if (k->is_instance_klass()) { - InstanceKlass* ik = InstanceKlass::cast(k); - ik->constants()->add_dumped_interned_strings(); - } - } - if (_extra_interned_strings != nullptr) { - for (i = 0; i < _extra_interned_strings->length(); i ++) { - OopHandle string = _extra_interned_strings->at(i); - HeapShared::add_to_dumped_interned_strings(string.resolve()); - } - } - - HeapShared::archive_objects(&_heap_info); - ArchiveBuilder::OtherROAllocMark mark; - HeapShared::write_subgraph_info_table(); + HeapShared::write_heap(&_heap_info); } #endif // INCLUDE_CDS_JAVA_HEAP @@ -1088,7 +1081,7 @@ void MetaspaceShared::initialize_runtime_shared_and_meta_spaces() { FileMapInfo* dynamic_mapinfo = nullptr; if (static_mapinfo != nullptr) { - log_info(cds)("Core region alignment: " SIZE_FORMAT, static_mapinfo->core_region_alignment()); + log_info(cds)("Core region alignment: %zu", static_mapinfo->core_region_alignment()); dynamic_mapinfo = open_dynamic_archive(); // First try to map at the requested address @@ -1242,9 +1235,9 @@ MapArchiveResult MetaspaceShared::map_archives(FileMapInfo* static_mapinfo, File } #endif // ASSERT - log_info(cds)("Reserved archive_space_rs [" INTPTR_FORMAT " - " INTPTR_FORMAT "] (" SIZE_FORMAT ") bytes", + log_info(cds)("Reserved archive_space_rs [" INTPTR_FORMAT " - " INTPTR_FORMAT "] (%zu) bytes", p2i(archive_space_rs.base()), p2i(archive_space_rs.end()), archive_space_rs.size()); - log_info(cds)("Reserved class_space_rs [" INTPTR_FORMAT " - " INTPTR_FORMAT "] (" SIZE_FORMAT ") bytes", + log_info(cds)("Reserved class_space_rs [" INTPTR_FORMAT " - " INTPTR_FORMAT "] (%zu) bytes", p2i(class_space_rs.base()), p2i(class_space_rs.end()), class_space_rs.size()); if (MetaspaceShared::use_windows_memory_mapping()) { @@ -1473,8 +1466,7 @@ char* MetaspaceShared::reserve_address_space_for_archives(FileMapInfo* static_ma size_t class_space_size = CompressedClassSpaceSize; assert(CompressedClassSpaceSize > 0 && is_aligned(CompressedClassSpaceSize, class_space_alignment), - "CompressedClassSpaceSize malformed: " - SIZE_FORMAT, CompressedClassSpaceSize); + "CompressedClassSpaceSize malformed: %zu", CompressedClassSpaceSize); const size_t ccs_begin_offset = align_up(archive_space_size, class_space_alignment); const size_t gap_size = ccs_begin_offset - archive_space_size; @@ -1484,7 +1476,7 @@ char* MetaspaceShared::reserve_address_space_for_archives(FileMapInfo* static_ma guarantee(archive_space_size < max_encoding_range_size - class_space_alignment, "Archive too large"); if ((archive_space_size + gap_size + class_space_size) > max_encoding_range_size) { class_space_size = align_down(max_encoding_range_size - archive_space_size - gap_size, class_space_alignment); - log_info(metaspace)("CDS initialization: reducing class space size from " SIZE_FORMAT " to " SIZE_FORMAT, + log_info(metaspace)("CDS initialization: reducing class space size from %zu to %zu", CompressedClassSpaceSize, class_space_size); FLAG_SET_ERGO(CompressedClassSpaceSize, class_space_size); } @@ -1606,8 +1598,8 @@ MapArchiveResult MetaspaceShared::map_archive(FileMapInfo* mapinfo, char* mapped mapinfo->set_is_mapped(false); if (mapinfo->core_region_alignment() != (size_t)core_region_alignment()) { - log_info(cds)("Unable to map CDS archive -- core_region_alignment() expected: " SIZE_FORMAT - " actual: " SIZE_FORMAT, mapinfo->core_region_alignment(), core_region_alignment()); + log_info(cds)("Unable to map CDS archive -- core_region_alignment() expected: %zu" + " actual: %zu", mapinfo->core_region_alignment(), core_region_alignment()); return MAP_ARCHIVE_OTHER_FAILURE; } @@ -1776,7 +1768,7 @@ void MetaspaceShared::print_on(outputStream* st) { address static_top = (address)_shared_metaspace_static_top; address top = (address)MetaspaceObj::shared_metaspace_top(); st->print("[" PTR_FORMAT "-" PTR_FORMAT "-" PTR_FORMAT "), ", p2i(base), p2i(static_top), p2i(top)); - st->print("size " SIZE_FORMAT ", ", top - base); + st->print("size %zu, ", top - base); st->print("SharedBaseAddress: " PTR_FORMAT ", ArchiveRelocationMode: %d.", SharedBaseAddress, ArchiveRelocationMode); } else { st->print("CDS archive(s) not mapped"); diff --git a/src/hotspot/share/cds/metaspaceShared.hpp b/src/hotspot/share/cds/metaspaceShared.hpp index 8c20378649187..6d5f273041a83 100644 --- a/src/hotspot/share/cds/metaspaceShared.hpp +++ b/src/hotspot/share/cds/metaspaceShared.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,7 +41,6 @@ class SerializeClosure; class StaticArchiveBuilder; template class Array; -template class GrowableArray; enum MapArchiveResult { MAP_ARCHIVE_SUCCESS, diff --git a/src/hotspot/share/cds/regeneratedClasses.cpp b/src/hotspot/share/cds/regeneratedClasses.cpp index 6c7be18edd90b..37d5e89598a7c 100644 --- a/src/hotspot/share/cds/regeneratedClasses.cpp +++ b/src/hotspot/share/cds/regeneratedClasses.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/archiveBuilder.hpp" #include "cds/regeneratedClasses.hpp" #include "memory/universe.hpp" diff --git a/src/hotspot/share/cds/runTimeClassInfo.cpp b/src/hotspot/share/cds/runTimeClassInfo.cpp index e2d41cd1de261..3d237e6759aaf 100644 --- a/src/hotspot/share/cds/runTimeClassInfo.cpp +++ b/src/hotspot/share/cds/runTimeClassInfo.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/archiveBuilder.hpp" #include "cds/dumpTimeClassInfo.hpp" #include "cds/runTimeClassInfo.hpp" diff --git a/src/hotspot/share/cds/unregisteredClasses.cpp b/src/hotspot/share/cds/unregisteredClasses.cpp index 2aeb2fc94e77f..ca52eb1ea70ff 100644 --- a/src/hotspot/share/cds/unregisteredClasses.cpp +++ b/src/hotspot/share/cds/unregisteredClasses.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/unregisteredClasses.hpp" #include "classfile/classFileStream.hpp" #include "classfile/classLoader.inline.hpp" diff --git a/src/hotspot/share/ci/bcEscapeAnalyzer.cpp b/src/hotspot/share/ci/bcEscapeAnalyzer.cpp index 16ecab7dfac05..cf7b839c98241 100644 --- a/src/hotspot/share/ci/bcEscapeAnalyzer.cpp +++ b/src/hotspot/share/ci/bcEscapeAnalyzer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/vmIntrinsics.hpp" #include "ci/bcEscapeAnalyzer.hpp" #include "ci/ciConstant.hpp" diff --git a/src/hotspot/share/ci/ciArray.cpp b/src/hotspot/share/ci/ciArray.cpp index 6f601c87ff2de..6b1a30fec6aa8 100644 --- a/src/hotspot/share/ci/ciArray.cpp +++ b/src/hotspot/share/ci/ciArray.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciArray.hpp" #include "ci/ciArrayKlass.hpp" #include "ci/ciConstant.hpp" diff --git a/src/hotspot/share/ci/ciArrayKlass.cpp b/src/hotspot/share/ci/ciArrayKlass.cpp index 6bcb2526cd693..947cc0cb6fcb2 100644 --- a/src/hotspot/share/ci/ciArrayKlass.cpp +++ b/src/hotspot/share/ci/ciArrayKlass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciArrayKlass.hpp" #include "ci/ciObjArrayKlass.hpp" #include "ci/ciTypeArrayKlass.hpp" diff --git a/src/hotspot/share/ci/ciBaseObject.cpp b/src/hotspot/share/ci/ciBaseObject.cpp index aeeaad73fbf82..8c4a9c5cb122f 100644 --- a/src/hotspot/share/ci/ciBaseObject.cpp +++ b/src/hotspot/share/ci/ciBaseObject.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciBaseObject.hpp" #include "ci/ciUtilities.hpp" #include "gc/shared/collectedHeap.inline.hpp" diff --git a/src/hotspot/share/ci/ciCallSite.cpp b/src/hotspot/share/ci/ciCallSite.cpp index 8b67d9ec6ac59..3271e4ea7c7a5 100644 --- a/src/hotspot/share/ci/ciCallSite.cpp +++ b/src/hotspot/share/ci/ciCallSite.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/javaClasses.inline.hpp" #include "ci/ciCallSite.hpp" #include "ci/ciUtilities.inline.hpp" diff --git a/src/hotspot/share/ci/ciConstant.cpp b/src/hotspot/share/ci/ciConstant.cpp index 62ff0ab08c914..234cd8171c46b 100644 --- a/src/hotspot/share/ci/ciConstant.cpp +++ b/src/hotspot/share/ci/ciConstant.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciConstant.hpp" #include "ci/ciUtilities.hpp" #include "memory/allocation.hpp" diff --git a/src/hotspot/share/ci/ciConstantPoolCache.cpp b/src/hotspot/share/ci/ciConstantPoolCache.cpp index e831516b0f70b..cfb031aff60b5 100644 --- a/src/hotspot/share/ci/ciConstantPoolCache.cpp +++ b/src/hotspot/share/ci/ciConstantPoolCache.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciConstantPoolCache.hpp" #include "ci/ciUtilities.inline.hpp" #include "memory/allocation.hpp" diff --git a/src/hotspot/share/ci/ciEnv.cpp b/src/hotspot/share/ci/ciEnv.cpp index eb7d1eaf64dd4..e87c5ba08e95e 100644 --- a/src/hotspot/share/ci/ciEnv.cpp +++ b/src/hotspot/share/ci/ciEnv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciConstant.hpp" #include "ci/ciEnv.hpp" #include "ci/ciField.hpp" diff --git a/src/hotspot/share/ci/ciExceptionHandler.cpp b/src/hotspot/share/ci/ciExceptionHandler.cpp index 6c30e71596545..1896ada69fc3a 100644 --- a/src/hotspot/share/ci/ciExceptionHandler.cpp +++ b/src/hotspot/share/ci/ciExceptionHandler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciExceptionHandler.hpp" #include "ci/ciUtilities.inline.hpp" #include "runtime/handles.inline.hpp" diff --git a/src/hotspot/share/ci/ciField.cpp b/src/hotspot/share/ci/ciField.cpp index 0eddd87200ae0..44d7fa3796051 100644 --- a/src/hotspot/share/ci/ciField.cpp +++ b/src/hotspot/share/ci/ciField.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciField.hpp" #include "ci/ciInstanceKlass.hpp" #include "ci/ciSymbols.hpp" diff --git a/src/hotspot/share/ci/ciFlags.cpp b/src/hotspot/share/ci/ciFlags.cpp index 1401a432a9e18..5eade4a12c168 100644 --- a/src/hotspot/share/ci/ciFlags.cpp +++ b/src/hotspot/share/ci/ciFlags.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciFlags.hpp" // ciFlags @@ -92,5 +91,5 @@ void ciFlags::print_member_flags(outputStream* st) { // ------------------------------------------------------------------ // ciFlags::print void ciFlags::print(outputStream* st) { - st->print(" flags=%x", _flags); + st->print(" flags=%x", _flags.as_unsigned_short()); } diff --git a/src/hotspot/share/ci/ciFlags.hpp b/src/hotspot/share/ci/ciFlags.hpp index dd1df622487f3..426f953611fee 100644 --- a/src/hotspot/share/ci/ciFlags.hpp +++ b/src/hotspot/share/ci/ciFlags.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,6 @@ #define SHARE_CI_CIFLAGS_HPP #include "ci/ciClassList.hpp" -#include "jvm_constants.h" #include "utilities/accessFlags.hpp" #include "utilities/ostream.hpp" @@ -39,37 +38,37 @@ class ciFlags { friend class ciField; friend class ciMethod; - jint _flags; + AccessFlags _flags; bool _stable; - bool _intialized_final_update; + bool _initialized_final_update; - ciFlags() :_flags(0), _stable(false), _intialized_final_update(false) { } + ciFlags() :_flags(0), _stable(false), _initialized_final_update(false) { } ciFlags(AccessFlags flags, bool is_stable = false, bool is_initialized_final_update = false) : - _flags(flags.as_int()), _stable(is_stable), _intialized_final_update(is_initialized_final_update) { } + _flags(flags), _stable(is_stable), _initialized_final_update(is_initialized_final_update) { } public: // Java access flags - bool is_public () const { return (_flags & JVM_ACC_PUBLIC ) != 0; } - bool is_private () const { return (_flags & JVM_ACC_PRIVATE ) != 0; } - bool is_protected () const { return (_flags & JVM_ACC_PROTECTED ) != 0; } - bool is_static () const { return (_flags & JVM_ACC_STATIC ) != 0; } - bool is_final () const { return (_flags & JVM_ACC_FINAL ) != 0; } - bool is_synchronized () const { return (_flags & JVM_ACC_SYNCHRONIZED ) != 0; } - bool is_super () const { return (_flags & JVM_ACC_SUPER ) != 0; } - bool is_volatile () const { return (_flags & JVM_ACC_VOLATILE ) != 0; } - bool is_transient () const { return (_flags & JVM_ACC_TRANSIENT ) != 0; } - bool is_native () const { return (_flags & JVM_ACC_NATIVE ) != 0; } - bool is_interface () const { return (_flags & JVM_ACC_INTERFACE ) != 0; } - bool is_abstract () const { return (_flags & JVM_ACC_ABSTRACT ) != 0; } + bool is_public () const { return _flags.is_public(); } + bool is_private () const { return _flags.is_private(); } + bool is_protected () const { return _flags.is_protected(); } + bool is_static () const { return _flags.is_static(); } + bool is_final () const { return _flags.is_final(); } + bool is_synchronized () const { return _flags.is_synchronized(); } + bool is_super () const { return _flags.is_super(); } + bool is_volatile () const { return _flags.is_volatile(); } + bool is_transient () const { return _flags.is_transient(); } + bool is_native () const { return _flags.is_native(); } + bool is_interface () const { return _flags.is_interface(); } + bool is_abstract () const { return _flags.is_abstract(); } bool is_stable () const { return _stable; } // In case the current object represents a field, return true if // the field is modified outside of instance initializer methods // (or class/initializer methods if the field is static) and false // otherwise. - bool has_initialized_final_update() const { return _intialized_final_update; }; + bool has_initialized_final_update() const { return _initialized_final_update; }; // Conversion - jint as_int() { return _flags; } + jint as_int() { return _flags.as_unsigned_short(); } void print_klass_flags(outputStream* st = tty); void print_member_flags(outputStream* st = tty); diff --git a/src/hotspot/share/ci/ciInstance.cpp b/src/hotspot/share/ci/ciInstance.cpp index 6ede59dd72309..edd8f8b0f4067 100644 --- a/src/hotspot/share/ci/ciInstance.cpp +++ b/src/hotspot/share/ci/ciInstance.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/javaClasses.inline.hpp" #include "ci/ciConstant.hpp" #include "ci/ciField.hpp" diff --git a/src/hotspot/share/ci/ciInstanceKlass.cpp b/src/hotspot/share/ci/ciInstanceKlass.cpp index a9342eeada48b..94655e017ca14 100644 --- a/src/hotspot/share/ci/ciInstanceKlass.cpp +++ b/src/hotspot/share/ci/ciInstanceKlass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciField.hpp" #include "ci/ciInstance.hpp" #include "ci/ciInstanceKlass.hpp" diff --git a/src/hotspot/share/ci/ciKlass.cpp b/src/hotspot/share/ci/ciKlass.cpp index f65d4a0311c82..f3e49634d2984 100644 --- a/src/hotspot/share/ci/ciKlass.cpp +++ b/src/hotspot/share/ci/ciKlass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciKlass.hpp" #include "ci/ciSymbol.hpp" #include "ci/ciUtilities.inline.hpp" @@ -222,7 +221,7 @@ jint ciKlass::modifier_flags() { jint ciKlass::access_flags() { assert(is_loaded(), "not loaded"); GUARDED_VM_ENTRY( - return get_Klass()->access_flags().as_int(); + return get_Klass()->access_flags().as_unsigned_short(); ) } diff --git a/src/hotspot/share/ci/ciMemberName.cpp b/src/hotspot/share/ci/ciMemberName.cpp index 4306e6e649ee2..aec4d4c4d19c1 100644 --- a/src/hotspot/share/ci/ciMemberName.cpp +++ b/src/hotspot/share/ci/ciMemberName.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciClassList.hpp" #include "ci/ciMemberName.hpp" #include "ci/ciUtilities.inline.hpp" diff --git a/src/hotspot/share/ci/ciMetadata.cpp b/src/hotspot/share/ci/ciMetadata.cpp index f0d1fcf4357e0..a2c21289a2cb6 100644 --- a/src/hotspot/share/ci/ciMetadata.cpp +++ b/src/hotspot/share/ci/ciMetadata.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciObject.hpp" #include "ci/ciUtilities.inline.hpp" #include "gc/shared/collectedHeap.inline.hpp" diff --git a/src/hotspot/share/ci/ciMethod.cpp b/src/hotspot/share/ci/ciMethod.cpp index 80277b91d2264..96cb0bb904094 100644 --- a/src/hotspot/share/ci/ciMethod.cpp +++ b/src/hotspot/share/ci/ciMethod.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciCallProfile.hpp" #include "ci/ciExceptionHandler.hpp" #include "ci/ciInstanceKlass.hpp" diff --git a/src/hotspot/share/ci/ciMethodBlocks.cpp b/src/hotspot/share/ci/ciMethodBlocks.cpp index 03dd2c31f993a..ea2ea04e8c072 100644 --- a/src/hotspot/share/ci/ciMethodBlocks.cpp +++ b/src/hotspot/share/ci/ciMethodBlocks.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciMethodBlocks.hpp" #include "ci/ciStreams.hpp" #include "interpreter/bytecode.hpp" diff --git a/src/hotspot/share/ci/ciMethodData.cpp b/src/hotspot/share/ci/ciMethodData.cpp index 5abb342d03119..a37e4ba75e6f5 100644 --- a/src/hotspot/share/ci/ciMethodData.cpp +++ b/src/hotspot/share/ci/ciMethodData.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciMetadata.hpp" #include "ci/ciMethodData.hpp" #include "ci/ciReplay.hpp" @@ -785,7 +784,7 @@ void ciMethodData::dump_replay_data(outputStream* out) { // We could use INTPTR_FORMAT here but that's zero justified // which makes comparing it with the SA version of this output // harder. data()'s element type is intptr_t. - out->print(" " INTX_FORMAT_X, data()[i]); + out->print(" 0x%zx", data()[i]); } // The MDO contained oop references as ciObjects, so scan for those diff --git a/src/hotspot/share/ci/ciMethodHandle.cpp b/src/hotspot/share/ci/ciMethodHandle.cpp index 49de75353a63f..2e2a57036a687 100644 --- a/src/hotspot/share/ci/ciMethodHandle.cpp +++ b/src/hotspot/share/ci/ciMethodHandle.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciClassList.hpp" #include "ci/ciMethodHandle.hpp" #include "ci/ciUtilities.inline.hpp" diff --git a/src/hotspot/share/ci/ciMethodType.cpp b/src/hotspot/share/ci/ciMethodType.cpp index f9cd22001a310..3051dbeeddd8f 100644 --- a/src/hotspot/share/ci/ciMethodType.cpp +++ b/src/hotspot/share/ci/ciMethodType.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciInstance.hpp" #include "ci/ciMethodType.hpp" #include "ci/ciUtilities.inline.hpp" diff --git a/src/hotspot/share/ci/ciNullObject.cpp b/src/hotspot/share/ci/ciNullObject.cpp index e79b8dc5ecea0..c030d9f57371f 100644 --- a/src/hotspot/share/ci/ciNullObject.cpp +++ b/src/hotspot/share/ci/ciNullObject.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciNullObject.hpp" #include "ci/ciUtilities.hpp" diff --git a/src/hotspot/share/ci/ciObjArray.cpp b/src/hotspot/share/ci/ciObjArray.cpp index d06665d616393..2a485fb26182d 100644 --- a/src/hotspot/share/ci/ciObjArray.cpp +++ b/src/hotspot/share/ci/ciObjArray.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciNullObject.hpp" #include "ci/ciObjArray.hpp" #include "ci/ciUtilities.inline.hpp" diff --git a/src/hotspot/share/ci/ciObjArrayKlass.cpp b/src/hotspot/share/ci/ciObjArrayKlass.cpp index 1b47702599b53..191e4e67522ac 100644 --- a/src/hotspot/share/ci/ciObjArrayKlass.cpp +++ b/src/hotspot/share/ci/ciObjArrayKlass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciInstanceKlass.hpp" #include "ci/ciObjArrayKlass.hpp" #include "ci/ciSymbol.hpp" diff --git a/src/hotspot/share/ci/ciObject.cpp b/src/hotspot/share/ci/ciObject.cpp index 2fe8b91b8215f..23696b6b70a8d 100644 --- a/src/hotspot/share/ci/ciObject.cpp +++ b/src/hotspot/share/ci/ciObject.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciObject.hpp" #include "ci/ciUtilities.inline.hpp" #include "gc/shared/collectedHeap.inline.hpp" diff --git a/src/hotspot/share/ci/ciObjectFactory.cpp b/src/hotspot/share/ci/ciObjectFactory.cpp index bf8e561d1a298..bbda155a2a515 100644 --- a/src/hotspot/share/ci/ciObjectFactory.cpp +++ b/src/hotspot/share/ci/ciObjectFactory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciCallSite.hpp" #include "ci/ciInstance.hpp" #include "ci/ciInstanceKlass.hpp" diff --git a/src/hotspot/share/ci/ciReplay.cpp b/src/hotspot/share/ci/ciReplay.cpp index c4127263df1cf..1385bb637a99d 100644 --- a/src/hotspot/share/ci/ciReplay.cpp +++ b/src/hotspot/share/ci/ciReplay.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciMethodData.hpp" #include "ci/ciReplay.hpp" #include "ci/ciSymbol.hpp" diff --git a/src/hotspot/share/ci/ciSignature.cpp b/src/hotspot/share/ci/ciSignature.cpp index efa056ef985f2..973e96b93ba2b 100644 --- a/src/hotspot/share/ci/ciSignature.cpp +++ b/src/hotspot/share/ci/ciSignature.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciMethodType.hpp" #include "ci/ciSignature.hpp" #include "ci/ciStreams.hpp" diff --git a/src/hotspot/share/ci/ciStreams.cpp b/src/hotspot/share/ci/ciStreams.cpp index 18d2a46a6862c..259e72a341259 100644 --- a/src/hotspot/share/ci/ciStreams.cpp +++ b/src/hotspot/share/ci/ciStreams.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciConstant.hpp" #include "ci/ciField.hpp" #include "ci/ciKlass.hpp" diff --git a/src/hotspot/share/ci/ciSymbol.cpp b/src/hotspot/share/ci/ciSymbol.cpp index 40b23deaa7f9d..c3e2b8d53e4b0 100644 --- a/src/hotspot/share/ci/ciSymbol.cpp +++ b/src/hotspot/share/ci/ciSymbol.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciSymbol.hpp" #include "ci/ciSymbols.hpp" #include "ci/ciUtilities.inline.hpp" diff --git a/src/hotspot/share/ci/ciType.cpp b/src/hotspot/share/ci/ciType.cpp index 05645478086c1..9340f1cda3db2 100644 --- a/src/hotspot/share/ci/ciType.cpp +++ b/src/hotspot/share/ci/ciType.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciEnv.hpp" #include "ci/ciType.hpp" #include "ci/ciUtilities.inline.hpp" diff --git a/src/hotspot/share/ci/ciTypeArray.cpp b/src/hotspot/share/ci/ciTypeArray.cpp index fb7c2b04646b1..5182cfef53676 100644 --- a/src/hotspot/share/ci/ciTypeArray.cpp +++ b/src/hotspot/share/ci/ciTypeArray.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciTypeArray.hpp" #include "ci/ciUtilities.inline.hpp" #include "oops/typeArrayOop.inline.hpp" diff --git a/src/hotspot/share/ci/ciTypeArrayKlass.cpp b/src/hotspot/share/ci/ciTypeArrayKlass.cpp index 6a5d5faadc6fd..59b687ccb8bc7 100644 --- a/src/hotspot/share/ci/ciTypeArrayKlass.cpp +++ b/src/hotspot/share/ci/ciTypeArrayKlass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciTypeArrayKlass.hpp" #include "ci/ciUtilities.inline.hpp" #include "memory/universe.hpp" diff --git a/src/hotspot/share/ci/ciTypeFlow.cpp b/src/hotspot/share/ci/ciTypeFlow.cpp index 36b4a2991cc9e..3caca6424bc98 100644 --- a/src/hotspot/share/ci/ciTypeFlow.cpp +++ b/src/hotspot/share/ci/ciTypeFlow.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciConstant.hpp" #include "ci/ciField.hpp" #include "ci/ciMethod.hpp" diff --git a/src/hotspot/share/ci/ciUtilities.cpp b/src/hotspot/share/ci/ciUtilities.cpp index 931a1c75d605a..1a91ded937142 100644 --- a/src/hotspot/share/ci/ciUtilities.cpp +++ b/src/hotspot/share/ci/ciUtilities.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciUtilities.hpp" #include "gc/shared/cardTableBarrierSet.hpp" #include "gc/shared/cardTable.hpp" diff --git a/src/hotspot/share/classfile/altHashing.cpp b/src/hotspot/share/classfile/altHashing.cpp index 1d43d6ebf1ed0..1f7a84f745c2b 100644 --- a/src/hotspot/share/classfile/altHashing.cpp +++ b/src/hotspot/share/classfile/altHashing.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ . */ -#include "precompiled.hpp" #include "classfile/altHashing.hpp" #include "classfile/vmClasses.hpp" #include "oops/klass.inline.hpp" diff --git a/src/hotspot/share/classfile/bytecodeAssembler.cpp b/src/hotspot/share/classfile/bytecodeAssembler.cpp index e1e54b56e412b..6c34d160042ba 100644 --- a/src/hotspot/share/classfile/bytecodeAssembler.cpp +++ b/src/hotspot/share/classfile/bytecodeAssembler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/bytecodeAssembler.hpp" #include "classfile/vmSymbols.hpp" diff --git a/src/hotspot/share/classfile/classFileError.cpp b/src/hotspot/share/classfile/classFileError.cpp index 634a1fbeafbae..b0a61e8cbd5d0 100644 --- a/src/hotspot/share/classfile/classFileError.cpp +++ b/src/hotspot/share/classfile/classFileError.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classFileParser.hpp" #include "classfile/stackMapTable.hpp" #include "classfile/verifier.hpp" diff --git a/src/hotspot/share/classfile/classFileParser.cpp b/src/hotspot/share/classfile/classFileParser.cpp index 5c58f20000616..92d31c48ca814 100644 --- a/src/hotspot/share/classfile/classFileParser.cpp +++ b/src/hotspot/share/classfile/classFileParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. * */ -#include "precompiled.hpp" #include "cds/cdsConfig.hpp" #include "classfile/classFileParser.hpp" #include "classfile/classFileStream.hpp" @@ -2127,7 +2126,7 @@ Method* ClassFileParser::parse_method(const ClassFileStream* const cfs, // access_flags, name_index, descriptor_index, attributes_count cfs->guarantee_more(8, CHECK_NULL); - int flags = cfs->get_u2_fast(); + u2 flags = cfs->get_u2_fast(); const u2 name_index = cfs->get_u2_fast(); const int cp_size = cp->length(); guarantee_property( @@ -2981,7 +2980,7 @@ u2 ClassFileParser::parse_classfile_inner_classes_attribute(const ClassFileStrea "Class is both outer and inner class in class file %s", CHECK_0); } // Access flags - jint flags; + u2 flags; // JVM_ACC_MODULE is defined in JDK-9 and later. if (_major_version >= JAVA_9_VERSION) { flags = cfs->get_u2_fast() & (RECOGNIZED_INNER_CLASS_MODIFIERS | JVM_ACC_MODULE); @@ -2998,7 +2997,7 @@ u2 ClassFileParser::parse_classfile_inner_classes_attribute(const ClassFileStrea inner_classes->at_put(index++, inner_class_info_index); inner_classes->at_put(index++, outer_class_info_index); inner_classes->at_put(index++, inner_name_index); - inner_classes->at_put(index++, inner_access_flags.as_short()); + inner_classes->at_put(index++, inner_access_flags.as_unsigned_short()); } // Check for circular and duplicate entries. @@ -3750,7 +3749,7 @@ void ClassFileParser::apply_parsed_class_metadata( // Initialize cached modifier_flags to support Class.getModifiers(). // This must follow setting inner_class attributes. - int computed_modifiers = this_klass->compute_modifier_flags(); + u2 computed_modifiers = this_klass->compute_modifier_flags(); this_klass->set_modifier_flags(computed_modifiers); // Delay the setting of _local_interfaces and _transitive_interfaces until after @@ -5336,7 +5335,7 @@ ClassFileParser::ClassFileParser(ClassFileStream* stream, assert(_stream != nullptr, "invariant"); assert(_stream->buffer() == _stream->current(), "invariant"); assert(_class_name != nullptr, "invariant"); - assert(0 == _access_flags.as_int(), "invariant"); + assert(0 == _access_flags.as_unsigned_short(), "invariant"); // Figure out whether we can skip format checking (matching classic VM behavior) _need_verify = Verifier::should_verify_for(_loader_data->class_loader()); @@ -5488,7 +5487,7 @@ void ClassFileParser::parse_stream(const ClassFileStream* const stream, stream->guarantee_more(8, CHECK); // flags, this_class, super_class, infs_len // Access flags - jint flags; + u2 flags; // JVM_ACC_MODULE is defined in JDK-9 and later. if (_major_version >= JAVA_9_VERSION) { flags = stream->get_u2_fast() & (JVM_RECOGNIZED_CLASS_MODIFIERS | JVM_ACC_MODULE); @@ -5663,7 +5662,7 @@ void ClassFileParser::mangle_hidden_class_name(InstanceKlass* const ik) { static volatile size_t counter = 0; Atomic::cmpxchg(&counter, (size_t)0, Arguments::default_SharedBaseAddress()); // initialize it size_t new_id = Atomic::add(&counter, (size_t)1); - jio_snprintf(addr_buf, 20, SIZE_FORMAT_X, new_id); + jio_snprintf(addr_buf, 20, "0x%zx", new_id); } else { jio_snprintf(addr_buf, 20, INTPTR_FORMAT, p2i(ik)); } diff --git a/src/hotspot/share/classfile/classFileStream.cpp b/src/hotspot/share/classfile/classFileStream.cpp index a934cbafa45dd..0fc3e5b390c03 100644 --- a/src/hotspot/share/classfile/classFileStream.cpp +++ b/src/hotspot/share/classfile/classFileStream.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classFileStream.hpp" #include "classfile/classLoader.hpp" #include "classfile/vmSymbols.hpp" diff --git a/src/hotspot/share/classfile/classLoader.cpp b/src/hotspot/share/classfile/classLoader.cpp index 83d0e803ee10e..fa003756685ea 100644 --- a/src/hotspot/share/classfile/classLoader.cpp +++ b/src/hotspot/share/classfile/classLoader.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/cds_globals.hpp" #include "cds/cdsConfig.hpp" #include "cds/filemap.hpp" diff --git a/src/hotspot/share/classfile/classLoaderData.cpp b/src/hotspot/share/classfile/classLoaderData.cpp index de0b16a907afb..825072cb13bef 100644 --- a/src/hotspot/share/classfile/classLoaderData.cpp +++ b/src/hotspot/share/classfile/classLoaderData.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,7 +46,6 @@ // The bootstrap loader (represented by null) also has a ClassLoaderData, // the singleton class the_null_class_loader_data(). -#include "precompiled.hpp" #include "classfile/classLoaderData.inline.hpp" #include "classfile/classLoaderDataGraph.inline.hpp" #include "classfile/dictionary.hpp" diff --git a/src/hotspot/share/classfile/classLoaderDataGraph.cpp b/src/hotspot/share/classfile/classLoaderDataGraph.cpp index c7051cd58e7d6..fca6a9e74ad31 100644 --- a/src/hotspot/share/classfile/classLoaderDataGraph.cpp +++ b/src/hotspot/share/classfile/classLoaderDataGraph.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderData.inline.hpp" #include "classfile/classLoaderDataGraph.inline.hpp" #include "classfile/dictionary.hpp" diff --git a/src/hotspot/share/classfile/classLoaderDataShared.cpp b/src/hotspot/share/classfile/classLoaderDataShared.cpp index 8abe469ea2531..16a16b3a16ffe 100644 --- a/src/hotspot/share/classfile/classLoaderDataShared.cpp +++ b/src/hotspot/share/classfile/classLoaderDataShared.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/cdsConfig.hpp" #include "cds/serializeClosure.hpp" #include "classfile/classLoaderData.inline.hpp" diff --git a/src/hotspot/share/classfile/classLoaderExt.cpp b/src/hotspot/share/classfile/classLoaderExt.cpp index f7b2906394d54..dc38c84f4c219 100644 --- a/src/hotspot/share/classfile/classLoaderExt.cpp +++ b/src/hotspot/share/classfile/classLoaderExt.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/cds_globals.hpp" #include "cds/cdsConfig.hpp" #include "cds/dynamicArchive.hpp" diff --git a/src/hotspot/share/classfile/classLoaderHierarchyDCmd.cpp b/src/hotspot/share/classfile/classLoaderHierarchyDCmd.cpp index 8a8113db4036d..2eadb813d7eee 100644 --- a/src/hotspot/share/classfile/classLoaderHierarchyDCmd.cpp +++ b/src/hotspot/share/classfile/classLoaderHierarchyDCmd.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderData.inline.hpp" #include "classfile/classLoaderDataGraph.hpp" diff --git a/src/hotspot/share/classfile/classLoaderStats.cpp b/src/hotspot/share/classfile/classLoaderStats.cpp index 5fbd4ce00d922..d74e8c1deba2e 100644 --- a/src/hotspot/share/classfile/classLoaderStats.cpp +++ b/src/hotspot/share/classfile/classLoaderStats.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderData.inline.hpp" #include "classfile/classLoaderDataGraph.hpp" #include "classfile/classLoaderStats.hpp" @@ -112,7 +111,7 @@ bool ClassLoaderStatsClosure::do_entry(oop const& key, ClassLoaderStats const& c Klass* class_loader_klass = (cls._class_loader == nullptr ? nullptr : cls._class_loader->klass()); Klass* parent_klass = (cls._parent == nullptr ? nullptr : cls._parent->klass()); - _out->print(INTPTR_FORMAT " " INTPTR_FORMAT " " INTPTR_FORMAT " " UINTX_FORMAT_W(6) " " SIZE_FORMAT_W(8) " " SIZE_FORMAT_W(8) " ", + _out->print(INTPTR_FORMAT " " INTPTR_FORMAT " " INTPTR_FORMAT " %6zu %8zu %8zu ", p2i(class_loader_klass), p2i(parent_klass), p2i(cls._cld), cls._classes_count, cls._chunk_sz, cls._block_sz); @@ -123,7 +122,7 @@ bool ClassLoaderStatsClosure::do_entry(oop const& key, ClassLoaderStats const& c } _out->cr(); if (cls._hidden_classes_count > 0) { - _out->print_cr(SPACE SPACE SPACE " " UINTX_FORMAT_W(6) " " SIZE_FORMAT_W(8) " " SIZE_FORMAT_W(8) " + hidden classes", + _out->print_cr(SPACE SPACE SPACE " %6zu %8zu %8zu + hidden classes", "", "", "", cls._hidden_classes_count, cls._hidden_chunk_sz, cls._hidden_block_sz); @@ -135,9 +134,9 @@ bool ClassLoaderStatsClosure::do_entry(oop const& key, ClassLoaderStats const& c void ClassLoaderStatsClosure::print() { _out->print_cr("ClassLoader" SPACE " Parent" SPACE " CLD*" SPACE " Classes ChunkSz BlockSz Type", "", "", ""); _stats->iterate(this); - _out->print("Total = " UINTX_FORMAT_W(-6), _total_loaders); + _out->print("Total = %-6zu", _total_loaders); _out->print(SPACE SPACE SPACE " ", "", "", ""); - _out->print_cr(UINTX_FORMAT_W(6) " " SIZE_FORMAT_W(8) " " SIZE_FORMAT_W(8) " ", + _out->print_cr("%6zu %8zu %8zu ", _total_classes, _total_chunk_sz, _total_block_sz); diff --git a/src/hotspot/share/classfile/classPrinter.cpp b/src/hotspot/share/classfile/classPrinter.cpp index 45a1eff4aed7b..c4b6a024242e7 100644 --- a/src/hotspot/share/classfile/classPrinter.cpp +++ b/src/hotspot/share/classfile/classPrinter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderData.hpp" #include "classfile/classLoaderDataGraph.hpp" #include "classfile/classPrinter.hpp" diff --git a/src/hotspot/share/classfile/compactHashtable.cpp b/src/hotspot/share/classfile/compactHashtable.cpp index 2df8d47a3f4cb..5a3c6998904db 100644 --- a/src/hotspot/share/classfile/compactHashtable.cpp +++ b/src/hotspot/share/classfile/compactHashtable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/archiveBuilder.hpp" #include "cds/cds_globals.hpp" #include "cds/cdsConfig.hpp" diff --git a/src/hotspot/share/classfile/defaultMethods.cpp b/src/hotspot/share/classfile/defaultMethods.cpp index 58d24c16ad3d8..75bc33a308307 100644 --- a/src/hotspot/share/classfile/defaultMethods.cpp +++ b/src/hotspot/share/classfile/defaultMethods.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/cdsConfig.hpp" #include "classfile/bytecodeAssembler.hpp" #include "classfile/defaultMethods.hpp" diff --git a/src/hotspot/share/classfile/dictionary.cpp b/src/hotspot/share/classfile/dictionary.cpp index a6df19ef91598..0f79e7a5a69b5 100644 --- a/src/hotspot/share/classfile/dictionary.cpp +++ b/src/hotspot/share/classfile/dictionary.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/cdsConfig.hpp" #include "classfile/classLoaderData.inline.hpp" #include "classfile/dictionary.hpp" @@ -46,7 +45,7 @@ Dictionary::Dictionary(ClassLoaderData* loader_data, size_t table_size) size_t start_size_log_2 = MAX2(log2i_ceil(table_size), 2); // 2 is minimum size even though some dictionaries only have one entry size_t current_size = ((size_t)1) << start_size_log_2; - log_info(class, loader, data)("Dictionary start size: " SIZE_FORMAT " (" SIZE_FORMAT ")", + log_info(class, loader, data)("Dictionary start size: %zu (%zu)", current_size, start_size_log_2); _table = new ConcurrentTable(start_size_log_2, END_SIZE, REHASH_LEN); } diff --git a/src/hotspot/share/classfile/fieldLayoutBuilder.cpp b/src/hotspot/share/classfile/fieldLayoutBuilder.cpp index f9353465ca7c4..1af9bb8336194 100644 --- a/src/hotspot/share/classfile/fieldLayoutBuilder.cpp +++ b/src/hotspot/share/classfile/fieldLayoutBuilder.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classFileParser.hpp" #include "classfile/fieldLayoutBuilder.hpp" #include "jvm.h" diff --git a/src/hotspot/share/classfile/javaAssertions.cpp b/src/hotspot/share/classfile/javaAssertions.cpp index cf51bfb21d676..2a8f94d81b95b 100644 --- a/src/hotspot/share/classfile/javaAssertions.cpp +++ b/src/hotspot/share/classfile/javaAssertions.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/javaAssertions.hpp" #include "classfile/javaClasses.hpp" #include "classfile/symbolTable.hpp" diff --git a/src/hotspot/share/classfile/javaClasses.cpp b/src/hotspot/share/classfile/javaClasses.cpp index 1aedb43973c57..4c698170079ba 100644 --- a/src/hotspot/share/classfile/javaClasses.cpp +++ b/src/hotspot/share/classfile/javaClasses.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/archiveBuilder.hpp" #include "cds/archiveHeapLoader.hpp" #include "cds/cdsConfig.hpp" @@ -1242,8 +1241,8 @@ void java_lang_Class::fixup_module_field(Klass* k, Handle module) { void java_lang_Class::set_oop_size(HeapWord* java_class, size_t size) { assert(_oop_size_offset != 0, "must be set"); - assert(size > 0, "Oop size must be greater than zero, not " SIZE_FORMAT, size); - assert(size <= INT_MAX, "Lossy conversion: " SIZE_FORMAT, size); + assert(size > 0, "Oop size must be greater than zero, not %zu", size); + assert(size <= INT_MAX, "Lossy conversion: %zu", size); *(int*)(((char*)java_class) + _oop_size_offset) = (int)size; } @@ -3169,7 +3168,7 @@ void java_lang_ClassFrameInfo::serialize_offsets(SerializeClosure* f) { #endif static int get_flags(const methodHandle& m) { - int flags = (jushort)( m->access_flags().as_short() & JVM_RECOGNIZED_METHOD_MODIFIERS ); + int flags = m->access_flags().as_method_flags(); if (m->is_object_initializer()) { flags |= java_lang_invoke_MemberName::MN_IS_CONSTRUCTOR; } else { @@ -5537,7 +5536,7 @@ int InjectedField::compute_offset() { ik->print(); tty->print_cr("all fields:"); for (AllFieldStream fs(ik); !fs.done(); fs.next()) { - tty->print_cr(" name: %s, sig: %s, flags: %08x", fs.name()->as_C_string(), fs.signature()->as_C_string(), fs.access_flags().as_int()); + tty->print_cr(" name: %s, sig: %s, flags: %08x", fs.name()->as_C_string(), fs.signature()->as_C_string(), fs.access_flags().as_field_flags()); } #endif //PRODUCT vm_exit_during_initialization("Invalid layout of well-known class: use -Xlog:class+load=info to see the origin of the problem class"); diff --git a/src/hotspot/share/classfile/javaClasses.hpp b/src/hotspot/share/classfile/javaClasses.hpp index 0d0fa5954b1e7..c75261981cffa 100644 --- a/src/hotspot/share/classfile/javaClasses.hpp +++ b/src/hotspot/share/classfile/javaClasses.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -321,12 +321,12 @@ class java_lang_Class : AllStatic { set_init_lock(java_class, nullptr); } static oop component_mirror(oop java_class); + static int component_mirror_offset() { return _component_mirror_offset; } static objArrayOop signers(oop java_class); static oop class_data(oop java_class); static void set_class_data(oop java_class, oop classData); static void set_reflection_data(oop java_class, oop reflection_data); - - static int component_mirror_offset() { return _component_mirror_offset; } + static int reflection_data_offset() { return _reflectionData_offset; } static oop class_loader(oop java_class); static void set_module(oop java_class, oop module); diff --git a/src/hotspot/share/classfile/klassFactory.cpp b/src/hotspot/share/classfile/klassFactory.cpp index 493fc27dd4308..52da747d8b6e9 100644 --- a/src/hotspot/share/classfile/klassFactory.cpp +++ b/src/hotspot/share/classfile/klassFactory.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/cdsConfig.hpp" #include "cds/filemap.hpp" #include "classfile/classFileParser.hpp" diff --git a/src/hotspot/share/classfile/loaderConstraints.cpp b/src/hotspot/share/classfile/loaderConstraints.cpp index 99d0c07ed42d4..21161f443260c 100644 --- a/src/hotspot/share/classfile/loaderConstraints.cpp +++ b/src/hotspot/share/classfile/loaderConstraints.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderData.inline.hpp" #include "classfile/classLoaderDataGraph.hpp" #include "classfile/dictionary.hpp" diff --git a/src/hotspot/share/classfile/metadataOnStackMark.cpp b/src/hotspot/share/classfile/metadataOnStackMark.cpp index faf1053dd87e8..51ce2c263a357 100644 --- a/src/hotspot/share/classfile/metadataOnStackMark.cpp +++ b/src/hotspot/share/classfile/metadataOnStackMark.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/metadataOnStackMark.hpp" #include "code/codeCache.hpp" #include "compiler/compileBroker.hpp" diff --git a/src/hotspot/share/classfile/moduleEntry.cpp b/src/hotspot/share/classfile/moduleEntry.cpp index 3283e9705b3c4..a0f9afdc98272 100644 --- a/src/hotspot/share/classfile/moduleEntry.cpp +++ b/src/hotspot/share/classfile/moduleEntry.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/archiveBuilder.hpp" #include "cds/archiveUtils.hpp" #include "cds/cdsConfig.hpp" @@ -400,7 +399,12 @@ ModuleEntry* ModuleEntry::allocate_archived_entry() const { assert(is_named(), "unnamed packages/modules are not archived"); ModuleEntry* archived_entry = (ModuleEntry*)ArchiveBuilder::rw_region_alloc(sizeof(ModuleEntry)); memcpy((void*)archived_entry, (void*)this, sizeof(ModuleEntry)); - archived_entry->_archived_module_index = -1; + + if (CDSConfig::is_dumping_full_module_graph()) { + archived_entry->_archived_module_index = HeapShared::append_root(module()); + } else { + archived_entry->_archived_module_index = -1; + } if (_archive_modules_entries == nullptr) { _archive_modules_entries = new (mtClass)ArchivedModuleEntries(); @@ -409,6 +413,14 @@ ModuleEntry* ModuleEntry::allocate_archived_entry() const { _archive_modules_entries->put(this, archived_entry); DEBUG_ONLY(_num_archived_module_entries++); + assert(archived_entry->shared_protection_domain() == nullptr, "never set during -Xshare:dump"); + // Clear handles and restore at run time. Handles cannot be archived. + OopHandle null_handle; + archived_entry->_module = null_handle; + + // For verify_archived_module_entries() + DEBUG_ONLY(_num_inited_module_entries++); + if (log_is_enabled(Info, cds, module)) { ResourceMark rm; LogStream ls(Log(cds, module)::info()); @@ -489,22 +501,6 @@ void ModuleEntry::init_as_archived_entry() { ArchivePtrMarker::mark_pointer((address*)&_location); } -void ModuleEntry::update_oops_in_archived_module(int root_oop_index) { - assert(CDSConfig::is_dumping_full_module_graph(), "sanity"); - assert(_archived_module_index == -1, "must be set exactly once"); - assert(root_oop_index >= 0, "sanity"); - - _archived_module_index = root_oop_index; - - assert(shared_protection_domain() == nullptr, "never set during -Xshare:dump"); - // Clear handles and restore at run time. Handles cannot be archived. - OopHandle null_handle; - _module = null_handle; - - // For verify_archived_module_entries() - DEBUG_ONLY(_num_inited_module_entries++); -} - #ifndef PRODUCT void ModuleEntry::verify_archived_module_entries() { assert(_num_archived_module_entries == _num_inited_module_entries, diff --git a/src/hotspot/share/classfile/modules.cpp b/src/hotspot/share/classfile/modules.cpp index 7e26febda89f2..950ca699a8e92 100644 --- a/src/hotspot/share/classfile/modules.cpp +++ b/src/hotspot/share/classfile/modules.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/archiveBuilder.hpp" #include "cds/cdsConfig.hpp" #include "cds/metaspaceShared.hpp" @@ -483,9 +482,7 @@ static bool _seen_platform_unnamed_module = false; static bool _seen_system_unnamed_module = false; // Validate the states of an java.lang.Module oop to be archived. -// -// Returns true iff the oop has an archived ModuleEntry. -bool Modules::check_archived_module_oop(oop orig_module_obj) { +void Modules::check_archived_module_oop(oop orig_module_obj) { assert(CDSConfig::is_dumping_full_module_graph(), "must be"); assert(java_lang_Module::is_instance(orig_module_obj), "must be"); @@ -498,7 +495,6 @@ bool Modules::check_archived_module_oop(oop orig_module_obj) { // jdk.internal.loader.ClassLoaders$BootClassLoader::unnamedModule log_info(cds, module)("Archived java.lang.Module oop " PTR_FORMAT " with no ModuleEntry*", p2i(orig_module_obj)); assert(java_lang_Module::name(orig_module_obj) == nullptr, "must be unnamed"); - return false; } else { // This java.lang.Module oop has an ModuleEntry*. Check if the latter is archived. if (log_is_enabled(Info, cds, module)) { @@ -516,7 +512,6 @@ bool Modules::check_archived_module_oop(oop orig_module_obj) { if (orig_module_ent->name() != nullptr) { // For each named module, we archive both the java.lang.Module oop and the ModuleEntry. assert(orig_module_ent->has_been_archived(), "sanity"); - return true; } else { // We only archive two unnamed module oops (for platform and system loaders). These do NOT have an archived // ModuleEntry. @@ -538,24 +533,10 @@ bool Modules::check_archived_module_oop(oop orig_module_obj) { // not in the archived module graph. These are always allocated at runtime. ShouldNotReachHere(); } - return false; } } } -void Modules::update_oops_in_archived_module(oop orig_module_obj, int archived_module_root_index) { - // This java.lang.Module oop must have an archived ModuleEntry - assert(check_archived_module_oop(orig_module_obj) == true, "sanity"); - - // We remember the oop inside the ModuleEntry::_archived_module_index. At runtime, we use - // this index to reinitialize the ModuleEntry inside ModuleEntry::restore_archived_oops(). - // - // ModuleEntry::verify_archived_module_entries(), called below, ensures that every archived - // ModuleEntry has been assigned an _archived_module_index. - ModuleEntry* orig_module_ent = java_lang_Module::module_entry_raw(orig_module_obj); - ModuleEntry::get_archived_entry(orig_module_ent)->update_oops_in_archived_module(archived_module_root_index); -} - void Modules::verify_archived_modules() { ModuleEntry::verify_archived_module_entries(); } @@ -628,12 +609,14 @@ void Modules::serialize(SerializeClosure* soc) { } void Modules::dump_native_access_flag() { + ResourceMark rm; const char* native_access_names = get_native_access_flags_as_sorted_string(); if (native_access_names != nullptr) { _archived_native_access_flags = ArchiveBuilder::current()->ro_strdup(native_access_names); } } +// Caller needs ResourceMark const char* Modules::get_native_access_flags_as_sorted_string() { return get_numbered_property_as_sorted_string("jdk.module.enable.native.access"); } @@ -641,6 +624,7 @@ const char* Modules::get_native_access_flags_as_sorted_string() { void Modules::serialize_native_access_flags(SerializeClosure* soc) { soc->do_ptr(&_archived_native_access_flags); if (soc->reading()) { + ResourceMark rm; check_archived_flag_consistency(_archived_native_access_flags, get_native_access_flags_as_sorted_string(), "jdk.module.enable.native.access"); // Don't hold onto the pointer, in case we might decide to unmap the archive. @@ -649,12 +633,14 @@ void Modules::serialize_native_access_flags(SerializeClosure* soc) { } void Modules::dump_addmods_names() { + ResourceMark rm; const char* addmods_names = get_addmods_names_as_sorted_string(); if (addmods_names != nullptr) { _archived_addmods_names = ArchiveBuilder::current()->ro_strdup(addmods_names); } } +// Caller needs ResourceMark const char* Modules::get_addmods_names_as_sorted_string() { return get_numbered_property_as_sorted_string("jdk.module.addmods"); } @@ -662,6 +648,7 @@ const char* Modules::get_addmods_names_as_sorted_string() { void Modules::serialize_addmods_names(SerializeClosure* soc) { soc->do_ptr(&_archived_addmods_names); if (soc->reading()) { + ResourceMark rm; check_archived_flag_consistency(_archived_addmods_names, get_addmods_names_as_sorted_string(), "jdk.module.addmods"); // Don't hold onto the pointer, in case we might decide to unmap the archive. @@ -669,8 +656,8 @@ void Modules::serialize_addmods_names(SerializeClosure* soc) { } } +// Caller needs ResourceMark const char* Modules::get_numbered_property_as_sorted_string(const char* property) { - ResourceMark rm; // theoretical string size limit for decimal int, but the following loop will end much sooner due to // OS command-line size limit. const int max_digits = 10; @@ -723,7 +710,7 @@ const char* Modules::get_numbered_property_as_sorted_string(const char* property } } - return (st.size() > 0) ? os::strdup(st.as_string()) : nullptr; // Example: "java.base,java.compiler" + return (st.size() > 0) ? st.as_string() : nullptr; // Example: "java.base,java.compiler" } void Modules::define_archived_modules(Handle h_platform_loader, Handle h_system_loader, TRAPS) { diff --git a/src/hotspot/share/classfile/modules.hpp b/src/hotspot/share/classfile/modules.hpp index 03069bd345209..2c23ab5f6ea65 100644 --- a/src/hotspot/share/classfile/modules.hpp +++ b/src/hotspot/share/classfile/modules.hpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -53,9 +53,7 @@ class Modules : AllStatic { static void define_module(Handle module, jboolean is_open, jstring version, jstring location, jobjectArray packages, TRAPS); - static bool check_archived_module_oop(oop orig_module_obj) NOT_CDS_JAVA_HEAP_RETURN_(false); - static void update_oops_in_archived_module(oop orig_module_obj, int archived_module_root_index) - NOT_CDS_JAVA_HEAP_RETURN; + static void check_archived_module_oop(oop orig_module_obj) NOT_CDS_JAVA_HEAP_RETURN; static void define_archived_modules(Handle h_platform_loader, Handle h_system_loader, TRAPS) NOT_CDS_JAVA_HEAP_RETURN; static void verify_archived_modules() NOT_CDS_JAVA_HEAP_RETURN; diff --git a/src/hotspot/share/classfile/packageEntry.cpp b/src/hotspot/share/classfile/packageEntry.cpp index 052960e1735dd..eaa311c4bd386 100644 --- a/src/hotspot/share/classfile/packageEntry.cpp +++ b/src/hotspot/share/classfile/packageEntry.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/archiveBuilder.hpp" #include "cds/archiveUtils.hpp" #include "cds/cdsConfig.hpp" diff --git a/src/hotspot/share/classfile/placeholders.cpp b/src/hotspot/share/classfile/placeholders.cpp index 38d359efcc245..6ee421fa023e9 100644 --- a/src/hotspot/share/classfile/placeholders.cpp +++ b/src/hotspot/share/classfile/placeholders.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderData.inline.hpp" #include "classfile/placeholders.hpp" #include "logging/log.hpp" diff --git a/src/hotspot/share/classfile/resolutionErrors.cpp b/src/hotspot/share/classfile/resolutionErrors.cpp index 1f2e75e92571f..03af71bc26f71 100644 --- a/src/hotspot/share/classfile/resolutionErrors.cpp +++ b/src/hotspot/share/classfile/resolutionErrors.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/resolutionErrors.hpp" #include "memory/allocation.hpp" #include "oops/constantPool.hpp" diff --git a/src/hotspot/share/classfile/stackMapFrame.cpp b/src/hotspot/share/classfile/stackMapFrame.cpp index d9a5fa5ce93cf..c71a278e0b8d0 100644 --- a/src/hotspot/share/classfile/stackMapFrame.cpp +++ b/src/hotspot/share/classfile/stackMapFrame.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/stackMapFrame.hpp" #include "classfile/verifier.hpp" #include "classfile/vmSymbols.hpp" diff --git a/src/hotspot/share/classfile/stackMapTable.cpp b/src/hotspot/share/classfile/stackMapTable.cpp index fa2a57f96b473..b66416ff1bf7f 100644 --- a/src/hotspot/share/classfile/stackMapTable.cpp +++ b/src/hotspot/share/classfile/stackMapTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/stackMapTable.hpp" #include "classfile/verifier.hpp" #include "memory/resourceArea.hpp" diff --git a/src/hotspot/share/classfile/stringTable.cpp b/src/hotspot/share/classfile/stringTable.cpp index d6aedcbb157fb..7aa6f044bd585 100644 --- a/src/hotspot/share/classfile/stringTable.cpp +++ b/src/hotspot/share/classfile/stringTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/archiveBuilder.hpp" #include "cds/archiveHeapLoader.inline.hpp" #include "cds/archiveHeapWriter.hpp" @@ -311,7 +310,7 @@ class StringTableLookupOop : public StringTableLookup { void StringTable::create_table() { size_t start_size_log_2 = log2i_ceil(StringTableSize); _current_size = ((size_t)1) << start_size_log_2; - log_trace(stringtable)("Start size: " SIZE_FORMAT " (" SIZE_FORMAT ")", + log_trace(stringtable)("Start size: %zu (%zu)", _current_size, start_size_log_2); _local_table = new StringTableHash(start_size_log_2, END_SIZE, REHASH_LEN, true); _oop_storage = OopStorageSet::create_weak("StringTable Weak", mtSymbol); @@ -582,7 +581,7 @@ void StringTable::grow(JavaThread* jt) { } gt.done(jt); _current_size = table_size(); - log_debug(stringtable)("Grown to size:" SIZE_FORMAT, _current_size); + log_debug(stringtable)("Grown to size:%zu", _current_size); } struct StringTableDoDelete : StackObj { @@ -631,7 +630,7 @@ void StringTable::clean_dead_entries(JavaThread* jt) { } void StringTable::gc_notification(size_t num_dead) { - log_trace(stringtable)("Uncleaned items:" SIZE_FORMAT, num_dead); + log_trace(stringtable)("Uncleaned items:%zu", num_dead); if (has_work()) { return; @@ -1012,20 +1011,14 @@ void StringTable::verify_secondary_array_index_bits() { // For each shared string: // [1] Store it into _shared_strings_array. Encode its position as a 32-bit index. // [2] Store the index and hashcode into _shared_table. -oop StringTable::init_shared_table(const DumpedInternedStrings* dumped_interned_strings) { +oop StringTable::init_shared_strings_array(const DumpedInternedStrings* dumped_interned_strings) { assert(HeapShared::can_write(), "must be"); objArrayOop array = (objArrayOop)(_shared_strings_array.resolve()); verify_secondary_array_index_bits(); - _shared_table.reset(); - CompactHashtableWriter writer((int)_items_count, ArchiveBuilder::string_stats()); - int index = 0; auto copy_into_array = [&] (oop string, bool value_ignored) { - unsigned int hash = java_lang_String::hash_code(string); - writer.add(hash, index); - if (!_is_two_dimensional_shared_strings_array) { assert(index < array->length(), "no strings should have been added"); array->obj_at_put(index, string); @@ -1045,11 +1038,24 @@ oop StringTable::init_shared_table(const DumpedInternedStrings* dumped_interned_ }; dumped_interned_strings->iterate_all(copy_into_array); - writer.dump(&_shared_table, "string"); - return array; } +void StringTable::write_shared_table(const DumpedInternedStrings* dumped_interned_strings) { + _shared_table.reset(); + CompactHashtableWriter writer((int)_items_count, ArchiveBuilder::string_stats()); + + int index = 0; + auto copy_into_shared_table = [&] (oop string, bool value_ignored) { + unsigned int hash = java_lang_String::hash_code(string); + writer.add(hash, index); + index ++; + }; + dumped_interned_strings->iterate_all(copy_into_shared_table); + + writer.dump(&_shared_table, "string"); +} + void StringTable::set_shared_strings_array_index(int root_index) { _shared_strings_array_root_index = root_index; } diff --git a/src/hotspot/share/classfile/stringTable.hpp b/src/hotspot/share/classfile/stringTable.hpp index 38abb9c875c8d..0d58e09f2083a 100644 --- a/src/hotspot/share/classfile/stringTable.hpp +++ b/src/hotspot/share/classfile/stringTable.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -148,7 +148,8 @@ class StringTable : AllStatic { static oop lookup_shared(const jchar* name, int len) NOT_CDS_JAVA_HEAP_RETURN_(nullptr); static size_t shared_entry_count() NOT_CDS_JAVA_HEAP_RETURN_(0); static void allocate_shared_strings_array(TRAPS) NOT_CDS_JAVA_HEAP_RETURN; - static oop init_shared_table(const DumpedInternedStrings* dumped_interned_strings) NOT_CDS_JAVA_HEAP_RETURN_(nullptr); + static oop init_shared_strings_array(const DumpedInternedStrings* dumped_interned_strings) NOT_CDS_JAVA_HEAP_RETURN_(nullptr); + static void write_shared_table(const DumpedInternedStrings* dumped_interned_strings) NOT_CDS_JAVA_HEAP_RETURN; static void set_shared_strings_array_index(int root_index) NOT_CDS_JAVA_HEAP_RETURN; static void serialize_shared_table_header(SerializeClosure* soc) NOT_CDS_JAVA_HEAP_RETURN; diff --git a/src/hotspot/share/classfile/symbolTable.cpp b/src/hotspot/share/classfile/symbolTable.cpp index 040ba4795e45a..84c0a5a39dee0 100644 --- a/src/hotspot/share/classfile/symbolTable.cpp +++ b/src/hotspot/share/classfile/symbolTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/archiveBuilder.hpp" #include "cds/cdsConfig.hpp" #include "cds/dynamicArchive.hpp" @@ -214,7 +213,7 @@ class SymbolTableConfig : public AllStatic { void SymbolTable::create_table () { size_t start_size_log_2 = log2i_ceil(SymbolTableSize); _current_size = ((size_t)1) << start_size_log_2; - log_trace(symboltable)("Start size: " SIZE_FORMAT " (" SIZE_FORMAT ")", + log_trace(symboltable)("Start size: %zu (%zu)", _current_size, start_size_log_2); _local_table = new SymbolTableHash(start_size_log_2, END_SIZE, REHASH_LEN, true); @@ -749,7 +748,7 @@ void SymbolTable::grow(JavaThread* jt) { } gt.done(jt); _current_size = table_size(); - log_debug(symboltable)("Grown to size:" SIZE_FORMAT, _current_size); + log_debug(symboltable)("Grown to size:%zu", _current_size); } struct SymbolTableDoDelete : StackObj { @@ -798,7 +797,7 @@ void SymbolTable::clean_dead_entries(JavaThread* jt) { Atomic::add(&_symbols_counted, stdc._processed); - log_debug(symboltable)("Cleaned " SIZE_FORMAT " of " SIZE_FORMAT, + log_debug(symboltable)("Cleaned %zu of %zu", stdd._deleted, stdc._processed); } @@ -931,29 +930,29 @@ void SymbolTable::print_histogram() { HistogramIterator hi; _local_table->do_scan(Thread::current(), hi); tty->print_cr("Symbol Table Histogram:"); - tty->print_cr(" Total number of symbols " SIZE_FORMAT_W(7), hi.total_count); - tty->print_cr(" Total size in memory " SIZE_FORMAT_W(7) "K", (hi.total_size * wordSize) / K); - tty->print_cr(" Total counted " SIZE_FORMAT_W(7), _symbols_counted); - tty->print_cr(" Total removed " SIZE_FORMAT_W(7), _symbols_removed); + tty->print_cr(" Total number of symbols %7zu", hi.total_count); + tty->print_cr(" Total size in memory %7zuK", (hi.total_size * wordSize) / K); + tty->print_cr(" Total counted %7zu", _symbols_counted); + tty->print_cr(" Total removed %7zu", _symbols_removed); if (_symbols_counted > 0) { tty->print_cr(" Percent removed %3.2f", ((double)_symbols_removed / (double)_symbols_counted) * 100); } - tty->print_cr(" Reference counts " SIZE_FORMAT_W(7), Symbol::_total_count); - tty->print_cr(" Symbol arena used " SIZE_FORMAT_W(7) "K", arena()->used() / K); - tty->print_cr(" Symbol arena size " SIZE_FORMAT_W(7) "K", arena()->size_in_bytes() / K); - tty->print_cr(" Total symbol length " SIZE_FORMAT_W(7), hi.total_length); - tty->print_cr(" Maximum symbol length " SIZE_FORMAT_W(7), hi.max_length); + tty->print_cr(" Reference counts %7zu", Symbol::_total_count); + tty->print_cr(" Symbol arena used %7zuK", arena()->used() / K); + tty->print_cr(" Symbol arena size %7zuK", arena()->size_in_bytes() / K); + tty->print_cr(" Total symbol length %7zu", hi.total_length); + tty->print_cr(" Maximum symbol length %7zu", hi.max_length); tty->print_cr(" Average symbol length %7.2f", ((double)hi.total_length / (double)hi.total_count)); tty->print_cr(" Symbol length histogram:"); tty->print_cr(" %6s %10s %10s", "Length", "#Symbols", "Size"); for (size_t i = 0; i < hi.results_length; i++) { if (hi.counts[i] > 0) { - tty->print_cr(" " SIZE_FORMAT_W(6) " " SIZE_FORMAT_W(10) " " SIZE_FORMAT_W(10) "K", + tty->print_cr(" %6zu %10zu %10zuK", i, hi.counts[i], (hi.sizes[i] * wordSize) / K); } } - tty->print_cr(" >=" SIZE_FORMAT_W(6) " " SIZE_FORMAT_W(10) " " SIZE_FORMAT_W(10) "K\n", + tty->print_cr(" >= %6zu %10zu %10zuK\n", hi.results_length, hi.out_of_range_count, (hi.out_of_range_size*wordSize) / K); } #endif // PRODUCT diff --git a/src/hotspot/share/classfile/systemDictionary.cpp b/src/hotspot/share/classfile/systemDictionary.cpp index 0cd9886bd0160..b51cfc03e7835 100644 --- a/src/hotspot/share/classfile/systemDictionary.cpp +++ b/src/hotspot/share/classfile/systemDictionary.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/cdsConfig.hpp" #include "cds/heapShared.hpp" #include "classfile/classFileParser.hpp" diff --git a/src/hotspot/share/classfile/systemDictionaryShared.cpp b/src/hotspot/share/classfile/systemDictionaryShared.cpp index 180ba73e68144..28fd53eedcd7f 100644 --- a/src/hotspot/share/classfile/systemDictionaryShared.cpp +++ b/src/hotspot/share/classfile/systemDictionaryShared.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/archiveBuilder.hpp" #include "cds/archiveHeapLoader.hpp" #include "cds/archiveUtils.hpp" @@ -205,15 +204,6 @@ DumpTimeClassInfo* SystemDictionaryShared::get_info_locked(InstanceKlass* k) { return info; } -void SystemDictionaryShared::mark_required_hidden_class(InstanceKlass* k) { - assert(k->is_hidden(), "sanity"); - DumpTimeClassInfo* info = _dumptime_table->get(k); - ResourceMark rm; - if (info != nullptr) { - info->set_is_required_hidden_class(); - } -} - bool SystemDictionaryShared::check_for_exclusion(InstanceKlass* k, DumpTimeClassInfo* info) { if (MetaspaceShared::is_in_shared_metaspace(k)) { // We have reached a super type that's already in the base archive. Treat it @@ -256,13 +246,17 @@ bool SystemDictionaryShared::is_jfr_event_class(InstanceKlass *k) { bool SystemDictionaryShared::is_registered_lambda_proxy_class(InstanceKlass* ik) { DumpTimeClassInfo* info = _dumptime_table->get(ik); - return (info != nullptr) ? info->_is_archived_lambda_proxy : false; + bool result = (info != nullptr) ? info->_is_registered_lambda_proxy : false; + if (result) { + assert(!CDSConfig::is_dumping_invokedynamic(), "only used in legacy lambda proxy support"); + } + return result; } void SystemDictionaryShared::reset_registered_lambda_proxy_class(InstanceKlass* ik) { DumpTimeClassInfo* info = _dumptime_table->get(ik); if (info != nullptr) { - info->_is_archived_lambda_proxy = false; + info->_is_registered_lambda_proxy = false; info->set_excluded(); } } @@ -340,11 +334,6 @@ bool SystemDictionaryShared::check_for_exclusion_impl(InstanceKlass* k) { } } - if (k->is_hidden() && !should_hidden_class_be_archived(k)) { - log_info(cds)("Skipping %s: Hidden class", k->name()->as_C_string()); - return true; - } - InstanceKlass* super = k->java_super(); if (super != nullptr && check_for_exclusion(super, nullptr)) { ResourceMark rm; @@ -601,9 +590,7 @@ void SystemDictionaryShared::validate_before_archiving(InstanceKlass* k) { guarantee(!info->is_excluded(), "Should not attempt to archive excluded class %s", name); if (is_builtin(k)) { if (k->is_hidden()) { - if (CDSConfig::is_dumping_invokedynamic()) { - assert(should_hidden_class_be_archived(k), "unexpected hidden class %s", name); - } else { + if (!CDSConfig::is_dumping_invokedynamic()) { assert(is_registered_lambda_proxy_class(k), "unexpected hidden class %s", name); } } @@ -657,29 +644,6 @@ class UnregisteredClassesDuplicationChecker : StackObj { } }; -void SystemDictionaryShared::scan_constant_pool(InstanceKlass* k) { - if (CDSConfig::is_dumping_invokedynamic()) { - k->constants()->find_required_hidden_classes(); - } -} - -bool SystemDictionaryShared::should_hidden_class_be_archived(InstanceKlass* k) { - assert(k->is_hidden(), "sanity"); - if (is_registered_lambda_proxy_class(k)) { - return true; - } - - if (CDSConfig::is_dumping_invokedynamic()) { - DumpTimeClassInfo* info = _dumptime_table->get(k); - if (info != nullptr && info->is_required_hidden_class()) { - guarantee(HeapShared::is_archivable_hidden_klass(k), "required hidden class must be archivable"); - return true; - } - } - - return false; -} - // Returns true if the class should be excluded. This can be called by // AOTConstantPoolResolver before or after we enter the CDS safepoint. // When called before the safepoint, we need to link the class so that @@ -729,24 +693,7 @@ bool SystemDictionaryShared::should_be_excluded(Klass* k) { } } -void SystemDictionaryShared::find_all_archivable_classes() { - HeapShared::start_finding_required_hidden_classes(); - find_all_archivable_classes_impl(); - HeapShared::end_finding_required_hidden_classes(); -} - -// Iterate over all the classes in _dumptime_table, marking the ones that must be -// excluded from the archive. Those that are not excluded will be archivable. -// -// (a) Non-hidden classes are easy. They are only check by the rules in -// SystemDictionaryShared::check_for_exclusion(). -// (b) For hidden classes, we only archive those that are required (i.e., they are -// referenced by Java objects (such as CallSites) that are reachable from -// ConstantPools). This needs help from HeapShared. -void SystemDictionaryShared::find_all_archivable_classes_impl() { - assert(!class_loading_may_happen(), "class loading must be disabled"); - assert_lock_strong(DumpTimeTable_lock); - +void SystemDictionaryShared::finish_exclusion_checks() { if (CDSConfig::is_dumping_dynamic_archive()) { // Do this first -- if a base class is excluded due to duplication, // all of its subclasses will also be excluded. @@ -756,58 +703,11 @@ void SystemDictionaryShared::find_all_archivable_classes_impl() { dup_checker.mark_duplicated_classes(); } - ResourceMark rm; + _dumptime_table->iterate_all_live_classes([&] (InstanceKlass* k, DumpTimeClassInfo& info) { + SystemDictionaryShared::check_for_exclusion(k, &info); + }); - // First, scan all non-hidden classes - auto check_non_hidden = [&] (InstanceKlass* k, DumpTimeClassInfo& info) { - if (!k->is_hidden()) { - SystemDictionaryShared::check_for_exclusion(k, &info); - if (!info.is_excluded() && !info.has_scanned_constant_pool()) { - scan_constant_pool(k); - info.set_has_scanned_constant_pool(); - } - } - }; - _dumptime_table->iterate_all_live_classes(check_non_hidden); - - // Then, scan all the hidden classes that have been marked as required to - // discover more hidden classes. Stop when we cannot make progress anymore. - bool made_progress; - do { - made_progress = false; - auto check_hidden = [&] (InstanceKlass* k, DumpTimeClassInfo& info) { - if (k->is_hidden() && should_hidden_class_be_archived(k)) { - SystemDictionaryShared::check_for_exclusion(k, &info); - if (info.is_excluded()) { - guarantee(!info.is_required_hidden_class(), "A required hidden class cannot be marked as excluded"); - } else if (!info.has_scanned_constant_pool()) { - scan_constant_pool(k); - info.set_has_scanned_constant_pool(); - // The CP entries in k *MAY* refer to other hidden classes, so scan - // every hidden class again. - made_progress = true; - } - } - }; - _dumptime_table->iterate_all_live_classes(check_hidden); - } while (made_progress); - - // Now, all hidden classes that have not yet been scanned must be marked as excluded - auto exclude_remaining_hidden = [&] (InstanceKlass* k, DumpTimeClassInfo& info) { - if (k->is_hidden()) { - SystemDictionaryShared::check_for_exclusion(k, &info); - if (CDSConfig::is_dumping_invokedynamic()) { - if (should_hidden_class_be_archived(k)) { - guarantee(!info.is_excluded(), "Must be"); - } else { - guarantee(info.is_excluded(), "Must be"); - } - } - } - }; - _dumptime_table->iterate_all_live_classes(exclude_remaining_hidden); _dumptime_table->update_counts(); - cleanup_lambda_proxy_class_dictionary(); } @@ -936,9 +836,9 @@ void SystemDictionaryShared::add_lambda_proxy_class(InstanceKlass* caller_ik, if (info != nullptr && !lambda_ik->is_non_strong_hidden() && is_builtin(lambda_ik) && is_builtin(caller_ik) // Don't include the lambda proxy if its nest host is not in the "linked" state. && nest_host->is_linked()) { - // Set _is_archived_lambda_proxy in DumpTimeClassInfo so that the lambda_ik - // won't be excluded during dumping of shared archive. See ExcludeDumpTimeSharedClasses. - info->_is_archived_lambda_proxy = true; + // Set _is_registered_lambda_proxy in DumpTimeClassInfo so that the lambda_ik + // won't be excluded during dumping of shared archive. + info->_is_registered_lambda_proxy = true; info->set_nest_host(nest_host); LambdaProxyClassKey key(caller_ik, @@ -1347,13 +1247,6 @@ class CopyLambdaProxyClassInfoToArchive : StackObj { bool do_entry(LambdaProxyClassKey& key, DumpTimeLambdaProxyClassInfo& info) { // In static dump, info._proxy_klasses->at(0) is already relocated to point to the archived class // (not the original class). - // - // The following check has been moved to SystemDictionaryShared::find_all_archivable_classes(), which - // happens before the classes are copied. - // - // if (SystemDictionaryShared::is_excluded_class(info._proxy_klasses->at(0))) { - // return true; - //} ResourceMark rm; log_info(cds,dynamic)("Archiving hidden %s", info._proxy_klasses->at(0)->external_name()); size_t byte_size = sizeof(RunTimeLambdaProxyClassInfo); diff --git a/src/hotspot/share/classfile/systemDictionaryShared.hpp b/src/hotspot/share/classfile/systemDictionaryShared.hpp index 5e0c54a6ffcc7..41e3d9c971667 100644 --- a/src/hotspot/share/classfile/systemDictionaryShared.hpp +++ b/src/hotspot/share/classfile/systemDictionaryShared.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -137,7 +137,6 @@ class SharedClassLoadingMark { }; class SystemDictionaryShared: public SystemDictionary { - friend class ExcludeDumpTimeSharedClasses; friend class CleanupDumpTimeLambdaProxyClassTable; struct ArchiveInfo { @@ -188,24 +187,20 @@ class SystemDictionaryShared: public SystemDictionary { static DumpTimeClassInfo* get_info(InstanceKlass* k); static DumpTimeClassInfo* get_info_locked(InstanceKlass* k); - static void find_all_archivable_classes_impl(); static void write_dictionary(RunTimeSharedDictionary* dictionary, bool is_builtin); static void write_lambda_proxy_class_dictionary(LambdaProxyClassDictionary* dictionary); static void cleanup_lambda_proxy_class_dictionary(); static void reset_registered_lambda_proxy_class(InstanceKlass* ik); static bool is_jfr_event_class(InstanceKlass *k); - static bool is_registered_lambda_proxy_class(InstanceKlass* ik); static bool check_for_exclusion_impl(InstanceKlass* k); static void remove_dumptime_info(InstanceKlass* k) NOT_CDS_RETURN; static bool has_been_redefined(InstanceKlass* k); static InstanceKlass* retrieve_lambda_proxy_class(const RunTimeLambdaProxyClassInfo* info) NOT_CDS_RETURN_(nullptr); - static void scan_constant_pool(InstanceKlass* k); DEBUG_ONLY(static bool _class_loading_may_happen;) public: - static bool should_hidden_class_be_archived(InstanceKlass* k); - static void mark_required_hidden_class(InstanceKlass* k); + static bool is_registered_lambda_proxy_class(InstanceKlass* ik); static bool is_hidden_lambda_proxy(InstanceKlass* ik); static bool is_early_klass(InstanceKlass* k); // Was k loaded while JvmtiExport::is_early_phase()==true static bool has_archived_enum_objs(InstanceKlass* ik); @@ -291,7 +286,9 @@ class SystemDictionaryShared: public SystemDictionary { } static bool add_unregistered_class(Thread* current, InstanceKlass* k); - static void find_all_archivable_classes(); + static void finish_exclusion_checks(); + static DumpTimeSharedClassTable* dumptime_table() { return _dumptime_table; } + static bool should_be_excluded(Klass* k); static bool check_for_exclusion(InstanceKlass* k, DumpTimeClassInfo* info); static void validate_before_archiving(InstanceKlass* k); diff --git a/src/hotspot/share/classfile/verificationType.cpp b/src/hotspot/share/classfile/verificationType.cpp index ddeee499814f8..d0541a0d20f93 100644 --- a/src/hotspot/share/classfile/verificationType.cpp +++ b/src/hotspot/share/classfile/verificationType.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/cdsConfig.hpp" #include "classfile/symbolTable.hpp" #include "classfile/systemDictionary.hpp" diff --git a/src/hotspot/share/classfile/verifier.cpp b/src/hotspot/share/classfile/verifier.cpp index 0ac2cc350b18d..95e5f55c17229 100644 --- a/src/hotspot/share/classfile/verifier.cpp +++ b/src/hotspot/share/classfile/verifier.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/cdsConfig.hpp" #include "classfile/classFileStream.hpp" #include "classfile/classLoader.hpp" diff --git a/src/hotspot/share/classfile/vmClasses.cpp b/src/hotspot/share/classfile/vmClasses.cpp index 553864ef0b991..ac359d4cacbf3 100644 --- a/src/hotspot/share/classfile/vmClasses.cpp +++ b/src/hotspot/share/classfile/vmClasses.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/aotLinkedClassBulkLoader.hpp" #include "cds/archiveHeapLoader.hpp" #include "cds/cdsConfig.hpp" diff --git a/src/hotspot/share/classfile/vmIntrinsics.cpp b/src/hotspot/share/classfile/vmIntrinsics.cpp index 407cdafaf2017..4357e44e18761 100644 --- a/src/hotspot/share/classfile/vmIntrinsics.cpp +++ b/src/hotspot/share/classfile/vmIntrinsics.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/vmIntrinsics.hpp" #include "classfile/vmSymbols.hpp" #include "compiler/compilerDirectives.hpp" @@ -36,31 +35,31 @@ #include "utilities/tribool.hpp" // These are flag-matching functions: -inline bool match_F_R(jshort flags) { +inline bool match_F_R(u2 flags) { const int req = 0; const int neg = JVM_ACC_STATIC | JVM_ACC_SYNCHRONIZED | JVM_ACC_NATIVE; return (flags & (req | neg)) == req; } -inline bool match_F_Y(jshort flags) { +inline bool match_F_Y(u2 flags) { const int req = JVM_ACC_SYNCHRONIZED; const int neg = JVM_ACC_STATIC | JVM_ACC_NATIVE; return (flags & (req | neg)) == req; } -inline bool match_F_RN(jshort flags) { +inline bool match_F_RN(u2 flags) { const int req = JVM_ACC_NATIVE; const int neg = JVM_ACC_STATIC | JVM_ACC_SYNCHRONIZED; return (flags & (req | neg)) == req; } -inline bool match_F_S(jshort flags) { +inline bool match_F_S(u2 flags) { const int req = JVM_ACC_STATIC; const int neg = JVM_ACC_SYNCHRONIZED | JVM_ACC_NATIVE; return (flags & (req | neg)) == req; } -inline bool match_F_SN(jshort flags) { +inline bool match_F_SN(u2 flags) { const int req = JVM_ACC_STATIC | JVM_ACC_NATIVE; const int neg = JVM_ACC_SYNCHRONIZED; return (flags & (req | neg)) == req; @@ -711,7 +710,7 @@ bool vmIntrinsics::is_disabled_by_flags(vmIntrinsics::ID id) { vmIntrinsics::ID vmIntrinsics::find_id_impl(vmSymbolID holder, vmSymbolID name, vmSymbolID sig, - jshort flags) { + u2 flags) { assert((int)vmSymbolID::SID_LIMIT <= (1<* CodeCache::_allocable_heaps = new(mtCode) GrowableArra static void check_min_size(const char* codeheap, size_t size, size_t required_size) { if (size < required_size) { - log_debug(codecache)("Code heap (%s) size " SIZE_FORMAT "K below required minimal size " SIZE_FORMAT "K", + log_debug(codecache)("Code heap (%s) size %zuK below required minimal size %zuK", codeheap, size/K, required_size/K); err_msg title("Not enough space in %s to run VM", codeheap); - err_msg message(SIZE_FORMAT "K < " SIZE_FORMAT "K", size/K, required_size/K); + err_msg message("%zuK < %zuK", size/K, required_size/K); vm_exit_during_initialization(title, message); } } @@ -206,7 +205,7 @@ void CodeCache::initialize_heaps() { const bool cache_size_set = FLAG_IS_CMDLINE(ReservedCodeCacheSize); const size_t ps = page_size(false, 8); const size_t min_size = MAX2(os::vm_allocation_granularity(), ps); - const size_t min_cache_size = CompilerConfig::min_code_cache_size(); // Make sure we have enough space for VM internal code + const size_t min_cache_size = CodeCacheMinimumUseSpace DEBUG_ONLY(* 3); // Make sure we have enough space for VM internal code size_t cache_size = align_up(ReservedCodeCacheSize, min_size); // Prerequisites @@ -256,15 +255,15 @@ void CodeCache::initialize_heaps() { size_t total = non_nmethod.size + profiled.size + non_profiled.size; if (total != cache_size && !cache_size_set) { - log_info(codecache)("ReservedCodeCache size " SIZE_FORMAT "K changed to total segments size NonNMethod " - SIZE_FORMAT "K NonProfiled " SIZE_FORMAT "K Profiled " SIZE_FORMAT "K = " SIZE_FORMAT "K", + log_info(codecache)("ReservedCodeCache size %zuK changed to total segments size NonNMethod " + "%zuK NonProfiled %zuK Profiled %zuK = %zuK", cache_size/K, non_nmethod.size/K, non_profiled.size/K, profiled.size/K, total/K); // Adjust ReservedCodeCacheSize as necessary because it was not set explicitly cache_size = total; } - log_debug(codecache)("Initializing code heaps ReservedCodeCache " SIZE_FORMAT "K NonNMethod " SIZE_FORMAT "K" - " NonProfiled " SIZE_FORMAT "K Profiled " SIZE_FORMAT "K", + log_debug(codecache)("Initializing code heaps ReservedCodeCache %zuK NonNMethod %zuK" + " NonProfiled %zuK Profiled %zuK", cache_size/K, non_nmethod.size/K, non_profiled.size/K, profiled.size/K); // Validation @@ -282,16 +281,16 @@ void CodeCache::initialize_heaps() { // ReservedCodeCacheSize was set explicitly, so report an error and abort if it doesn't match the segment sizes if (total != cache_size && cache_size_set) { - err_msg message("NonNMethodCodeHeapSize (" SIZE_FORMAT "K)", non_nmethod.size/K); + err_msg message("NonNMethodCodeHeapSize (%zuK)", non_nmethod.size/K); if (profiled.enabled) { - message.append(" + ProfiledCodeHeapSize (" SIZE_FORMAT "K)", profiled.size/K); + message.append(" + ProfiledCodeHeapSize (%zuK)", profiled.size/K); } if (non_profiled.enabled) { - message.append(" + NonProfiledCodeHeapSize (" SIZE_FORMAT "K)", non_profiled.size/K); + message.append(" + NonProfiledCodeHeapSize (%zuK)", non_profiled.size/K); } - message.append(" = " SIZE_FORMAT "K", total/K); + message.append(" = %zuK", total/K); message.append((total > cache_size) ? " is greater than " : " is less than "); - message.append("ReservedCodeCacheSize (" SIZE_FORMAT "K).", cache_size/K); + message.append("ReservedCodeCacheSize (%zuK).", cache_size/K); vm_exit_during_initialization("Invalid code heap sizes", message); } @@ -356,7 +355,7 @@ ReservedSpace CodeCache::reserve_heap_memory(size_t size, size_t rs_ps) { ReservedSpace rs = CodeMemoryReserver::reserve(rs_size, rs_align, rs_ps); if (!rs.is_reserved()) { - vm_exit_during_initialization(err_msg("Could not reserve enough space for code cache (" SIZE_FORMAT "K)", + vm_exit_during_initialization(err_msg("Could not reserve enough space for code cache (%zuK)", rs_size/K)); } @@ -437,7 +436,7 @@ void CodeCache::add_heap(ReservedSpace rs, const char* name, CodeBlobType code_b size_t size_initial = MIN2((size_t)InitialCodeCacheSize, rs.size()); size_initial = align_up(size_initial, rs.page_size()); if (!heap->reserve(rs, size_initial, CodeCacheSegmentSize)) { - vm_exit_during_initialization(err_msg("Could not reserve enough space in %s (" SIZE_FORMAT "K)", + vm_exit_during_initialization(err_msg("Could not reserve enough space in %s (%zuK)", heap->name(), size_initial/K)); } @@ -565,7 +564,7 @@ CodeBlob* CodeCache::allocate(uint size, CodeBlobType code_blob_type, bool handl } else { tty->print("CodeCache"); } - tty->print_cr(" extended to [" INTPTR_FORMAT ", " INTPTR_FORMAT "] (" SSIZE_FORMAT " bytes)", + tty->print_cr(" extended to [" INTPTR_FORMAT ", " INTPTR_FORMAT "] (%zd bytes)", (intptr_t)heap->low_boundary(), (intptr_t)heap->high(), (address)heap->high() - (address)heap->low_boundary()); } @@ -1491,10 +1490,10 @@ void CodeCache::print_memory_overhead() { } // Print bytes that are allocated in the freelist ttyLocker ttl; - tty->print_cr("Number of elements in freelist: " SSIZE_FORMAT, freelists_length()); - tty->print_cr("Allocated in freelist: " SSIZE_FORMAT "kB", bytes_allocated_in_freelists()/K); - tty->print_cr("Unused bytes in CodeBlobs: " SSIZE_FORMAT "kB", (wasted_bytes/K)); - tty->print_cr("Segment map size: " SSIZE_FORMAT "kB", allocated_segments()/K); // 1 byte per segment + tty->print_cr("Number of elements in freelist: %zd", freelists_length()); + tty->print_cr("Allocated in freelist: %zdkB", bytes_allocated_in_freelists()/K); + tty->print_cr("Unused bytes in CodeBlobs: %zdkB", (wasted_bytes/K)); + tty->print_cr("Segment map size: %zdkB", allocated_segments()/K); // 1 byte per segment } //------------------------------------------------------------------------------------------------ @@ -1727,8 +1726,8 @@ void CodeCache::print_summary(outputStream* st, bool detailed) { total_used += used; total_max_used += max_used; total_free += free; - st->print_cr(" size=" SIZE_FORMAT "Kb used=" SIZE_FORMAT - "Kb max_used=" SIZE_FORMAT "Kb free=" SIZE_FORMAT "Kb", + st->print_cr(" size=%zuKb used=%zu" + "Kb max_used=%zuKb free=%zuKb", size, used, max_used, free); if (detailed) { @@ -1788,7 +1787,7 @@ void CodeCache::print_layout(outputStream* st) { void CodeCache::log_state(outputStream* st) { st->print(" total_blobs='" UINT32_FORMAT "' nmethods='" UINT32_FORMAT "'" - " adapters='" UINT32_FORMAT "' free_code_cache='" SIZE_FORMAT "'", + " adapters='" UINT32_FORMAT "' free_code_cache='%zu'", blob_count(), nmethod_count(), adapter_count(), unallocated_capacity()); } diff --git a/src/hotspot/share/code/codeCache.hpp b/src/hotspot/share/code/codeCache.hpp index dbca9aeb25fee..3e446ab8430fe 100644 --- a/src/hotspot/share/code/codeCache.hpp +++ b/src/hotspot/share/code/codeCache.hpp @@ -90,7 +90,6 @@ class CodeCache : AllStatic { friend class JVMCIVMStructs; template friend class CodeBlobIterator; friend class WhiteBox; - friend class CodeCacheLoader; friend class ShenandoahParallelCodeHeapIterator; private: // CodeHeaps of the cache diff --git a/src/hotspot/share/code/codeHeapState.cpp b/src/hotspot/share/code/codeHeapState.cpp index 0fa7c7386c7ee..065aab5c2500d 100644 --- a/src/hotspot/share/code/codeHeapState.cpp +++ b/src/hotspot/share/code/codeHeapState.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2019 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "code/codeHeapState.hpp" #include "compiler/compileBroker.hpp" #include "oops/klass.inline.hpp" @@ -370,7 +369,7 @@ void CodeHeapState::prepare_StatArray(outputStream* out, size_t nElem, size_t gr if (StatArray == nullptr) { //---< just do nothing if allocation failed >--- out->print_cr("Statistics could not be collected for %s, probably out of memory.", heapName); - out->print_cr("Current granularity is " SIZE_FORMAT " bytes. Try a coarser granularity.", granularity); + out->print_cr("Current granularity is %zu bytes. Try a coarser granularity.", granularity); alloc_granules = 0; granule_size = 0; } else { @@ -621,11 +620,11 @@ void CodeHeapState::aggregate(outputStream* out, CodeHeap* heap, size_t granular " collected data to be consistent. Only the method names and signatures\n" " are retrieved at print time. That may lead to rare cases where the\n" " name of a method is no longer available, e.g. because it was unloaded.\n"); - ast->print_cr(" CodeHeap committed size " SIZE_FORMAT "K (" SIZE_FORMAT "M), reserved size " SIZE_FORMAT "K (" SIZE_FORMAT "M), %d%% occupied.", + ast->print_cr(" CodeHeap committed size %zuK (%zuM), reserved size %zuK (%zuM), %d%% occupied.", size/(size_t)K, size/(size_t)M, res_size/(size_t)K, res_size/(size_t)M, (unsigned int)(100.0*size/res_size)); - ast->print_cr(" CodeHeap allocation segment size is " SIZE_FORMAT " bytes. This is the smallest possible granularity.", seg_size); - ast->print_cr(" CodeHeap (committed part) is mapped to " SIZE_FORMAT " granules of size " SIZE_FORMAT " bytes.", granules, granularity); - ast->print_cr(" Each granule takes " SIZE_FORMAT " bytes of C heap, that is " SIZE_FORMAT "K in total for statistics data.", sizeof(StatElement), (sizeof(StatElement)*granules)/(size_t)K); + ast->print_cr(" CodeHeap allocation segment size is %zu bytes. This is the smallest possible granularity.", seg_size); + ast->print_cr(" CodeHeap (committed part) is mapped to %zu granules of size %zu bytes.", granules, granularity); + ast->print_cr(" Each granule takes %zu bytes of C heap, that is %zuK in total for statistics data.", sizeof(StatElement), (sizeof(StatElement)*granules)/(size_t)K); ast->print_cr(" The number of granules is limited to %dk, requiring a granules size of at least %d bytes for a 1GB heap.", (unsigned int)(max_granules/K), (unsigned int)(G/max_granules)); BUFFEREDSTREAM_FLUSH("\n") @@ -697,10 +696,10 @@ void CodeHeapState::aggregate(outputStream* out, CodeHeap* heap, size_t granular insane = true; ast->print_cr("Sanity check: HeapBlock @%p outside used range (%p)", (char*)h, low_bound + size); } if (ix_end >= granules) { - insane = true; ast->print_cr("Sanity check: end index (%d) out of bounds (" SIZE_FORMAT ")", ix_end, granules); + insane = true; ast->print_cr("Sanity check: end index (%d) out of bounds (%zu)", ix_end, granules); } if (size != heap->capacity()) { - insane = true; ast->print_cr("Sanity check: code heap capacity has changed (" SIZE_FORMAT "K to " SIZE_FORMAT "K)", size/(size_t)K, heap->capacity()/(size_t)K); + insane = true; ast->print_cr("Sanity check: code heap capacity has changed (%zuK to %zuK)", size/(size_t)K, heap->capacity()/(size_t)K); } if (ix_beg > ix_end) { insane = true; ast->print_cr("Sanity check: end index (%d) lower than begin index (%d)", ix_end, ix_beg); @@ -1042,19 +1041,19 @@ void CodeHeapState::aggregate(outputStream* out, CodeHeap* heap, size_t granular // interspersed with print data from other threads. We take this risk intentionally. // Getting stalled waiting for tty_lock while holding the CodeCache_lock is not desirable. printBox(ast, '-', "Global CodeHeap statistics for segment ", heapName); - ast->print_cr("freeSpace = " SIZE_FORMAT_W(8) "k, nBlocks_free = %6d, %10.3f%% of capacity, %10.3f%% of max_capacity", freeSpace/(size_t)K, nBlocks_free, (100.0*freeSpace)/size, (100.0*freeSpace)/res_size); - ast->print_cr("usedSpace = " SIZE_FORMAT_W(8) "k, nBlocks_used = %6d, %10.3f%% of capacity, %10.3f%% of max_capacity", usedSpace/(size_t)K, nBlocks_used, (100.0*usedSpace)/size, (100.0*usedSpace)/res_size); - ast->print_cr(" Tier1 Space = " SIZE_FORMAT_W(8) "k, nBlocks_t1 = %6d, %10.3f%% of capacity, %10.3f%% of max_capacity", t1Space/(size_t)K, nBlocks_t1, (100.0*t1Space)/size, (100.0*t1Space)/res_size); - ast->print_cr(" Tier2 Space = " SIZE_FORMAT_W(8) "k, nBlocks_t2 = %6d, %10.3f%% of capacity, %10.3f%% of max_capacity", t2Space/(size_t)K, nBlocks_t2, (100.0*t2Space)/size, (100.0*t2Space)/res_size); - ast->print_cr(" Alive Space = " SIZE_FORMAT_W(8) "k, nBlocks_alive = %6d, %10.3f%% of capacity, %10.3f%% of max_capacity", aliveSpace/(size_t)K, nBlocks_alive, (100.0*aliveSpace)/size, (100.0*aliveSpace)/res_size); - ast->print_cr(" disconnected = " SIZE_FORMAT_W(8) "k, nBlocks_disconn = %6d, %10.3f%% of capacity, %10.3f%% of max_capacity", disconnSpace/(size_t)K, nBlocks_disconn, (100.0*disconnSpace)/size, (100.0*disconnSpace)/res_size); - ast->print_cr(" not entrant = " SIZE_FORMAT_W(8) "k, nBlocks_notentr = %6d, %10.3f%% of capacity, %10.3f%% of max_capacity", notentrSpace/(size_t)K, nBlocks_notentr, (100.0*notentrSpace)/size, (100.0*notentrSpace)/res_size); - ast->print_cr(" stubSpace = " SIZE_FORMAT_W(8) "k, nBlocks_stub = %6d, %10.3f%% of capacity, %10.3f%% of max_capacity", stubSpace/(size_t)K, nBlocks_stub, (100.0*stubSpace)/size, (100.0*stubSpace)/res_size); + ast->print_cr("freeSpace = %8zuk, nBlocks_free = %6d, %10.3f%% of capacity, %10.3f%% of max_capacity", freeSpace/(size_t)K, nBlocks_free, (100.0*freeSpace)/size, (100.0*freeSpace)/res_size); + ast->print_cr("usedSpace = %8zuk, nBlocks_used = %6d, %10.3f%% of capacity, %10.3f%% of max_capacity", usedSpace/(size_t)K, nBlocks_used, (100.0*usedSpace)/size, (100.0*usedSpace)/res_size); + ast->print_cr(" Tier1 Space = %8zuk, nBlocks_t1 = %6d, %10.3f%% of capacity, %10.3f%% of max_capacity", t1Space/(size_t)K, nBlocks_t1, (100.0*t1Space)/size, (100.0*t1Space)/res_size); + ast->print_cr(" Tier2 Space = %8zuk, nBlocks_t2 = %6d, %10.3f%% of capacity, %10.3f%% of max_capacity", t2Space/(size_t)K, nBlocks_t2, (100.0*t2Space)/size, (100.0*t2Space)/res_size); + ast->print_cr(" Alive Space = %8zuk, nBlocks_alive = %6d, %10.3f%% of capacity, %10.3f%% of max_capacity", aliveSpace/(size_t)K, nBlocks_alive, (100.0*aliveSpace)/size, (100.0*aliveSpace)/res_size); + ast->print_cr(" disconnected = %8zuk, nBlocks_disconn = %6d, %10.3f%% of capacity, %10.3f%% of max_capacity", disconnSpace/(size_t)K, nBlocks_disconn, (100.0*disconnSpace)/size, (100.0*disconnSpace)/res_size); + ast->print_cr(" not entrant = %8zuk, nBlocks_notentr = %6d, %10.3f%% of capacity, %10.3f%% of max_capacity", notentrSpace/(size_t)K, nBlocks_notentr, (100.0*notentrSpace)/size, (100.0*notentrSpace)/res_size); + ast->print_cr(" stubSpace = %8zuk, nBlocks_stub = %6d, %10.3f%% of capacity, %10.3f%% of max_capacity", stubSpace/(size_t)K, nBlocks_stub, (100.0*stubSpace)/size, (100.0*stubSpace)/res_size); ast->print_cr("ZombieBlocks = %8d. These are HeapBlocks which could not be identified as CodeBlobs.", nBlocks_zomb); ast->cr(); - ast->print_cr("Segment start = " INTPTR_FORMAT ", used space = " SIZE_FORMAT_W(8)"k", p2i(low_bound), size/K); - ast->print_cr("Segment end (used) = " INTPTR_FORMAT ", remaining space = " SIZE_FORMAT_W(8)"k", p2i(low_bound) + size, (res_size - size)/K); - ast->print_cr("Segment end (reserved) = " INTPTR_FORMAT ", reserved space = " SIZE_FORMAT_W(8)"k", p2i(low_bound) + res_size, res_size/K); + ast->print_cr("Segment start = " INTPTR_FORMAT ", used space = %8zuk", p2i(low_bound), size/K); + ast->print_cr("Segment end (used) = " INTPTR_FORMAT ", remaining space = %8zuk", p2i(low_bound) + size, (res_size - size)/K); + ast->print_cr("Segment end (reserved) = " INTPTR_FORMAT ", reserved space = %8zuk", p2i(low_bound) + res_size, res_size/K); ast->cr(); ast->print_cr("latest allocated compilation id = %d", latest_compilation_id); ast->print_cr("highest observed compilation id = %d", highest_compilation_id); @@ -1134,7 +1133,7 @@ void CodeHeapState::aggregate(outputStream* out, CodeHeap* heap, size_t granular ast->print_cr(" The aggregate step collects information about all free blocks in CodeHeap.\n" " Subsequent print functions create their output based on this snapshot.\n"); ast->print_cr(" Free space in %s is distributed over %d free blocks.", heapName, nBlocks_free); - ast->print_cr(" Each free block takes " SIZE_FORMAT " bytes of C heap for statistics data, that is " SIZE_FORMAT "K in total.", sizeof(FreeBlk), (sizeof(FreeBlk)*nBlocks_free)/K); + ast->print_cr(" Each free block takes %zu bytes of C heap for statistics data, that is %zuK in total.", sizeof(FreeBlk), (sizeof(FreeBlk)*nBlocks_free)/K); BUFFEREDSTREAM_FLUSH("\n") //---------------------------------------- @@ -1303,7 +1302,7 @@ void CodeHeapState::print_usedSpace(outputStream* out, CodeHeap* heap) { if (is_nmethod) { //---< nMethod size in hex >--- ast->print(UINT32_FORMAT_X_0, TopSizeArray[i].nm_size); - ast->print("(" SIZE_FORMAT_W(4) "K)", TopSizeArray[i].nm_size/K); + ast->print("(%4zuK)", TopSizeArray[i].nm_size/K); ast->fill_to(51); ast->print(" %c", blobTypeChar[TopSizeArray[i].type]); //---< compiler information >--- @@ -1315,7 +1314,7 @@ void CodeHeapState::print_usedSpace(outputStream* out, CodeHeap* heap) { } else { //---< block size in hex >--- ast->print(UINT32_FORMAT_X_0, (unsigned int)(TopSizeArray[i].len<print("(" SIZE_FORMAT_W(4) "K)", (TopSizeArray[i].len<print("(%4zuK)", (TopSizeArray[i].len<--- ast->fill_to(56); //---< name and signature >--- @@ -1362,17 +1361,17 @@ void CodeHeapState::print_usedSpace(outputStream* out, CodeHeap* heap) { ast->print_cr("[Size Range)------avg.-size-+----count-+"); for (unsigned int i = 0; i < nSizeDistElements; i++) { if (SizeDistributionArray[i].rangeStart<print("[" SIZE_FORMAT_W(5) " .." SIZE_FORMAT_W(5) " ): " + ast->print("[%5zu ..%5zu ): " ,(size_t)(SizeDistributionArray[i].rangeStart<print("[" SIZE_FORMAT_W(5) "K.." SIZE_FORMAT_W(5) "K): " + ast->print("[%5zuK..%5zuK): " ,(SizeDistributionArray[i].rangeStart<print("[" SIZE_FORMAT_W(5) "M.." SIZE_FORMAT_W(5) "M): " + ast->print("[%5zuM..%5zuM): " ,(SizeDistributionArray[i].rangeStart<print_cr("[Size Range)------avg.-size-+----count-+"); for (unsigned int i = 0; i < nSizeDistElements; i++) { if (SizeDistributionArray[i].rangeStart<print("[" SIZE_FORMAT_W(5) " .." SIZE_FORMAT_W(5) " ): " + ast->print("[%5zu ..%5zu ): " ,(size_t)(SizeDistributionArray[i].rangeStart<print("[" SIZE_FORMAT_W(5) "K.." SIZE_FORMAT_W(5) "K): " + ast->print("[%5zuK..%5zuK): " ,(SizeDistributionArray[i].rangeStart<print("[" SIZE_FORMAT_W(5) "M.." SIZE_FORMAT_W(5) "M): " + ast->print("[%5zuM..%5zuM): " ,(SizeDistributionArray[i].rangeStart<cr(); ast->print_cr("--------------------------------------------------------------------"); - ast->print_cr("Address range [" INTPTR_FORMAT "," INTPTR_FORMAT "), " SIZE_FORMAT "k", p2i(low_bound+ix*granule_size), p2i(low_bound + end_ix*granule_size), (end_ix - ix)*granule_size/(size_t)K); + ast->print_cr("Address range [" INTPTR_FORMAT "," INTPTR_FORMAT "), %zuk", p2i(low_bound+ix*granule_size), p2i(low_bound + end_ix*granule_size), (end_ix - ix)*granule_size/(size_t)K); ast->print_cr("--------------------------------------------------------------------"); BUFFEREDSTREAM_FLUSH_AUTO("") } @@ -2170,7 +2169,7 @@ void CodeHeapState::print_names(outputStream* out, CodeHeap* heap) { bool get_name = (cbType == nMethod_inuse) || (cbType == nMethod_notused); //---< nMethod size in hex >--- ast->print(UINT32_FORMAT_X_0, total_size); - ast->print("(" SIZE_FORMAT_W(4) "K)", total_size/K); + ast->print("(%4zuK)", total_size/K); //---< compiler information >--- ast->fill_to(51); ast->print("%5s %3d", compTypeName[StatArray[ix].compiler], StatArray[ix].level); diff --git a/src/hotspot/share/code/compiledIC.cpp b/src/hotspot/share/code/compiledIC.cpp index 684aee509ee53..2547b8711db16 100644 --- a/src/hotspot/share/code/compiledIC.cpp +++ b/src/hotspot/share/code/compiledIC.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "code/codeBehaviours.hpp" #include "code/codeCache.hpp" #include "code/compiledIC.hpp" diff --git a/src/hotspot/share/code/compressedStream.cpp b/src/hotspot/share/code/compressedStream.cpp index 6a4174fb6ce0e..db86a1acd3c8f 100644 --- a/src/hotspot/share/code/compressedStream.cpp +++ b/src/hotspot/share/code/compressedStream.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "code/compressedStream.hpp" #include "utilities/ostream.hpp" #include "utilities/reverse_bits.hpp" diff --git a/src/hotspot/share/code/debugInfo.cpp b/src/hotspot/share/code/debugInfo.cpp index ccee142c93808..9e895ecf152f3 100644 --- a/src/hotspot/share/code/debugInfo.cpp +++ b/src/hotspot/share/code/debugInfo.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "code/debugInfo.hpp" #include "code/debugInfoRec.hpp" #include "code/nmethod.hpp" diff --git a/src/hotspot/share/code/debugInfoRec.cpp b/src/hotspot/share/code/debugInfoRec.cpp index 71da21f1e99cd..02cd23407bf90 100644 --- a/src/hotspot/share/code/debugInfoRec.cpp +++ b/src/hotspot/share/code/debugInfoRec.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "code/debugInfoRec.hpp" #include "code/scopeDesc.hpp" #include "compiler/oopMap.hpp" diff --git a/src/hotspot/share/code/dependencies.cpp b/src/hotspot/share/code/dependencies.cpp index 260da40b87a42..7f925388eb039 100644 --- a/src/hotspot/share/code/dependencies.cpp +++ b/src/hotspot/share/code/dependencies.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciArrayKlass.hpp" #include "ci/ciEnv.hpp" #include "ci/ciKlass.hpp" diff --git a/src/hotspot/share/code/dependencyContext.cpp b/src/hotspot/share/code/dependencyContext.cpp index 0e6b99d172dcb..6a7742cea8d3d 100644 --- a/src/hotspot/share/code/dependencyContext.cpp +++ b/src/hotspot/share/code/dependencyContext.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "code/nmethod.hpp" #include "code/dependencies.hpp" #include "code/dependencyContext.hpp" diff --git a/src/hotspot/share/code/exceptionHandlerTable.cpp b/src/hotspot/share/code/exceptionHandlerTable.cpp index aedeb0e9e049f..a295d1271aa65 100644 --- a/src/hotspot/share/code/exceptionHandlerTable.cpp +++ b/src/hotspot/share/code/exceptionHandlerTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "code/exceptionHandlerTable.hpp" #include "code/nmethod.hpp" #include "memory/allocation.inline.hpp" diff --git a/src/hotspot/share/code/location.cpp b/src/hotspot/share/code/location.cpp index ba8859b60a887..ec9d0797dc3a3 100644 --- a/src/hotspot/share/code/location.cpp +++ b/src/hotspot/share/code/location.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "code/debugInfo.hpp" #include "code/location.hpp" #include "runtime/handles.inline.hpp" diff --git a/src/hotspot/share/code/nmethod.cpp b/src/hotspot/share/code/nmethod.cpp index 754a7786605ff..283970afa69a7 100644 --- a/src/hotspot/share/code/nmethod.cpp +++ b/src/hotspot/share/code/nmethod.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.inline.hpp" #include "code/codeCache.hpp" #include "code/compiledIC.hpp" @@ -1586,7 +1585,7 @@ void nmethod::log_identity(xmlStream* log) const { #define LOG_OFFSET(log, name) \ if (p2i(name##_end()) - p2i(name##_begin())) \ - log->print(" " XSTR(name) "_offset='" INTX_FORMAT "'" , \ + log->print(" " XSTR(name) "_offset='%zd'" , \ p2i(name##_begin()) - p2i(this)) @@ -1962,7 +1961,7 @@ void nmethod::log_state_change() const { if (LogCompilation) { if (xtty != nullptr) { ttyLocker ttyl; // keep the following output all in one block - xtty->begin_elem("make_not_entrant thread='" UINTX_FORMAT "'", + xtty->begin_elem("make_not_entrant thread='%zu'", os::current_thread_id()); log_identity(xtty); xtty->stamp(); @@ -2110,7 +2109,7 @@ void nmethod::purge(bool unregister_nmethod) { // completely deallocate this method Events::log_nmethod_flush(Thread::current(), "flushing %s nmethod " INTPTR_FORMAT, is_osr_method() ? "osr" : "", p2i(this)); log_debug(codecache)("*flushing %s nmethod %3d/" INTPTR_FORMAT ". Live blobs:" UINT32_FORMAT - "/Free CodeCache:" SIZE_FORMAT "Kb", + "/Free CodeCache:%zuKb", is_osr_method() ? "osr" : "",_compile_id, p2i(this), CodeCache::blob_count(), CodeCache::unallocated_capacity(CodeCache::get_code_blob_type(this))/1024); diff --git a/src/hotspot/share/code/oopRecorder.cpp b/src/hotspot/share/code/oopRecorder.cpp index 1849493974ca4..af23bf12b4386 100644 --- a/src/hotspot/share/code/oopRecorder.cpp +++ b/src/hotspot/share/code/oopRecorder.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciEnv.hpp" #include "ci/ciInstance.hpp" #include "ci/ciMetadata.hpp" diff --git a/src/hotspot/share/code/pcDesc.cpp b/src/hotspot/share/code/pcDesc.cpp index 241eee03a9c13..23f0c9f80c5fe 100644 --- a/src/hotspot/share/code/pcDesc.cpp +++ b/src/hotspot/share/code/pcDesc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "code/debugInfoRec.hpp" #include "code/nmethod.hpp" #include "code/pcDesc.hpp" diff --git a/src/hotspot/share/code/relocInfo.cpp b/src/hotspot/share/code/relocInfo.cpp index a379f88ddc180..9dc4eced9662b 100644 --- a/src/hotspot/share/code/relocInfo.cpp +++ b/src/hotspot/share/code/relocInfo.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "code/codeCache.hpp" #include "code/compiledIC.hpp" #include "code/nmethod.hpp" diff --git a/src/hotspot/share/code/scopeDesc.cpp b/src/hotspot/share/code/scopeDesc.cpp index d22d3352f4e4e..d3e08a886e6e4 100644 --- a/src/hotspot/share/code/scopeDesc.cpp +++ b/src/hotspot/share/code/scopeDesc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/javaClasses.inline.hpp" #include "code/debugInfoRec.hpp" #include "code/pcDesc.hpp" diff --git a/src/hotspot/share/code/stubs.cpp b/src/hotspot/share/code/stubs.cpp index 95cee4edb43c9..074241ff61133 100644 --- a/src/hotspot/share/code/stubs.cpp +++ b/src/hotspot/share/code/stubs.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "code/codeBlob.hpp" #include "code/codeCache.hpp" #include "code/stubs.hpp" diff --git a/src/hotspot/share/code/vmreg.cpp b/src/hotspot/share/code/vmreg.cpp index b9ee4a6b3e7a5..7407eceac0580 100644 --- a/src/hotspot/share/code/vmreg.cpp +++ b/src/hotspot/share/code/vmreg.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "code/vmreg.hpp" diff --git a/src/hotspot/share/code/vtableStubs.cpp b/src/hotspot/share/code/vtableStubs.cpp index 6a0c52ae828c4..00826f820366d 100644 --- a/src/hotspot/share/code/vtableStubs.cpp +++ b/src/hotspot/share/code/vtableStubs.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "code/vtableStubs.hpp" #include "compiler/compileBroker.hpp" #include "compiler/disassembler.hpp" @@ -79,7 +78,7 @@ void* VtableStub::operator new(size_t size, int code_size) throw() { void VtableStub::print_on(outputStream* st) const { - st->print("vtable stub (index = %d, receiver_location = " INTX_FORMAT ", code = [" INTPTR_FORMAT ", " INTPTR_FORMAT "])", + st->print("vtable stub (index = %d, receiver_location = %zd, code = [" INTPTR_FORMAT ", " INTPTR_FORMAT "])", index(), p2i(receiver_location()), p2i(code_begin()), p2i(code_end())); } @@ -226,7 +225,7 @@ address VtableStubs::find_stub(bool is_vtable_stub, int vtable_index) { enter(is_vtable_stub, vtable_index, s); if (PrintAdapterHandlers) { - tty->print_cr("Decoding VtableStub %s[%d]@" PTR_FORMAT " [" PTR_FORMAT ", " PTR_FORMAT "] (" SIZE_FORMAT " bytes)", + tty->print_cr("Decoding VtableStub %s[%d]@" PTR_FORMAT " [" PTR_FORMAT ", " PTR_FORMAT "] (%zu bytes)", is_vtable_stub? "vtbl": "itbl", vtable_index, p2i(VtableStub::receiver_location()), p2i(s->code_begin()), p2i(s->code_end()), pointer_delta(s->code_end(), s->code_begin(), 1)); Disassembler::decode(s->code_begin(), s->code_end()); diff --git a/src/hotspot/share/compiler/abstractCompiler.cpp b/src/hotspot/share/compiler/abstractCompiler.cpp index 0c094c75d8b59..386243850ddb2 100644 --- a/src/hotspot/share/compiler/abstractCompiler.cpp +++ b/src/hotspot/share/compiler/abstractCompiler.cpp @@ -1,5 +1,5 @@ // -// Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved. // 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,6 @@ // questions. // -#include "precompiled.hpp" #include "compiler/abstractCompiler.hpp" #include "compiler/compileBroker.hpp" #include "runtime/mutexLocker.hpp" diff --git a/src/hotspot/share/compiler/abstractDisassembler.cpp b/src/hotspot/share/compiler/abstractDisassembler.cpp index 6117108155fe8..32f37e7b5139b 100644 --- a/src/hotspot/share/compiler/abstractDisassembler.cpp +++ b/src/hotspot/share/compiler/abstractDisassembler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2019 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -26,7 +26,6 @@ // AbstractDisassembler is the base class for // platform-specific Disassembler classes. -#include "precompiled.hpp" #include "asm/assembler.inline.hpp" #include "compiler/abstractDisassembler.hpp" #include "oops/oop.inline.hpp" diff --git a/src/hotspot/share/compiler/cHeapStringHolder.cpp b/src/hotspot/share/compiler/cHeapStringHolder.cpp index 0383e738a47c9..261658e04eb1c 100644 --- a/src/hotspot/share/compiler/cHeapStringHolder.cpp +++ b/src/hotspot/share/compiler/cHeapStringHolder.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "compiler/cHeapStringHolder.hpp" void CHeapStringHolder::set(const char* string) { diff --git a/src/hotspot/share/compiler/compilationFailureInfo.cpp b/src/hotspot/share/compiler/compilationFailureInfo.cpp index fb94102ef1654..aaa9cb79d1211 100644 --- a/src/hotspot/share/compiler/compilationFailureInfo.cpp +++ b/src/hotspot/share/compiler/compilationFailureInfo.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, 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. * @@ -23,8 +23,6 @@ * */ -#include "precompiled.hpp" - #if defined(COMPILER1) || defined(COMPILER2) #ifdef COMPILER1 diff --git a/src/hotspot/share/compiler/compilationLog.cpp b/src/hotspot/share/compiler/compilationLog.cpp index 822ff1a7ff4ab..f8dc24d3aaaf3 100644 --- a/src/hotspot/share/compiler/compilationLog.cpp +++ b/src/hotspot/share/compiler/compilationLog.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "code/nmethod.hpp" #include "compiler/compilationLog.hpp" #include "compiler/compileTask.hpp" diff --git a/src/hotspot/share/compiler/compilationMemoryStatistic.cpp b/src/hotspot/share/compiler/compilationMemoryStatistic.cpp index 4cc2043656efa..89d0b60212e22 100644 --- a/src/hotspot/share/compiler/compilationMemoryStatistic.cpp +++ b/src/hotspot/share/compiler/compilationMemoryStatistic.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, 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. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "logging/log.hpp" #include "logging/logStream.hpp" #ifdef COMPILER1 diff --git a/src/hotspot/share/compiler/compilationPolicy.cpp b/src/hotspot/share/compiler/compilationPolicy.cpp index 8fc70619abe7e..e28c4511d5219 100644 --- a/src/hotspot/share/compiler/compilationPolicy.cpp +++ b/src/hotspot/share/compiler/compilationPolicy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "code/scopeDesc.hpp" #include "compiler/compilationPolicy.hpp" #include "compiler/compileBroker.hpp" @@ -455,7 +454,7 @@ void CompilationPolicy::initialize() { c2_size = C2Compiler::initial_code_buffer_size(); #endif size_t buffer_size = c1_only ? c1_size : (c1_size/3 + 2*c2_size/3); - int max_count = (ReservedCodeCacheSize - (int)CompilerConfig::min_code_cache_size()) / (int)buffer_size; + int max_count = (ReservedCodeCacheSize - (CodeCacheMinimumUseSpace DEBUG_ONLY(* 3))) / (int)buffer_size; if (count > max_count) { // Lower the compiler count such that all buffers fit into the code cache count = MAX2(max_count, c1_only ? 1 : 2); diff --git a/src/hotspot/share/compiler/compileBroker.cpp b/src/hotspot/share/compiler/compileBroker.cpp index 30956b6c793bd..badcfeab2954e 100644 --- a/src/hotspot/share/compiler/compileBroker.cpp +++ b/src/hotspot/share/compiler/compileBroker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/javaClasses.inline.hpp" #include "classfile/symbolTable.hpp" #include "classfile/vmClasses.hpp" @@ -1917,7 +1916,7 @@ void CompileBroker::compiler_thread_loop() { // Open a log. CompileLog* log = get_log(thread); if (log != nullptr) { - log->begin_elem("start_compile_thread name='%s' thread='" UINTX_FORMAT "' process='%d'", + log->begin_elem("start_compile_thread name='%s' thread='%zu' process='%d'", thread->name(), os::current_thread_id(), os::current_process_id()); @@ -2008,11 +2007,11 @@ void CompileBroker::init_compiler_thread_log() { for (int try_temp_dir = 1; try_temp_dir >= 0; try_temp_dir--) { const char* dir = (try_temp_dir ? os::get_temp_directory() : nullptr); if (dir == nullptr) { - jio_snprintf(file_name, sizeof(file_name), "hs_c" UINTX_FORMAT "_pid%u.log", + jio_snprintf(file_name, sizeof(file_name), "hs_c%zu_pid%u.log", thread_id, os::current_process_id()); } else { jio_snprintf(file_name, sizeof(file_name), - "%s%shs_c" UINTX_FORMAT "_pid%u.log", dir, + "%s%shs_c%zu_pid%u.log", dir, os::file_separator(), thread_id, os::current_process_id()); } @@ -2031,7 +2030,7 @@ void CompileBroker::init_compiler_thread_log() { if (xtty != nullptr) { ttyLocker ttyl; // Record any per thread log files - xtty->elem("thread_logfile thread='" INTX_FORMAT "' filename='%s'", thread_id, file_name); + xtty->elem("thread_logfile thread='%zd' filename='%s'", thread_id, file_name); } return; } @@ -2532,6 +2531,11 @@ void CompileBroker::collect_statistics(CompilerThread* thread, elapsedTimer time // C1 and C2 counters are counting both successful and unsuccessful compiles _t_total_compilation.add(time); + // Update compilation times. Used by the implementation of JFR CompilerStatistics + // and java.lang.management.CompilationMXBean. + _perf_total_compilation->inc(time.ticks()); + _peak_compilation_time = MAX2(time.milliseconds(), _peak_compilation_time); + if (!success) { _total_bailout_count++; if (UsePerfData) { @@ -2550,12 +2554,6 @@ void CompileBroker::collect_statistics(CompilerThread* thread, elapsedTimer time _t_invalidated_compilation.add(time); } else { // Compilation succeeded - - // update compilation ticks - used by the implementation of - // java.lang.management.CompilationMXBean - _perf_total_compilation->inc(time.ticks()); - _peak_compilation_time = time.milliseconds() > _peak_compilation_time ? time.milliseconds() : _peak_compilation_time; - if (CITime) { int bytes_compiled = method->code_size() + task->num_inlined_bytecodes(); if (is_osr) { @@ -2779,9 +2777,9 @@ void CompileBroker::print_info(outputStream *out) { out->print_cr("CodeCache overview"); out->print_cr("--------------------------------------------------------"); out->cr(); - out->print_cr(" Reserved size : " SIZE_FORMAT_W(7) " KB", CodeCache::max_capacity() / K); - out->print_cr(" Committed size : " SIZE_FORMAT_W(7) " KB", CodeCache::capacity() / K); - out->print_cr(" Unallocated capacity : " SIZE_FORMAT_W(7) " KB", CodeCache::unallocated_capacity() / K); + out->print_cr(" Reserved size : %7zu KB", CodeCache::max_capacity() / K); + out->print_cr(" Committed size : %7zu KB", CodeCache::capacity() / K); + out->print_cr(" Unallocated capacity : %7zu KB", CodeCache::unallocated_capacity() / K); out->cr(); } diff --git a/src/hotspot/share/compiler/compileLog.cpp b/src/hotspot/share/compiler/compileLog.cpp index 7b780fec492f9..85b8cbdf5921a 100644 --- a/src/hotspot/share/compiler/compileLog.cpp +++ b/src/hotspot/share/compiler/compileLog.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciMethod.hpp" #include "code/codeCache.hpp" #include "compiler/compileLog.hpp" @@ -212,7 +211,7 @@ void CompileLog::finish_log_on_error(outputStream* file, char* buf, int buflen) // print/print_cr may need to allocate large stack buffer to format // strings, here we use snprintf() and print_raw() instead. file->print_raw(""); diff --git a/src/hotspot/share/compiler/compileTask.cpp b/src/hotspot/share/compiler/compileTask.cpp index 1a2af5721665f..2011fa656248b 100644 --- a/src/hotspot/share/compiler/compileTask.cpp +++ b/src/hotspot/share/compiler/compileTask.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "compiler/compilationPolicy.hpp" #include "compiler/compileTask.hpp" #include "compiler/compileLog.hpp" diff --git a/src/hotspot/share/compiler/compilerDefinitions.cpp b/src/hotspot/share/compiler/compilerDefinitions.cpp index ad3d14012ff62..f82e96be6ae7e 100644 --- a/src/hotspot/share/compiler/compilerDefinitions.cpp +++ b/src/hotspot/share/compiler/compilerDefinitions.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "code/codeCache.hpp" #include "compiler/compilerDefinitions.inline.hpp" #include "interpreter/invocationCounter.hpp" @@ -475,7 +474,8 @@ void CompilerConfig::set_jvmci_specific_flags() { bool CompilerConfig::check_args_consistency(bool status) { // Check lower bounds of the code cache - size_t min_code_cache_size = CompilerConfig::min_code_cache_size(); + // Template Interpreter code is approximately 3X larger in debug builds. + uint min_code_cache_size = CodeCacheMinimumUseSpace DEBUG_ONLY(* 3); if (ReservedCodeCacheSize < InitialCodeCacheSize) { jio_fprintf(defaultStream::error_stream(), "Invalid ReservedCodeCacheSize: %dK. Must be at least InitialCodeCacheSize=%dK.\n", diff --git a/src/hotspot/share/compiler/compilerDefinitions.hpp b/src/hotspot/share/compiler/compilerDefinitions.hpp index a72e82e32bd56..bdaa6dffb8f5f 100644 --- a/src/hotspot/share/compiler/compilerDefinitions.hpp +++ b/src/hotspot/share/compiler/compilerDefinitions.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -148,8 +148,6 @@ class CompilerConfig : public AllStatic { inline static bool is_c2_or_jvmci_compiler_only(); inline static bool is_c2_or_jvmci_compiler_enabled(); - inline static size_t min_code_cache_size(); - private: static bool is_compilation_mode_selected(); static void set_compilation_policy_flags(); diff --git a/src/hotspot/share/compiler/compilerDefinitions.inline.hpp b/src/hotspot/share/compiler/compilerDefinitions.inline.hpp index 5d04ef307d0f7..45df9b0b8b005 100644 --- a/src/hotspot/share/compiler/compilerDefinitions.inline.hpp +++ b/src/hotspot/share/compiler/compilerDefinitions.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * 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,12 +25,6 @@ #ifndef SHARE_COMPILER_COMPILERDEFINITIONS_INLINE_HPP #define SHARE_COMPILER_COMPILERDEFINITIONS_INLINE_HPP -#ifdef COMPILER1 -#include "c1/c1_Compiler.hpp" -#endif -#ifdef COMPILER2 -#include "opto/c2compiler.hpp" -#endif #include "compiler/compilerDefinitions.hpp" #include "compiler/compiler_globals.hpp" #include "runtime/arguments.hpp" @@ -136,13 +130,4 @@ inline bool CompilerConfig::is_c2_or_jvmci_compiler_enabled() { return is_c2_enabled() || is_jvmci_compiler_enabled(); } -inline size_t CompilerConfig::min_code_cache_size() { - size_t min_code_cache_size = CodeCacheMinimumUseSpace; - // Template Interpreter code is approximately 3X larger in debug builds. - DEBUG_ONLY(min_code_cache_size *= 3); - COMPILER1_PRESENT(min_code_cache_size += Compiler::code_buffer_size()); - COMPILER2_PRESENT(min_code_cache_size += C2Compiler::initial_code_buffer_size()); - return min_code_cache_size; -} - #endif // SHARE_COMPILER_COMPILERDEFINITIONS_INLINE_HPP diff --git a/src/hotspot/share/compiler/compilerDirectives.cpp b/src/hotspot/share/compiler/compilerDirectives.cpp index 46750cacc35db..5431b03f6a142 100644 --- a/src/hotspot/share/compiler/compilerDirectives.cpp +++ b/src/hotspot/share/compiler/compilerDirectives.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciMethod.hpp" #include "ci/ciUtilities.inline.hpp" #include "compiler/abstractCompiler.hpp" diff --git a/src/hotspot/share/compiler/compilerDirectives.hpp b/src/hotspot/share/compiler/compilerDirectives.hpp index 620874508f483..74e3d8b9b38e7 100644 --- a/src/hotspot/share/compiler/compilerDirectives.hpp +++ b/src/hotspot/share/compiler/compilerDirectives.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -218,8 +218,8 @@ void set_##name(void* value) { \ return _trace_merge_stores_tags; }; - void print_intx(outputStream* st, ccstr n, intx v, bool mod) { if (mod) { st->print("%s:" INTX_FORMAT " ", n, v); } } - void print_uintx(outputStream* st, ccstr n, intx v, bool mod) { if (mod) { st->print("%s:" UINTX_FORMAT " ", n, v); } } + void print_intx(outputStream* st, ccstr n, intx v, bool mod) { if (mod) { st->print("%s:%zd ", n, v); } } + void print_uintx(outputStream* st, ccstr n, intx v, bool mod) { if (mod) { st->print("%s:%zu ", n, v); } } void print_bool(outputStream* st, ccstr n, bool v, bool mod) { if (mod) { st->print("%s:%s ", n, v ? "true" : "false"); } } void print_double(outputStream* st, ccstr n, double v, bool mod) { if (mod) { st->print("%s:%f ", n, v); } } void print_ccstr(outputStream* st, ccstr n, ccstr v, bool mod) { if (mod) { st->print("%s:%s ", n, v); } } diff --git a/src/hotspot/share/compiler/compilerEvent.cpp b/src/hotspot/share/compiler/compilerEvent.cpp index d2f6e7ba88670..4bc859ef0d642 100644 --- a/src/hotspot/share/compiler/compilerEvent.cpp +++ b/src/hotspot/share/compiler/compilerEvent.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. * */ -#include "precompiled.hpp" #include "ci/ciMethod.hpp" #include "compiler/compilerEvent.hpp" #include "jfr/jfr.hpp" diff --git a/src/hotspot/share/compiler/compilerOracle.cpp b/src/hotspot/share/compiler/compilerOracle.cpp index 107350794a02d..8e296226feec1 100644 --- a/src/hotspot/share/compiler/compilerOracle.cpp +++ b/src/hotspot/share/compiler/compilerOracle.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/symbolTable.hpp" #include "compiler/compilerDirectives.hpp" #include "compiler/compilerOracle.hpp" @@ -236,10 +235,10 @@ void TypedMethodOptionMatcher::print() { enum OptionType type = option2type(_option); switch (type) { case OptionType::Intx: - tty->print_cr(" intx %s = " INTX_FORMAT, name, value()); + tty->print_cr(" intx %s = %zd", name, value()); break; case OptionType::Uintx: - tty->print_cr(" uintx %s = " UINTX_FORMAT, name, value()); + tty->print_cr(" uintx %s = %zu", name, value()); break; case OptionType::Bool: tty->print_cr(" bool %s = %s", name, value() ? "true" : "false"); @@ -736,7 +735,7 @@ static void scan_value(enum OptionType type, char* line, int& total_bytes_read, success = parseMemLimit(line, value, bytes_read, errorbuf, buf_size); } else { // Is it a raw number? - success = sscanf(line, "" INTX_FORMAT "%n", &value, &bytes_read) == 1; + success = sscanf(line, "%zd%n", &value, &bytes_read) == 1; } if (success) { total_bytes_read += bytes_read; @@ -754,7 +753,7 @@ static void scan_value(enum OptionType type, char* line, int& total_bytes_read, success = parseMemStat(line, value, bytes_read, errorbuf, buf_size); } else { // parse as raw number - success = sscanf(line, "" UINTX_FORMAT "%n", &value, &bytes_read) == 1; + success = sscanf(line, "%zu%n", &value, &bytes_read) == 1; } if (success) { total_bytes_read += bytes_read; diff --git a/src/hotspot/share/compiler/compilerThread.cpp b/src/hotspot/share/compiler/compilerThread.cpp index e6329f3e65579..a72fc48b9a116 100644 --- a/src/hotspot/share/compiler/compilerThread.cpp +++ b/src/hotspot/share/compiler/compilerThread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "compiler/compilationMemoryStatistic.hpp" #include "compiler/compileBroker.hpp" #include "compiler/compileTask.hpp" diff --git a/src/hotspot/share/compiler/directivesParser.cpp b/src/hotspot/share/compiler/directivesParser.cpp index 731bf33d799dd..72cc0612c492f 100644 --- a/src/hotspot/share/compiler/directivesParser.cpp +++ b/src/hotspot/share/compiler/directivesParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "compiler/compileBroker.hpp" #include "compiler/directivesParser.hpp" #include "memory/allocation.inline.hpp" diff --git a/src/hotspot/share/compiler/disassembler.cpp b/src/hotspot/share/compiler/disassembler.cpp index 6556ce4ae1df2..f8313db66aa2d 100644 --- a/src/hotspot/share/compiler/disassembler.cpp +++ b/src/hotspot/share/compiler/disassembler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.inline.hpp" #include "asm/macroAssembler.hpp" #include "ci/ciUtilities.hpp" @@ -597,7 +596,7 @@ void decode_env::print_address(address adr) { if (desc != nullptr) { st->print("Stub::%s", desc->name()); if (desc->begin() != adr) { - st->print(INTX_FORMAT_W(+) " " PTR_FORMAT, adr - desc->begin(), p2i(adr)); + st->print("%+zd " PTR_FORMAT, adr - desc->begin(), p2i(adr)); } else if (WizardMode) { st->print(" " PTR_FORMAT, p2i(adr)); } diff --git a/src/hotspot/share/compiler/methodLiveness.cpp b/src/hotspot/share/compiler/methodLiveness.cpp index 7d65b20a1595e..af21321e05d59 100644 --- a/src/hotspot/share/compiler/methodLiveness.cpp +++ b/src/hotspot/share/compiler/methodLiveness.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciMethod.hpp" #include "ci/ciMethodBlocks.hpp" #include "ci/ciStreams.hpp" diff --git a/src/hotspot/share/compiler/methodMatcher.cpp b/src/hotspot/share/compiler/methodMatcher.cpp index 0bd5cdd8501fc..1f401d2e409b7 100644 --- a/src/hotspot/share/compiler/methodMatcher.cpp +++ b/src/hotspot/share/compiler/methodMatcher.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/symbolTable.hpp" #include "classfile/vmSymbols.hpp" #include "compiler/compilerOracle.hpp" diff --git a/src/hotspot/share/compiler/oopMap.cpp b/src/hotspot/share/compiler/oopMap.cpp index 376057aa72e25..ea2c770d66f74 100644 --- a/src/hotspot/share/compiler/oopMap.cpp +++ b/src/hotspot/share/compiler/oopMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "code/codeBlob.hpp" #include "code/codeCache.hpp" #include "code/nmethod.hpp" @@ -929,7 +928,7 @@ void DerivedPointerTable::add(derived_pointer* derived_loc, derived_base* base_l tty->print_cr( "Add derived pointer@" INTPTR_FORMAT " - Derived: " INTPTR_FORMAT - " Base: " INTPTR_FORMAT " (@" INTPTR_FORMAT ") (Offset: " INTX_FORMAT ")", + " Base: " INTPTR_FORMAT " (@" INTPTR_FORMAT ") (Offset: %zd)", p2i(derived_loc), derived_pointer_value(*derived_loc), intptr_t(*base_loc), p2i(base_loc), offset ); } @@ -959,7 +958,7 @@ void DerivedPointerTable::update_pointers() { if (TraceDerivedPointers) { tty->print_cr("Updating derived pointer@" INTPTR_FORMAT - " - Derived: " INTPTR_FORMAT " Base: " INTPTR_FORMAT " (Offset: " INTX_FORMAT ")", + " - Derived: " INTPTR_FORMAT " Base: " INTPTR_FORMAT " (Offset: %zd)", p2i(derived_loc), derived_pointer_value(*derived_loc), p2i(base), offset); } diff --git a/src/hotspot/share/gc/epsilon/epsilonArguments.cpp b/src/hotspot/share/gc/epsilon/epsilonArguments.cpp index ba023e8799bc5..fc2ee7dff013b 100644 --- a/src/hotspot/share/gc/epsilon/epsilonArguments.cpp +++ b/src/hotspot/share/gc/epsilon/epsilonArguments.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/epsilon/epsilonArguments.hpp" #include "gc/epsilon/epsilonHeap.hpp" #include "gc/shared/gcArguments.hpp" @@ -46,7 +45,7 @@ void EpsilonArguments::initialize() { } if (EpsilonMaxTLABSize < MinTLABSize) { - log_warning(gc)("EpsilonMaxTLABSize < MinTLABSize, adjusting it to " SIZE_FORMAT, MinTLABSize); + log_warning(gc)("EpsilonMaxTLABSize < MinTLABSize, adjusting it to %zu", MinTLABSize); EpsilonMaxTLABSize = MinTLABSize; } diff --git a/src/hotspot/share/gc/epsilon/epsilonBarrierSet.cpp b/src/hotspot/share/gc/epsilon/epsilonBarrierSet.cpp index 6444ea344c2d5..e02da30d8e5ae 100644 --- a/src/hotspot/share/gc/epsilon/epsilonBarrierSet.cpp +++ b/src/hotspot/share/gc/epsilon/epsilonBarrierSet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2018, Red Hat, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "gc/epsilon/epsilonBarrierSet.hpp" #include "gc/epsilon/epsilonThreadLocalData.hpp" #include "gc/shared/barrierSet.hpp" diff --git a/src/hotspot/share/gc/epsilon/epsilonHeap.cpp b/src/hotspot/share/gc/epsilon/epsilonHeap.cpp index 3cd5665e04534..8bc98835844ed 100644 --- a/src/hotspot/share/gc/epsilon/epsilonHeap.cpp +++ b/src/hotspot/share/gc/epsilon/epsilonHeap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2022, Red Hat, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "gc/epsilon/epsilonHeap.hpp" #include "gc/epsilon/epsilonInitLogger.hpp" #include "gc/epsilon/epsilonMemoryPool.hpp" @@ -103,7 +102,7 @@ EpsilonHeap* EpsilonHeap::heap() { } HeapWord* EpsilonHeap::allocate_work(size_t size, bool verbose) { - assert(is_object_aligned(size), "Allocation size should be aligned: " SIZE_FORMAT, size); + assert(is_object_aligned(size), "Allocation size should be aligned: %zu", size); HeapWord* res = nullptr; while (true) { @@ -129,7 +128,7 @@ HeapWord* EpsilonHeap::allocate_work(size_t size, bool verbose) { size_t unused_space = max_capacity() - used(); size_t want_space = MAX2(size_in_bytes, EpsilonMinHeapExpand); assert(unused_space >= uncommitted_space, - "Unused (" SIZE_FORMAT ") >= uncommitted (" SIZE_FORMAT ")", + "Unused (%zu) >= uncommitted (%zu)", unused_space, uncommitted_space); if (want_space < uncommitted_space) { @@ -218,18 +217,18 @@ HeapWord* EpsilonHeap::allocate_new_tlab(size_t min_size, // Check that adjustments did not break local and global invariants assert(is_object_aligned(size), - "Size honors object alignment: " SIZE_FORMAT, size); + "Size honors object alignment: %zu", size); assert(min_size <= size, - "Size honors min size: " SIZE_FORMAT " <= " SIZE_FORMAT, min_size, size); + "Size honors min size: %zu <= %zu", min_size, size); assert(size <= _max_tlab_size, - "Size honors max size: " SIZE_FORMAT " <= " SIZE_FORMAT, size, _max_tlab_size); + "Size honors max size: %zu <= %zu", size, _max_tlab_size); assert(size <= CollectedHeap::max_tlab_size(), - "Size honors global max size: " SIZE_FORMAT " <= " SIZE_FORMAT, size, CollectedHeap::max_tlab_size()); + "Size honors global max size: %zu <= %zu", size, CollectedHeap::max_tlab_size()); if (log_is_enabled(Trace, gc)) { ResourceMark rm; - log_trace(gc)("TLAB size for \"%s\" (Requested: " SIZE_FORMAT "K, Min: " SIZE_FORMAT - "K, Max: " SIZE_FORMAT "K, Ergo: " SIZE_FORMAT "K) -> " SIZE_FORMAT "K", + log_trace(gc)("TLAB size for \"%s\" (Requested: %zuK, Min: %zu" + "K, Max: %zuK, Ergo: %zuK) -> %zuK", thread->name(), requested_size * HeapWordSize / K, min_size * HeapWordSize / K, @@ -325,8 +324,8 @@ void EpsilonHeap::print_heap_info(size_t used) const { size_t committed = capacity(); if (reserved != 0) { - log_info(gc)("Heap: " SIZE_FORMAT "%s reserved, " SIZE_FORMAT "%s (%.2f%%) committed, " - SIZE_FORMAT "%s (%.2f%%) used", + log_info(gc)("Heap: %zu%s reserved, %zu%s (%.2f%%) committed, " + "%zu%s (%.2f%%) used", byte_size_in_proper_unit(reserved), proper_unit_for_byte_size(reserved), byte_size_in_proper_unit(committed), proper_unit_for_byte_size(committed), committed * 100.0 / reserved, @@ -344,8 +343,8 @@ void EpsilonHeap::print_metaspace_info() const { size_t used = stats.used(); if (reserved != 0) { - log_info(gc, metaspace)("Metaspace: " SIZE_FORMAT "%s reserved, " SIZE_FORMAT "%s (%.2f%%) committed, " - SIZE_FORMAT "%s (%.2f%%) used", + log_info(gc, metaspace)("Metaspace: %zu%s reserved, %zu%s (%.2f%%) committed, " + "%zu%s (%.2f%%) used", byte_size_in_proper_unit(reserved), proper_unit_for_byte_size(reserved), byte_size_in_proper_unit(committed), proper_unit_for_byte_size(committed), committed * 100.0 / reserved, diff --git a/src/hotspot/share/gc/epsilon/epsilonInitLogger.cpp b/src/hotspot/share/gc/epsilon/epsilonInitLogger.cpp index a75e9e7679da7..fec5110fba338 100644 --- a/src/hotspot/share/gc/epsilon/epsilonInitLogger.cpp +++ b/src/hotspot/share/gc/epsilon/epsilonInitLogger.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/epsilon/epsilonHeap.hpp" #include "gc/epsilon/epsilonInitLogger.hpp" #include "gc/shared/tlab_globals.hpp" @@ -32,31 +31,31 @@ #include "utilities/globalDefinitions.hpp" void EpsilonInitLogger::print_gc_specific() { - // Warn users that non-resizable heap might be better for some configurations. - // We are not adjusting the heap size by ourselves, because it affects startup time. - if (InitialHeapSize != MaxHeapSize) { - log_warning(gc, init)("Consider setting -Xms equal to -Xmx to avoid resizing hiccups"); - } - - // Warn users that AlwaysPreTouch might be better for some configurations. - // We are not turning this on by ourselves, because it affects startup time. - if (FLAG_IS_DEFAULT(AlwaysPreTouch) && !AlwaysPreTouch) { - log_warning(gc, init)("Consider enabling -XX:+AlwaysPreTouch to avoid memory commit hiccups"); - } - if (UseTLAB) { size_t max_tlab = EpsilonHeap::heap()->max_tlab_size() * HeapWordSize; - log_info(gc, init)("TLAB Size Max: " SIZE_FORMAT "%s", + log_info(gc, init)("TLAB Size Max: %zu%s", byte_size_in_exact_unit(max_tlab), exact_unit_for_byte_size(max_tlab)); if (EpsilonElasticTLAB) { log_info(gc, init)("TLAB Size Elasticity: %.2fx", EpsilonTLABElasticity); } if (EpsilonElasticTLABDecay) { - log_info(gc, init)("TLAB Size Decay Time: " SIZE_FORMAT "ms", EpsilonTLABDecayTime); + log_info(gc, init)("TLAB Size Decay Time: %zums", EpsilonTLABDecayTime); } } else { log_info(gc, init)("TLAB: Disabled"); } + + // Suggest that non-resizable heap might be better for some configurations. + // We are not adjusting the heap size by ourselves, because it affects startup time. + if (InitialHeapSize != MaxHeapSize) { + log_info(gc)("Consider setting -Xms equal to -Xmx to avoid resizing hiccups"); + } + + // Suggest that AlwaysPreTouch might be better for some configurations. + // We are not turning this on by ourselves, because it affects startup time. + if (FLAG_IS_DEFAULT(AlwaysPreTouch) && !AlwaysPreTouch) { + log_info(gc)("Consider enabling -XX:+AlwaysPreTouch to avoid memory commit hiccups"); + } } void EpsilonInitLogger::print() { diff --git a/src/hotspot/share/gc/epsilon/epsilonMemoryPool.cpp b/src/hotspot/share/gc/epsilon/epsilonMemoryPool.cpp index b90d6e38d28d5..013b00d505a9f 100644 --- a/src/hotspot/share/gc/epsilon/epsilonMemoryPool.cpp +++ b/src/hotspot/share/gc/epsilon/epsilonMemoryPool.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/epsilon/epsilonHeap.hpp" #include "gc/epsilon/epsilonMemoryPool.hpp" #include "gc/shared/gc_globals.hpp" diff --git a/src/hotspot/share/gc/epsilon/epsilonMonitoringSupport.cpp b/src/hotspot/share/gc/epsilon/epsilonMonitoringSupport.cpp index 93d84d5604ccf..55f15fb473dc9 100644 --- a/src/hotspot/share/gc/epsilon/epsilonMonitoringSupport.cpp +++ b/src/hotspot/share/gc/epsilon/epsilonMonitoringSupport.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/epsilon/epsilonMonitoringSupport.hpp" #include "gc/epsilon/epsilonHeap.hpp" #include "gc/shared/generationCounters.hpp" diff --git a/src/hotspot/share/gc/g1/c1/g1BarrierSetC1.cpp b/src/hotspot/share/gc/g1/c1/g1BarrierSetC1.cpp index 449ff2e4acf8b..1e91e067f330b 100644 --- a/src/hotspot/share/gc/g1/c1/g1BarrierSetC1.cpp +++ b/src/hotspot/share/gc/g1/c1/g1BarrierSetC1.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_LIRGenerator.hpp" #include "c1/c1_CodeStubs.hpp" #include "gc/g1/c1/g1BarrierSetC1.hpp" diff --git a/src/hotspot/share/gc/g1/c2/g1BarrierSetC2.cpp b/src/hotspot/share/gc/g1/c2/g1BarrierSetC2.cpp index 315aa469dbe56..7999efe54bf65 100644 --- a/src/hotspot/share/gc/g1/c2/g1BarrierSetC2.cpp +++ b/src/hotspot/share/gc/g1/c2/g1BarrierSetC2.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/javaClasses.hpp" #include "code/vmreg.inline.hpp" #include "gc/g1/c2/g1BarrierSetC2.hpp" diff --git a/src/hotspot/share/gc/g1/g1AllocRegion.cpp b/src/hotspot/share/gc/g1/g1AllocRegion.cpp index a0a2b31ed6a18..47d7e3a6bffa7 100644 --- a/src/hotspot/share/gc/g1/g1AllocRegion.cpp +++ b/src/hotspot/share/gc/g1/g1AllocRegion.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1AllocRegion.inline.hpp" #include "gc/g1/g1EvacStats.inline.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" @@ -225,10 +224,10 @@ void G1AllocRegion::trace(const char* str, size_t min_word_size, size_t desired_ if (detailed_info) { if (result != nullptr) { - out->print(" min " SIZE_FORMAT " desired " SIZE_FORMAT " actual " SIZE_FORMAT " " PTR_FORMAT, + out->print(" min %zu desired %zu actual %zu " PTR_FORMAT, min_word_size, desired_word_size, actual_word_size, p2i(result)); } else if (min_word_size != 0) { - out->print(" min " SIZE_FORMAT " desired " SIZE_FORMAT, min_word_size, desired_word_size); + out->print(" min %zu desired %zu", min_word_size, desired_word_size); } } out->cr(); @@ -319,7 +318,7 @@ G1HeapRegion* MutatorAllocRegion::release() { _wasted_bytes += retire_internal(_retained_alloc_region, false); _retained_alloc_region = nullptr; } - log_debug(gc, alloc, region)("Mutator Allocation stats, regions: %u, wasted size: " SIZE_FORMAT "%s (%4.1f%%)", + log_debug(gc, alloc, region)("Mutator Allocation stats, regions: %u, wasted size: %zu%s (%4.1f%%)", count(), byte_size_in_proper_unit(_wasted_bytes), proper_unit_for_byte_size(_wasted_bytes), diff --git a/src/hotspot/share/gc/g1/g1Allocator.cpp b/src/hotspot/share/gc/g1/g1Allocator.cpp index be8c39ba440b2..56dbeb9eac140 100644 --- a/src/hotspot/share/gc/g1/g1Allocator.cpp +++ b/src/hotspot/share/gc/g1/g1Allocator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1Allocator.inline.hpp" #include "gc/g1/g1AllocRegion.inline.hpp" #include "gc/g1/g1EvacInfo.hpp" @@ -218,7 +217,7 @@ HeapWord* G1Allocator::par_allocate_during_gc(G1HeapRegionAttr dest, size_t temp = 0; HeapWord* result = par_allocate_during_gc(dest, word_size, word_size, &temp, node_index); assert(result == nullptr || temp == word_size, - "Requested " SIZE_FORMAT " words, but got " SIZE_FORMAT " at " PTR_FORMAT, + "Requested %zu words, but got %zu at " PTR_FORMAT, word_size, temp, p2i(result)); return result; } diff --git a/src/hotspot/share/gc/g1/g1Analytics.cpp b/src/hotspot/share/gc/g1/g1Analytics.cpp index 5809bfa2b6c5e..59d1a48cd8529 100644 --- a/src/hotspot/share/gc/g1/g1Analytics.cpp +++ b/src/hotspot/share/gc/g1/g1Analytics.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1Analytics.hpp" #include "gc/g1/g1AnalyticsSequences.inline.hpp" #include "gc/g1/g1Predictions.hpp" diff --git a/src/hotspot/share/gc/g1/g1Arguments.cpp b/src/hotspot/share/gc/g1/g1Arguments.cpp index 1ae5f2ce76fef..b1cf9fd304620 100644 --- a/src/hotspot/share/gc/g1/g1Arguments.cpp +++ b/src/hotspot/share/gc/g1/g1Arguments.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, Red Hat, Inc. and/or its affiliates. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "cds/cdsConfig.hpp" #include "gc/g1/g1Arguments.hpp" #include "gc/g1/g1CardSet.hpp" diff --git a/src/hotspot/share/gc/g1/g1BarrierSet.cpp b/src/hotspot/share/gc/g1/g1BarrierSet.cpp index 4eb3fcf600b04..c56434340cd5a 100644 --- a/src/hotspot/share/gc/g1/g1BarrierSet.cpp +++ b/src/hotspot/share/gc/g1/g1BarrierSet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1BarrierSet.inline.hpp" #include "gc/g1/g1BarrierSetAssembler.hpp" #include "gc/g1/g1CardTable.inline.hpp" diff --git a/src/hotspot/share/gc/g1/g1BarrierSetRuntime.cpp b/src/hotspot/share/gc/g1/g1BarrierSetRuntime.cpp index ab67321242e71..ce0d53e4891cc 100644 --- a/src/hotspot/share/gc/g1/g1BarrierSetRuntime.cpp +++ b/src/hotspot/share/gc/g1/g1BarrierSetRuntime.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1BarrierSet.inline.hpp" #include "gc/g1/g1BarrierSetRuntime.hpp" #include "gc/g1/g1ThreadLocalData.hpp" diff --git a/src/hotspot/share/gc/g1/g1BatchedTask.cpp b/src/hotspot/share/gc/g1/g1BatchedTask.cpp index 804ec06688054..9089ffedf61de 100644 --- a/src/hotspot/share/gc/g1/g1BatchedTask.cpp +++ b/src/hotspot/share/gc/g1/g1BatchedTask.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1BatchedTask.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" diff --git a/src/hotspot/share/gc/g1/g1BiasedArray.cpp b/src/hotspot/share/gc/g1/g1BiasedArray.cpp index 22b07db3d85d6..05b8d7834e764 100644 --- a/src/hotspot/share/gc/g1/g1BiasedArray.cpp +++ b/src/hotspot/share/gc/g1/g1BiasedArray.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1BiasedArray.hpp" #include "memory/padded.inline.hpp" @@ -48,20 +47,20 @@ address G1BiasedMappedArrayBase::create_new_base_array(size_t length, size_t ele #ifndef PRODUCT void G1BiasedMappedArrayBase::verify_index(idx_t index) const { guarantee(_base != nullptr, "Array not initialized"); - guarantee(index < length(), "Index out of bounds index: " SIZE_FORMAT " length: " SIZE_FORMAT, index, length()); + guarantee(index < length(), "Index out of bounds index: %zu length: %zu", index, length()); } void G1BiasedMappedArrayBase::verify_biased_index(idx_t biased_index) const { guarantee(_biased_base != nullptr, "Array not initialized"); guarantee(biased_index >= bias() && biased_index < (bias() + length()), - "Biased index out of bounds, index: " SIZE_FORMAT " bias: " SIZE_FORMAT " length: " SIZE_FORMAT, + "Biased index out of bounds, index: %zu bias: %zu length: %zu", biased_index, bias(), length()); } void G1BiasedMappedArrayBase::verify_biased_index_inclusive_end(idx_t biased_index) const { guarantee(_biased_base != nullptr, "Array not initialized"); guarantee(biased_index >= bias() && biased_index <= (bias() + length()), - "Biased index out of inclusive bounds, index: " SIZE_FORMAT " bias: " SIZE_FORMAT " length: " SIZE_FORMAT, + "Biased index out of inclusive bounds, index: %zu bias: %zu length: %zu", biased_index, bias(), length()); } diff --git a/src/hotspot/share/gc/g1/g1BiasedArray.hpp b/src/hotspot/share/gc/g1/g1BiasedArray.hpp index 67b4c6bbe3084..da99f928ab599 100644 --- a/src/hotspot/share/gc/g1/g1BiasedArray.hpp +++ b/src/hotspot/share/gc/g1/g1BiasedArray.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -72,12 +72,12 @@ class G1BiasedMappedArrayBase : public CHeapObj { void initialize(HeapWord* bottom, HeapWord* end, size_t target_elem_size_in_bytes, size_t mapping_granularity_in_bytes) { assert(mapping_granularity_in_bytes > 0, "just checking"); assert(is_power_of_2(mapping_granularity_in_bytes), - "mapping granularity must be power of 2, is " SIZE_FORMAT, mapping_granularity_in_bytes); + "mapping granularity must be power of 2, is %zu", mapping_granularity_in_bytes); assert((uintptr_t)bottom % mapping_granularity_in_bytes == 0, - "bottom mapping area address must be a multiple of mapping granularity " SIZE_FORMAT ", is " PTR_FORMAT, + "bottom mapping area address must be a multiple of mapping granularity %zu, is " PTR_FORMAT, mapping_granularity_in_bytes, p2i(bottom)); assert((uintptr_t)end % mapping_granularity_in_bytes == 0, - "end mapping area address must be a multiple of mapping granularity " SIZE_FORMAT ", is " PTR_FORMAT, + "end mapping area address must be a multiple of mapping granularity %zu, is " PTR_FORMAT, mapping_granularity_in_bytes, p2i(end)); size_t num_target_elems = pointer_delta(end, bottom, mapping_granularity_in_bytes); idx_t bias = (uintptr_t)bottom / mapping_granularity_in_bytes; diff --git a/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp b/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp index a8c558743184b..dcd1979343acb 100644 --- a/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp +++ b/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1BlockOffsetTable.inline.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1HeapRegion.inline.hpp" @@ -44,7 +43,7 @@ G1BlockOffsetTable::G1BlockOffsetTable(MemRegion heap, G1RegionToSpaceMapper* st _offset_base = ((uint8_t*)bot_reserved.start() - (uintptr_t(_reserved.start()) >> CardTable::card_shift())); log_trace(gc, bot)("G1BlockOffsetTable::G1BlockOffsetTable: "); - log_trace(gc, bot)(" rs.base(): " PTR_FORMAT " rs.size(): " SIZE_FORMAT " rs end(): " PTR_FORMAT, + log_trace(gc, bot)(" rs.base(): " PTR_FORMAT " rs.size(): %zu rs end(): " PTR_FORMAT, p2i(bot_reserved.start()), bot_reserved.byte_size(), p2i(bot_reserved.end())); } diff --git a/src/hotspot/share/gc/g1/g1BlockOffsetTable.hpp b/src/hotspot/share/gc/g1/g1BlockOffsetTable.hpp index e0454d803f1e4..59d5c4efcef21 100644 --- a/src/hotspot/share/gc/g1/g1BlockOffsetTable.hpp +++ b/src/hotspot/share/gc/g1/g1BlockOffsetTable.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,7 +47,7 @@ class G1BlockOffsetTable: public CHeapObj { void check_offset(size_t offset, const char* msg) const { assert(offset < CardTable::card_size_in_words(), - "%s - offset: " SIZE_FORMAT ", N_words: %u", + "%s - offset: %zu, N_words: %u", msg, offset, CardTable::card_size_in_words()); } diff --git a/src/hotspot/share/gc/g1/g1CardSet.cpp b/src/hotspot/share/gc/g1/g1CardSet.cpp index 5c11a1a967700..57b7f91260ccd 100644 --- a/src/hotspot/share/gc/g1/g1CardSet.cpp +++ b/src/hotspot/share/gc/g1/g1CardSet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1CardSet.inline.hpp" #include "gc/g1/g1CardSetContainers.inline.hpp" #include "gc/g1/g1CardSetMemory.inline.hpp" diff --git a/src/hotspot/share/gc/g1/g1CardSetContainers.cpp b/src/hotspot/share/gc/g1/g1CardSetContainers.cpp index adee0a8e5a947..6ee1dfb2f95a5 100644 --- a/src/hotspot/share/gc/g1/g1CardSetContainers.cpp +++ b/src/hotspot/share/gc/g1/g1CardSetContainers.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1CardSetContainers.hpp" #include "utilities/globalDefinitions.hpp" diff --git a/src/hotspot/share/gc/g1/g1CardSetMemory.cpp b/src/hotspot/share/gc/g1/g1CardSetMemory.cpp index 28ed698b248e7..6f683e777fb94 100644 --- a/src/hotspot/share/gc/g1/g1CardSetMemory.cpp +++ b/src/hotspot/share/gc/g1/g1CardSetMemory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1CardSetContainers.inline.hpp" #include "gc/g1/g1CardSetMemory.inline.hpp" diff --git a/src/hotspot/share/gc/g1/g1CardTable.cpp b/src/hotspot/share/gc/g1/g1CardTable.cpp index fa8203a1f58a6..303b8cda91fa3 100644 --- a/src/hotspot/share/gc/g1/g1CardTable.cpp +++ b/src/hotspot/share/gc/g1/g1CardTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1CardTable.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/shared/memset_with_concurrent_readers.hpp" diff --git a/src/hotspot/share/gc/g1/g1CodeRootSet.cpp b/src/hotspot/share/gc/g1/g1CodeRootSet.cpp index e72e5e8d377ed..40534b9b4c98a 100644 --- a/src/hotspot/share/gc/g1/g1CodeRootSet.cpp +++ b/src/hotspot/share/gc/g1/g1CodeRootSet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * */ -#include "precompiled.hpp" - #include "code/codeCache.hpp" #include "code/nmethod.hpp" #include "gc/g1/g1CodeRootSet.hpp" diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp index 91fc048e982d2..478c8f48f27ba 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderDataGraph.hpp" #include "classfile/metadataOnStackMark.hpp" #include "classfile/systemDictionary.hpp" @@ -179,11 +178,11 @@ G1HeapRegion* G1CollectedHeap::new_region(size_t word_size, // safepoint. assert(SafepointSynchronize::is_at_safepoint(), "invariant"); - log_debug(gc, ergo, heap)("Attempt heap expansion (region allocation request failed). Allocation request: " SIZE_FORMAT "B", + log_debug(gc, ergo, heap)("Attempt heap expansion (region allocation request failed). Allocation request: %zuB", word_size * HeapWordSize); assert(word_size * HeapWordSize < G1HeapRegion::GrainBytes, - "This kind of expansion should never be more than one region. Size: " SIZE_FORMAT, + "This kind of expansion should never be more than one region. Size: %zu", word_size * HeapWordSize); if (expand_single_region(node_index)) { // Given that expand_single_region() succeeded in expanding the heap, and we @@ -335,7 +334,7 @@ G1CollectedHeap::humongous_obj_allocate_initialize_regions(G1HeapRegion* first_h } size_t G1CollectedHeap::humongous_obj_size_in_regions(size_t word_size) { - assert(is_humongous(word_size), "Object of size " SIZE_FORMAT " must be humongous here", word_size); + assert(is_humongous(word_size), "Object of size %zu must be humongous here", word_size); return align_up(word_size, G1HeapRegion::GrainWords) / G1HeapRegion::GrainWords; } @@ -358,7 +357,7 @@ HeapWord* G1CollectedHeap::humongous_obj_allocate(size_t word_size) { humongous_start = _hrm.expand_and_allocate_humongous(obj_regions); if (humongous_start != nullptr) { // We managed to find a region by expanding the heap. - log_debug(gc, ergo, heap)("Heap expansion (humongous allocation request). Allocation request: " SIZE_FORMAT "B", + log_debug(gc, ergo, heap)("Heap expansion (humongous allocation request). Allocation request: %zuB", word_size * HeapWordSize); policy()->record_new_heap_size(num_regions()); } else { @@ -444,7 +443,7 @@ HeapWord* G1CollectedHeap::attempt_allocation_slow(size_t word_size) { return result; } - log_trace(gc, alloc)("%s: Unsuccessfully scheduled collection allocating " SIZE_FORMAT " words", + log_trace(gc, alloc)("%s: Unsuccessfully scheduled collection allocating %zu words", Thread::current()->name(), word_size); // We can reach here if we were unsuccessful in scheduling a collection (because @@ -462,7 +461,7 @@ HeapWord* G1CollectedHeap::attempt_allocation_slow(size_t word_size) { // Give a warning if we seem to be looping forever. if ((QueuedAllocationWarningCount > 0) && (try_count % QueuedAllocationWarningCount == 0)) { - log_warning(gc, alloc)("%s: Retried allocation %u times for " SIZE_FORMAT " words", + log_warning(gc, alloc)("%s: Retried allocation %u times for %zu words", Thread::current()->name(), try_count, word_size); } } @@ -495,8 +494,8 @@ HeapWord* G1CollectedHeap::alloc_archive_region(size_t word_size, HeapWord* pref MemRegion reserved = _hrm.reserved(); if (reserved.word_size() <= word_size) { - log_info(gc, heap)("Unable to allocate regions as archive heap is too large; size requested = " SIZE_FORMAT - " bytes, heap = " SIZE_FORMAT " bytes", word_size, reserved.word_size()); + log_info(gc, heap)("Unable to allocate regions as archive heap is too large; size requested = %zu" + " bytes, heap = %zu bytes", word_size, reserved.word_size()); return nullptr; } @@ -514,7 +513,7 @@ HeapWord* G1CollectedHeap::alloc_archive_region(size_t word_size, HeapWord* pref } increase_used(word_size * HeapWordSize); if (commits != 0) { - log_debug(gc, ergo, heap)("Attempt heap expansion (allocate archive regions). Total size: " SIZE_FORMAT "B", + log_debug(gc, ergo, heap)("Attempt heap expansion (allocate archive regions). Total size: %zuB", G1HeapRegion::GrainWords * HeapWordSize * commits); } @@ -573,7 +572,7 @@ void G1CollectedHeap::dealloc_archive_regions(MemRegion range) { iterate_regions_in_range(range, dealloc_archive_region); if (shrink_count != 0) { - log_debug(gc, ergo, heap)("Attempt heap shrinking (CDS archive regions). Total size: " SIZE_FORMAT "B", + log_debug(gc, ergo, heap)("Attempt heap shrinking (CDS archive regions). Total size: %zuB", G1HeapRegion::GrainWords * HeapWordSize * shrink_count); // Explicit uncommit. uncommit_regions(shrink_count); @@ -673,7 +672,7 @@ HeapWord* G1CollectedHeap::attempt_allocation_humongous(size_t word_size) { return result; } - log_trace(gc, alloc)("%s: Unsuccessfully scheduled collection allocating " SIZE_FORMAT "", + log_trace(gc, alloc)("%s: Unsuccessfully scheduled collection allocating %zu", Thread::current()->name(), word_size); // We can reach here if we were unsuccessful in scheduling a collection (because @@ -978,7 +977,7 @@ HeapWord* G1CollectedHeap::expand_and_allocate(size_t word_size) { _verifier->verify_region_sets_optional(); size_t expand_bytes = MAX2(word_size * HeapWordSize, MinHeapDeltaBytes); - log_debug(gc, ergo, heap)("Attempt heap expansion (allocation request failed). Allocation request: " SIZE_FORMAT "B", + log_debug(gc, ergo, heap)("Attempt heap expansion (allocation request failed). Allocation request: %zuB", word_size * HeapWordSize); @@ -995,7 +994,7 @@ bool G1CollectedHeap::expand(size_t expand_bytes, WorkerThreads* pretouch_worker size_t aligned_expand_bytes = os::align_up_vm_page_size(expand_bytes); aligned_expand_bytes = align_up(aligned_expand_bytes, G1HeapRegion::GrainBytes); - log_debug(gc, ergo, heap)("Expand the heap. requested expansion amount: " SIZE_FORMAT "B expansion amount: " SIZE_FORMAT "B", + log_debug(gc, ergo, heap)("Expand the heap. requested expansion amount: %zuB expansion amount: %zuB", expand_bytes, aligned_expand_bytes); if (is_maximal_no_gc()) { @@ -1042,7 +1041,7 @@ void G1CollectedHeap::shrink_helper(size_t shrink_bytes) { uint num_regions_removed = _hrm.shrink_by(num_regions_to_remove); size_t shrunk_bytes = num_regions_removed * G1HeapRegion::GrainBytes; - log_debug(gc, ergo, heap)("Shrink the heap. requested shrinking amount: " SIZE_FORMAT "B aligned shrinking amount: " SIZE_FORMAT "B actual amount shrunk: " SIZE_FORMAT "B", + log_debug(gc, ergo, heap)("Shrink the heap. requested shrinking amount: %zuB aligned shrinking amount: %zuB actual amount shrunk: %zuB", shrink_bytes, aligned_shrink_bytes, shrunk_bytes); if (num_regions_removed > 0) { log_debug(gc, heap)("Uncommittable regions after shrink: %u", num_regions_removed); @@ -2117,12 +2116,12 @@ void G1CollectedHeap::print_on(outputStream* st) const { p2i(_hrm.reserved().start()), p2i(_hrm.reserved().end())); st->cr(); - st->print(" region size " SIZE_FORMAT "K, ", G1HeapRegion::GrainBytes / K); + st->print(" region size %zuK, ", G1HeapRegion::GrainBytes / K); uint young_regions = young_regions_count(); - st->print("%u young (" SIZE_FORMAT "K), ", young_regions, + st->print("%u young (%zuK), ", young_regions, (size_t) young_regions * G1HeapRegion::GrainBytes / K); uint survivor_regions = survivor_regions_count(); - st->print("%u survivors (" SIZE_FORMAT "K)", survivor_regions, + st->print("%u survivors (%zuK)", survivor_regions, (size_t) survivor_regions * G1HeapRegion::GrainBytes / K); st->cr(); if (_numa->is_enabled()) { @@ -2774,7 +2773,7 @@ void G1CollectedHeap::increase_used(size_t bytes) { void G1CollectedHeap::decrease_used(size_t bytes) { assert(_summary_bytes_used >= bytes, - "invariant: _summary_bytes_used: " SIZE_FORMAT " should be >= bytes: " SIZE_FORMAT, + "invariant: _summary_bytes_used: %zu should be >= bytes: %zu", _summary_bytes_used, bytes); _summary_bytes_used -= bytes; } diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp index 1b840392769cd..73dfc85bb1bc0 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -361,8 +361,8 @@ class G1CollectedHeap : public CollectedHeap { do { \ size_t cur_used_bytes = g1h->used(); \ size_t recal_used_bytes = g1h->recalculate_used(); \ - assert(cur_used_bytes == recal_used_bytes, "Used(" SIZE_FORMAT ") is not" \ - " same as recalculated used(" SIZE_FORMAT ").", \ + assert(cur_used_bytes == recal_used_bytes, "Used(%zu) is not" \ + " same as recalculated used(%zu).", \ cur_used_bytes, recal_used_bytes); \ } while (0) #else diff --git a/src/hotspot/share/gc/g1/g1CollectionSet.cpp b/src/hotspot/share/gc/g1/g1CollectionSet.cpp index ec90fd377503d..91c13183c4bee 100644 --- a/src/hotspot/share/gc/g1/g1CollectionSet.cpp +++ b/src/hotspot/share/gc/g1/g1CollectionSet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1Analytics.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1CollectionSet.hpp" @@ -284,7 +283,7 @@ double G1CollectionSet::finalize_young_part(double target_pause_time_ms, G1Survi size_t pending_cards = _policy->pending_cards_at_gc_start(); - log_trace(gc, ergo, cset)("Start choosing CSet. Pending cards: " SIZE_FORMAT " target pause time: %1.2fms", + log_trace(gc, ergo, cset)("Start choosing CSet. Pending cards: %zu target pause time: %1.2fms", pending_cards, target_pause_time_ms); // The young list is laid with the survivor regions from the previous diff --git a/src/hotspot/share/gc/g1/g1CollectionSetCandidates.cpp b/src/hotspot/share/gc/g1/g1CollectionSetCandidates.cpp index 05e6457c095a5..1c3134eee6471 100644 --- a/src/hotspot/share/gc/g1/g1CollectionSetCandidates.cpp +++ b/src/hotspot/share/gc/g1/g1CollectionSetCandidates.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1CollectionSetCandidates.inline.hpp" #include "gc/g1/g1CollectionSetChooser.hpp" #include "gc/g1/g1HeapRegion.inline.hpp" diff --git a/src/hotspot/share/gc/g1/g1CollectionSetChooser.cpp b/src/hotspot/share/gc/g1/g1CollectionSetChooser.cpp index 630fb8a7a1122..28ca72a238115 100644 --- a/src/hotspot/share/gc/g1/g1CollectionSetChooser.cpp +++ b/src/hotspot/share/gc/g1/g1CollectionSetChooser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1CollectionSetCandidates.hpp" #include "gc/g1/g1CollectionSetChooser.hpp" @@ -224,7 +223,7 @@ class G1BuildCandidateRegionsTask : public WorkerTask { num_pruned++; } - log_debug(gc, ergo, cset)("Pruned %u regions out of %u, leaving " SIZE_FORMAT " bytes waste (allowed " SIZE_FORMAT ")", + log_debug(gc, ergo, cset)("Pruned %u regions out of %u, leaving %zu bytes waste (allowed %zu)", num_pruned, num_candidates, wasted_bytes, diff --git a/src/hotspot/share/gc/g1/g1CollectorState.cpp b/src/hotspot/share/gc/g1/g1CollectorState.cpp index 581ab4f16bf63..d41ee22fdcead 100644 --- a/src/hotspot/share/gc/g1/g1CollectorState.cpp +++ b/src/hotspot/share/gc/g1/g1CollectorState.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1CollectorState.hpp" #include "gc/g1/g1GCPauseType.hpp" diff --git a/src/hotspot/share/gc/g1/g1CommittedRegionMap.cpp b/src/hotspot/share/gc/g1/g1CommittedRegionMap.cpp index 6919cc7d0c911..d8454cd5cf88c 100644 --- a/src/hotspot/share/gc/g1/g1CommittedRegionMap.cpp +++ b/src/hotspot/share/gc/g1/g1CommittedRegionMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1CommittedRegionMap.inline.hpp" #include "logging/log.hpp" #include "memory/universe.hpp" @@ -233,7 +232,7 @@ void G1CommittedRegionMap::verify_free_range(uint start, uint end) const { void G1CommittedRegionMap::verify_no_inactive_regons() const { BitMap::idx_t first_inactive = _inactive.find_first_set_bit(0); - assert(first_inactive == _inactive.size(), "Should be no inactive regions, but was at index: " SIZE_FORMAT, first_inactive); + assert(first_inactive == _inactive.size(), "Should be no inactive regions, but was at index: %zu", first_inactive); } void G1CommittedRegionMap::verify_active_count(uint start, uint end, uint expected) const { diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp index d0879e9967cd3..3558138ad5b24 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderData.hpp" #include "classfile/classLoaderDataGraph.hpp" #include "gc/g1/g1BarrierSet.hpp" @@ -140,7 +139,7 @@ bool G1CMMarkStack::initialize() { log_trace(gc)("MarkStackSize: %uk MarkStackSizeMax: %uk", (uint)(MarkStackSize / K), (uint)(MarkStackSizeMax / K)); - log_debug(gc)("Initialize mark stack with " SIZE_FORMAT " chunks, maximum " SIZE_FORMAT, + log_debug(gc)("Initialize mark stack with %zu chunks, maximum %zu", initial_num_chunks, max_capacity); return _chunk_allocator.initialize(initial_num_chunks, max_num_chunks); @@ -205,7 +204,7 @@ bool G1CMMarkStack::ChunkAllocator::initialize(size_t initial_capacity, size_t m size_t new_capacity = bucket_size(0); if (!reserve(new_capacity)) { - log_warning(gc)("Failed to reserve memory for new overflow mark stack with " SIZE_FORMAT " chunks and size " SIZE_FORMAT "B.", new_capacity, new_capacity * sizeof(TaskQueueEntryChunk)); + log_warning(gc)("Failed to reserve memory for new overflow mark stack with %zu chunks and size %zuB.", new_capacity, new_capacity * sizeof(TaskQueueEntryChunk)); return false; } return true; @@ -213,7 +212,7 @@ bool G1CMMarkStack::ChunkAllocator::initialize(size_t initial_capacity, size_t m 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); + log_debug(gc)("Can not expand overflow mark stack further, already at maximum capacity of %zu chunks.", _capacity); return false; } @@ -221,7 +220,7 @@ bool G1CMMarkStack::ChunkAllocator::try_expand_to(size_t desired_capacity) { desired_capacity = MIN2(desired_capacity, _max_capacity); if (reserve(desired_capacity)) { - log_debug(gc)("Expanded the mark stack capacity from " SIZE_FORMAT " to " SIZE_FORMAT " chunks", + log_debug(gc)("Expanded the mark stack capacity from %zu to %zu chunks", old_capacity, desired_capacity); return true; } @@ -249,7 +248,7 @@ G1CMMarkStack::ChunkAllocator::~ChunkAllocator() { } bool G1CMMarkStack::ChunkAllocator::reserve(size_t new_capacity) { - assert(new_capacity <= _max_capacity, "Cannot expand overflow mark stack beyond the max_capacity" SIZE_FORMAT " chunks.", _max_capacity); + assert(new_capacity <= _max_capacity, "Cannot expand overflow mark stack beyond the max_capacity of %zu chunks.", _max_capacity); size_t highest_bucket = get_bucket(new_capacity - 1); size_t i = get_bucket(_capacity); @@ -273,7 +272,7 @@ bool G1CMMarkStack::ChunkAllocator::reserve(size_t new_capacity) { TaskQueueEntryChunk* bucket_base = MmapArrayAllocator::allocate_or_null(bucket_capacity, mtGC); if (bucket_base == nullptr) { - log_warning(gc)("Failed to reserve memory for increasing the overflow mark stack capacity with " SIZE_FORMAT " chunks and size " SIZE_FORMAT "B.", + log_warning(gc)("Failed to reserve memory for increasing the overflow mark stack capacity with %zu chunks and size %zuB.", bucket_capacity, bucket_capacity * sizeof(TaskQueueEntryChunk)); return false; } @@ -384,7 +383,7 @@ void G1CMRootMemRegions::reset() { void G1CMRootMemRegions::add(HeapWord* start, HeapWord* end) { assert_at_safepoint(); size_t idx = Atomic::fetch_then_add(&_num_root_regions, 1u); - assert(idx < _max_regions, "Trying to add more root MemRegions than there is space " SIZE_FORMAT, _max_regions); + assert(idx < _max_regions, "Trying to add more root MemRegions than there is space %zu", _max_regions); assert(start != nullptr && end != nullptr && start <= end, "Start (" PTR_FORMAT ") should be less or equal to " "end (" PTR_FORMAT ")", p2i(start), p2i(end)); _root_regions[idx].set_start(start); @@ -446,7 +445,7 @@ void G1CMRootMemRegions::scan_finished() { if (!_should_abort) { assert(_claimed_root_regions >= num_root_regions(), - "we should have claimed all root regions, claimed " SIZE_FORMAT ", length = %u", + "we should have claimed all root regions, claimed %zu, length = %u", _claimed_root_regions, num_root_regions()); } @@ -790,7 +789,7 @@ void G1ConcurrentMark::clear_bitmap(WorkerThreads* workers, bool may_yield) { G1ClearBitMapTask cl(this, num_workers, may_yield); - log_debug(gc, ergo)("Running %s with %u workers for " SIZE_FORMAT " work units.", cl.name(), num_workers, num_chunks); + log_debug(gc, ergo)("Running %s with %u workers for %zu work units.", cl.name(), num_workers, num_chunks); workers->run_task(&cl, num_workers); guarantee(may_yield || cl.is_complete(), "Must have completed iteration when not yielding."); } @@ -1737,7 +1736,7 @@ void G1ConcurrentMark::weak_refs_work() { // We can not trust g1_is_alive and the contents of the heap if the marking stack // overflowed while processing references. Exit the VM. fatal("Overflow during reference processing, can not continue. Current mark stack depth: " - SIZE_FORMAT ", MarkStackSize: " SIZE_FORMAT ", MarkStackSizeMax: " SIZE_FORMAT ". " + "%zu, MarkStackSize: %zu, MarkStackSizeMax: %zu. " "Please increase MarkStackSize and/or MarkStackSizeMax and restart.", _global_mark_stack.size(), MarkStackSize, MarkStackSizeMax); return; @@ -1882,7 +1881,7 @@ void G1ConcurrentMark::finalize_marking() { SATBMarkQueueSet& satb_mq_set = G1BarrierSet::satb_mark_queue_set(); guarantee(has_overflown() || satb_mq_set.completed_buffers_num() == 0, - "Invariant: has_overflown = %s, num buffers = " SIZE_FORMAT, + "Invariant: has_overflown = %s, num buffers = %zu", BOOL_TO_STR(has_overflown()), satb_mq_set.completed_buffers_num()); @@ -1898,7 +1897,7 @@ void G1ConcurrentMark::flush_all_task_caches() { misses += stats.second; } size_t sum = hits + misses; - log_debug(gc, stats)("Mark stats cache hits " SIZE_FORMAT " misses " SIZE_FORMAT " ratio %1.3lf", + log_debug(gc, stats)("Mark stats cache hits %zu misses %zu ratio %1.3lf", hits, misses, percent_of(hits, sum)); } @@ -2475,7 +2474,7 @@ void G1CMTask::print_stats() { _step_times_ms.sum()); size_t const hits = _mark_stats_cache.hits(); size_t const misses = _mark_stats_cache.misses(); - log_debug(gc, stats)(" Mark Stats Cache: hits " SIZE_FORMAT " misses " SIZE_FORMAT " ratio %.3f", + log_debug(gc, stats)(" Mark Stats Cache: hits %zu misses %zu ratio %.3f", hits, misses, percent_of(hits, hits + misses)); } @@ -2976,7 +2975,7 @@ G1CMTask::G1CMTask(uint worker_id, #define G1PPRL_TYPE_H_FORMAT " %4s" #define G1PPRL_STATE_FORMAT " %-5s" #define G1PPRL_STATE_H_FORMAT " %5s" -#define G1PPRL_BYTE_FORMAT " " SIZE_FORMAT_W(9) +#define G1PPRL_BYTE_FORMAT " %9zu" #define G1PPRL_BYTE_H_FORMAT " %9s" #define G1PPRL_DOUBLE_FORMAT "%14.1f" #define G1PPRL_GCEFF_FORMAT " %14s" @@ -2984,7 +2983,7 @@ G1CMTask::G1CMTask(uint worker_id, // For summary info #define G1PPRL_SUM_ADDR_FORMAT(tag) " " tag ":" G1PPRL_ADDR_BASE_FORMAT -#define G1PPRL_SUM_BYTE_FORMAT(tag) " " tag ": " SIZE_FORMAT +#define G1PPRL_SUM_BYTE_FORMAT(tag) " " tag ": %zu" #define G1PPRL_SUM_MB_FORMAT(tag) " " tag ": %1.2f MB" #define G1PPRL_SUM_MB_PERC_FORMAT(tag) G1PPRL_SUM_MB_FORMAT(tag) " / %1.2f %%" diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMark.inline.hpp b/src/hotspot/share/gc/g1/g1ConcurrentMark.inline.hpp index 039169794c543..c5ad269ae6902 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMark.inline.hpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * 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,7 @@ inline void G1CMMarkStack::iterate(Fn fn) const { TaskQueueEntryChunk* cur = _chunk_list; while (cur != nullptr) { - guarantee(num_chunks <= _chunks_in_chunk_list, "Found " SIZE_FORMAT " oop chunks which is more than there should be", num_chunks); + guarantee(num_chunks <= _chunks_in_chunk_list, "Found %zu oop chunks which is more than there should be", num_chunks); for (size_t i = 0; i < EntriesPerChunk; ++i) { if (cur->data[i].is_null()) { diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMarkBitMap.cpp b/src/hotspot/share/gc/g1/g1ConcurrentMarkBitMap.cpp index 4506fda30dabe..3d2e6c0f84906 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMarkBitMap.cpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMarkBitMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1ConcurrentMarkBitMap.inline.hpp" #include "gc/g1/g1HeapRegion.hpp" diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMarkObjArrayProcessor.cpp b/src/hotspot/share/gc/g1/g1ConcurrentMarkObjArrayProcessor.cpp index ee1b1d6555a36..7f62e5527d5df 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMarkObjArrayProcessor.cpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMarkObjArrayProcessor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1ConcurrentMark.inline.hpp" #include "gc/g1/g1ConcurrentMarkObjArrayProcessor.inline.hpp" @@ -48,7 +47,7 @@ size_t G1CMObjArrayProcessor::process_array_slice(objArrayOop obj, HeapWord* sta } size_t G1CMObjArrayProcessor::process_obj(oop obj) { - assert(should_be_sliced(obj), "Must be an array object %d and large " SIZE_FORMAT, obj->is_objArray(), obj->size()); + assert(should_be_sliced(obj), "Must be an array object %d and large %zu", obj->is_objArray(), obj->size()); return process_array_slice(objArrayOop(obj), cast_from_oop(obj), objArrayOop(obj)->size()); } diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMarkThread.cpp b/src/hotspot/share/gc/g1/g1ConcurrentMarkThread.cpp index 37e76a73fe79c..83d547966ed47 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMarkThread.cpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMarkThread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderDataGraph.hpp" #include "gc/g1/g1Analytics.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" diff --git a/src/hotspot/share/gc/g1/g1ConcurrentRebuildAndScrub.cpp b/src/hotspot/share/gc/g1/g1ConcurrentRebuildAndScrub.cpp index f62d42069004f..993df8b47ce3d 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentRebuildAndScrub.cpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentRebuildAndScrub.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1ConcurrentRebuildAndScrub.hpp" diff --git a/src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp b/src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp index 8357737ef6a7d..2e48e438fc955 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1BarrierSet.hpp" #include "gc/g1/g1CollectionSet.hpp" #include "gc/g1/g1ConcurrentRefine.hpp" diff --git a/src/hotspot/share/gc/g1/g1ConcurrentRefineStats.cpp b/src/hotspot/share/gc/g1/g1ConcurrentRefineStats.cpp index 3e8f83326b270..7f0bcc5b50fcc 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentRefineStats.cpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentRefineStats.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1ConcurrentRefineStats.hpp" G1ConcurrentRefineStats::G1ConcurrentRefineStats() : diff --git a/src/hotspot/share/gc/g1/g1ConcurrentRefineThread.cpp b/src/hotspot/share/gc/g1/g1ConcurrentRefineThread.cpp index ed69ac08d1bf0..da1f85eba7343 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentRefineThread.cpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentRefineThread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1BarrierSet.hpp" #include "gc/g1/g1ConcurrentRefine.hpp" #include "gc/g1/g1ConcurrentRefineStats.hpp" diff --git a/src/hotspot/share/gc/g1/g1ConcurrentRefineThreadsNeeded.cpp b/src/hotspot/share/gc/g1/g1ConcurrentRefineThreadsNeeded.cpp index b016ff87adca4..d34229bd35942 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentRefineThreadsNeeded.cpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentRefineThreadsNeeded.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * 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,12 +22,12 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1Analytics.hpp" #include "gc/g1/g1ConcurrentRefineThreadsNeeded.hpp" #include "gc/g1/g1HeapRegion.hpp" #include "gc/g1/g1Policy.hpp" #include "utilities/globalDefinitions.hpp" + #include G1ConcurrentRefineThreadsNeeded::G1ConcurrentRefineThreadsNeeded(G1Policy* policy, diff --git a/src/hotspot/share/gc/g1/g1DirtyCardQueue.cpp b/src/hotspot/share/gc/g1/g1DirtyCardQueue.cpp index 96c212bd2ed28..a2b463ecb347f 100644 --- a/src/hotspot/share/gc/g1/g1DirtyCardQueue.cpp +++ b/src/hotspot/share/gc/g1/g1DirtyCardQueue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1BarrierSet.inline.hpp" #include "gc/g1/g1CardTableEntryClosure.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" @@ -174,7 +173,7 @@ void G1DirtyCardQueueSet::verify_num_cards() const { actual += cur->size(); } assert(actual == Atomic::load(&_num_cards), - "Num entries in completed buffers should be " SIZE_FORMAT " but are " SIZE_FORMAT, + "Num entries in completed buffers should be %zu but are %zu", Atomic::load(&_num_cards), actual); } #endif // ASSERT diff --git a/src/hotspot/share/gc/g1/g1EvacFailureRegions.cpp b/src/hotspot/share/gc/g1/g1EvacFailureRegions.cpp index afc1602639a30..86ceb40e97edb 100644 --- a/src/hotspot/share/gc/g1/g1EvacFailureRegions.cpp +++ b/src/hotspot/share/gc/g1/g1EvacFailureRegions.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1BatchedTask.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" diff --git a/src/hotspot/share/gc/g1/g1EvacStats.cpp b/src/hotspot/share/gc/g1/g1EvacStats.cpp index e632dd2eeddb2..b0e5f7b6864f2 100644 --- a/src/hotspot/share/gc/g1/g1EvacStats.cpp +++ b/src/hotspot/share/gc/g1/g1EvacStats.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1EvacStats.hpp" #include "gc/shared/gcId.hpp" #include "gc/shared/gc_globals.hpp" diff --git a/src/hotspot/share/gc/g1/g1FreeIdSet.cpp b/src/hotspot/share/gc/g1/g1FreeIdSet.cpp index e3cb99acf8da6..6ff863920df23 100644 --- a/src/hotspot/share/gc/g1/g1FreeIdSet.cpp +++ b/src/hotspot/share/gc/g1/g1FreeIdSet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1FreeIdSet.hpp" #include "memory/allocation.inline.hpp" #include "runtime/atomic.hpp" diff --git a/src/hotspot/share/gc/g1/g1FromCardCache.cpp b/src/hotspot/share/gc/g1/g1FromCardCache.cpp index 062130f40ab7f..4a29bcbc6dc41 100644 --- a/src/hotspot/share/gc/g1/g1FromCardCache.cpp +++ b/src/hotspot/share/gc/g1/g1FromCardCache.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1ConcurrentRefine.hpp" #include "gc/g1/g1DirtyCardQueue.hpp" #include "gc/g1/g1FromCardCache.hpp" @@ -57,7 +56,7 @@ void G1FromCardCache::initialize(uint max_reserved_regions) { void G1FromCardCache::invalidate(uint start_idx, size_t new_num_regions) { guarantee((size_t)start_idx + new_num_regions <= max_uintx, - "Trying to invalidate beyond maximum region, from %u size " SIZE_FORMAT, + "Trying to invalidate beyond maximum region, from %u size %zu", start_idx, new_num_regions); uint end_idx = (start_idx + (uint)new_num_regions); assert(end_idx <= _max_reserved_regions, "Must be within max."); @@ -73,7 +72,7 @@ void G1FromCardCache::invalidate(uint start_idx, size_t new_num_regions) { void G1FromCardCache::print(outputStream* out) { for (uint i = 0; i < num_par_rem_sets(); i++) { for (uint j = 0; j < _max_reserved_regions; j++) { - out->print_cr("_from_card_cache[%u][%u] = " SIZE_FORMAT ".", + out->print_cr("_from_card_cache[%u][%u] = %zu.", i, j, at(i, j)); } } diff --git a/src/hotspot/share/gc/g1/g1FullCollector.cpp b/src/hotspot/share/gc/g1/g1FullCollector.cpp index 5789b44e6189e..6a4e517178680 100644 --- a/src/hotspot/share/gc/g1/g1FullCollector.cpp +++ b/src/hotspot/share/gc/g1/g1FullCollector.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderDataGraph.hpp" #include "gc/g1/g1CollectedHeap.hpp" #include "gc/g1/g1FullCollector.inline.hpp" diff --git a/src/hotspot/share/gc/g1/g1FullGCAdjustTask.cpp b/src/hotspot/share/gc/g1/g1FullGCAdjustTask.cpp index 0d4adbe632e39..9a1dd4d1ff54e 100644 --- a/src/hotspot/share/gc/g1/g1FullGCAdjustTask.cpp +++ b/src/hotspot/share/gc/g1/g1FullGCAdjustTask.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderData.hpp" #include "classfile/classLoaderDataGraph.hpp" #include "gc/g1/g1CollectedHeap.hpp" diff --git a/src/hotspot/share/gc/g1/g1FullGCCompactTask.cpp b/src/hotspot/share/gc/g1/g1FullGCCompactTask.cpp index bee3656ead5e4..cc71cf861720b 100644 --- a/src/hotspot/share/gc/g1/g1FullGCCompactTask.cpp +++ b/src/hotspot/share/gc/g1/g1FullGCCompactTask.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1CollectedHeap.hpp" #include "gc/g1/g1ConcurrentMarkBitMap.inline.hpp" #include "gc/g1/g1FullCollector.inline.hpp" diff --git a/src/hotspot/share/gc/g1/g1FullGCCompactionPoint.cpp b/src/hotspot/share/gc/g1/g1FullGCCompactionPoint.cpp index ddd1b7c0999b8..d9d1957fc72bb 100644 --- a/src/hotspot/share/gc/g1/g1FullGCCompactionPoint.cpp +++ b/src/hotspot/share/gc/g1/g1FullGCCompactionPoint.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1FullCollector.inline.hpp" #include "gc/g1/g1FullGCCompactionPoint.hpp" #include "gc/g1/g1HeapRegion.hpp" diff --git a/src/hotspot/share/gc/g1/g1FullGCMarkTask.cpp b/src/hotspot/share/gc/g1/g1FullGCMarkTask.cpp index 288331b398f7b..25002186280d8 100644 --- a/src/hotspot/share/gc/g1/g1FullGCMarkTask.cpp +++ b/src/hotspot/share/gc/g1/g1FullGCMarkTask.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1CollectedHeap.hpp" #include "gc/g1/g1FullCollector.hpp" #include "gc/g1/g1FullGCMarker.hpp" diff --git a/src/hotspot/share/gc/g1/g1FullGCMarker.cpp b/src/hotspot/share/gc/g1/g1FullGCMarker.cpp index 8fcc957b1682b..f3a8d23cbba3d 100644 --- a/src/hotspot/share/gc/g1/g1FullGCMarker.cpp +++ b/src/hotspot/share/gc/g1/g1FullGCMarker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderData.hpp" #include "classfile/classLoaderDataGraph.hpp" #include "gc/g1/g1FullGCMarker.inline.hpp" diff --git a/src/hotspot/share/gc/g1/g1FullGCOopClosures.cpp b/src/hotspot/share/gc/g1/g1FullGCOopClosures.cpp index ebc7852d150e7..d9cf64a365589 100644 --- a/src/hotspot/share/gc/g1/g1FullGCOopClosures.cpp +++ b/src/hotspot/share/gc/g1/g1FullGCOopClosures.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1CollectedHeap.hpp" #include "gc/g1/g1FullCollector.hpp" #include "gc/g1/g1FullGCMarker.inline.hpp" diff --git a/src/hotspot/share/gc/g1/g1FullGCPrepareTask.cpp b/src/hotspot/share/gc/g1/g1FullGCPrepareTask.cpp index bed17e91ae9fb..86297086b444d 100644 --- a/src/hotspot/share/gc/g1/g1FullGCPrepareTask.cpp +++ b/src/hotspot/share/gc/g1/g1FullGCPrepareTask.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1ConcurrentMarkBitMap.inline.hpp" #include "gc/g1/g1FullCollector.inline.hpp" diff --git a/src/hotspot/share/gc/g1/g1FullGCPrepareTask.inline.hpp b/src/hotspot/share/gc/g1/g1FullGCPrepareTask.inline.hpp index 1d2a023ed3a64..f9868bba67893 100644 --- a/src/hotspot/share/gc/g1/g1FullGCPrepareTask.inline.hpp +++ b/src/hotspot/share/gc/g1/g1FullGCPrepareTask.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -107,7 +107,7 @@ inline bool G1DetermineCompactionQueueClosure::do_heap_region(G1HeapRegion* hr) // Too many live objects in the region; skip compacting it. _collector->update_from_compacting_to_skip_compacting(hr->hrm_index()); - log_trace(gc, phases)("Phase 2: skip compaction region index: %u, live words: " SIZE_FORMAT, + log_trace(gc, phases)("Phase 2: skip compaction region index: %u, live words: %zu", hr->hrm_index(), _collector->live_words(hr->hrm_index())); } diff --git a/src/hotspot/share/gc/g1/g1FullGCResetMetadataTask.cpp b/src/hotspot/share/gc/g1/g1FullGCResetMetadataTask.cpp index 2022ff795256d..610cba9852147 100644 --- a/src/hotspot/share/gc/g1/g1FullGCResetMetadataTask.cpp +++ b/src/hotspot/share/gc/g1/g1FullGCResetMetadataTask.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1FullCollector.inline.hpp" #include "gc/g1/g1FullGCResetMetadataTask.hpp" #include "utilities/ticks.hpp" diff --git a/src/hotspot/share/gc/g1/g1FullGCScope.cpp b/src/hotspot/share/gc/g1/g1FullGCScope.cpp index 9352b7df2d9bf..5879442b82b12 100644 --- a/src/hotspot/share/gc/g1/g1FullGCScope.cpp +++ b/src/hotspot/share/gc/g1/g1FullGCScope.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1FullGCScope.hpp" #include "gc/shared/gc_globals.hpp" diff --git a/src/hotspot/share/gc/g1/g1FullGCTask.cpp b/src/hotspot/share/gc/g1/g1FullGCTask.cpp index b9faa7af60375..633eae186e21e 100644 --- a/src/hotspot/share/gc/g1/g1FullGCTask.cpp +++ b/src/hotspot/share/gc/g1/g1FullGCTask.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1FullGCTask.hpp" #include "logging/log.hpp" #include "utilities/ticks.hpp" diff --git a/src/hotspot/share/gc/g1/g1GCCounters.cpp b/src/hotspot/share/gc/g1/g1GCCounters.cpp index bd9546e799164..9133b28d896ff 100644 --- a/src/hotspot/share/gc/g1/g1GCCounters.cpp +++ b/src/hotspot/share/gc/g1/g1GCCounters.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1CollectedHeap.hpp" #include "gc/g1/g1GCCounters.hpp" diff --git a/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp b/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp index 4ec708ae09392..6d98dc220ffb0 100644 --- a/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp +++ b/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1GCParPhaseTimesTracker.hpp" #include "gc/g1/g1GCPhaseTimes.hpp" @@ -405,7 +404,7 @@ void G1GCPhaseTimes::trace_time(const char* name, double value) const { } void G1GCPhaseTimes::trace_count(const char* name, size_t value) const { - log_trace(gc, phases)(" %s: " SIZE_FORMAT, name, value); + log_trace(gc, phases)(" %s: %zu", name, value); } double G1GCPhaseTimes::print_pre_evacuate_collection_set() const { diff --git a/src/hotspot/share/gc/g1/g1HeapRegion.cpp b/src/hotspot/share/gc/g1/g1HeapRegion.cpp index 9cb2650f8208c..0377b82a65ccb 100644 --- a/src/hotspot/share/gc/g1/g1HeapRegion.cpp +++ b/src/hotspot/share/gc/g1/g1HeapRegion.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "code/nmethod.hpp" #include "gc/g1/g1Allocator.inline.hpp" #include "gc/g1/g1BlockOffsetTable.inline.hpp" @@ -389,7 +388,7 @@ bool G1HeapRegion::verify_code_roots(VerifyOption vo) const { if (is_empty()) { bool has_code_roots = code_roots_length > 0; if (has_code_roots) { - log_error(gc, verify)("region " HR_FORMAT " is empty but has " SIZE_FORMAT " code root entries", + log_error(gc, verify)("region " HR_FORMAT " is empty but has %zu code root entries", HR_FORMAT_PARAMS(this), code_roots_length); } return has_code_roots; @@ -398,7 +397,7 @@ bool G1HeapRegion::verify_code_roots(VerifyOption vo) const { if (is_continues_humongous()) { bool has_code_roots = code_roots_length > 0; if (has_code_roots) { - log_error(gc, verify)("region " HR_FORMAT " is a continuation of a humongous region but has " SIZE_FORMAT " code root entries", + log_error(gc, verify)("region " HR_FORMAT " is a continuation of a humongous region but has %zu code root entries", HR_FORMAT_PARAMS(this), code_roots_length); } return has_code_roots; diff --git a/src/hotspot/share/gc/g1/g1HeapRegionEventSender.cpp b/src/hotspot/share/gc/g1/g1HeapRegionEventSender.cpp index 3be3ec2410c7e..79a2688e6b466 100644 --- a/src/hotspot/share/gc/g1/g1HeapRegionEventSender.cpp +++ b/src/hotspot/share/gc/g1/g1HeapRegionEventSender.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1CollectedHeap.hpp" #include "gc/g1/g1HeapRegion.hpp" #include "gc/g1/g1HeapRegionEventSender.hpp" diff --git a/src/hotspot/share/gc/g1/g1HeapRegionManager.cpp b/src/hotspot/share/gc/g1/g1HeapRegionManager.cpp index 9fb56f7c58fb2..016b2046265d8 100644 --- a/src/hotspot/share/gc/g1/g1HeapRegionManager.cpp +++ b/src/hotspot/share/gc/g1/g1HeapRegionManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1Arguments.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1ConcurrentRefine.hpp" diff --git a/src/hotspot/share/gc/g1/g1HeapRegionRemSet.cpp b/src/hotspot/share/gc/g1/g1HeapRegionRemSet.cpp index c1343fd7dbffc..7196e8b2db26c 100644 --- a/src/hotspot/share/gc/g1/g1HeapRegionRemSet.cpp +++ b/src/hotspot/share/gc/g1/g1HeapRegionRemSet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1BlockOffsetTable.inline.hpp" #include "gc/g1/g1CardSetContainers.inline.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" @@ -98,7 +97,7 @@ G1MonotonicArenaMemoryStats G1HeapRegionRemSet::card_set_memory_stats() const { } void G1HeapRegionRemSet::print_static_mem_size(outputStream* out) { - out->print_cr(" Static structures = " SIZE_FORMAT, G1HeapRegionRemSet::static_mem_size()); + out->print_cr(" Static structures = %zu", G1HeapRegionRemSet::static_mem_size()); } // Code roots support diff --git a/src/hotspot/share/gc/g1/g1HeapRegionSet.cpp b/src/hotspot/share/gc/g1/g1HeapRegionSet.cpp index 38796239168ef..70186adcdfcee 100644 --- a/src/hotspot/share/gc/g1/g1HeapRegionSet.cpp +++ b/src/hotspot/share/gc/g1/g1HeapRegionSet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1HeapRegionRemSet.inline.hpp" #include "gc/g1/g1HeapRegionSet.inline.hpp" diff --git a/src/hotspot/share/gc/g1/g1HeapRegionTracer.cpp b/src/hotspot/share/gc/g1/g1HeapRegionTracer.cpp index 749b7d2d1f5cc..2517b53c17c95 100644 --- a/src/hotspot/share/gc/g1/g1HeapRegionTracer.cpp +++ b/src/hotspot/share/gc/g1/g1HeapRegionTracer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1HeapRegionTracer.hpp" #include "jfr/jfrEvents.hpp" diff --git a/src/hotspot/share/gc/g1/g1HeapRegionType.cpp b/src/hotspot/share/gc/g1/g1HeapRegionType.cpp index c6d38e341be33..ba6bf7e870de8 100644 --- a/src/hotspot/share/gc/g1/g1HeapRegionType.cpp +++ b/src/hotspot/share/gc/g1/g1HeapRegionType.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1HeapRegionTraceType.hpp" #include "gc/g1/g1HeapRegionType.hpp" diff --git a/src/hotspot/share/gc/g1/g1HeapSizingPolicy.cpp b/src/hotspot/share/gc/g1/g1HeapSizingPolicy.cpp index e8642e59cb4a4..c35ce7c356d28 100644 --- a/src/hotspot/share/gc/g1/g1HeapSizingPolicy.cpp +++ b/src/hotspot/share/gc/g1/g1HeapSizingPolicy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1Analytics.hpp" #include "gc/g1/g1CollectedHeap.hpp" #include "gc/g1/g1HeapSizingPolicy.hpp" @@ -74,7 +73,7 @@ static void log_expansion(double short_term_pause_time_ratio, log_debug(gc, ergo, heap)("Heap expansion: " "short term pause time ratio %1.2f%% long term pause time ratio %1.2f%% " "threshold %1.2f%% pause time ratio %1.2f%% fully expanded %s " - "resize by " SIZE_FORMAT "B", + "resize by %zuB", short_term_pause_time_ratio * 100.0, long_term_pause_time_ratio * 100.0, threshold * 100.0, @@ -240,8 +239,8 @@ size_t G1HeapSizingPolicy::full_collection_resize_amount(bool& expand) { // This assert only makes sense here, before we adjust them // with respect to the min and max heap size. assert(minimum_desired_capacity <= maximum_desired_capacity, - "minimum_desired_capacity = " SIZE_FORMAT ", " - "maximum_desired_capacity = " SIZE_FORMAT, + "minimum_desired_capacity = %zu, " + "maximum_desired_capacity = %zu", minimum_desired_capacity, maximum_desired_capacity); // Should not be greater than the heap max size. No need to adjust @@ -258,8 +257,8 @@ size_t G1HeapSizingPolicy::full_collection_resize_amount(bool& expand) { size_t expand_bytes = minimum_desired_capacity - capacity_after_gc; log_debug(gc, ergo, heap)("Attempt heap expansion (capacity lower than min desired capacity). " - "Capacity: " SIZE_FORMAT "B occupancy: " SIZE_FORMAT "B live: " SIZE_FORMAT "B " - "min_desired_capacity: " SIZE_FORMAT "B (" UINTX_FORMAT " %%)", + "Capacity: %zuB occupancy: %zuB live: %zuB " + "min_desired_capacity: %zuB (%zu %%)", capacity_after_gc, used_after_gc, _g1h->used(), minimum_desired_capacity, MinHeapFreeRatio); expand = true; @@ -270,8 +269,8 @@ size_t G1HeapSizingPolicy::full_collection_resize_amount(bool& expand) { size_t shrink_bytes = capacity_after_gc - maximum_desired_capacity; log_debug(gc, ergo, heap)("Attempt heap shrinking (capacity higher than max desired capacity). " - "Capacity: " SIZE_FORMAT "B occupancy: " SIZE_FORMAT "B live: " SIZE_FORMAT "B " - "maximum_desired_capacity: " SIZE_FORMAT "B (" UINTX_FORMAT " %%)", + "Capacity: %zuB occupancy: %zuB live: %zuB " + "maximum_desired_capacity: %zuB (%zu %%)", capacity_after_gc, used_after_gc, _g1h->used(), maximum_desired_capacity, MaxHeapFreeRatio); expand = false; diff --git a/src/hotspot/share/gc/g1/g1HeapTransition.cpp b/src/hotspot/share/gc/g1/g1HeapTransition.cpp index 815b701c4be90..30ad4c72bf663 100644 --- a/src/hotspot/share/gc/g1/g1HeapTransition.cpp +++ b/src/hotspot/share/gc/g1/g1HeapTransition.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1CollectedHeap.hpp" #include "gc/g1/g1HeapTransition.hpp" #include "gc/g1/g1Policy.hpp" @@ -96,7 +95,7 @@ class G1HeapTransition::DetailedUsageClosure: public G1HeapRegionClosure { _usage._humongous_used += r->used(); _usage._humongous_region_count++; } else { - assert(r->used() == 0, "Expected used to be 0 but it was " SIZE_FORMAT, r->used()); + assert(r->used() == 0, "Expected used to be 0 but it was %zu", r->used()); } return false; } @@ -109,7 +108,7 @@ static void log_regions(const char* msg, size_t before_length, size_t after_leng if (lt.is_enabled()) { LogStream ls(lt); - ls.print("%s regions: " SIZE_FORMAT "->" SIZE_FORMAT "(" SIZE_FORMAT ")", + ls.print("%s regions: %zu->%zu(%zu)", msg, before_length, after_length, capacity); // Not null only if gc+heap+numa at Debug level is enabled. if (before_per_node_length != nullptr && after_per_node_length != nullptr) { @@ -141,12 +140,12 @@ void G1HeapTransition::print() { DetailedUsageClosure blk; _g1_heap->heap_region_iterate(&blk); usage = blk._usage; - assert(usage._eden_region_count == 0, "Expected no eden regions, but got " SIZE_FORMAT, usage._eden_region_count); - assert(usage._survivor_region_count == after._survivor_length, "Expected survivors to be " SIZE_FORMAT " but was " SIZE_FORMAT, + assert(usage._eden_region_count == 0, "Expected no eden regions, but got %zu", usage._eden_region_count); + assert(usage._survivor_region_count == after._survivor_length, "Expected survivors to be %zu but was %zu", after._survivor_length, usage._survivor_region_count); - assert(usage._old_region_count == after._old_length, "Expected old to be " SIZE_FORMAT " but was " SIZE_FORMAT, + assert(usage._old_region_count == after._old_length, "Expected old to be %zu but was %zu", after._old_length, usage._old_region_count); - assert(usage._humongous_region_count == after._humongous_length, "Expected humongous to be " SIZE_FORMAT " but was " SIZE_FORMAT, + assert(usage._humongous_region_count == after._humongous_length, "Expected humongous to be %zu but was %zu", after._humongous_length, usage._humongous_region_count); } @@ -156,17 +155,17 @@ void G1HeapTransition::print() { log_regions("Survivor", _before._survivor_length, after._survivor_length, survivor_capacity_length_before_gc, _before._survivor_length_per_node, after._survivor_length_per_node); - log_trace(gc, heap)(" Used: " SIZE_FORMAT "K, Waste: " SIZE_FORMAT "K", + log_trace(gc, heap)(" Used: %zuK, Waste: %zuK", usage._survivor_used / K, ((after._survivor_length * G1HeapRegion::GrainBytes) - usage._survivor_used) / K); - log_info(gc, heap)("Old regions: " SIZE_FORMAT "->" SIZE_FORMAT, + log_info(gc, heap)("Old regions: %zu->%zu", _before._old_length, after._old_length); - log_trace(gc, heap)(" Used: " SIZE_FORMAT "K, Waste: " SIZE_FORMAT "K", + log_trace(gc, heap)(" Used: %zuK, Waste: %zuK", usage._old_used / K, ((after._old_length * G1HeapRegion::GrainBytes) - usage._old_used) / K); - log_info(gc, heap)("Humongous regions: " SIZE_FORMAT "->" SIZE_FORMAT, + log_info(gc, heap)("Humongous regions: %zu->%zu", _before._humongous_length, after._humongous_length); - log_trace(gc, heap)(" Used: " SIZE_FORMAT "K, Waste: " SIZE_FORMAT "K", + log_trace(gc, heap)(" Used: %zuK, Waste: %zuK", usage._humongous_used / K, ((after._humongous_length * G1HeapRegion::GrainBytes) - usage._humongous_used) / K); MetaspaceUtils::print_metaspace_change(_before._meta_sizes); diff --git a/src/hotspot/share/gc/g1/g1HeapVerifier.cpp b/src/hotspot/share/gc/g1/g1HeapVerifier.cpp index 7d399b8265e65..6bec1094579ad 100644 --- a/src/hotspot/share/gc/g1/g1HeapVerifier.cpp +++ b/src/hotspot/share/gc/g1/g1HeapVerifier.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "code/nmethod.hpp" #include "gc/g1/g1Allocator.inline.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" diff --git a/src/hotspot/share/gc/g1/g1IHOPControl.cpp b/src/hotspot/share/gc/g1/g1IHOPControl.cpp index db8426d940139..5c05169c29ded 100644 --- a/src/hotspot/share/gc/g1/g1IHOPControl.cpp +++ b/src/hotspot/share/gc/g1/g1IHOPControl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1IHOPControl.hpp" #include "gc/g1/g1Predictions.hpp" @@ -40,7 +39,7 @@ G1IHOPControl::G1IHOPControl(double initial_ihop_percent, } void G1IHOPControl::update_target_occupancy(size_t new_target_occupancy) { - log_debug(gc, ihop)("Target occupancy update: old: " SIZE_FORMAT "B, new: " SIZE_FORMAT "B", + log_debug(gc, ihop)("Target occupancy update: old: %zuB, new: %zuB", _target_occupancy, new_target_occupancy); _target_occupancy = new_target_occupancy; } @@ -54,8 +53,8 @@ void G1IHOPControl::update_allocation_info(double allocation_time_s, size_t addi void G1IHOPControl::print() { assert(_target_occupancy > 0, "Target occupancy still not updated yet."); size_t cur_conc_mark_start_threshold = get_conc_mark_start_threshold(); - log_debug(gc, ihop)("Basic information (value update), threshold: " SIZE_FORMAT "B (%1.2f), target occupancy: " SIZE_FORMAT "B, current occupancy: " SIZE_FORMAT "B, " - "recent allocation size: " SIZE_FORMAT "B, recent allocation duration: %1.2fms, recent old gen allocation rate: %1.2fB/s, recent marking phase length: %1.2fms", + log_debug(gc, ihop)("Basic information (value update), threshold: %zuB (%1.2f), target occupancy: %zuB, current occupancy: %zuB, " + "recent allocation size: %zuB, recent allocation duration: %1.2fms, recent old gen allocation rate: %1.2fB/s, recent marking phase length: %1.2fms", cur_conc_mark_start_threshold, percent_of(cur_conc_mark_start_threshold, _target_occupancy), _target_occupancy, @@ -169,8 +168,8 @@ void G1AdaptiveIHOPControl::update_marking_length(double marking_length_s) { void G1AdaptiveIHOPControl::print() { G1IHOPControl::print(); size_t actual_target = actual_target_threshold(); - log_debug(gc, ihop)("Adaptive IHOP information (value update), threshold: " SIZE_FORMAT "B (%1.2f), internal target occupancy: " SIZE_FORMAT "B, " - "occupancy: " SIZE_FORMAT "B, additional buffer size: " SIZE_FORMAT "B, predicted old gen allocation rate: %1.2fB/s, " + log_debug(gc, ihop)("Adaptive IHOP information (value update), threshold: %zuB (%1.2f), internal target occupancy: %zuB, " + "occupancy: %zuB, additional buffer size: %zuB, predicted old gen allocation rate: %1.2fB/s, " "predicted marking phase length: %1.2fms, prediction active: %s", get_conc_mark_start_threshold(), percent_of(get_conc_mark_start_threshold(), actual_target), diff --git a/src/hotspot/share/gc/g1/g1InitLogger.cpp b/src/hotspot/share/gc/g1/g1InitLogger.cpp index 2f5753f9ff6a5..1e09eed904315 100644 --- a/src/hotspot/share/gc/g1/g1InitLogger.cpp +++ b/src/hotspot/share/gc/g1/g1InitLogger.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1InitLogger.hpp" #include "gc/shared/gcLogPrecious.hpp" #include "gc/shared/gc_globals.hpp" @@ -30,7 +29,7 @@ #include "utilities/globalDefinitions.hpp" void G1InitLogger::print_heap() { - log_info_p(gc, init)("Heap Region Size: " SIZE_FORMAT "M", G1HeapRegionSize / M); + log_info_p(gc, init)("Heap Region Size: %zuM", G1HeapRegionSize / M); GCInitLogger::print_heap(); } @@ -45,7 +44,7 @@ void G1InitLogger::print_gc_specific() { // Print a message about periodic GC configuration. if (G1PeriodicGCInterval != 0) { log_info_p(gc, init)("Periodic GC: Enabled"); - log_info_p(gc, init)("Periodic GC Interval: " UINTX_FORMAT "ms", G1PeriodicGCInterval); + log_info_p(gc, init)("Periodic GC Interval: %zums", G1PeriodicGCInterval); } else { log_info_p(gc, init)("Periodic GC: Disabled"); } diff --git a/src/hotspot/share/gc/g1/g1MMUTracker.cpp b/src/hotspot/share/gc/g1/g1MMUTracker.cpp index 24776a5334d99..391c165e82274 100644 --- a/src/hotspot/share/gc/g1/g1MMUTracker.cpp +++ b/src/hotspot/share/gc/g1/g1MMUTracker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1MMUTracker.hpp" #include "gc/g1/g1Trace.hpp" #include "logging/log.hpp" diff --git a/src/hotspot/share/gc/g1/g1MemoryPool.cpp b/src/hotspot/share/gc/g1/g1MemoryPool.cpp index ccff848192627..bc5f27617b1b9 100644 --- a/src/hotspot/share/gc/g1/g1MemoryPool.cpp +++ b/src/hotspot/share/gc/g1/g1MemoryPool.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1CollectedHeap.hpp" #include "gc/g1/g1HeapRegion.hpp" #include "gc/g1/g1MemoryPool.hpp" diff --git a/src/hotspot/share/gc/g1/g1MonitoringSupport.cpp b/src/hotspot/share/gc/g1/g1MonitoringSupport.cpp index 203ef473fa258..e018515a051de 100644 --- a/src/hotspot/share/gc/g1/g1MonitoringSupport.cpp +++ b/src/hotspot/share/gc/g1/g1MonitoringSupport.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1MonitoringSupport.hpp" #include "gc/g1/g1Policy.hpp" @@ -285,12 +284,12 @@ void G1MonitoringSupport::recalculate_sizes() { _eden_space_used = MIN2(_eden_space_used, _eden_space_committed); // _survivor_space_used is calculated during a safepoint and _survivor_space_committed // is calculated from survivor region count * heap region size. - assert(_survivor_space_used <= _survivor_space_committed, "Survivor used bytes(" SIZE_FORMAT - ") should be less than or equal to survivor committed(" SIZE_FORMAT ")", + assert(_survivor_space_used <= _survivor_space_committed, "Survivor used bytes(%zu)" + " should be less than or equal to survivor committed(%zu)", _survivor_space_used, _survivor_space_committed); // _old_gen_committed is calculated in terms of _old_gen_used value. - assert(_old_gen_used <= _old_gen_committed, "Old gen used bytes(" SIZE_FORMAT - ") should be less than or equal to old gen committed(" SIZE_FORMAT ")", + assert(_old_gen_used <= _old_gen_committed, "Old gen used bytes(%zu)" + " should be less than or equal to old gen committed(%zu)", _old_gen_used, _old_gen_committed); } diff --git a/src/hotspot/share/gc/g1/g1MonotonicArena.cpp b/src/hotspot/share/gc/g1/g1MonotonicArena.cpp index b2706d7a9463c..4c7a411d87867 100644 --- a/src/hotspot/share/gc/g1/g1MonotonicArena.cpp +++ b/src/hotspot/share/gc/g1/g1MonotonicArena.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1MonotonicArena.inline.hpp" #include "memory/allocation.hpp" #include "runtime/atomic.hpp" diff --git a/src/hotspot/share/gc/g1/g1MonotonicArenaFreeMemoryTask.cpp b/src/hotspot/share/gc/g1/g1MonotonicArenaFreeMemoryTask.cpp index 59a1afe6f3408..cc857a5396907 100644 --- a/src/hotspot/share/gc/g1/g1MonotonicArenaFreeMemoryTask.cpp +++ b/src/hotspot/share/gc/g1/g1MonotonicArenaFreeMemoryTask.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciUtilities.hpp" #include "gc/g1/g1CardSetMemory.inline.hpp" #include "gc/g1/g1CollectedHeap.hpp" diff --git a/src/hotspot/share/gc/g1/g1MonotonicArenaFreePool.cpp b/src/hotspot/share/gc/g1/g1MonotonicArenaFreePool.cpp index 76df02d2a7142..922c68bfba4a5 100644 --- a/src/hotspot/share/gc/g1/g1MonotonicArenaFreePool.cpp +++ b/src/hotspot/share/gc/g1/g1MonotonicArenaFreePool.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1MonotonicArena.inline.hpp" #include "gc/g1/g1MonotonicArenaFreePool.hpp" diff --git a/src/hotspot/share/gc/g1/g1NMethodClosure.cpp b/src/hotspot/share/gc/g1/g1NMethodClosure.cpp index 379b1f935e103..8dca2d7cccf7b 100644 --- a/src/hotspot/share/gc/g1/g1NMethodClosure.cpp +++ b/src/hotspot/share/gc/g1/g1NMethodClosure.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "code/nmethod.hpp" #include "gc/g1/g1NMethodClosure.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" diff --git a/src/hotspot/share/gc/g1/g1NUMA.cpp b/src/hotspot/share/gc/g1/g1NUMA.cpp index 923d3af621d70..cd7dc55d0fe5b 100644 --- a/src/hotspot/share/gc/g1/g1NUMA.cpp +++ b/src/hotspot/share/gc/g1/g1NUMA.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1NUMA.hpp" #include "gc/shared/gc_globals.hpp" #include "logging/logStream.hpp" @@ -215,7 +214,7 @@ void G1NUMA::request_memory_on_node(void* aligned_address, size_t size_in_bytes, uint node_index = preferred_node_index_for_index(region_index); assert(is_aligned(aligned_address, page_size()), "Given address (" PTR_FORMAT ") should be aligned.", p2i(aligned_address)); - assert(is_aligned(size_in_bytes, page_size()), "Given size (" SIZE_FORMAT ") should be aligned.", size_in_bytes); + assert(is_aligned(size_in_bytes, page_size()), "Given size (%zu) should be aligned.", size_in_bytes); log_trace(gc, heap, numa)("Request memory [" PTR_FORMAT ", " PTR_FORMAT ") to be NUMA id (%u)", p2i(aligned_address), p2i((char*)aligned_address + size_in_bytes), _node_ids[node_index]); diff --git a/src/hotspot/share/gc/g1/g1NUMAStats.cpp b/src/hotspot/share/gc/g1/g1NUMAStats.cpp index 089e4c0e8b83a..aaebfa1be8f32 100644 --- a/src/hotspot/share/gc/g1/g1NUMAStats.cpp +++ b/src/hotspot/share/gc/g1/g1NUMAStats.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1NUMAStats.hpp" #include "logging/logStream.hpp" @@ -162,7 +161,7 @@ static const char* phase_to_explanatory_string(G1NUMAStats::NodeDataItems phase) } } -#define RATE_TOTAL_FORMAT "%0.0f%% " SIZE_FORMAT "/" SIZE_FORMAT +#define RATE_TOTAL_FORMAT "%0.0f%% %zu/%zu" void G1NUMAStats::print_info(G1NUMAStats::NodeDataItems phase) { LogTarget(Info, gc, heap, numa) lt; @@ -206,18 +205,18 @@ void G1NUMAStats::print_mutator_alloc_stat_debug() { for (uint req = 0; req < array_width; req++) { ls.print("%3d ", _node_ids[req]); for (uint alloc = 0; alloc < array_width; alloc++) { - ls.print(SIZE_FORMAT_W(8), _node_data[NewRegionAlloc]->get(req, alloc)); + ls.print("%8zu", _node_data[NewRegionAlloc]->get(req, alloc)); } - ls.print(SIZE_FORMAT_W(8), _node_data[NewRegionAlloc]->sum(req)); + ls.print("%8zu", _node_data[NewRegionAlloc]->sum(req)); ls.print_cr(""); // Add padding to align with the string 'Requested NUMA id'. ls.print(" "); } ls.print("Any "); for (uint alloc = 0; alloc < array_width; alloc++) { - ls.print(SIZE_FORMAT_W(8), _node_data[NewRegionAlloc]->get(array_width, alloc)); + ls.print("%8zu", _node_data[NewRegionAlloc]->get(array_width, alloc)); } - ls.print(SIZE_FORMAT_W(8), _node_data[NewRegionAlloc]->sum(array_width)); + ls.print("%8zu", _node_data[NewRegionAlloc]->sum(array_width)); ls.print_cr(""); } } diff --git a/src/hotspot/share/gc/g1/g1OldGenAllocationTracker.cpp b/src/hotspot/share/gc/g1/g1OldGenAllocationTracker.cpp index 89ac76eef6079..ec3d39d7e5043 100644 --- a/src/hotspot/share/gc/g1/g1OldGenAllocationTracker.cpp +++ b/src/hotspot/share/gc/g1/g1OldGenAllocationTracker.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1OldGenAllocationTracker.hpp" #include "logging/log.hpp" diff --git a/src/hotspot/share/gc/g1/g1OopClosures.cpp b/src/hotspot/share/gc/g1/g1OopClosures.cpp index 9b30595e82f75..44085269d4554 100644 --- a/src/hotspot/share/gc/g1/g1OopClosures.cpp +++ b/src/hotspot/share/gc/g1/g1OopClosures.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1OopClosures.inline.hpp" #include "gc/g1/g1ParScanThreadState.hpp" diff --git a/src/hotspot/share/gc/g1/g1OopStarChunkedList.cpp b/src/hotspot/share/gc/g1/g1OopStarChunkedList.cpp index 48f69d51db929..5d19503ad9c1b 100644 --- a/src/hotspot/share/gc/g1/g1OopStarChunkedList.cpp +++ b/src/hotspot/share/gc/g1/g1OopStarChunkedList.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1OopStarChunkedList.inline.hpp" G1OopStarChunkedList::~G1OopStarChunkedList() { diff --git a/src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.cpp b/src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.cpp index 41c4fc3a34cec..eb76106d91c82 100644 --- a/src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.cpp +++ b/src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1PageBasedVirtualSpace.hpp" #include "gc/shared/pretouchTask.hpp" #include "gc/shared/workerThread.hpp" @@ -48,13 +47,13 @@ void G1PageBasedVirtualSpace::initialize_with_page_size(ReservedSpace rs, size_t vmassert(page_size > 0, "Page size must be non-zero."); guarantee(is_aligned(rs.base(), page_size), - "Reserved space base " PTR_FORMAT " is not aligned to requested page size " SIZE_FORMAT, p2i(rs.base()), page_size); + "Reserved space base " PTR_FORMAT " is not aligned to requested page size %zu", p2i(rs.base()), page_size); guarantee(is_aligned(used_size, os::vm_page_size()), - "Given used reserved space size needs to be OS page size aligned (" SIZE_FORMAT " bytes) but is " SIZE_FORMAT, os::vm_page_size(), used_size); + "Given used reserved space size needs to be OS page size aligned (%zu bytes) but is %zu", os::vm_page_size(), used_size); guarantee(used_size <= rs.size(), - "Used size of reserved space " SIZE_FORMAT " bytes is smaller than reservation at " SIZE_FORMAT " bytes", used_size, rs.size()); + "Used size of reserved space %zu bytes is smaller than reservation at %zu bytes", used_size, rs.size()); guarantee(is_aligned(rs.size(), page_size), - "Expected that the virtual space is size aligned, but " SIZE_FORMAT " is not aligned to page size " SIZE_FORMAT, rs.size(), page_size); + "Expected that the virtual space is size aligned, but %zu is not aligned to page size %zu", rs.size(), page_size); _low_boundary = rs.base(); _high_boundary = _low_boundary + used_size; @@ -121,15 +120,15 @@ size_t G1PageBasedVirtualSpace::page_size() const { bool G1PageBasedVirtualSpace::is_after_last_page(size_t index) const { guarantee(index <= _committed.size(), - "Given boundary page " SIZE_FORMAT " is beyond managed page count " SIZE_FORMAT, index, _committed.size()); + "Given boundary page %zu is beyond managed page count %zu", index, _committed.size()); return index == _committed.size(); } void G1PageBasedVirtualSpace::commit_preferred_pages(size_t start, size_t num_pages) { vmassert(num_pages > 0, "No full pages to commit"); vmassert(start + num_pages <= _committed.size(), - "Tried to commit area from page " SIZE_FORMAT " to page " SIZE_FORMAT " " - "that is outside of managed space of " SIZE_FORMAT " pages", + "Tried to commit area from page %zu to page %zu " + "that is outside of managed space of %zu pages", start, start + num_pages, _committed.size()); char* start_addr = page_start(start); @@ -147,9 +146,9 @@ void G1PageBasedVirtualSpace::commit_tail() { void G1PageBasedVirtualSpace::commit_internal(size_t start_page, size_t end_page) { guarantee(start_page < end_page, - "Given start page " SIZE_FORMAT " is larger or equal to end page " SIZE_FORMAT, start_page, end_page); + "Given start page %zu is larger or equal to end page %zu", start_page, end_page); guarantee(end_page <= _committed.size(), - "Given end page " SIZE_FORMAT " is beyond end of managed page amount of " SIZE_FORMAT, end_page, _committed.size()); + "Given end page %zu is beyond end of managed page amount of %zu", end_page, _committed.size()); size_t pages = end_page - start_page; bool need_to_commit_tail = is_after_last_page(end_page) && is_last_page_partial(); @@ -176,7 +175,7 @@ char* G1PageBasedVirtualSpace::bounded_end_addr(size_t end_page) const { bool G1PageBasedVirtualSpace::commit(size_t start_page, size_t size_in_pages) { // We need to make sure to commit all pages covered by the given area. guarantee(is_area_uncommitted(start_page, size_in_pages), - "Specified area is not uncommitted, start page: " SIZE_FORMAT ", page count: " SIZE_FORMAT, + "Specified area is not uncommitted, start page: %zu, page count: %zu", start_page, size_in_pages); bool zero_filled = true; @@ -198,7 +197,7 @@ bool G1PageBasedVirtualSpace::commit(size_t start_page, size_t size_in_pages) { void G1PageBasedVirtualSpace::uncommit_internal(size_t start_page, size_t end_page) { guarantee(start_page < end_page, - "Given start page " SIZE_FORMAT " is larger or equal to end page " SIZE_FORMAT, start_page, end_page); + "Given start page %zu is larger or equal to end page %zu", start_page, end_page); char* start_addr = page_start(start_page); os::uncommit_memory(start_addr, pointer_delta(bounded_end_addr(end_page), start_addr, sizeof(char))); @@ -206,7 +205,7 @@ void G1PageBasedVirtualSpace::uncommit_internal(size_t start_page, size_t end_pa void G1PageBasedVirtualSpace::uncommit(size_t start_page, size_t size_in_pages) { guarantee(is_area_committed(start_page, size_in_pages), - "Specified area is not committed, start page: " SIZE_FORMAT ", page count: " SIZE_FORMAT, + "Specified area is not committed, start page: %zu, page count: %zu", start_page, size_in_pages); size_t end_page = start_page + size_in_pages; @@ -236,9 +235,9 @@ void G1PageBasedVirtualSpace::print_on(outputStream* out) { out->print ("Virtual space:"); if (_special) out->print(" (pinned in memory)"); out->cr(); - out->print_cr(" - committed: " SIZE_FORMAT, committed_size()); - out->print_cr(" - reserved: " SIZE_FORMAT, reserved_size()); - out->print_cr(" - preferred page size: " SIZE_FORMAT, _page_size); + out->print_cr(" - committed: %zu", committed_size()); + out->print_cr(" - reserved: %zu", reserved_size()); + out->print_cr(" - preferred page size: %zu", _page_size); out->print_cr(" - [low_b, high_b]: [" PTR_FORMAT ", " PTR_FORMAT "]", p2i(_low_boundary), p2i(_high_boundary)); } diff --git a/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp b/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp index 5762d07972874..4774cbe956d19 100644 --- a/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp +++ b/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1Allocator.inline.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1CollectionSet.hpp" diff --git a/src/hotspot/share/gc/g1/g1ParScanThreadState.inline.hpp b/src/hotspot/share/gc/g1/g1ParScanThreadState.inline.hpp index f96a24007390c..148284e7ef7c1 100644 --- a/src/hotspot/share/gc/g1/g1ParScanThreadState.inline.hpp +++ b/src/hotspot/share/gc/g1/g1ParScanThreadState.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -75,7 +75,7 @@ inline void G1ParScanThreadState::remember_root_into_optional_region(T* p) { oop o = RawAccess::oop_load(p); uint index = _g1h->heap_region_containing(o)->index_in_opt_cset(); assert(index < _max_num_optional_regions, - "Trying to access optional region idx %u beyond " SIZE_FORMAT, index, _max_num_optional_regions); + "Trying to access optional region idx %u beyond %zu", index, _max_num_optional_regions); _oops_into_optional_regions[index].push_root(p); } @@ -84,14 +84,14 @@ inline void G1ParScanThreadState::remember_reference_into_optional_region(T* p) oop o = RawAccess::oop_load(p); uint index = _g1h->heap_region_containing(o)->index_in_opt_cset(); assert(index < _max_num_optional_regions, - "Trying to access optional region idx %u beyond " SIZE_FORMAT, index, _max_num_optional_regions); + "Trying to access optional region idx %u beyond %zu", index, _max_num_optional_regions); _oops_into_optional_regions[index].push_oop(p); verify_task(p); } G1OopStarChunkedList* G1ParScanThreadState::oops_into_optional_region(const G1HeapRegion* hr) { assert(hr->index_in_opt_cset() < _max_num_optional_regions, - "Trying to access optional region idx %u beyond " SIZE_FORMAT " " HR_FORMAT, + "Trying to access optional region idx %u beyond %zu " HR_FORMAT, hr->index_in_opt_cset(), _max_num_optional_regions, HR_FORMAT_PARAMS(hr)); return &_oops_into_optional_regions[hr->index_in_opt_cset()]; } diff --git a/src/hotspot/share/gc/g1/g1ParallelCleaning.cpp b/src/hotspot/share/gc/g1/g1ParallelCleaning.cpp index 3525f5764639d..a4c79cbed7a9a 100644 --- a/src/hotspot/share/gc/g1/g1ParallelCleaning.cpp +++ b/src/hotspot/share/gc/g1/g1ParallelCleaning.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1ParallelCleaning.hpp" #include "runtime/atomic.hpp" diff --git a/src/hotspot/share/gc/g1/g1PeriodicGCTask.cpp b/src/hotspot/share/gc/g1/g1PeriodicGCTask.cpp index fea7c2f3c8687..afbd0f35ce6e6 100644 --- a/src/hotspot/share/gc/g1/g1PeriodicGCTask.cpp +++ b/src/hotspot/share/gc/g1/g1PeriodicGCTask.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1ConcurrentMark.inline.hpp" #include "gc/g1/g1ConcurrentMarkThread.inline.hpp" @@ -48,7 +47,7 @@ bool G1PeriodicGCTask::should_start_periodic_gc(G1CollectedHeap* g1h, // Check if enough time has passed since the last GC. uintx time_since_last_gc = (uintx)g1h->time_since_last_collection().milliseconds(); if ((time_since_last_gc < G1PeriodicGCInterval)) { - log_debug(gc, periodic)("Last GC occurred " UINTX_FORMAT "ms before which is below threshold " UINTX_FORMAT "ms. Skipping.", + log_debug(gc, periodic)("Last GC occurred %zums before which is below threshold %zums. Skipping.", time_since_last_gc, G1PeriodicGCInterval); return false; } diff --git a/src/hotspot/share/gc/g1/g1Policy.cpp b/src/hotspot/share/gc/g1/g1Policy.cpp index 1b71901f0fe05..eee2d02028f3c 100644 --- a/src/hotspot/share/gc/g1/g1Policy.cpp +++ b/src/hotspot/share/gc/g1/g1Policy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1Allocator.hpp" #include "gc/g1/g1Analytics.hpp" #include "gc/g1/g1Arguments.hpp" @@ -606,8 +605,8 @@ void G1Policy::record_full_collection_end() { static void log_refinement_stats(const char* kind, const G1ConcurrentRefineStats& stats) { log_debug(gc, refine, stats) - ("%s refinement: %.2fms, refined: " SIZE_FORMAT - ", precleaned: " SIZE_FORMAT ", dirtied: " SIZE_FORMAT, + ("%s refinement: %.2fms, refined: %zu" + ", precleaned: %zu, dirtied: %zu", kind, stats.refinement_time().seconds() * MILLIUNITS, stats.refined_cards(), @@ -757,7 +756,7 @@ bool G1Policy::need_to_start_conc_mark(const char* source, size_t alloc_word_siz bool result = false; if (marking_request_bytes > marking_initiating_used_threshold) { result = collector_state()->in_young_only_phase(); - log_debug(gc, ergo, ihop)("%s occupancy: " SIZE_FORMAT "B allocation request: " SIZE_FORMAT "B threshold: " SIZE_FORMAT "B (%1.2f) source: %s", + log_debug(gc, ergo, ihop)("%s occupancy: %zuB allocation request: %zuB threshold: %zuB (%1.2f) source: %s", result ? "Request concurrent cycle initiation (occupancy higher than threshold)" : "Do not request concurrent cycle initiation (still doing mixed collections)", cur_used_bytes, alloc_byte_size, marking_initiating_used_threshold, (double) marking_initiating_used_threshold / _g1h->capacity() * 100, source); } diff --git a/src/hotspot/share/gc/g1/g1RedirtyCardsQueue.cpp b/src/hotspot/share/gc/g1/g1RedirtyCardsQueue.cpp index 59501447878b2..c89812ad08f28 100644 --- a/src/hotspot/share/gc/g1/g1RedirtyCardsQueue.cpp +++ b/src/hotspot/share/gc/g1/g1RedirtyCardsQueue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1RedirtyCardsQueue.hpp" #include "gc/shared/bufferNode.hpp" #include "runtime/atomic.hpp" diff --git a/src/hotspot/share/gc/g1/g1RegionMarkStatsCache.cpp b/src/hotspot/share/gc/g1/g1RegionMarkStatsCache.cpp index e8b7c00b27e8b..eca0f78aed917 100644 --- a/src/hotspot/share/gc/g1/g1RegionMarkStatsCache.cpp +++ b/src/hotspot/share/gc/g1/g1RegionMarkStatsCache.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1RegionMarkStatsCache.inline.hpp" #include "memory/allocation.inline.hpp" diff --git a/src/hotspot/share/gc/g1/g1RegionToSpaceMapper.cpp b/src/hotspot/share/gc/g1/g1RegionToSpaceMapper.cpp index ed43bf94648e2..33a9df7934917 100644 --- a/src/hotspot/share/gc/g1/g1RegionToSpaceMapper.cpp +++ b/src/hotspot/share/gc/g1/g1RegionToSpaceMapper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1BiasedArray.hpp" #include "gc/g1/g1NUMA.hpp" #include "gc/g1/g1RegionToSpaceMapper.hpp" @@ -91,7 +90,7 @@ class G1RegionsLargerThanCommitSizeMapper : public G1RegionToSpaceMapper { virtual void commit_regions(uint start_idx, size_t num_regions, WorkerThreads* pretouch_workers) { guarantee(is_range_uncommitted(start_idx, num_regions), - "Range not uncommitted, start: %u, num_regions: " SIZE_FORMAT, + "Range not uncommitted, start: %u, num_regions: %zu", start_idx, num_regions); const size_t start_page = (size_t)start_idx * _pages_per_region; @@ -113,7 +112,7 @@ class G1RegionsLargerThanCommitSizeMapper : public G1RegionToSpaceMapper { virtual void uncommit_regions(uint start_idx, size_t num_regions) { guarantee(is_range_committed(start_idx, num_regions), - "Range not committed, start: %u, num_regions: " SIZE_FORMAT, + "Range not committed, start: %u, num_regions: %zu", start_idx, num_regions); _storage.uncommit((size_t)start_idx * _pages_per_region, num_regions * _pages_per_region); diff --git a/src/hotspot/share/gc/g1/g1RegionsOnNodes.cpp b/src/hotspot/share/gc/g1/g1RegionsOnNodes.cpp index b72d3687c6728..91f6ee4909524 100644 --- a/src/hotspot/share/gc/g1/g1RegionsOnNodes.cpp +++ b/src/hotspot/share/gc/g1/g1RegionsOnNodes.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1HeapRegion.hpp" #include "gc/g1/g1NUMA.hpp" #include "gc/g1/g1RegionsOnNodes.hpp" diff --git a/src/hotspot/share/gc/g1/g1RemSet.cpp b/src/hotspot/share/gc/g1/g1RemSet.cpp index 7ae81de1d074f..531ca49845665 100644 --- a/src/hotspot/share/gc/g1/g1RemSet.cpp +++ b/src/hotspot/share/gc/g1/g1RemSet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1BarrierSet.hpp" #include "gc/g1/g1BatchedTask.hpp" #include "gc/g1/g1BlockOffsetTable.inline.hpp" @@ -107,7 +106,7 @@ class G1RemSetScanState : public CHeapObj { // dirty card, i.e. actually needs scanning. bool chunk_needs_scan(uint const region_idx, uint const card_in_region) const { size_t const idx = ((size_t)region_idx << _log_scan_chunks_per_region) + (card_in_region >> _scan_chunks_shift); - assert(idx < _num_total_scan_chunks, "Index " SIZE_FORMAT " out of bounds " SIZE_FORMAT, + assert(idx < _num_total_scan_chunks, "Index %zu out of bounds %zu", idx, _num_total_scan_chunks); return _region_scan_chunks[idx]; } @@ -347,7 +346,7 @@ class G1RemSetScanState : public CHeapObj { void set_chunk_dirty(size_t const card_idx) { assert((card_idx >> _scan_chunks_shift) < _num_total_scan_chunks, - "Trying to access index " SIZE_FORMAT " out of bounds " SIZE_FORMAT, + "Trying to access index %zu out of bounds %zu", card_idx >> _scan_chunks_shift, _num_total_scan_chunks); size_t const chunk_idx = card_idx >> _scan_chunks_shift; _region_scan_chunks[chunk_idx] = true; @@ -1438,7 +1437,7 @@ void G1RemSet::print_merge_heap_roots_stats() { size_t total_old_region_cards = (g1h->num_regions() - (g1h->num_free_regions() - g1h->collection_set()->cur_length())) * G1HeapRegion::CardsPerRegion; - ls.print_cr("Visited cards " SIZE_FORMAT " Total dirty " SIZE_FORMAT " (%.2lf%%) Total old " SIZE_FORMAT " (%.2lf%%)", + ls.print_cr("Visited cards %zu Total dirty %zu (%.2lf%%) Total old %zu (%.2lf%%)", num_visited_cards, total_dirty_region_cards, percent_of(num_visited_cards, total_dirty_region_cards), @@ -1471,7 +1470,7 @@ void G1RemSet::merge_heap_roots(bool initial_evacuation) { { G1MergeHeapRootsTask cl(_scan_state, num_workers, initial_evacuation); - log_debug(gc, ergo)("Running %s using %u workers for " SIZE_FORMAT " regions", + log_debug(gc, ergo)("Running %s using %u workers for %zu regions", cl.name(), num_workers, increment_length); workers->run_task(&cl, num_workers); } @@ -1504,7 +1503,7 @@ inline void check_card_ptr(CardTable::CardValue* card_ptr, G1CardTable* ct) { #ifdef ASSERT G1CollectedHeap* g1h = G1CollectedHeap::heap(); assert(g1h->is_in(ct->addr_for(card_ptr)), - "Card at " PTR_FORMAT " index " SIZE_FORMAT " representing heap at " PTR_FORMAT " (%u) must be in committed heap", + "Card at " PTR_FORMAT " index %zu representing heap at " PTR_FORMAT " (%u) must be in committed heap", p2i(card_ptr), ct->index_for(ct->addr_for(card_ptr)), p2i(ct->addr_for(card_ptr)), diff --git a/src/hotspot/share/gc/g1/g1RemSetSummary.cpp b/src/hotspot/share/gc/g1/g1RemSetSummary.cpp index 5ea3500a7b0f7..adc2be84380a5 100644 --- a/src/hotspot/share/gc/g1/g1RemSetSummary.cpp +++ b/src/hotspot/share/gc/g1/g1RemSetSummary.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1BarrierSet.hpp" #include "gc/g1/g1CardSetMemory.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" @@ -153,29 +152,29 @@ class RegionTypeCounter { size_t code_root_elems() const { return _code_root_elems; } void print_rs_mem_info_on(outputStream * out, size_t total) { - out->print_cr(" " SIZE_FORMAT_W(8) " (%5.1f%%) by " SIZE_FORMAT " " - "(" SIZE_FORMAT ") %s regions unused " SIZE_FORMAT, + out->print_cr(" %8zu (%5.1f%%) by %zu " + "(%zu) %s regions unused %zu", rs_mem_size(), rs_mem_size_percent_of(total), amount_tracked(), amount(), _name, rs_unused_mem_size()); } void print_cards_occupied_info_on(outputStream * out, size_t total) { - out->print_cr(" " SIZE_FORMAT_W(8) " (%5.1f%%) entries by " SIZE_FORMAT " " - "(" SIZE_FORMAT ") %s regions", + out->print_cr(" %8zu (%5.1f%%) entries by %zu " + "(%zu) %s regions", cards_occupied(), cards_occupied_percent_of(total), amount_tracked(), amount(), _name); } void print_code_root_mem_info_on(outputStream * out, size_t total) { - out->print_cr(" " SIZE_FORMAT_W(8) "%s (%5.1f%%) by " SIZE_FORMAT " %s regions", + out->print_cr(" %8zu%s (%5.1f%%) by %zu %s regions", byte_size_in_proper_unit(code_root_mem_size()), proper_unit_for_byte_size(code_root_mem_size()), code_root_mem_size_percent_of(total), amount(), _name); } void print_code_root_elems_info_on(outputStream * out, size_t total) { - out->print_cr(" " SIZE_FORMAT_W(8) " (%5.1f%%) elements by " SIZE_FORMAT " %s regions", + out->print_cr(" %8zu (%5.1f%%) elements by %zu %s regions", code_root_elems(), code_root_elems_percent_of(total), amount(), _name); } }; @@ -267,8 +266,8 @@ class HRRSStatsIter: public G1HeapRegionClosure { RegionTypeCounter* counters[] = { &_young, &_humongous, &_free, &_old, nullptr }; out->print_cr(" Current rem set statistics"); - out->print_cr(" Total per region rem sets sizes = " SIZE_FORMAT - " Max = " SIZE_FORMAT " unused = " SIZE_FORMAT, + out->print_cr(" Total per region rem sets sizes = %zu" + " Max = %zu unused = %zu", total_rs_mem_sz(), max_rs_mem_sz(), total_rs_unused_mem_sz()); @@ -276,7 +275,7 @@ class HRRSStatsIter: public G1HeapRegionClosure { (*current)->print_rs_mem_info_on(out, total_rs_mem_sz()); } - out->print_cr(" " SIZE_FORMAT " occupied cards represented.", + out->print_cr(" %zu occupied cards represented.", total_cards_occupied()); for (RegionTypeCounter** current = &counters[0]; *current != nullptr; current++) { (*current)->print_cards_occupied_info_on(out, total_cards_occupied()); @@ -285,7 +284,7 @@ class HRRSStatsIter: public G1HeapRegionClosure { // Largest sized rem set region statistics G1HeapRegionRemSet* rem_set = max_rs_mem_sz_region()->rem_set(); out->print_cr(" Region with largest rem set = " HR_FORMAT ", " - "size = " SIZE_FORMAT " occupied = " SIZE_FORMAT, + "size = %zu occupied = %zu", HR_FORMAT_PARAMS(max_rs_mem_sz_region()), rem_set->mem_size(), rem_set->occupied()); @@ -296,8 +295,8 @@ class HRRSStatsIter: public G1HeapRegionClosure { // Code root statistics G1HeapRegionRemSet* max_code_root_rem_set = max_code_root_mem_sz_region()->rem_set(); - out->print_cr(" Total heap region code root sets sizes = " SIZE_FORMAT "%s." - " Max = " SIZE_FORMAT "%s.", + out->print_cr(" Total heap region code root sets sizes = %zu%s." + " Max = %zu%s.", byte_size_in_proper_unit(total_code_root_mem_sz()), proper_unit_for_byte_size(total_code_root_mem_sz()), byte_size_in_proper_unit(max_code_root_rem_set->code_roots_mem_size()), @@ -306,14 +305,14 @@ class HRRSStatsIter: public G1HeapRegionClosure { (*current)->print_code_root_mem_info_on(out, total_code_root_mem_sz()); } - out->print_cr(" " SIZE_FORMAT " code roots represented.", + out->print_cr(" %zu code roots represented.", total_code_root_elems()); for (RegionTypeCounter** current = &counters[0]; *current != nullptr; current++) { (*current)->print_code_root_elems_info_on(out, total_code_root_elems()); } out->print_cr(" Region with largest amount of code roots = " HR_FORMAT ", " - "size = " SIZE_FORMAT "%s, num_slots = " SIZE_FORMAT ".", + "size = %zu%s, num_slots = %zu.", HR_FORMAT_PARAMS(max_code_root_mem_sz_region()), byte_size_in_proper_unit(max_code_root_rem_set->code_roots_mem_size()), proper_unit_for_byte_size(max_code_root_rem_set->code_roots_mem_size()), diff --git a/src/hotspot/share/gc/g1/g1RemSetTrackingPolicy.cpp b/src/hotspot/share/gc/g1/g1RemSetTrackingPolicy.cpp index 6538dffd998e8..9874b78699d94 100644 --- a/src/hotspot/share/gc/g1/g1RemSetTrackingPolicy.cpp +++ b/src/hotspot/share/gc/g1/g1RemSetTrackingPolicy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1CollectionSetChooser.hpp" #include "gc/g1/g1HeapRegion.inline.hpp" diff --git a/src/hotspot/share/gc/g1/g1RootClosures.cpp b/src/hotspot/share/gc/g1/g1RootClosures.cpp index 7acc3adc83611..f03681487cbc7 100644 --- a/src/hotspot/share/gc/g1/g1RootClosures.cpp +++ b/src/hotspot/share/gc/g1/g1RootClosures.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1OopClosures.inline.hpp" #include "gc/g1/g1RootClosures.hpp" #include "gc/g1/g1SharedClosures.hpp" diff --git a/src/hotspot/share/gc/g1/g1RootProcessor.cpp b/src/hotspot/share/gc/g1/g1RootProcessor.cpp index 07ae66cfb0ba7..cf28c53648d74 100644 --- a/src/hotspot/share/gc/g1/g1RootProcessor.cpp +++ b/src/hotspot/share/gc/g1/g1RootProcessor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderDataGraph.hpp" #include "classfile/stringTable.hpp" #include "code/codeCache.hpp" diff --git a/src/hotspot/share/gc/g1/g1SATBMarkQueueSet.cpp b/src/hotspot/share/gc/g1/g1SATBMarkQueueSet.cpp index 17a0f9326b5fe..f0b29a5bbaba1 100644 --- a/src/hotspot/share/gc/g1/g1SATBMarkQueueSet.cpp +++ b/src/hotspot/share/gc/g1/g1SATBMarkQueueSet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1BarrierSet.inline.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1HeapRegion.hpp" diff --git a/src/hotspot/share/gc/g1/g1ServiceThread.cpp b/src/hotspot/share/gc/g1/g1ServiceThread.cpp index 655220c349bbd..5f664cfba3a21 100644 --- a/src/hotspot/share/gc/g1/g1ServiceThread.cpp +++ b/src/hotspot/share/gc/g1/g1ServiceThread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1ServiceThread.hpp" #include "logging/log.hpp" #include "runtime/cpuTimeCounters.hpp" diff --git a/src/hotspot/share/gc/g1/g1StringDedup.cpp b/src/hotspot/share/gc/g1/g1StringDedup.cpp index 6881c606114dd..97b15df537e33 100644 --- a/src/hotspot/share/gc/g1/g1StringDedup.cpp +++ b/src/hotspot/share/gc/g1/g1StringDedup.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1StringDedup.hpp" #include "gc/shared/stringdedup/stringDedup.hpp" diff --git a/src/hotspot/share/gc/g1/g1SurvRateGroup.cpp b/src/hotspot/share/gc/g1/g1SurvRateGroup.cpp index 40f15446fecc0..1eaaf44a1fbde 100644 --- a/src/hotspot/share/gc/g1/g1SurvRateGroup.cpp +++ b/src/hotspot/share/gc/g1/g1SurvRateGroup.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1HeapRegion.hpp" #include "gc/g1/g1Predictions.hpp" #include "gc/g1/g1SurvRateGroup.hpp" diff --git a/src/hotspot/share/gc/g1/g1SurvivorRegions.cpp b/src/hotspot/share/gc/g1/g1SurvivorRegions.cpp index 53febea0a495b..dd3323f4079e2 100644 --- a/src/hotspot/share/gc/g1/g1SurvivorRegions.cpp +++ b/src/hotspot/share/gc/g1/g1SurvivorRegions.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1HeapRegion.hpp" #include "gc/g1/g1SurvivorRegions.hpp" #include "utilities/growableArray.hpp" diff --git a/src/hotspot/share/gc/g1/g1Trace.cpp b/src/hotspot/share/gc/g1/g1Trace.cpp index 598a238e93b92..3cc8a8a28e176 100644 --- a/src/hotspot/share/gc/g1/g1Trace.cpp +++ b/src/hotspot/share/gc/g1/g1Trace.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1EvacInfo.hpp" #include "gc/g1/g1HeapRegionTraceType.hpp" #include "gc/g1/g1Trace.hpp" diff --git a/src/hotspot/share/gc/g1/g1UncommitRegionTask.cpp b/src/hotspot/share/gc/g1/g1UncommitRegionTask.cpp index 31ca32d9ea2f5..e1203229557a0 100644 --- a/src/hotspot/share/gc/g1/g1UncommitRegionTask.cpp +++ b/src/hotspot/share/gc/g1/g1UncommitRegionTask.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1UncommitRegionTask.hpp" #include "gc/shared/suspendibleThreadSet.hpp" @@ -82,7 +81,7 @@ void G1UncommitRegionTask::report_execution(Tickspan time, uint regions) { _summary_region_count += regions; _summary_duration += time; - log_trace(gc, heap)("Concurrent Uncommit: " SIZE_FORMAT "%s, %u regions, %1.3fms", + log_trace(gc, heap)("Concurrent Uncommit: %zu%s, %u regions, %1.3fms", byte_size_in_proper_unit(regions * G1HeapRegion::GrainBytes), proper_unit_for_byte_size(regions * G1HeapRegion::GrainBytes), regions, @@ -90,7 +89,7 @@ void G1UncommitRegionTask::report_execution(Tickspan time, uint regions) { } void G1UncommitRegionTask::report_summary() { - log_debug(gc, heap)("Concurrent Uncommit Summary: " SIZE_FORMAT "%s, %u regions, %1.3fms", + log_debug(gc, heap)("Concurrent Uncommit Summary: %zu%s, %u regions, %1.3fms", byte_size_in_proper_unit(_summary_region_count * G1HeapRegion::GrainBytes), proper_unit_for_byte_size(_summary_region_count * G1HeapRegion::GrainBytes), _summary_region_count, diff --git a/src/hotspot/share/gc/g1/g1VMOperations.cpp b/src/hotspot/share/gc/g1/g1VMOperations.cpp index 634cdf6265fd4..9552bd6d41812 100644 --- a/src/hotspot/share/gc/g1/g1VMOperations.cpp +++ b/src/hotspot/share/gc/g1/g1VMOperations.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1ConcurrentMarkThread.inline.hpp" #include "gc/g1/g1Policy.hpp" diff --git a/src/hotspot/share/gc/g1/g1YoungCollector.cpp b/src/hotspot/share/gc/g1/g1YoungCollector.cpp index 2af5658f98e1c..9cb734ec65399 100644 --- a/src/hotspot/share/gc/g1/g1YoungCollector.cpp +++ b/src/hotspot/share/gc/g1/g1YoungCollector.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderDataGraph.inline.hpp" #include "classfile/javaClasses.inline.hpp" diff --git a/src/hotspot/share/gc/g1/g1YoungGCAllocationFailureInjector.cpp b/src/hotspot/share/gc/g1/g1YoungGCAllocationFailureInjector.cpp index dcf42b31bb133..ceb859d249b79 100644 --- a/src/hotspot/share/gc/g1/g1YoungGCAllocationFailureInjector.cpp +++ b/src/hotspot/share/gc/g1/g1YoungGCAllocationFailureInjector.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * */ -#include "precompiled.hpp" - #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1YoungGCAllocationFailureInjector.inline.hpp" #include "gc/shared/gc_globals.hpp" diff --git a/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp b/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp index c72dcc9661821..5b9086be362a5 100644 --- a/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp +++ b/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "compiler/oopMap.hpp" #include "gc/g1/g1CardSetMemory.hpp" @@ -394,7 +393,7 @@ class G1FreeHumongousRegionClosure : public G1HeapRegionIndexClosure { "Only eagerly reclaiming type arrays is supported, but the object " PTR_FORMAT " is not.", p2i(r->bottom())); - log_debug(gc, humongous)("Reclaimed humongous region %u (object size " SIZE_FORMAT " @ " PTR_FORMAT ")", + log_debug(gc, humongous)("Reclaimed humongous region %u (object size %zu @ " PTR_FORMAT ")", region_index, obj->size() * HeapWordSize, p2i(r->bottom()) diff --git a/src/hotspot/share/gc/g1/g1YoungGCPreEvacuateTasks.cpp b/src/hotspot/share/gc/g1/g1YoungGCPreEvacuateTasks.cpp index d746062366966..63e7797981210 100644 --- a/src/hotspot/share/gc/g1/g1YoungGCPreEvacuateTasks.cpp +++ b/src/hotspot/share/gc/g1/g1YoungGCPreEvacuateTasks.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * */ -#include "precompiled.hpp" - #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1ConcurrentRefineStats.hpp" #include "gc/g1/g1DirtyCardQueue.hpp" diff --git a/src/hotspot/share/gc/g1/g1YoungGenSizer.cpp b/src/hotspot/share/gc/g1/g1YoungGenSizer.cpp index 0c4b0b90df0aa..a8209eb19ba37 100644 --- a/src/hotspot/share/gc/g1/g1YoungGenSizer.cpp +++ b/src/hotspot/share/gc/g1/g1YoungGenSizer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1Arguments.hpp" #include "gc/g1/g1HeapRegion.hpp" #include "gc/g1/g1YoungGenSizer.hpp" @@ -44,8 +43,8 @@ G1YoungGenSizer::G1YoungGenSizer() : _sizer_kind(SizerDefaults), if (NewSize > MaxNewSize) { if (FLAG_IS_CMDLINE(MaxNewSize)) { - log_warning(gc, ergo)("NewSize (" SIZE_FORMAT "k) is greater than the MaxNewSize (" SIZE_FORMAT "k). " - "A new max generation size of " SIZE_FORMAT "k will be used.", + log_warning(gc, ergo)("NewSize (%zuk) is greater than the MaxNewSize (%zuk). " + "A new max generation size of %zuk will be used.", NewSize/K, MaxNewSize/K, NewSize/K); } FLAG_SET_ERGO(MaxNewSize, NewSize); diff --git a/src/hotspot/share/gc/g1/jvmFlagConstraintsG1.cpp b/src/hotspot/share/gc/g1/jvmFlagConstraintsG1.cpp index 0a29caed8ccd8..68da7400256a7 100644 --- a/src/hotspot/share/gc/g1/jvmFlagConstraintsG1.cpp +++ b/src/hotspot/share/gc/g1/jvmFlagConstraintsG1.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/g1/g1HeapRegionBounds.inline.hpp" #include "gc/g1/jvmFlagConstraintsG1.hpp" #include "gc/shared/bufferNode.hpp" @@ -83,7 +82,7 @@ JVMFlag::Error G1HeapRegionSizeConstraintFunc(size_t value, bool verbose) { // Default value of G1HeapRegionSize=0 means will be set ergonomically. if (FLAG_IS_CMDLINE(G1HeapRegionSize) && (value < G1HeapRegionBounds::min_size())) { JVMFlag::printError(verbose, - "G1HeapRegionSize (" SIZE_FORMAT ") must be " + "G1HeapRegionSize (%zu) must be " "greater than or equal to ergonomic heap region minimum size\n", value); return JVMFlag::VIOLATES_CONSTRAINT; @@ -123,8 +122,8 @@ JVMFlag::Error G1MaxNewSizePercentConstraintFunc(uint value, bool verbose) { JVMFlag::Error MaxGCPauseMillisConstraintFuncG1(uintx value, bool verbose) { if (UseG1GC && FLAG_IS_CMDLINE(MaxGCPauseMillis) && (value >= GCPauseIntervalMillis)) { JVMFlag::printError(verbose, - "MaxGCPauseMillis (" UINTX_FORMAT ") must be " - "less than GCPauseIntervalMillis (" UINTX_FORMAT ")\n", + "MaxGCPauseMillis (%zu) must be " + "less than GCPauseIntervalMillis (%zu)\n", value, GCPauseIntervalMillis); return JVMFlag::VIOLATES_CONSTRAINT; } @@ -137,7 +136,7 @@ JVMFlag::Error GCPauseIntervalMillisConstraintFuncG1(uintx value, bool verbose) if (FLAG_IS_CMDLINE(GCPauseIntervalMillis)) { if (value < 1) { JVMFlag::printError(verbose, - "GCPauseIntervalMillis (" UINTX_FORMAT ") must be " + "GCPauseIntervalMillis (%zu) must be " "greater than or equal to 1\n", value); return JVMFlag::VIOLATES_CONSTRAINT; @@ -152,8 +151,8 @@ JVMFlag::Error GCPauseIntervalMillisConstraintFuncG1(uintx value, bool verbose) if (value <= MaxGCPauseMillis) { JVMFlag::printError(verbose, - "GCPauseIntervalMillis (" UINTX_FORMAT ") must be " - "greater than MaxGCPauseMillis (" UINTX_FORMAT ")\n", + "GCPauseIntervalMillis (%zu) must be " + "greater than MaxGCPauseMillis (%zu)\n", value, MaxGCPauseMillis); return JVMFlag::VIOLATES_CONSTRAINT; } @@ -171,7 +170,7 @@ JVMFlag::Error NewSizeConstraintFuncG1(size_t value, bool verbose) { // So maximum of NewSize should be 'max_juint * 1M' if (UseG1GC && (value > (max_juint * 1 * M))) { JVMFlag::printError(verbose, - "NewSize (" SIZE_FORMAT ") must be less than ergonomic maximum value\n", + "NewSize (%zu) must be less than ergonomic maximum value\n", value); return JVMFlag::VIOLATES_CONSTRAINT; } diff --git a/src/hotspot/share/gc/parallel/gcAdaptivePolicyCounters.cpp b/src/hotspot/share/gc/parallel/gcAdaptivePolicyCounters.cpp index 9f0b5961ea0e1..47c09befb400d 100644 --- a/src/hotspot/share/gc/parallel/gcAdaptivePolicyCounters.cpp +++ b/src/hotspot/share/gc/parallel/gcAdaptivePolicyCounters.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/parallel/gcAdaptivePolicyCounters.hpp" #include "memory/resourceArea.hpp" diff --git a/src/hotspot/share/gc/parallel/jvmFlagConstraintsParallel.cpp b/src/hotspot/share/gc/parallel/jvmFlagConstraintsParallel.cpp index 99c795341df8d..94e2d306165db 100644 --- a/src/hotspot/share/gc/parallel/jvmFlagConstraintsParallel.cpp +++ b/src/hotspot/share/gc/parallel/jvmFlagConstraintsParallel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/parallel/jvmFlagConstraintsParallel.hpp" #include "gc/shared/gc_globals.hpp" #include "runtime/globals.hpp" diff --git a/src/hotspot/share/gc/parallel/mutableNUMASpace.cpp b/src/hotspot/share/gc/parallel/mutableNUMASpace.cpp index 06aa3d5fc72b2..874d3974ead53 100644 --- a/src/hotspot/share/gc/parallel/mutableNUMASpace.cpp +++ b/src/hotspot/share/gc/parallel/mutableNUMASpace.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/parallel/mutableNUMASpace.hpp" #include "gc/shared/collectedHeap.hpp" #include "gc/shared/gc_globals.hpp" @@ -99,7 +98,7 @@ void MutableNUMASpace::ensure_parsability() { while (words_left_to_fill > 0) { size_t words_to_fill = MIN2(words_left_to_fill, CollectedHeap::filler_array_max_size()); assert(words_to_fill >= CollectedHeap::min_fill_size(), - "Remaining size (" SIZE_FORMAT ") is too small to fill (based on " SIZE_FORMAT " and " SIZE_FORMAT ")", + "Remaining size (%zu) is too small to fill (based on %zu and %zu)", words_to_fill, words_left_to_fill, CollectedHeap::filler_array_max_size()); CollectedHeap::fill_with_object(cur_top, words_to_fill); cur_top += words_to_fill; @@ -619,8 +618,8 @@ void MutableNUMASpace::print_on(outputStream* st) const { for (int i = 0; i < lgrp_spaces()->length(); i++) { lgrp_spaces()->at(i)->accumulate_statistics(page_size()); } - st->print(" local/remote/unbiased/uncommitted: " SIZE_FORMAT "K/" - SIZE_FORMAT "K/" SIZE_FORMAT "K/" SIZE_FORMAT "K\n", + st->print(" local/remote/unbiased/uncommitted: %zuK/" + "%zuK/%zuK/%zuK\n", ls->space_stats()->_local_space / K, ls->space_stats()->_remote_space / K, ls->space_stats()->_unbiased_space / K, diff --git a/src/hotspot/share/gc/parallel/mutableSpace.cpp b/src/hotspot/share/gc/parallel/mutableSpace.cpp index 74801f4870b24..19ec0fcf83991 100644 --- a/src/hotspot/share/gc/parallel/mutableSpace.cpp +++ b/src/hotspot/share/gc/parallel/mutableSpace.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/parallel/mutableSpace.hpp" #include "gc/shared/pretouchTask.hpp" #include "gc/shared/spaceDecorator.hpp" @@ -233,7 +232,7 @@ void MutableSpace::object_iterate(ObjectClosure* cl) { void MutableSpace::print_short() const { print_short_on(tty); } void MutableSpace::print_short_on( outputStream* st) const { - st->print(" space " SIZE_FORMAT "K, %d%% used", capacity_in_bytes() / K, + st->print(" space %zuK, %d%% used", capacity_in_bytes() / K, (int) ((double) used_in_bytes() * 100 / capacity_in_bytes())); } diff --git a/src/hotspot/share/gc/parallel/objectStartArray.cpp b/src/hotspot/share/gc/parallel/objectStartArray.cpp index 2637a9d2b8827..e8d94b28d1879 100644 --- a/src/hotspot/share/gc/parallel/objectStartArray.cpp +++ b/src/hotspot/share/gc/parallel/objectStartArray.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/parallel/objectStartArray.inline.hpp" #include "gc/shared/cardTableBarrierSet.hpp" #include "memory/memoryReserver.hpp" diff --git a/src/hotspot/share/gc/parallel/parMarkBitMap.cpp b/src/hotspot/share/gc/parallel/parMarkBitMap.cpp index db06cc785218b..cda892f68ca92 100644 --- a/src/hotspot/share/gc/parallel/parMarkBitMap.cpp +++ b/src/hotspot/share/gc/parallel/parMarkBitMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/parallel/parMarkBitMap.inline.hpp" #include "gc/parallel/psCompactionManager.inline.hpp" #include "gc/parallel/psParallelCompact.inline.hpp" diff --git a/src/hotspot/share/gc/parallel/parallelArguments.cpp b/src/hotspot/share/gc/parallel/parallelArguments.cpp index d9972ccc146c6..6309f52c82ed2 100644 --- a/src/hotspot/share/gc/parallel/parallelArguments.cpp +++ b/src/hotspot/share/gc/parallel/parallelArguments.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, Red Hat, Inc. and/or its affiliates. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "gc/parallel/parallelArguments.hpp" #include "gc/parallel/parallelScavengeHeap.hpp" #include "gc/shared/adaptiveSizePolicy.hpp" diff --git a/src/hotspot/share/gc/parallel/parallelInitLogger.cpp b/src/hotspot/share/gc/parallel/parallelInitLogger.cpp index 555b96e26319b..b6d1034f60a1c 100644 --- a/src/hotspot/share/gc/parallel/parallelInitLogger.cpp +++ b/src/hotspot/share/gc/parallel/parallelInitLogger.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * 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,16 +22,15 @@ * */ -#include "precompiled.hpp" #include "gc/parallel/parallelInitLogger.hpp" #include "gc/shared/genArguments.hpp" #include "gc/shared/gcLogPrecious.hpp" void ParallelInitLogger::print_heap() { log_info_p(gc, init)("Alignments:" - " Space " SIZE_FORMAT "%s," - " Generation " SIZE_FORMAT "%s," - " Heap " SIZE_FORMAT "%s", + " Space %zu%s," + " Generation %zu%s," + " Heap %zu%s", byte_size_in_exact_unit(SpaceAlignment), exact_unit_for_byte_size(SpaceAlignment), byte_size_in_exact_unit(GenAlignment), exact_unit_for_byte_size(GenAlignment), byte_size_in_exact_unit(HeapAlignment), exact_unit_for_byte_size(HeapAlignment)); diff --git a/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp b/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp index 6b1b25dd6aae3..dc6a3ca565f78 100644 --- a/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp +++ b/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/parallel/objectStartArray.inline.hpp" #include "gc/parallel/parallelArguments.hpp" #include "gc/parallel/parallelInitLogger.hpp" @@ -400,7 +399,7 @@ HeapWord* ParallelScavengeHeap::mem_allocate_work(size_t size, if ((result == nullptr) && (QueuedAllocationWarningCount > 0) && (loop_count % QueuedAllocationWarningCount == 0)) { log_warning(gc)("ParallelScavengeHeap::mem_allocate retries %d times", loop_count); - log_warning(gc)("\tsize=" SIZE_FORMAT, size); + log_warning(gc)("\tsize=%zu", size); } } diff --git a/src/hotspot/share/gc/parallel/psAdaptiveSizePolicy.cpp b/src/hotspot/share/gc/parallel/psAdaptiveSizePolicy.cpp index 288a21fd35d05..3bb0c0bf1192a 100644 --- a/src/hotspot/share/gc/parallel/psAdaptiveSizePolicy.cpp +++ b/src/hotspot/share/gc/parallel/psAdaptiveSizePolicy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/parallel/parallelScavengeHeap.hpp" #include "gc/parallel/psAdaptiveSizePolicy.hpp" #include "gc/parallel/psGCAdaptivePolicyCounters.hpp" @@ -315,12 +314,12 @@ void PSAdaptiveSizePolicy::compute_eden_space_size( if (desired_eden_size > eden_limit) { log_debug(gc, ergo)( "PSAdaptiveSizePolicy::compute_eden_space_size limits:" - " desired_eden_size: " SIZE_FORMAT - " old_eden_size: " SIZE_FORMAT - " eden_limit: " SIZE_FORMAT - " cur_eden: " SIZE_FORMAT - " max_eden_size: " SIZE_FORMAT - " avg_young_live: " SIZE_FORMAT, + " desired_eden_size: %zu" + " old_eden_size: %zu" + " eden_limit: %zu" + " cur_eden: %zu" + " max_eden_size: %zu" + " avg_young_live: %zu", desired_eden_size, _eden_size, eden_limit, cur_eden, max_eden_size, (size_t)avg_young_live()->average()); } @@ -358,14 +357,14 @@ void PSAdaptiveSizePolicy::compute_eden_space_size( _avg_major_interval->average(), gc_pause_goal_sec()); - log_debug(gc, ergo)("Live_space: " SIZE_FORMAT " free_space: " SIZE_FORMAT, + log_debug(gc, ergo)("Live_space: %zu free_space: %zu", live_space(), free_space()); - log_trace(gc, ergo)("avg_young_live: " SIZE_FORMAT " avg_old_live: " SIZE_FORMAT, + log_trace(gc, ergo)("avg_young_live: %zu avg_old_live: %zu", (size_t)avg_young_live()->average(), (size_t)avg_old_live()->average()); - log_debug(gc, ergo)("Old eden_size: " SIZE_FORMAT " desired_eden_size: " SIZE_FORMAT, + log_debug(gc, ergo)("Old eden_size: %zu desired_eden_size: %zu", _eden_size, desired_eden_size); set_eden_size(desired_eden_size); @@ -492,11 +491,11 @@ void PSAdaptiveSizePolicy::compute_old_gen_free_space( size_t free_in_old_gen = (size_t)(max_old_gen_size - avg_old_live()->average()); log_debug(gc, ergo)( "PSAdaptiveSizePolicy::compute_old_gen_free_space limits:" - " desired_promo_size: " SIZE_FORMAT - " promo_limit: " SIZE_FORMAT - " free_in_old_gen: " SIZE_FORMAT - " max_old_gen_size: " SIZE_FORMAT - " avg_old_live: " SIZE_FORMAT, + " desired_promo_size: %zu" + " promo_limit: %zu" + " free_in_old_gen: %zu" + " max_old_gen_size: %zu" + " avg_old_live: %zu", desired_promo_size, promo_limit, free_in_old_gen, max_old_gen_size, (size_t) avg_old_live()->average()); } @@ -529,14 +528,14 @@ void PSAdaptiveSizePolicy::compute_old_gen_free_space( gc_pause_goal_sec()); // Footprint stats - log_debug(gc, ergo)("Live_space: " SIZE_FORMAT " free_space: " SIZE_FORMAT, + log_debug(gc, ergo)("Live_space: %zu free_space: %zu", live_space(), free_space()); - log_trace(gc, ergo)("avg_young_live: " SIZE_FORMAT " avg_old_live: " SIZE_FORMAT, + log_trace(gc, ergo)("avg_young_live: %zu avg_old_live: %zu", (size_t)avg_young_live()->average(), (size_t)avg_old_live()->average()); - log_debug(gc, ergo)("Old promo_size: " SIZE_FORMAT " desired_promo_size: " SIZE_FORMAT, + log_debug(gc, ergo)("Old promo_size: %zu desired_promo_size: %zu", _promo_size, desired_promo_size); set_promo_size(desired_promo_size); @@ -603,7 +602,7 @@ void PSAdaptiveSizePolicy::adjust_promo_for_pause_time(size_t* desired_promo_siz log_trace(gc, ergo)( "PSAdaptiveSizePolicy::adjust_promo_for_pause_time " "adjusting gen sizes for major pause (avg %f goal %f). " - "desired_promo_size " SIZE_FORMAT " promo delta " SIZE_FORMAT, + "desired_promo_size %zu promo delta %zu", _avg_major_pause->average(), gc_pause_goal_sec(), *desired_promo_size_ptr, promo_heap_delta); } @@ -620,7 +619,7 @@ void PSAdaptiveSizePolicy::adjust_eden_for_pause_time(size_t* desired_eden_size_ log_trace(gc, ergo)( "PSAdaptiveSizePolicy::adjust_eden_for_pause_time " "adjusting gen sizes for major pause (avg %f goal %f). " - "desired_eden_size " SIZE_FORMAT " eden delta " SIZE_FORMAT, + "desired_eden_size %zu eden delta %zu", _avg_major_pause->average(), gc_pause_goal_sec(), *desired_eden_size_ptr, eden_heap_delta); } @@ -636,7 +635,7 @@ void PSAdaptiveSizePolicy::adjust_promo_for_throughput(bool is_full_gc, return; } - log_trace(gc, ergo)("PSAdaptiveSizePolicy::adjust_promo_for_throughput(is_full: %d, promo: " SIZE_FORMAT "): mutator_cost %f major_gc_cost %f minor_gc_cost %f", + log_trace(gc, ergo)("PSAdaptiveSizePolicy::adjust_promo_for_throughput(is_full: %d, promo: %zu): mutator_cost %f major_gc_cost %f minor_gc_cost %f", is_full_gc, *desired_promo_size_ptr, mutator_cost(), major_gc_cost(), minor_gc_cost()); // Tenured generation @@ -650,7 +649,7 @@ void PSAdaptiveSizePolicy::adjust_promo_for_throughput(bool is_full_gc, double scale_by_ratio = major_gc_cost() / gc_cost(); scaled_promo_heap_delta = (size_t) (scale_by_ratio * (double) promo_heap_delta); - log_trace(gc, ergo)("Scaled tenured increment: " SIZE_FORMAT " by %f down to " SIZE_FORMAT, + log_trace(gc, ergo)("Scaled tenured increment: %zu by %f down to %zu", promo_heap_delta, scale_by_ratio, scaled_promo_heap_delta); } else if (major_gc_cost() >= 0.0) { // Scaling is not going to work. If the major gc time is the @@ -697,7 +696,7 @@ void PSAdaptiveSizePolicy::adjust_promo_for_throughput(bool is_full_gc, _old_gen_change_for_major_throughput++; } - log_trace(gc, ergo)("Adjusting tenured gen for throughput (avg %f goal %f). desired_promo_size " SIZE_FORMAT " promo_delta " SIZE_FORMAT , + log_trace(gc, ergo)("Adjusting tenured gen for throughput (avg %f goal %f). desired_promo_size %zu promo_delta %zu", mutator_cost(), _throughput_goal, *desired_promo_size_ptr, scaled_promo_heap_delta); @@ -715,7 +714,7 @@ void PSAdaptiveSizePolicy::adjust_eden_for_throughput(bool is_full_gc, return; } - log_trace(gc, ergo)("PSAdaptiveSizePolicy::adjust_eden_for_throughput(is_full: %d, cur_eden: " SIZE_FORMAT "): mutator_cost %f major_gc_cost %f minor_gc_cost %f", + log_trace(gc, ergo)("PSAdaptiveSizePolicy::adjust_eden_for_throughput(is_full: %d, cur_eden: %zu): mutator_cost %f major_gc_cost %f minor_gc_cost %f", is_full_gc, *desired_eden_size_ptr, mutator_cost(), major_gc_cost(), minor_gc_cost()); // Young generation @@ -728,7 +727,7 @@ void PSAdaptiveSizePolicy::adjust_eden_for_throughput(bool is_full_gc, assert(scale_by_ratio <= 1.0 && scale_by_ratio >= 0.0, "Scaling is wrong"); scaled_eden_heap_delta = (size_t) (scale_by_ratio * (double) eden_heap_delta); - log_trace(gc, ergo)("Scaled eden increment: " SIZE_FORMAT " by %f down to " SIZE_FORMAT, + log_trace(gc, ergo)("Scaled eden increment: %zu by %f down to %zu", eden_heap_delta, scale_by_ratio, scaled_eden_heap_delta); } else if (minor_gc_cost() >= 0.0) { // Scaling is not going to work. If the minor gc time is the @@ -774,7 +773,7 @@ void PSAdaptiveSizePolicy::adjust_eden_for_throughput(bool is_full_gc, _young_gen_change_for_minor_throughput++; } - log_trace(gc, ergo)("Adjusting eden for throughput (avg %f goal %f). desired_eden_size " SIZE_FORMAT " eden delta " SIZE_FORMAT, + log_trace(gc, ergo)("Adjusting eden for throughput (avg %f goal %f). desired_eden_size %zu eden delta %zu", mutator_cost(), _throughput_goal, *desired_eden_size_ptr, scaled_eden_heap_delta); } @@ -791,9 +790,9 @@ size_t PSAdaptiveSizePolicy::adjust_promo_for_footprint( log_trace(gc, ergo)( "AdaptiveSizePolicy::adjust_promo_for_footprint " "adjusting tenured gen for footprint. " - "starting promo size " SIZE_FORMAT - " reduced promo size " SIZE_FORMAT - " promo delta " SIZE_FORMAT, + "starting promo size %zu" + " reduced promo size %zu" + " promo delta %zu", desired_promo_size, reduced_size, change ); assert(reduced_size <= desired_promo_size, "Inconsistent result"); @@ -813,9 +812,9 @@ size_t PSAdaptiveSizePolicy::adjust_eden_for_footprint( log_trace(gc, ergo)( "AdaptiveSizePolicy::adjust_eden_for_footprint " "adjusting eden for footprint. " - " starting eden size " SIZE_FORMAT - " reduced eden size " SIZE_FORMAT - " eden delta " SIZE_FORMAT, + " starting eden size %zu" + " reduced eden size %zu" + " eden delta %zu", desired_eden_size, reduced_size, change); assert(reduced_size <= desired_eden_size, "Inconsistent result"); @@ -947,12 +946,10 @@ uint PSAdaptiveSizePolicy::compute_survivor_space_size_and_threshold( // Finally, increment or decrement the tenuring threshold, as decided above. // We test for decrementing first, as we might have hit the target size // limit. - if (decr_tenuring_threshold && !(AlwaysTenure || NeverTenure)) { - if (tenuring_threshold > 1) { + if (!(AlwaysTenure || NeverTenure)) { + if (decr_tenuring_threshold && tenuring_threshold > 1) { tenuring_threshold--; - } - } else if (incr_tenuring_threshold && !(AlwaysTenure || NeverTenure)) { - if (tenuring_threshold < MaxTenuringThreshold) { + } else if (incr_tenuring_threshold && tenuring_threshold < MaxTenuringThreshold) { tenuring_threshold++; } } @@ -966,7 +963,7 @@ uint PSAdaptiveSizePolicy::compute_survivor_space_size_and_threshold( log_debug(gc, ergo)("avg_survived_padded_avg: %f", _avg_survived->padded_average()); log_trace(gc, ergo)("avg_promoted_avg: %f avg_promoted_dev: %f", avg_promoted()->average(), avg_promoted()->deviation()); - log_debug(gc, ergo)("avg_promoted_padded_avg: %f avg_pretenured_padded_avg: %f tenuring_thresh: %d target_size: " SIZE_FORMAT, + log_debug(gc, ergo)("avg_promoted_padded_avg: %f avg_pretenured_padded_avg: %f tenuring_thresh: %d target_size: %zu", avg_promoted()->padded_average(), _avg_pretenured->padded_average(), tenuring_threshold, target_size); @@ -989,7 +986,7 @@ void PSAdaptiveSizePolicy::update_averages(bool is_survivor_overflow, } avg_promoted()->sample(promoted); - log_trace(gc, ergo)("AdaptiveSizePolicy::update_averages: survived: " SIZE_FORMAT " promoted: " SIZE_FORMAT " overflow: %s", + log_trace(gc, ergo)("AdaptiveSizePolicy::update_averages: survived: %zu promoted: %zu overflow: %s", survived, promoted, is_survivor_overflow ? "true" : "false"); } diff --git a/src/hotspot/share/gc/parallel/psCardTable.cpp b/src/hotspot/share/gc/parallel/psCardTable.cpp index b80a1b13b007f..f8841b9a164f5 100644 --- a/src/hotspot/share/gc/parallel/psCardTable.cpp +++ b/src/hotspot/share/gc/parallel/psCardTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/parallel/objectStartArray.inline.hpp" #include "gc/parallel/parallelScavengeHeap.inline.hpp" #include "gc/parallel/psCardTable.hpp" @@ -122,13 +121,38 @@ class PSStripeShadowCardTable { const uint _card_shift; const uint _card_size; CardValue _table[PSCardTable::num_cards_in_stripe]; - const CardValue* _table_base; + uintptr_t _table_base; + + // Avoid UB pointer operations by using integers internally. + + static_assert(sizeof(uintptr_t) == sizeof(CardValue*), "simplifying assumption"); + static_assert(sizeof(CardValue) == 1, "simplifying assumption"); + + static uintptr_t iaddr(const void* p) { + return reinterpret_cast(p); + } + + uintptr_t compute_table_base(HeapWord* start) const { + uintptr_t offset = iaddr(start) >> _card_shift; + return iaddr(_table) - offset; + } + + void verify_card_inclusive(const CardValue* card) const { + assert(iaddr(card) >= iaddr(_table), "out of bounds"); + assert(iaddr(card) <= (iaddr(_table) + sizeof(_table)), "out of bounds"); + } + + void verify_card_exclusive(const CardValue* card) const { + assert(iaddr(card) >= iaddr(_table), "out of bounds"); + assert(iaddr(card) < (iaddr(_table) + sizeof(_table)), "out of bounds"); + } public: PSStripeShadowCardTable(PSCardTable* pst, HeapWord* const start, HeapWord* const end) : _card_shift(CardTable::card_shift()), _card_size(CardTable::card_size()), - _table_base(_table - (uintptr_t(start) >> _card_shift)) { + _table_base(compute_table_base(start)) + { size_t stripe_byte_size = pointer_delta(end, start) * HeapWordSize; size_t copy_length = align_up(stripe_byte_size, _card_size) >> _card_shift; // The end of the last stripe may not be card aligned as it is equal to old @@ -143,12 +167,16 @@ class PSStripeShadowCardTable { } HeapWord* addr_for(const CardValue* const card) { - assert(card >= _table && card <= &_table[PSCardTable::num_cards_in_stripe], "out of bounds"); - return (HeapWord*) ((card - _table_base) << _card_shift); + verify_card_inclusive(card); + uintptr_t addr = (iaddr(card) - _table_base) << _card_shift; + return reinterpret_cast(addr); } const CardValue* card_for(HeapWord* addr) { - return &_table_base[uintptr_t(addr) >> _card_shift]; + uintptr_t icard = _table_base + (iaddr(addr) >> _card_shift); + const CardValue* card = reinterpret_cast(icard); + verify_card_inclusive(card); + return card; } bool is_dirty(const CardValue* const card) { @@ -156,7 +184,7 @@ class PSStripeShadowCardTable { } bool is_clean(const CardValue* const card) { - assert(card >= _table && card < &_table[PSCardTable::num_cards_in_stripe], "out of bounds"); + verify_card_exclusive(card); return *card == PSCardTable::clean_card_val(); } diff --git a/src/hotspot/share/gc/parallel/psClosure.inline.hpp b/src/hotspot/share/gc/parallel/psClosure.inline.hpp index 7425b65739d16..5cc059a09f50d 100644 --- a/src/hotspot/share/gc/parallel/psClosure.inline.hpp +++ b/src/hotspot/share/gc/parallel/psClosure.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,7 +45,7 @@ class PSAdjustWeakRootsClosure final: public OopClosure { oop new_obj = o->forwardee(); if (log_develop_is_enabled(Trace, gc, scavenge)) { ResourceMark rm; // required by internal_name() - log_develop_trace(gc, scavenge)("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (" SIZE_FORMAT ")}", + log_develop_trace(gc, scavenge)("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%zu)}", "forwarding", new_obj->klass()->internal_name(), p2i((void *)o), p2i((void *)new_obj), new_obj->size()); } diff --git a/src/hotspot/share/gc/parallel/psCompactionManager.cpp b/src/hotspot/share/gc/parallel/psCompactionManager.cpp index 19bb22fb91523..0601c5047ebe3 100644 --- a/src/hotspot/share/gc/parallel/psCompactionManager.cpp +++ b/src/hotspot/share/gc/parallel/psCompactionManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/parallel/objectStartArray.hpp" #include "gc/parallel/parMarkBitMap.inline.hpp" #include "gc/parallel/parallelScavengeHeap.hpp" diff --git a/src/hotspot/share/gc/parallel/psGCAdaptivePolicyCounters.cpp b/src/hotspot/share/gc/parallel/psGCAdaptivePolicyCounters.cpp index ed96c5c418157..561d6009d59f0 100644 --- a/src/hotspot/share/gc/parallel/psGCAdaptivePolicyCounters.cpp +++ b/src/hotspot/share/gc/parallel/psGCAdaptivePolicyCounters.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/parallel/psGCAdaptivePolicyCounters.hpp" #include "memory/resourceArea.hpp" diff --git a/src/hotspot/share/gc/parallel/psGenerationCounters.cpp b/src/hotspot/share/gc/parallel/psGenerationCounters.cpp index 1b0e8d320a93e..8792df7cf277f 100644 --- a/src/hotspot/share/gc/parallel/psGenerationCounters.cpp +++ b/src/hotspot/share/gc/parallel/psGenerationCounters.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * */ -#include "precompiled.hpp" #include "gc/parallel/psGenerationCounters.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" diff --git a/src/hotspot/share/gc/parallel/psMemoryPool.cpp b/src/hotspot/share/gc/parallel/psMemoryPool.cpp index cd92e86c98b57..c120664600bb1 100644 --- a/src/hotspot/share/gc/parallel/psMemoryPool.cpp +++ b/src/hotspot/share/gc/parallel/psMemoryPool.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/parallel/psMemoryPool.hpp" PSGenerationPool::PSGenerationPool(PSOldGen* old_gen, diff --git a/src/hotspot/share/gc/parallel/psOldGen.cpp b/src/hotspot/share/gc/parallel/psOldGen.cpp index 52ea4dc042cbb..ab74d3468e19e 100644 --- a/src/hotspot/share/gc/parallel/psOldGen.cpp +++ b/src/hotspot/share/gc/parallel/psOldGen.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/parallel/objectStartArray.inline.hpp" #include "gc/parallel/parallelArguments.hpp" #include "gc/parallel/parallelScavengeHeap.hpp" @@ -251,7 +250,7 @@ bool PSOldGen::expand_by(size_t bytes) { if (result) { size_t new_mem_size = virtual_space()->committed_size(); size_t old_mem_size = new_mem_size - bytes; - log_debug(gc)("Expanding %s from " SIZE_FORMAT "K by " SIZE_FORMAT "K to " SIZE_FORMAT "K", + log_debug(gc)("Expanding %s from %zuK by %zuK to %zuK", name(), old_mem_size/K, bytes/K, new_mem_size/K); } @@ -279,7 +278,7 @@ void PSOldGen::shrink(size_t bytes) { size_t new_mem_size = virtual_space()->committed_size(); size_t old_mem_size = new_mem_size + bytes; - log_debug(gc)("Shrinking %s from " SIZE_FORMAT "K by " SIZE_FORMAT "K to " SIZE_FORMAT "K", + log_debug(gc)("Shrinking %s from %zuK by %zuK to %zuK", name(), old_mem_size/K, bytes/K, new_mem_size/K); } } @@ -309,9 +308,9 @@ void PSOldGen::resize(size_t desired_free_space) { const size_t current_size = capacity_in_bytes(); log_trace(gc, ergo)("AdaptiveSizePolicy::old generation size: " - "desired free: " SIZE_FORMAT " used: " SIZE_FORMAT - " new size: " SIZE_FORMAT " current size " SIZE_FORMAT - " gen limits: " SIZE_FORMAT " / " SIZE_FORMAT, + "desired free: %zu used: %zu" + " new size: %zu current size %zu" + " gen limits: %zu / %zu", desired_free_space, used_in_bytes(), new_size, current_size, max_gen_size(), min_gen_size()); @@ -329,7 +328,7 @@ void PSOldGen::resize(size_t desired_free_space) { shrink(change_bytes); } - log_trace(gc, ergo)("AdaptiveSizePolicy::old generation size: collection: %d (" SIZE_FORMAT ") -> (" SIZE_FORMAT ") ", + log_trace(gc, ergo)("AdaptiveSizePolicy::old generation size: collection: %d (%zu) -> (%zu) ", ParallelScavengeHeap::heap()->total_collections(), size_before, virtual_space()->committed_size()); @@ -367,7 +366,7 @@ void PSOldGen::post_resize() { void PSOldGen::print() const { print_on(tty);} void PSOldGen::print_on(outputStream* st) const { st->print(" %-15s", name()); - st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K", + st->print(" total %zuK, used %zuK", capacity_in_bytes()/K, used_in_bytes()/K); st->print_cr(" [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT ")", p2i(virtual_space()->low_boundary()), diff --git a/src/hotspot/share/gc/parallel/psParallelCompact.cpp b/src/hotspot/share/gc/parallel/psParallelCompact.cpp index 1aadcbeba3316..bdc53db29b844 100644 --- a/src/hotspot/share/gc/parallel/psParallelCompact.cpp +++ b/src/hotspot/share/gc/parallel/psParallelCompact.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderDataGraph.hpp" #include "classfile/javaClasses.inline.hpp" #include "classfile/stringTable.hpp" @@ -584,16 +583,16 @@ bool PSParallelCompact::initialize_aux_data() { if (!_mark_bitmap.initialize(mr)) { vm_shutdown_during_initialization( - err_msg("Unable to allocate " SIZE_FORMAT "KB bitmaps for parallel " - "garbage collection for the requested " SIZE_FORMAT "KB heap.", + err_msg("Unable to allocate %zuKB bitmaps for parallel " + "garbage collection for the requested %zuKB heap.", _mark_bitmap.reserved_byte_size()/K, mr.byte_size()/K)); return false; } if (!_summary_data.initialize(mr)) { vm_shutdown_during_initialization( - err_msg("Unable to allocate " SIZE_FORMAT "KB card tables for parallel " - "garbage collection for the requested " SIZE_FORMAT "KB heap.", + err_msg("Unable to allocate %zuKB card tables for parallel " + "garbage collection for the requested %zuKB heap.", _summary_data.reserved_byte_size()/K, mr.byte_size()/K)); return false; } @@ -1075,7 +1074,7 @@ bool PSParallelCompact::invoke_no_policy(bool clear_all_soft_refs) { if (UseAdaptiveSizePolicy) { log_debug(gc, ergo)("AdaptiveSizeStart: collection: %d ", heap->total_collections()); - log_trace(gc, ergo)("old_gen_capacity: " SIZE_FORMAT " young_gen_capacity: " SIZE_FORMAT, + log_trace(gc, ergo)("old_gen_capacity: %zu young_gen_capacity: %zu", old_gen->capacity_in_bytes(), young_gen->capacity_in_bytes()); // Don't check if the size_policy is ready here. Let @@ -1688,7 +1687,7 @@ class FillableRegionLogger : public StackObj { public: FillableRegionLogger() : _next_index(0), _enabled(log_develop_is_enabled(Trace, gc, compaction)), _total_regions(0) { } ~FillableRegionLogger() { - log.trace(SIZE_FORMAT " initially fillable regions", _total_regions); + log.trace("%zu initially fillable regions", _total_regions); } void print_line() { @@ -1697,7 +1696,7 @@ class FillableRegionLogger : public StackObj { } FormatBuffer<> line("Fillable: "); for (int i = 0; i < _next_index; i++) { - line.append(" " SIZE_FORMAT_W(7), _regions[i]); + line.append(" %7zu", _regions[i]); } log.trace("%s", line.buffer()); _next_index = 0; diff --git a/src/hotspot/share/gc/parallel/psPromotionLAB.cpp b/src/hotspot/share/gc/parallel/psPromotionLAB.cpp index 4c3367cdf9c98..e3ed819ceb1ef 100644 --- a/src/hotspot/share/gc/parallel/psPromotionLAB.cpp +++ b/src/hotspot/share/gc/parallel/psPromotionLAB.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/parallel/mutableSpace.hpp" #include "gc/parallel/parallelScavengeHeap.hpp" #include "gc/parallel/psPromotionLAB.hpp" diff --git a/src/hotspot/share/gc/parallel/psPromotionManager.cpp b/src/hotspot/share/gc/parallel/psPromotionManager.cpp index 69fdde5ea9ff2..12758f1b66147 100644 --- a/src/hotspot/share/gc/parallel/psPromotionManager.cpp +++ b/src/hotspot/share/gc/parallel/psPromotionManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/javaClasses.inline.hpp" #include "gc/parallel/mutableSpace.hpp" #include "gc/parallel/parallelScavengeHeap.hpp" diff --git a/src/hotspot/share/gc/parallel/psScavenge.cpp b/src/hotspot/share/gc/parallel/psScavenge.cpp index 101f06b8fe0b7..7434097da21cd 100644 --- a/src/hotspot/share/gc/parallel/psScavenge.cpp +++ b/src/hotspot/share/gc/parallel/psScavenge.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderDataGraph.hpp" #include "classfile/stringTable.hpp" #include "code/codeCache.hpp" @@ -460,7 +459,7 @@ bool PSScavenge::invoke(bool clear_soft_refs) { // Calculate the new survivor size and tenuring threshold log_debug(gc, ergo)("AdaptiveSizeStart: collection: %d ", heap->total_collections()); - log_trace(gc, ergo)("old_gen_capacity: " SIZE_FORMAT " young_gen_capacity: " SIZE_FORMAT, + log_trace(gc, ergo)("old_gen_capacity: %zu young_gen_capacity: %zu", old_gen->capacity_in_bytes(), young_gen->capacity_in_bytes()); if (UsePerfData) { @@ -628,7 +627,7 @@ bool PSScavenge::should_attempt_scavenge() { size_t free_in_old_gen = old_gen->max_gen_size() - old_gen->used_in_bytes(); bool result = promotion_estimate < free_in_old_gen; - log_trace(ergo)("%s scavenge: average_promoted " SIZE_FORMAT " padded_average_promoted " SIZE_FORMAT " free in old gen " SIZE_FORMAT, + log_trace(ergo)("%s scavenge: average_promoted %zu padded_average_promoted %zu free in old gen %zu", result ? "Do" : "Skip", (size_t) policy->average_promoted_in_bytes(), (size_t) policy->padded_average_promoted_in_bytes(), free_in_old_gen); diff --git a/src/hotspot/share/gc/parallel/psVMOperations.cpp b/src/hotspot/share/gc/parallel/psVMOperations.cpp index d4d2e1df21f24..674e51bf6d277 100644 --- a/src/hotspot/share/gc/parallel/psVMOperations.cpp +++ b/src/hotspot/share/gc/parallel/psVMOperations.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/parallel/psParallelCompact.inline.hpp" #include "gc/parallel/parallelScavengeHeap.inline.hpp" #include "gc/parallel/psScavenge.hpp" diff --git a/src/hotspot/share/gc/parallel/psVirtualspace.cpp b/src/hotspot/share/gc/parallel/psVirtualspace.cpp index ee8a564e3063d..ce4cd4ad977a6 100644 --- a/src/hotspot/share/gc/parallel/psVirtualspace.cpp +++ b/src/hotspot/share/gc/parallel/psVirtualspace.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/parallel/psVirtualspace.hpp" #include "memory/reservedSpace.hpp" #include "runtime/os.hpp" diff --git a/src/hotspot/share/gc/parallel/psYoungGen.cpp b/src/hotspot/share/gc/parallel/psYoungGen.cpp index dd9619e454656..82b946201d2ee 100644 --- a/src/hotspot/share/gc/parallel/psYoungGen.cpp +++ b/src/hotspot/share/gc/parallel/psYoungGen.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/parallel/mutableNUMASpace.hpp" #include "gc/parallel/parallelScavengeHeap.hpp" #include "gc/parallel/psScavenge.hpp" @@ -256,9 +255,9 @@ void PSYoungGen::resize(size_t eden_size, size_t survivor_size) { space_invariants(); log_trace(gc, ergo)("Young generation size: " - "desired eden: " SIZE_FORMAT " survivor: " SIZE_FORMAT - " used: " SIZE_FORMAT " capacity: " SIZE_FORMAT - " gen limits: " SIZE_FORMAT " / " SIZE_FORMAT, + "desired eden: %zu survivor: %zu" + " used: %zu capacity: %zu" + " gen limits: %zu / %zu", eden_size, survivor_size, used_in_bytes(), capacity_in_bytes(), max_gen_size(), min_gen_size()); } @@ -315,15 +314,15 @@ bool PSYoungGen::resize_generation(size_t eden_size, size_t survivor_size) { } } else { if (orig_size == max_gen_size()) { - log_trace(gc)("PSYoung generation size at maximum: " SIZE_FORMAT "K", orig_size/K); + log_trace(gc)("PSYoung generation size at maximum: %zuK", orig_size/K); } else if (orig_size == min_gen_size()) { - log_trace(gc)("PSYoung generation size at minimum: " SIZE_FORMAT "K", orig_size/K); + log_trace(gc)("PSYoung generation size at minimum: %zuK", orig_size/K); } } if (size_changed) { post_resize(); - log_trace(gc)("PSYoung generation size changed: " SIZE_FORMAT "K->" SIZE_FORMAT "K", + log_trace(gc)("PSYoung generation size changed: %zuK->%zuK", orig_size/K, virtual_space()->committed_size()/K); } @@ -420,21 +419,21 @@ void PSYoungGen::resize_spaces(size_t requested_eden_size, return; } - log_trace(gc, ergo)("PSYoungGen::resize_spaces(requested_eden_size: " SIZE_FORMAT ", requested_survivor_size: " SIZE_FORMAT ")", + log_trace(gc, ergo)("PSYoungGen::resize_spaces(requested_eden_size: %zu, requested_survivor_size: %zu)", requested_eden_size, requested_survivor_size); - log_trace(gc, ergo)(" eden: [" PTR_FORMAT ".." PTR_FORMAT ") " SIZE_FORMAT, + log_trace(gc, ergo)(" eden: [" PTR_FORMAT ".." PTR_FORMAT ") %zu", p2i(eden_space()->bottom()), p2i(eden_space()->end()), pointer_delta(eden_space()->end(), eden_space()->bottom(), sizeof(char))); - log_trace(gc, ergo)(" from: [" PTR_FORMAT ".." PTR_FORMAT ") " SIZE_FORMAT, + log_trace(gc, ergo)(" from: [" PTR_FORMAT ".." PTR_FORMAT ") %zu", p2i(from_space()->bottom()), p2i(from_space()->end()), pointer_delta(from_space()->end(), from_space()->bottom(), sizeof(char))); - log_trace(gc, ergo)(" to: [" PTR_FORMAT ".." PTR_FORMAT ") " SIZE_FORMAT, + log_trace(gc, ergo)(" to: [" PTR_FORMAT ".." PTR_FORMAT ") %zu", p2i(to_space()->bottom()), p2i(to_space()->end()), pointer_delta( to_space()->end(), @@ -525,15 +524,15 @@ void PSYoungGen::resize_spaces(size_t requested_eden_size, guarantee(to_start != to_end, "to space is zero sized"); - log_trace(gc, ergo)(" [eden_start .. eden_end): [" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, + log_trace(gc, ergo)(" [eden_start .. eden_end): [" PTR_FORMAT " .. " PTR_FORMAT ") %zu", p2i(eden_start), p2i(eden_end), pointer_delta(eden_end, eden_start, sizeof(char))); - log_trace(gc, ergo)(" [from_start .. from_end): [" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, + log_trace(gc, ergo)(" [from_start .. from_end): [" PTR_FORMAT " .. " PTR_FORMAT ") %zu", p2i(from_start), p2i(from_end), pointer_delta(from_end, from_start, sizeof(char))); - log_trace(gc, ergo)(" [ to_start .. to_end): [" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, + log_trace(gc, ergo)(" [ to_start .. to_end): [" PTR_FORMAT " .. " PTR_FORMAT ") %zu", p2i(to_start), p2i(to_end), pointer_delta( to_end, to_start, sizeof(char))); @@ -575,15 +574,15 @@ void PSYoungGen::resize_spaces(size_t requested_eden_size, eden_end = MAX2(eden_end, eden_start + SpaceAlignment); to_start = MAX2(to_start, eden_end); - log_trace(gc, ergo)(" [eden_start .. eden_end): [" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, + log_trace(gc, ergo)(" [eden_start .. eden_end): [" PTR_FORMAT " .. " PTR_FORMAT ") %zu", p2i(eden_start), p2i(eden_end), pointer_delta(eden_end, eden_start, sizeof(char))); - log_trace(gc, ergo)(" [ to_start .. to_end): [" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, + log_trace(gc, ergo)(" [ to_start .. to_end): [" PTR_FORMAT " .. " PTR_FORMAT ") %zu", p2i(to_start), p2i(to_end), pointer_delta( to_end, to_start, sizeof(char))); - log_trace(gc, ergo)(" [from_start .. from_end): [" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, + log_trace(gc, ergo)(" [from_start .. from_end): [" PTR_FORMAT " .. " PTR_FORMAT ") %zu", p2i(from_start), p2i(from_end), pointer_delta(from_end, from_start, sizeof(char))); @@ -646,7 +645,7 @@ void PSYoungGen::resize_spaces(size_t requested_eden_size, assert(from_space()->top() == old_from_top, "from top changed!"); - log_trace(gc, ergo)("AdaptiveSizePolicy::survivor space sizes: collection: %d (" SIZE_FORMAT ", " SIZE_FORMAT ") -> (" SIZE_FORMAT ", " SIZE_FORMAT ") ", + log_trace(gc, ergo)("AdaptiveSizePolicy::survivor space sizes: collection: %d (%zu, %zu) -> (%zu, %zu) ", ParallelScavengeHeap::heap()->total_collections(), old_from, old_to, from_space()->capacity_in_bytes(), @@ -702,7 +701,7 @@ void PSYoungGen::object_iterate(ObjectClosure* blk) { void PSYoungGen::print() const { print_on(tty); } void PSYoungGen::print_on(outputStream* st) const { st->print(" %-15s", "PSYoungGen"); - st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K", + st->print(" total %zuK, used %zuK", capacity_in_bytes()/K, used_in_bytes()/K); virtual_space()->print_space_boundaries_on(st); st->print(" eden"); eden_space()->print_on(st); diff --git a/src/hotspot/share/gc/parallel/spaceCounters.cpp b/src/hotspot/share/gc/parallel/spaceCounters.cpp index 588c743d86587..4133fc2e2480a 100644 --- a/src/hotspot/share/gc/parallel/spaceCounters.cpp +++ b/src/hotspot/share/gc/parallel/spaceCounters.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/parallel/spaceCounters.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" diff --git a/src/hotspot/share/gc/serial/cSpaceCounters.cpp b/src/hotspot/share/gc/serial/cSpaceCounters.cpp index 6a9b51245783a..9f8b91e205cd0 100644 --- a/src/hotspot/share/gc/serial/cSpaceCounters.cpp +++ b/src/hotspot/share/gc/serial/cSpaceCounters.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/serial/cSpaceCounters.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" diff --git a/src/hotspot/share/gc/serial/cardTableRS.cpp b/src/hotspot/share/gc/serial/cardTableRS.cpp index 1c1781e280efa..80985424a62ad 100644 --- a/src/hotspot/share/gc/serial/cardTableRS.cpp +++ b/src/hotspot/share/gc/serial/cardTableRS.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderDataGraph.hpp" #include "gc/serial/cardTableRS.hpp" #include "gc/serial/generation.hpp" diff --git a/src/hotspot/share/gc/serial/defNewGeneration.cpp b/src/hotspot/share/gc/serial/defNewGeneration.cpp index f78a766c4c3b8..f637eb62a00f2 100644 --- a/src/hotspot/share/gc/serial/defNewGeneration.cpp +++ b/src/hotspot/share/gc/serial/defNewGeneration.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/serial/cardTableRS.hpp" #include "gc/serial/serialGcRefProcProxyTask.hpp" #include "gc/serial/serialHeap.inline.hpp" @@ -480,11 +479,11 @@ void DefNewGeneration::compute_new_size() { gch->rem_set()->resize_covered_region(cmr); log_debug(gc, ergo, heap)( - "New generation size " SIZE_FORMAT "K->" SIZE_FORMAT "K [eden=" SIZE_FORMAT "K,survivor=" SIZE_FORMAT "K]", + "New generation size %zuK->%zuK [eden=%zuK,survivor=%zuK]", new_size_before/K, _virtual_space.committed_size()/K, eden()->capacity()/K, from()->capacity()/K); log_trace(gc, ergo, heap)( - " [allowed " SIZE_FORMAT "K extra for %d threads]", + " [allowed %zuK extra for %d threads]", thread_increase_size/K, threads_count); } } @@ -715,7 +714,7 @@ void DefNewGeneration::remove_forwarding_pointers() { } void DefNewGeneration::handle_promotion_failure(oop old) { - log_debug(gc, promotion)("Promotion failure size = " SIZE_FORMAT ") ", old->size()); + log_debug(gc, promotion)("Promotion failure size = %zu) ", old->size()); _promotion_failed = true; _promotion_failed_info.register_copy_failure(old->size()); @@ -840,7 +839,7 @@ void DefNewGeneration::verify() { void DefNewGeneration::print_on(outputStream* st) const { st->print(" %-10s", name()); - st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K", + st->print(" total %zuK, used %zuK", capacity()/K, used()/K); st->print_cr(" [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT ")", p2i(_virtual_space.low_boundary()), diff --git a/src/hotspot/share/gc/serial/generation.cpp b/src/hotspot/share/gc/serial/generation.cpp index b15b071d7103f..61b128464e135 100644 --- a/src/hotspot/share/gc/serial/generation.cpp +++ b/src/hotspot/share/gc/serial/generation.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/serial/cardTableRS.hpp" #include "gc/serial/generation.hpp" #include "gc/serial/serialHeap.hpp" diff --git a/src/hotspot/share/gc/serial/serialArguments.cpp b/src/hotspot/share/gc/serial/serialArguments.cpp index c9d2caf9063c8..9b55e0cd9f69b 100644 --- a/src/hotspot/share/gc/serial/serialArguments.cpp +++ b/src/hotspot/share/gc/serial/serialArguments.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/fullGCForwarding.hpp" #include "gc/shared/gcArguments.hpp" #include "gc/serial/serialArguments.hpp" diff --git a/src/hotspot/share/gc/serial/serialBlockOffsetTable.cpp b/src/hotspot/share/gc/serial/serialBlockOffsetTable.cpp index bfb4a65baa62e..5fd55e2a73da1 100644 --- a/src/hotspot/share/gc/serial/serialBlockOffsetTable.cpp +++ b/src/hotspot/share/gc/serial/serialBlockOffsetTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/serial/serialBlockOffsetTable.inline.hpp" #include "gc/shared/blockOffsetTable.hpp" #include "gc/shared/collectedHeap.inline.hpp" diff --git a/src/hotspot/share/gc/serial/serialFullGC.cpp b/src/hotspot/share/gc/serial/serialFullGC.cpp index 0df28fa7bd5d2..9d0dc1932fcbc 100644 --- a/src/hotspot/share/gc/serial/serialFullGC.cpp +++ b/src/hotspot/share/gc/serial/serialFullGC.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderDataGraph.hpp" #include "classfile/classLoaderData.inline.hpp" #include "classfile/javaClasses.inline.hpp" @@ -133,7 +132,7 @@ class DeadSpacer : StackObj { // obj->set_mark(obj->mark().set_marked()); assert(dead_length == obj->size(), "bad filler object size"); - log_develop_trace(gc, compaction)("Inserting object to dead space: " PTR_FORMAT ", " PTR_FORMAT ", " SIZE_FORMAT "b", + log_develop_trace(gc, compaction)("Inserting object to dead space: " PTR_FORMAT ", " PTR_FORMAT ", %zub", p2i(dead_start), p2i(dead_end), dead_length * HeapWordSize); return true; @@ -651,7 +650,7 @@ void SerialFullGC::adjust_marks() { } void SerialFullGC::restore_marks() { - log_trace(gc)("Restoring " SIZE_FORMAT " marks", _preserved_count + _preserved_overflow_stack_set.get()->size()); + log_trace(gc)("Restoring %zu marks", _preserved_count + _preserved_overflow_stack_set.get()->size()); // restore the marks we saved earlier for (size_t i = 0; i < _preserved_count; i++) { diff --git a/src/hotspot/share/gc/serial/serialHeap.cpp b/src/hotspot/share/gc/serial/serialHeap.cpp index 23f1df6fc66db..bae627cd1de0c 100644 --- a/src/hotspot/share/gc/serial/serialHeap.cpp +++ b/src/hotspot/share/gc/serial/serialHeap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderDataGraph.hpp" #include "classfile/stringTable.hpp" #include "classfile/symbolTable.hpp" @@ -219,8 +218,7 @@ ReservedHeapSpace SerialHeap::allocate(size_t alignment) { "the maximum representable size"); } assert(total_reserved % alignment == 0, - "Gen size; total_reserved=" SIZE_FORMAT ", alignment=" - SIZE_FORMAT, total_reserved, alignment); + "Gen size; total_reserved=%zu, alignment=%zu", total_reserved, alignment); ReservedHeapSpace heap_rs = Universe::reserve_heap(total_reserved, alignment); size_t used_page_size = heap_rs.page_size(); @@ -400,7 +398,7 @@ HeapWord* SerialHeap::mem_allocate_work(size_t size, if ((QueuedAllocationWarningCount > 0) && (try_count % QueuedAllocationWarningCount == 0)) { log_warning(gc, ergo)("SerialHeap::mem_allocate_work retries %d times," - " size=" SIZE_FORMAT " %s", try_count, size, is_tlab ? "(TLAB)" : ""); + " size=%zu %s", try_count, size, is_tlab ? "(TLAB)" : ""); } } } diff --git a/src/hotspot/share/gc/serial/serialHeap.hpp b/src/hotspot/share/gc/serial/serialHeap.hpp index d787d216e37ab..d35809bf3a1d6 100644 --- a/src/hotspot/share/gc/serial/serialHeap.hpp +++ b/src/hotspot/share/gc/serial/serialHeap.hpp @@ -111,6 +111,9 @@ class SerialHeap : public CollectedHeap { bool is_young_gc_safe() const; + void gc_prologue(bool full); + void gc_epilogue(bool full); + public: // Returns JNI_OK on success jint initialize() override; @@ -226,10 +229,6 @@ class SerialHeap : public CollectedHeap { SO_ScavengeCodeCache = 0x10 }; - protected: - virtual void gc_prologue(bool full); - virtual void gc_epilogue(bool full); - public: // Apply closures on various roots in Young GC or marking/adjust phases of Full GC. void process_roots(ScanningOption so, diff --git a/src/hotspot/share/gc/serial/serialMemoryPools.cpp b/src/hotspot/share/gc/serial/serialMemoryPools.cpp index b82252b5a094f..723b53a3e2b0b 100644 --- a/src/hotspot/share/gc/serial/serialMemoryPools.cpp +++ b/src/hotspot/share/gc/serial/serialMemoryPools.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/serial/defNewGeneration.hpp" #include "gc/serial/serialMemoryPools.hpp" #include "gc/serial/tenuredGeneration.hpp" diff --git a/src/hotspot/share/gc/serial/serialStringDedup.cpp b/src/hotspot/share/gc/serial/serialStringDedup.cpp index 93910ae65d375..486affd3d20a3 100644 --- a/src/hotspot/share/gc/serial/serialStringDedup.cpp +++ b/src/hotspot/share/gc/serial/serialStringDedup.cpp @@ -21,7 +21,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/serial/defNewGeneration.hpp" #include "gc/serial/serialHeap.hpp" #include "gc/serial/serialStringDedup.hpp" diff --git a/src/hotspot/share/gc/serial/serialVMOperations.cpp b/src/hotspot/share/gc/serial/serialVMOperations.cpp index 36805f619ecb8..445f5959fe077 100644 --- a/src/hotspot/share/gc/serial/serialVMOperations.cpp +++ b/src/hotspot/share/gc/serial/serialVMOperations.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/serial/serialVMOperations.hpp" #include "gc/shared/gcLocker.hpp" diff --git a/src/hotspot/share/gc/serial/tenuredGeneration.cpp b/src/hotspot/share/gc/serial/tenuredGeneration.cpp index 2b7711e9b0a9e..e3b7eef478ace 100644 --- a/src/hotspot/share/gc/serial/tenuredGeneration.cpp +++ b/src/hotspot/share/gc/serial/tenuredGeneration.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/serial/cardTableRS.hpp" #include "gc/serial/serialBlockOffsetTable.inline.hpp" #include "gc/serial/serialFullGC.hpp" @@ -69,7 +68,7 @@ bool TenuredGeneration::grow_by(size_t bytes) { size_t new_mem_size = _virtual_space.committed_size(); size_t old_mem_size = new_mem_size - bytes; - log_trace(gc, heap)("Expanding %s from " SIZE_FORMAT "K by " SIZE_FORMAT "K to " SIZE_FORMAT "K", + log_trace(gc, heap)("Expanding %s from %zuK by %zuK to %zuK", name(), old_mem_size/K, bytes/K, new_mem_size/K); } return result; @@ -140,7 +139,7 @@ void TenuredGeneration::shrink(size_t bytes) { size_t new_mem_size = _virtual_space.committed_size(); size_t old_mem_size = new_mem_size + size; - log_trace(gc, heap)("Shrinking %s from " SIZE_FORMAT "K to " SIZE_FORMAT "K", + log_trace(gc, heap)("Shrinking %s from %zuK to %zuK", name(), old_mem_size/K, new_mem_size/K); } @@ -236,7 +235,7 @@ void TenuredGeneration::compute_new_size_inner() { assert(shrink_bytes <= max_shrink_bytes, "invalid shrink size"); log_trace(gc, heap)(" shrinking: initSize: %.1fK maximum_desired_capacity: %.1fK", OldSize / (double) K, maximum_desired_capacity / (double) K); - log_trace(gc, heap)(" shrink_bytes: %.1fK current_shrink_factor: " SIZE_FORMAT " new shrink factor: " SIZE_FORMAT " _min_heap_delta_bytes: %.1fK", + log_trace(gc, heap)(" shrink_bytes: %.1fK current_shrink_factor: %zu new shrink factor: %zu _min_heap_delta_bytes: %.1fK", shrink_bytes / (double) K, current_shrink_factor, _shrink_factor, @@ -354,8 +353,8 @@ void TenuredGeneration::compute_new_size() { compute_new_size_inner(); assert(used() == used_after_gc && used_after_gc <= capacity(), - "used: " SIZE_FORMAT " used_after_gc: " SIZE_FORMAT - " capacity: " SIZE_FORMAT, used(), used_after_gc, capacity()); + "used: %zu used_after_gc: %zu" + " capacity: %zu", used(), used_after_gc, capacity()); } void TenuredGeneration::update_promote_stats() { @@ -384,7 +383,7 @@ bool TenuredGeneration::promotion_attempt_is_safe(size_t max_promotion_in_bytes) bool res = (promotion_estimate <= available); - log_trace(gc)("Tenured: promo attempt is%s safe: available(" SIZE_FORMAT ") %s av_promo(" SIZE_FORMAT "), max_promo(" SIZE_FORMAT ")", + log_trace(gc)("Tenured: promo attempt is%s safe: available(%zu) %s av_promo(%zu), max_promo(%zu)", res? "":" not", available, res? ">=":"<", avg_promoted, max_promotion_in_bytes); return res; @@ -445,7 +444,7 @@ void TenuredGeneration::verify() { void TenuredGeneration::print_on(outputStream* st) const { st->print(" %-10s", name()); - st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K", + st->print(" total %zuK, used %zuK", capacity()/K, used()/K); st->print_cr(" [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT ")", p2i(_virtual_space.low_boundary()), diff --git a/src/hotspot/share/gc/shared/accessBarrierSupport.cpp b/src/hotspot/share/gc/shared/accessBarrierSupport.cpp index 93e88f82dba6a..35ea85571c2d3 100644 --- a/src/hotspot/share/gc/shared/accessBarrierSupport.cpp +++ b/src/hotspot/share/gc/shared/accessBarrierSupport.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/javaClasses.inline.hpp" #include "gc/shared/accessBarrierSupport.inline.hpp" #include "oops/access.hpp" diff --git a/src/hotspot/share/gc/shared/adaptiveSizePolicy.cpp b/src/hotspot/share/gc/shared/adaptiveSizePolicy.cpp index 1454a2b21e94d..3ebcdaaaf21b8 100644 --- a/src/hotspot/share/gc/shared/adaptiveSizePolicy.cpp +++ b/src/hotspot/share/gc/shared/adaptiveSizePolicy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/adaptiveSizePolicy.hpp" #include "gc/shared/gcCause.hpp" #include "gc/shared/gcUtil.hpp" @@ -337,11 +336,11 @@ class AdaptiveSizePolicySpaceOverheadTester: public GCOverheadTester { log_trace(gc, ergo)( "AdaptiveSizePolicySpaceOverheadTester::is_exceeded:" - " promo_limit: " SIZE_FORMAT - " total_free_limit: " SIZE_FORMAT - " max_old_gen_size: " SIZE_FORMAT - " max_eden_size: " SIZE_FORMAT - " mem_free_limit: " SIZE_FORMAT, + " promo_limit: %zu" + " total_free_limit: %zu" + " max_old_gen_size: %zu" + " max_eden_size: %zu" + " mem_free_limit: %zu", promo_limit, total_free_limit, _max_old_gen_size, _max_eden_size, (size_t)mem_free_limit); diff --git a/src/hotspot/share/gc/shared/ageTable.cpp b/src/hotspot/share/gc/shared/ageTable.cpp index 28f17a4220b89..f5b62466556ed 100644 --- a/src/hotspot/share/gc/shared/ageTable.cpp +++ b/src/hotspot/share/gc/shared/ageTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/ageTable.inline.hpp" #include "gc/shared/ageTableTracer.hpp" #include "gc/shared/collectedHeap.hpp" @@ -35,7 +34,7 @@ #include "utilities/copy.hpp" #include "logging/logStream.hpp" -/* Copyright (c) 1992, 2024, Oracle and/or its affiliates, and Stanford University. +/* Copyright (c) 1992, 2025, Oracle and/or its affiliates, and Stanford University. See the LICENSE file for license information. */ AgeTable::AgeTable(bool global) : _use_perf_data(UsePerfData && global) { @@ -108,7 +107,7 @@ uint AgeTable::compute_tenuring_threshold(size_t desired_survivor_size) { } - log_debug(gc, age)("Desired survivor size %zu bytes, new threshold " UINTX_FORMAT " (max threshold %u)", + log_debug(gc, age)("Desired survivor size %zu bytes, new threshold %zu (max threshold %u)", desired_survivor_size * oopSize, (uintx) result, MaxTenuringThreshold); return result; @@ -131,7 +130,7 @@ void AgeTable::print_on(outputStream* st) { size_t word_size = sizes[age]; total += word_size; if (word_size > 0) { - st->print_cr("- age %3u: " SIZE_FORMAT_W(10) " bytes, " SIZE_FORMAT_W(10) " total", + st->print_cr("- age %3u: %10zu bytes, %10zu total", age, word_size * oopSize, total * oopSize); } AgeTableTracer::send_tenuring_distribution_event(age, word_size * oopSize); diff --git a/src/hotspot/share/gc/shared/ageTableTracer.cpp b/src/hotspot/share/gc/shared/ageTableTracer.cpp index 5e0fbcfbcb11e..c178ce99f565c 100644 --- a/src/hotspot/share/gc/shared/ageTableTracer.cpp +++ b/src/hotspot/share/gc/shared/ageTableTracer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/ageTableTracer.hpp" #include "gc/shared/gcId.hpp" #include "jfr/jfrEvents.hpp" diff --git a/src/hotspot/share/gc/shared/allocTracer.cpp b/src/hotspot/share/gc/shared/allocTracer.cpp index 45fa0c7e631bd..bfd4ed75914af 100644 --- a/src/hotspot/share/gc/shared/allocTracer.cpp +++ b/src/hotspot/share/gc/shared/allocTracer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/allocTracer.hpp" #include "jfr/jfrEvents.hpp" #include "utilities/globalDefinitions.hpp" diff --git a/src/hotspot/share/gc/shared/barrierSet.cpp b/src/hotspot/share/gc/shared/barrierSet.cpp index c3a0c9cbbff0d..65ad476adc426 100644 --- a/src/hotspot/share/gc/shared/barrierSet.cpp +++ b/src/hotspot/share/gc/shared/barrierSet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/barrierSetAssembler.hpp" #include "gc/shared/barrierSetNMethod.hpp" diff --git a/src/hotspot/share/gc/shared/barrierSetNMethod.cpp b/src/hotspot/share/gc/shared/barrierSetNMethod.cpp index d61664cf5a6fc..4b81f321be3b7 100644 --- a/src/hotspot/share/gc/shared/barrierSetNMethod.cpp +++ b/src/hotspot/share/gc/shared/barrierSetNMethod.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "code/codeCache.hpp" #include "code/nmethod.hpp" #include "gc/shared/barrierSet.hpp" diff --git a/src/hotspot/share/gc/shared/barrierSetStackChunk.cpp b/src/hotspot/share/gc/shared/barrierSetStackChunk.cpp index aa5dfe787f7c6..9bbfdf5ba7ace 100644 --- a/src/hotspot/share/gc/shared/barrierSetStackChunk.cpp +++ b/src/hotspot/share/gc/shared/barrierSetStackChunk.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/barrierSetStackChunk.hpp" #include "memory/iterator.hpp" #include "oops/access.inline.hpp" diff --git a/src/hotspot/share/gc/shared/bufferNode.cpp b/src/hotspot/share/gc/shared/bufferNode.cpp index 9baa812c56ecd..e27b1279c7904 100644 --- a/src/hotspot/share/gc/shared/bufferNode.cpp +++ b/src/hotspot/share/gc/shared/bufferNode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/bufferNode.hpp" #include "utilities/debug.hpp" #include "memory/allocation.inline.hpp" @@ -68,4 +67,3 @@ void BufferNode::Allocator::release(BufferNode* node) { node->~BufferNode(); _free_list.release(node); } - diff --git a/src/hotspot/share/gc/shared/bufferNodeList.cpp b/src/hotspot/share/gc/shared/bufferNodeList.cpp index 4a527b3d64241..768f40e0985c2 100644 --- a/src/hotspot/share/gc/shared/bufferNodeList.cpp +++ b/src/hotspot/share/gc/shared/bufferNodeList.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/bufferNodeList.hpp" #include "utilities/debug.hpp" diff --git a/src/hotspot/share/gc/shared/c1/barrierSetC1.cpp b/src/hotspot/share/gc/shared/c1/barrierSetC1.cpp index 046a7ee586572..ac640fb88d259 100644 --- a/src/hotspot/share/gc/shared/c1/barrierSetC1.cpp +++ b/src/hotspot/share/gc/shared/c1/barrierSetC1.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_Defs.hpp" #include "c1/c1_LIRGenerator.hpp" #include "classfile/javaClasses.hpp" diff --git a/src/hotspot/share/gc/shared/c1/cardTableBarrierSetC1.cpp b/src/hotspot/share/gc/shared/c1/cardTableBarrierSetC1.cpp index 21b1ef7ea7e54..1cf629ca6b21c 100644 --- a/src/hotspot/share/gc/shared/c1/cardTableBarrierSetC1.cpp +++ b/src/hotspot/share/gc/shared/c1/cardTableBarrierSetC1.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/c1/cardTableBarrierSetC1.hpp" #include "gc/shared/cardTable.hpp" #include "gc/shared/cardTableBarrierSet.hpp" diff --git a/src/hotspot/share/gc/shared/c1/modRefBarrierSetC1.cpp b/src/hotspot/share/gc/shared/c1/modRefBarrierSetC1.cpp index c2074c2859fe3..d7d463d252e4e 100644 --- a/src/hotspot/share/gc/shared/c1/modRefBarrierSetC1.cpp +++ b/src/hotspot/share/gc/shared/c1/modRefBarrierSetC1.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/c1/modRefBarrierSetC1.hpp" #include "utilities/macros.hpp" diff --git a/src/hotspot/share/gc/shared/c2/barrierSetC2.cpp b/src/hotspot/share/gc/shared/c2/barrierSetC2.cpp index 080af1c9693ed..3d59e972925a0 100644 --- a/src/hotspot/share/gc/shared/c2/barrierSetC2.cpp +++ b/src/hotspot/share/gc/shared/c2/barrierSetC2.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "code/vmreg.inline.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/tlab_globals.hpp" diff --git a/src/hotspot/share/gc/shared/c2/cardTableBarrierSetC2.cpp b/src/hotspot/share/gc/shared/c2/cardTableBarrierSetC2.cpp index 7997492188b9d..870e351db6690 100644 --- a/src/hotspot/share/gc/shared/c2/cardTableBarrierSetC2.cpp +++ b/src/hotspot/share/gc/shared/c2/cardTableBarrierSetC2.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciUtilities.hpp" #include "gc/shared/cardTable.hpp" #include "gc/shared/cardTableBarrierSet.hpp" @@ -50,13 +49,9 @@ Node* CardTableBarrierSetC2::byte_map_base_node(GraphKit* kit) const { // Insert a write-barrier store. This is to let generational GC work; we have // to flag all oop-stores before the next GC point. void CardTableBarrierSetC2::post_barrier(GraphKit* kit, - Node* ctl, - Node* oop_store, Node* obj, Node* adr, - uint adr_idx, Node* val, - BasicType bt, bool use_precise) const { // No store check needed if we're storing a null. if (val != nullptr && val->is_Con()) { diff --git a/src/hotspot/share/gc/shared/c2/cardTableBarrierSetC2.hpp b/src/hotspot/share/gc/shared/c2/cardTableBarrierSetC2.hpp index 3abb6068f4a47..a380ec4a484cf 100644 --- a/src/hotspot/share/gc/shared/c2/cardTableBarrierSetC2.hpp +++ b/src/hotspot/share/gc/shared/c2/cardTableBarrierSetC2.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * 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,13 +30,9 @@ class CardTableBarrierSetC2: public ModRefBarrierSetC2 { protected: virtual void post_barrier(GraphKit* kit, - Node* ctl, - Node* store, Node* obj, Node* adr, - uint adr_idx, Node* val, - BasicType bt, bool use_precise) const; Node* byte_map_base_node(GraphKit* kit) const; diff --git a/src/hotspot/share/gc/shared/c2/modRefBarrierSetC2.cpp b/src/hotspot/share/gc/shared/c2/modRefBarrierSetC2.cpp index a8a1fb58fce16..cf5d3fc7e1668 100644 --- a/src/hotspot/share/gc/shared/c2/modRefBarrierSetC2.cpp +++ b/src/hotspot/share/gc/shared/c2/modRefBarrierSetC2.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * 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,18 +22,14 @@ * */ -#include "precompiled.hpp" #include "opto/arraycopynode.hpp" #include "opto/graphKit.hpp" #include "opto/idealKit.hpp" -#include "opto/narrowptrnode.hpp" #include "gc/shared/c2/modRefBarrierSetC2.hpp" -#include "utilities/macros.hpp" Node* ModRefBarrierSetC2::store_at_resolved(C2Access& access, C2AccessValue& val) const { DecoratorSet decorators = access.decorators(); - const TypePtr* adr_type = access.addr().type(); Node* adr = access.addr().node(); bool is_array = (decorators & IS_ARRAY) != 0; @@ -48,36 +44,22 @@ Node* ModRefBarrierSetC2::store_at_resolved(C2Access& access, C2AccessValue& val assert(access.is_parse_access(), "entry not supported at optimization time"); C2ParseAccess& parse_access = static_cast(access); - GraphKit* kit = parse_access.kit(); - uint adr_idx = kit->C->get_alias_index(adr_type); - assert(adr_idx != Compile::AliasIdxTop, "use other store_to_memory factory" ); - - pre_barrier(kit, true /* do_load */, kit->control(), access.base(), adr, adr_idx, val.node(), - static_cast(val.type()), nullptr /* pre_val */, access.type()); Node* store = BarrierSetC2::store_at_resolved(access, val); - post_barrier(kit, kit->control(), access.raw_access(), access.base(), adr, adr_idx, val.node(), - access.type(), use_precise); + post_barrier(parse_access.kit(), access.base(), adr, val.node(), use_precise); return store; } Node* ModRefBarrierSetC2::atomic_cmpxchg_val_at_resolved(C2AtomicParseAccess& access, Node* expected_val, Node* new_val, const Type* value_type) const { - GraphKit* kit = access.kit(); - if (!access.is_oop()) { return BarrierSetC2::atomic_cmpxchg_val_at_resolved(access, expected_val, new_val, value_type); } - pre_barrier(kit, false /* do_load */, - kit->control(), nullptr, nullptr, max_juint, nullptr, nullptr, - expected_val /* pre_val */, T_OBJECT); - Node* result = BarrierSetC2::atomic_cmpxchg_val_at_resolved(access, expected_val, new_val, value_type); - post_barrier(kit, kit->control(), access.raw_access(), access.base(), - access.addr().node(), access.alias_idx(), new_val, T_OBJECT, true); + post_barrier(access.kit(), access.base(), access.addr().node(), new_val, true); return result; } @@ -90,10 +72,6 @@ Node* ModRefBarrierSetC2::atomic_cmpxchg_bool_at_resolved(C2AtomicParseAccess& a return BarrierSetC2::atomic_cmpxchg_bool_at_resolved(access, expected_val, new_val, value_type); } - pre_barrier(kit, false /* do_load */, - kit->control(), nullptr, nullptr, max_juint, nullptr, nullptr, - expected_val /* pre_val */, T_OBJECT); - Node* load_store = BarrierSetC2::atomic_cmpxchg_bool_at_resolved(access, expected_val, new_val, value_type); // Emit the post barrier only when the actual store happened. This makes sense @@ -109,8 +87,7 @@ Node* ModRefBarrierSetC2::atomic_cmpxchg_bool_at_resolved(C2AtomicParseAccess& a IdealKit ideal(kit); ideal.if_then(load_store, BoolTest::ne, ideal.ConI(0), PROB_STATIC_FREQUENT); { kit->sync_kit(ideal); - post_barrier(kit, ideal.ctrl(), access.raw_access(), access.base(), - access.addr().node(), access.alias_idx(), new_val, T_OBJECT, true); + post_barrier(kit, access.base(), access.addr().node(), new_val, true); ideal.sync_kit(kit); } ideal.end_if(); kit->final_sync(ideal); @@ -119,21 +96,12 @@ Node* ModRefBarrierSetC2::atomic_cmpxchg_bool_at_resolved(C2AtomicParseAccess& a } Node* ModRefBarrierSetC2::atomic_xchg_at_resolved(C2AtomicParseAccess& access, Node* new_val, const Type* value_type) const { - GraphKit* kit = access.kit(); - Node* result = BarrierSetC2::atomic_xchg_at_resolved(access, new_val, value_type); if (!access.is_oop()) { return result; } - // Don't need to load pre_val. The old value is returned by load_store. - // The pre_barrier can execute after the xchg as long as no safepoint - // gets inserted between them. - pre_barrier(kit, false /* do_load */, - kit->control(), nullptr, nullptr, max_juint, nullptr, nullptr, - result /* pre_val */, T_OBJECT); - post_barrier(kit, kit->control(), access.raw_access(), access.base(), access.addr().node(), - access.alias_idx(), new_val, T_OBJECT, true); + post_barrier(access.kit(), access.base(), access.addr().node(), new_val, true); return result; } diff --git a/src/hotspot/share/gc/shared/c2/modRefBarrierSetC2.hpp b/src/hotspot/share/gc/shared/c2/modRefBarrierSetC2.hpp index cd19076f2ca72..42fe3f7d0b6a4 100644 --- a/src/hotspot/share/gc/shared/c2/modRefBarrierSetC2.hpp +++ b/src/hotspot/share/gc/shared/c2/modRefBarrierSetC2.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * 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,25 +31,10 @@ class TypeOopPtr; class ModRefBarrierSetC2: public BarrierSetC2 { protected: - virtual void pre_barrier(GraphKit* kit, - bool do_load, - Node* ctl, - Node* obj, - Node* adr, - uint adr_idx, - Node* val, - const TypeOopPtr* val_type, - Node* pre_val, - BasicType bt) const {} - virtual void post_barrier(GraphKit* kit, - Node* ctl, - Node* store, Node* obj, Node* adr, - uint adr_idx, Node* val, - BasicType bt, bool use_precise) const {} virtual Node* store_at_resolved(C2Access& access, C2AccessValue& val) const; diff --git a/src/hotspot/share/gc/shared/cardTable.cpp b/src/hotspot/share/gc/shared/cardTable.cpp index 29ec67359bb9c..b32720f1d2cd5 100644 --- a/src/hotspot/share/gc/shared/cardTable.cpp +++ b/src/hotspot/share/gc/shared/cardTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/cardTable.hpp" #include "gc/shared/collectedHeap.hpp" #include "gc/shared/gcLogPrecious.hpp" diff --git a/src/hotspot/share/gc/shared/cardTableBarrierSet.cpp b/src/hotspot/share/gc/shared/cardTableBarrierSet.cpp index c448d75940808..84bf3eac13046 100644 --- a/src/hotspot/share/gc/shared/cardTableBarrierSet.cpp +++ b/src/hotspot/share/gc/shared/cardTableBarrierSet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "compiler/compilerDefinitions.inline.hpp" #include "gc/shared/cardTable.hpp" #include "gc/shared/cardTableBarrierSet.inline.hpp" diff --git a/src/hotspot/share/gc/shared/classUnloadingContext.cpp b/src/hotspot/share/gc/shared/classUnloadingContext.cpp index fdf84d69b6a86..4eac2561e679f 100644 --- a/src/hotspot/share/gc/shared/classUnloadingContext.cpp +++ b/src/hotspot/share/gc/shared/classUnloadingContext.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * */ -#include "precompiled.hpp" - #include "classfile/classLoaderData.inline.hpp" #include "code/nmethod.hpp" #include "gc/shared/classUnloadingContext.hpp" diff --git a/src/hotspot/share/gc/shared/collectedHeap.cpp b/src/hotspot/share/gc/shared/collectedHeap.cpp index e35748b366900..d78e1f0822eed 100644 --- a/src/hotspot/share/gc/shared/collectedHeap.cpp +++ b/src/hotspot/share/gc/shared/collectedHeap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/cdsConfig.hpp" #include "classfile/classLoaderData.hpp" #include "classfile/vmClasses.hpp" @@ -405,7 +404,7 @@ MetaWord* CollectedHeap::satisfy_failed_metadata_allocation(ClassLoaderData* loa if ((QueuedAllocationWarningCount > 0) && (loop_count % QueuedAllocationWarningCount == 0)) { log_warning(gc, ergo)("satisfy_failed_metadata_allocation() retries %d times," - " size=" SIZE_FORMAT, loop_count, word_size); + " size=%zu", loop_count, word_size); } } while (true); // Until a GC is done } @@ -481,7 +480,7 @@ CollectedHeap::fill_with_array(HeapWord* start, size_t words, bool zap) const size_t payload_size = words - filler_array_hdr_size(); const size_t len = payload_size * HeapWordSize / sizeof(jint); - assert((int)len >= 0, "size too large " SIZE_FORMAT " becomes %d", words, (int)len); + assert((int)len >= 0, "size too large %zu becomes %d", words, (int)len); ObjArrayAllocator allocator(Universe::fillerArrayKlass(), words, (int)len, /* do_zero */ false); allocator.initialize(start); diff --git a/src/hotspot/share/gc/shared/collectedHeap.hpp b/src/hotspot/share/gc/shared/collectedHeap.hpp index 036bc0230c877..31a224597a048 100644 --- a/src/hotspot/share/gc/shared/collectedHeap.hpp +++ b/src/hotspot/share/gc/shared/collectedHeap.hpp @@ -383,12 +383,10 @@ class CollectedHeap : public CHeapObj { void increment_total_collections(bool full = false) { _total_collections++; if (full) { - increment_total_full_collections(); + _total_full_collections++; } } - void increment_total_full_collections() { _total_full_collections++; } - // Return the SoftRefPolicy for the heap; SoftRefPolicy* soft_ref_policy() { return &_soft_ref_policy; } diff --git a/src/hotspot/share/gc/shared/collectorCounters.cpp b/src/hotspot/share/gc/shared/collectorCounters.cpp index 3a81dc383265c..f01997f985475 100644 --- a/src/hotspot/share/gc/shared/collectorCounters.cpp +++ b/src/hotspot/share/gc/shared/collectorCounters.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/collectorCounters.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" diff --git a/src/hotspot/share/gc/shared/concurrentGCBreakpoints.cpp b/src/hotspot/share/gc/shared/concurrentGCBreakpoints.cpp index 9b0b4bd7b1031..3a974952fea5c 100644 --- a/src/hotspot/share/gc/shared/concurrentGCBreakpoints.cpp +++ b/src/hotspot/share/gc/shared/concurrentGCBreakpoints.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/collectedHeap.hpp" #include "gc/shared/concurrentGCBreakpoints.hpp" #include "logging/log.hpp" diff --git a/src/hotspot/share/gc/shared/concurrentGCThread.cpp b/src/hotspot/share/gc/shared/concurrentGCThread.cpp index 04cf571749fe4..7d0cecde528bf 100644 --- a/src/hotspot/share/gc/shared/concurrentGCThread.cpp +++ b/src/hotspot/share/gc/shared/concurrentGCThread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/concurrentGCThread.hpp" #include "runtime/atomic.hpp" #include "runtime/init.hpp" diff --git a/src/hotspot/share/gc/shared/freeListAllocator.cpp b/src/hotspot/share/gc/shared/freeListAllocator.cpp index ef7d12ab0242f..27f1cd8aeb373 100644 --- a/src/hotspot/share/gc/shared/freeListAllocator.cpp +++ b/src/hotspot/share/gc/shared/freeListAllocator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/freeListAllocator.hpp" #include "logging/log.hpp" #include "utilities/globalCounter.inline.hpp" diff --git a/src/hotspot/share/gc/shared/fullGCForwarding.cpp b/src/hotspot/share/gc/shared/fullGCForwarding.cpp index 4880b08887e56..474a3209d7431 100644 --- a/src/hotspot/share/gc/shared/fullGCForwarding.cpp +++ b/src/hotspot/share/gc/shared/fullGCForwarding.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/fullGCForwarding.hpp" #include "memory/memRegion.hpp" #include "runtime/globals_extension.hpp" @@ -34,8 +33,8 @@ void FullGCForwarding::initialize_flags(size_t max_heap_size) { #ifdef _LP64 size_t max_narrow_heap_size = right_n_bits(NumLowBitsNarrow - Shift); if (UseCompactObjectHeaders && max_heap_size > max_narrow_heap_size * HeapWordSize) { - warning("Compact object headers require a java heap size smaller than " SIZE_FORMAT - "%s (given: " SIZE_FORMAT "%s). Disabling compact object headers.", + warning("Compact object headers require a java heap size smaller than %zu" + "%s (given: %zu%s). Disabling compact object headers.", byte_size_in_proper_unit(max_narrow_heap_size * HeapWordSize), proper_unit_for_byte_size(max_narrow_heap_size * HeapWordSize), byte_size_in_proper_unit(max_heap_size), diff --git a/src/hotspot/share/gc/shared/gcArguments.cpp b/src/hotspot/share/gc/shared/gcArguments.cpp index c20c8c4922ef5..d45e6a9c7ddb0 100644 --- a/src/hotspot/share/gc/shared/gcArguments.cpp +++ b/src/hotspot/share/gc/shared/gcArguments.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, Red Hat, Inc. and/or its affiliates. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/cardTable.hpp" #include "gc/shared/gcArguments.hpp" #include "logging/log.hpp" @@ -99,7 +98,7 @@ void GCArguments::assert_size_info() { #endif // ASSERT void GCArguments::initialize_size_info() { - log_debug(gc, heap)("Minimum heap " SIZE_FORMAT " Initial heap " SIZE_FORMAT " Maximum heap " SIZE_FORMAT, + log_debug(gc, heap)("Minimum heap %zu Initial heap %zu Maximum heap %zu", MinHeapSize, InitialHeapSize, MaxHeapSize); DEBUG_ONLY(assert_size_info();) @@ -109,10 +108,10 @@ void GCArguments::initialize_heap_flags_and_sizes() { assert(SpaceAlignment != 0, "Space alignment not set up properly"); assert(HeapAlignment != 0, "Heap alignment not set up properly"); assert(HeapAlignment >= SpaceAlignment, - "HeapAlignment: " SIZE_FORMAT " less than SpaceAlignment: " SIZE_FORMAT, + "HeapAlignment: %zu less than SpaceAlignment: %zu", HeapAlignment, SpaceAlignment); assert(HeapAlignment % SpaceAlignment == 0, - "HeapAlignment: " SIZE_FORMAT " not aligned by SpaceAlignment: " SIZE_FORMAT, + "HeapAlignment: %zu not aligned by SpaceAlignment: %zu", HeapAlignment, SpaceAlignment); if (FLAG_IS_CMDLINE(MaxHeapSize)) { diff --git a/src/hotspot/share/gc/shared/gcBehaviours.cpp b/src/hotspot/share/gc/shared/gcBehaviours.cpp index b52ef9e7d3dc6..02971943874bd 100644 --- a/src/hotspot/share/gc/shared/gcBehaviours.cpp +++ b/src/hotspot/share/gc/shared/gcBehaviours.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "code/nmethod.hpp" #include "gc/shared/gcBehaviours.hpp" diff --git a/src/hotspot/share/gc/shared/gcCause.cpp b/src/hotspot/share/gc/shared/gcCause.cpp index f73d3146aa3c2..f972aeccbc4b0 100644 --- a/src/hotspot/share/gc/shared/gcCause.cpp +++ b/src/hotspot/share/gc/shared/gcCause.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/gcCause.hpp" const char* GCCause::to_string(GCCause::Cause cause) { diff --git a/src/hotspot/share/gc/shared/gcConfig.cpp b/src/hotspot/share/gc/shared/gcConfig.cpp index bb9d0806a5312..402bd0caacddc 100644 --- a/src/hotspot/share/gc/shared/gcConfig.cpp +++ b/src/hotspot/share/gc/shared/gcConfig.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/gcConfig.hpp" #include "runtime/globals_extension.hpp" #include "runtime/java.hpp" diff --git a/src/hotspot/share/gc/shared/gcConfiguration.cpp b/src/hotspot/share/gc/shared/gcConfiguration.cpp index 4c94cfeab8b61..1c24c2353a19c 100644 --- a/src/hotspot/share/gc/shared/gcConfiguration.cpp +++ b/src/hotspot/share/gc/shared/gcConfiguration.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. * */ -#include "precompiled.hpp" #include "gc/shared/collectedHeap.hpp" #include "gc/shared/gc_globals.hpp" #include "gc/shared/gcArguments.hpp" diff --git a/src/hotspot/share/gc/shared/gcId.cpp b/src/hotspot/share/gc/shared/gcId.cpp index 8d123386180cb..6a182e41ee27a 100644 --- a/src/hotspot/share/gc/shared/gcId.cpp +++ b/src/hotspot/share/gc/shared/gcId.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/gcId.hpp" #include "jvm.h" #include "runtime/javaThread.hpp" diff --git a/src/hotspot/share/gc/shared/gcInitLogger.cpp b/src/hotspot/share/gc/shared/gcInitLogger.cpp index 1dfc27c533377..0a327ea7dfe2e 100644 --- a/src/hotspot/share/gc/shared/gcInitLogger.cpp +++ b/src/hotspot/share/gc/shared/gcInitLogger.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/gcInitLogger.hpp" #include "gc/shared/gcLogPrecious.hpp" #include "gc/shared/gc_globals.hpp" @@ -75,7 +74,7 @@ void GCInitLogger::print_large_pages() { void GCInitLogger::print_numa() { if (UseNUMA) { log_info_p(gc, init)("NUMA Support: Enabled"); - log_info_p(gc, init)("NUMA Nodes: " SIZE_FORMAT, os::numa_get_groups_num()); + log_info_p(gc, init)("NUMA Nodes: %zu", os::numa_get_groups_num()); } else { log_info_p(gc, init)("NUMA Support: Disabled"); } @@ -91,11 +90,11 @@ void GCInitLogger::print_compressed_oops() { } void GCInitLogger::print_heap() { - log_info_p(gc, init)("Heap Min Capacity: " SIZE_FORMAT "%s", + log_info_p(gc, init)("Heap Min Capacity: %zu%s", byte_size_in_exact_unit(MinHeapSize), exact_unit_for_byte_size(MinHeapSize)); - log_info_p(gc, init)("Heap Initial Capacity: " SIZE_FORMAT "%s", + log_info_p(gc, init)("Heap Initial Capacity: %zu%s", byte_size_in_exact_unit(InitialHeapSize), exact_unit_for_byte_size(InitialHeapSize)); - log_info_p(gc, init)("Heap Max Capacity: " SIZE_FORMAT "%s", + log_info_p(gc, init)("Heap Max Capacity: %zu%s", byte_size_in_exact_unit(MaxHeapSize), exact_unit_for_byte_size(MaxHeapSize)); log_info_p(gc, init)("Pre-touch: %s", AlwaysPreTouch ? "Enabled" : "Disabled"); diff --git a/src/hotspot/share/gc/shared/gcLocker.cpp b/src/hotspot/share/gc/shared/gcLocker.cpp index d4e10b2671225..6344ba80d438e 100644 --- a/src/hotspot/share/gc/shared/gcLocker.cpp +++ b/src/hotspot/share/gc/shared/gcLocker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/collectedHeap.hpp" #include "gc/shared/gcLocker.hpp" #include "gc/shared/gcTrace.hpp" diff --git a/src/hotspot/share/gc/shared/gcLogPrecious.cpp b/src/hotspot/share/gc/shared/gcLogPrecious.cpp index afc42e7cfcc46..43bd58db1aa08 100644 --- a/src/hotspot/share/gc/shared/gcLogPrecious.cpp +++ b/src/hotspot/share/gc/shared/gcLogPrecious.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/gcLogPrecious.hpp" #include "runtime/mutex.hpp" #include "runtime/mutexLocker.hpp" diff --git a/src/hotspot/share/gc/shared/gcOverheadChecker.cpp b/src/hotspot/share/gc/shared/gcOverheadChecker.cpp index 4eb5a459e7474..c6c89a51f54b6 100644 --- a/src/hotspot/share/gc/shared/gcOverheadChecker.cpp +++ b/src/hotspot/share/gc/shared/gcOverheadChecker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2019, Google and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/gcOverheadChecker.hpp" #include "gc/shared/softRefPolicy.hpp" #include "logging/log.hpp" diff --git a/src/hotspot/share/gc/shared/gcPolicyCounters.cpp b/src/hotspot/share/gc/shared/gcPolicyCounters.cpp index dba53e9ee3193..d24ad745aa14d 100644 --- a/src/hotspot/share/gc/shared/gcPolicyCounters.cpp +++ b/src/hotspot/share/gc/shared/gcPolicyCounters.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/gcPolicyCounters.hpp" #include "gc/shared/gc_globals.hpp" #include "memory/resourceArea.hpp" diff --git a/src/hotspot/share/gc/shared/gcTimer.cpp b/src/hotspot/share/gc/shared/gcTimer.cpp index e293cb335a89d..8585975015184 100644 --- a/src/hotspot/share/gc/shared/gcTimer.cpp +++ b/src/hotspot/share/gc/shared/gcTimer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/gcTimer.hpp" #include "gc/shared/gc_globals.hpp" #include "utilities/growableArray.hpp" diff --git a/src/hotspot/share/gc/shared/gcTrace.cpp b/src/hotspot/share/gc/shared/gcTrace.cpp index 1c84c3ca88bdc..bad9c707b1e51 100644 --- a/src/hotspot/share/gc/shared/gcTrace.cpp +++ b/src/hotspot/share/gc/shared/gcTrace.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/copyFailedInfo.hpp" #include "gc/shared/gcHeapSummary.hpp" #include "gc/shared/gcId.hpp" diff --git a/src/hotspot/share/gc/shared/gcTraceSend.cpp b/src/hotspot/share/gc/shared/gcTraceSend.cpp index 31ec2871cd05e..14e64e110b730 100644 --- a/src/hotspot/share/gc/shared/gcTraceSend.cpp +++ b/src/hotspot/share/gc/shared/gcTraceSend.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/copyFailedInfo.hpp" #include "gc/shared/gcHeapSummary.hpp" #include "gc/shared/gcTimer.hpp" diff --git a/src/hotspot/share/gc/shared/gcTraceTime.cpp b/src/hotspot/share/gc/shared/gcTraceTime.cpp index af375039d12e2..def8a3f3f5c0c 100644 --- a/src/hotspot/share/gc/shared/gcTraceTime.cpp +++ b/src/hotspot/share/gc/shared/gcTraceTime.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/collectedHeap.hpp" #include "gc/shared/gcTraceTime.inline.hpp" #include "gc/shared/gcTrace.hpp" @@ -63,7 +62,7 @@ void GCTraceTimeLoggerImpl::log_end(Ticks end) { size_t used_before_m = _heap_usage_before / M; size_t used_m = heap->used() / M; size_t capacity_m = heap->capacity() / M; - out.print(" " SIZE_FORMAT "M->" SIZE_FORMAT "M(" SIZE_FORMAT "M)", used_before_m, used_m, capacity_m); + out.print(" %zuM->%zuM(%zuM)", used_before_m, used_m, capacity_m); } out.print_cr(" %.3fms", duration_in_ms); diff --git a/src/hotspot/share/gc/shared/gcUtil.cpp b/src/hotspot/share/gc/shared/gcUtil.cpp index 2c4010e75983b..6a4aa6d53dd25 100644 --- a/src/hotspot/share/gc/shared/gcUtil.cpp +++ b/src/hotspot/share/gc/shared/gcUtil.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/gcUtil.hpp" // Catch-all file for utility classes diff --git a/src/hotspot/share/gc/shared/gcVMOperations.cpp b/src/hotspot/share/gc/shared/gcVMOperations.cpp index 4cc75f4745991..85c452a6f8989 100644 --- a/src/hotspot/share/gc/shared/gcVMOperations.cpp +++ b/src/hotspot/share/gc/shared/gcVMOperations.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderData.hpp" #include "classfile/javaClasses.hpp" #include "gc/shared/allocTracer.hpp" @@ -110,7 +109,7 @@ bool VM_GC_Operation::doit_prologue() { if (!is_init_completed()) { vm_exit_during_initialization( err_msg("GC triggered before VM initialization completed. Try increasing " - "NewSize, current value " SIZE_FORMAT "%s.", + "NewSize, current value %zu%s.", byte_size_in_proper_unit(NewSize), proper_unit_for_byte_size(NewSize))); } @@ -140,8 +139,8 @@ void VM_GC_Operation::doit_epilogue() { } bool VM_GC_HeapInspection::doit_prologue() { - if (_full_gc && UseZGC) { - // ZGC cannot perform a synchronous GC cycle from within the VM thread. + if (_full_gc && (UseZGC || UseShenandoahGC)) { + // ZGC and Shenandoah cannot perform a synchronous GC cycle from within the VM thread. // So VM_GC_HeapInspection::collect() is a noop. To respect the _full_gc // flag a synchronous GC cycle is performed from the caller thread in the // prologue. @@ -259,7 +258,7 @@ void VM_CollectForMetadataAllocation::doit() { return; } - log_debug(gc)("After Metaspace GC failed to allocate size " SIZE_FORMAT, _size); + log_debug(gc)("After Metaspace GC failed to allocate size %zu", _size); if (GCLocker::is_active_and_needs_gc()) { set_gc_locked(); diff --git a/src/hotspot/share/gc/shared/genArguments.cpp b/src/hotspot/share/gc/shared/genArguments.cpp index c94ca56722f62..90617b1675fa0 100644 --- a/src/hotspot/share/gc/shared/genArguments.cpp +++ b/src/hotspot/share/gc/shared/genArguments.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/serial/generation.hpp" #include "gc/shared/cardTable.hpp" #include "gc/shared/genArguments.hpp" @@ -79,13 +78,13 @@ void GenArguments::initialize_heap_flags_and_sizes() { assert(GenAlignment != 0, "Generation alignment not set up properly"); assert(HeapAlignment >= GenAlignment, - "HeapAlignment: " SIZE_FORMAT " less than GenAlignment: " SIZE_FORMAT, + "HeapAlignment: %zu less than GenAlignment: %zu", HeapAlignment, GenAlignment); assert(GenAlignment % SpaceAlignment == 0, - "GenAlignment: " SIZE_FORMAT " not aligned by SpaceAlignment: " SIZE_FORMAT, + "GenAlignment: %zu not aligned by SpaceAlignment: %zu", GenAlignment, SpaceAlignment); assert(HeapAlignment % GenAlignment == 0, - "HeapAlignment: " SIZE_FORMAT " not aligned by GenAlignment: " SIZE_FORMAT, + "HeapAlignment: %zu not aligned by GenAlignment: %zu", HeapAlignment, GenAlignment); // All generational heaps have a young gen; handle those flags here @@ -128,8 +127,8 @@ void GenArguments::initialize_heap_flags_and_sizes() { // Make sure there is room for an old generation size_t smaller_max_new_size = MaxHeapSize - GenAlignment; if (FLAG_IS_CMDLINE(MaxNewSize)) { - log_warning(gc, ergo)("MaxNewSize (" SIZE_FORMAT "k) is equal to or greater than the entire " - "heap (" SIZE_FORMAT "k). A new max generation size of " SIZE_FORMAT "k will be used.", + log_warning(gc, ergo)("MaxNewSize (%zuk) is equal to or greater than the entire " + "heap (%zuk). A new max generation size of %zuk will be used.", MaxNewSize/K, MaxHeapSize/K, smaller_max_new_size/K); } FLAG_SET_ERGO(MaxNewSize, smaller_max_new_size); @@ -147,8 +146,8 @@ void GenArguments::initialize_heap_flags_and_sizes() { // At this point this should only happen if the user specifies a large NewSize and/or // a small (but not too small) MaxNewSize. if (FLAG_IS_CMDLINE(MaxNewSize)) { - log_warning(gc, ergo)("NewSize (" SIZE_FORMAT "k) is greater than the MaxNewSize (" SIZE_FORMAT "k). " - "A new max generation size of " SIZE_FORMAT "k will be used.", + log_warning(gc, ergo)("NewSize (%zuk) is greater than the MaxNewSize (%zuk). " + "A new max generation size of %zuk will be used.", NewSize/K, MaxNewSize/K, NewSize/K); } FLAG_SET_ERGO(MaxNewSize, NewSize); @@ -245,7 +244,7 @@ void GenArguments::initialize_size_info() { } } - log_trace(gc, heap)("1: Minimum young " SIZE_FORMAT " Initial young " SIZE_FORMAT " Maximum young " SIZE_FORMAT, + log_trace(gc, heap)("1: Minimum young %zu Initial young %zu Maximum young %zu", MinNewSize, initial_young_size, max_young_size); // At this point the minimum, initial and maximum sizes @@ -287,7 +286,7 @@ void GenArguments::initialize_size_info() { initial_young_size = desired_young_size; } - log_trace(gc, heap)("2: Minimum young " SIZE_FORMAT " Initial young " SIZE_FORMAT " Maximum young " SIZE_FORMAT, + log_trace(gc, heap)("2: Minimum young %zu Initial young %zu Maximum young %zu", MinNewSize, initial_young_size, max_young_size); } @@ -304,7 +303,7 @@ void GenArguments::initialize_size_info() { OldSize = initial_old_size; } - log_trace(gc, heap)("Minimum old " SIZE_FORMAT " Initial old " SIZE_FORMAT " Maximum old " SIZE_FORMAT, + log_trace(gc, heap)("Minimum old %zu Initial old %zu Maximum old %zu", MinOldSize, OldSize, MaxOldSize); DEBUG_ONLY(assert_size_info();) diff --git a/src/hotspot/share/gc/shared/generationCounters.cpp b/src/hotspot/share/gc/shared/generationCounters.cpp index a0d0e529990e6..a8e5889dd8eeb 100644 --- a/src/hotspot/share/gc/shared/generationCounters.cpp +++ b/src/hotspot/share/gc/shared/generationCounters.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/generationCounters.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" diff --git a/src/hotspot/share/gc/shared/hSpaceCounters.cpp b/src/hotspot/share/gc/shared/hSpaceCounters.cpp index 5800e05a0a534..de5dd2912a505 100644 --- a/src/hotspot/share/gc/shared/hSpaceCounters.cpp +++ b/src/hotspot/share/gc/shared/hSpaceCounters.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/hSpaceCounters.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" diff --git a/src/hotspot/share/gc/shared/isGCActiveMark.cpp b/src/hotspot/share/gc/shared/isGCActiveMark.cpp index 70d289794270c..5dd1bd59031fc 100644 --- a/src/hotspot/share/gc/shared/isGCActiveMark.cpp +++ b/src/hotspot/share/gc/shared/isGCActiveMark.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/collectedHeap.hpp" #include "gc/shared/isGCActiveMark.hpp" #include "memory/universe.hpp" diff --git a/src/hotspot/share/gc/shared/jvmFlagConstraintsGC.cpp b/src/hotspot/share/gc/shared/jvmFlagConstraintsGC.cpp index cb36962e61e58..1ed3701fdab09 100644 --- a/src/hotspot/share/gc/shared/jvmFlagConstraintsGC.cpp +++ b/src/hotspot/share/gc/shared/jvmFlagConstraintsGC.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/serial/cardTableRS.hpp" #include "gc/shared/collectedHeap.hpp" #include "gc/shared/gcArguments.hpp" @@ -57,8 +56,8 @@ static JVMFlag::Error MinPLABSizeBounds(const char* name, size_t value, bool ver if ((GCConfig::is_gc_selected(CollectedHeap::G1) || GCConfig::is_gc_selected(CollectedHeap::Parallel)) && (value < PLAB::min_size())) { JVMFlag::printError(verbose, - "%s (" SIZE_FORMAT ") must be " - "greater than or equal to ergonomic PLAB minimum size (" SIZE_FORMAT ")\n", + "%s (%zu) must be " + "greater than or equal to ergonomic PLAB minimum size (%zu)\n", name, value, PLAB::min_size()); return JVMFlag::VIOLATES_CONSTRAINT; } @@ -70,8 +69,8 @@ JVMFlag::Error MaxPLABSizeBounds(const char* name, size_t value, bool verbose) { if ((GCConfig::is_gc_selected(CollectedHeap::G1) || GCConfig::is_gc_selected(CollectedHeap::Parallel)) && (value > PLAB::max_size())) { JVMFlag::printError(verbose, - "%s (" SIZE_FORMAT ") must be " - "less than or equal to ergonomic PLAB maximum size (" SIZE_FORMAT ")\n", + "%s (%zu) must be " + "less than or equal to ergonomic PLAB maximum size (%zu)\n", name, value, PLAB::max_size()); return JVMFlag::VIOLATES_CONSTRAINT; } @@ -99,8 +98,8 @@ JVMFlag::Error OldPLABSizeConstraintFunc(size_t value, bool verbose) { JVMFlag::Error MinHeapFreeRatioConstraintFunc(uintx value, bool verbose) { if (value > MaxHeapFreeRatio) { JVMFlag::printError(verbose, - "MinHeapFreeRatio (" UINTX_FORMAT ") must be " - "less than or equal to MaxHeapFreeRatio (" UINTX_FORMAT ")\n", + "MinHeapFreeRatio (%zu) must be " + "less than or equal to MaxHeapFreeRatio (%zu)\n", value, MaxHeapFreeRatio); return JVMFlag::VIOLATES_CONSTRAINT; } else { @@ -111,8 +110,8 @@ JVMFlag::Error MinHeapFreeRatioConstraintFunc(uintx value, bool verbose) { JVMFlag::Error MaxHeapFreeRatioConstraintFunc(uintx value, bool verbose) { if (value < MinHeapFreeRatio) { JVMFlag::printError(verbose, - "MaxHeapFreeRatio (" UINTX_FORMAT ") must be " - "greater than or equal to MinHeapFreeRatio (" UINTX_FORMAT ")\n", + "MaxHeapFreeRatio (%zu) must be " + "greater than or equal to MinHeapFreeRatio (%zu)\n", value, MinHeapFreeRatio); return JVMFlag::VIOLATES_CONSTRAINT; } else { @@ -124,8 +123,8 @@ static JVMFlag::Error CheckMaxHeapSizeAndSoftRefLRUPolicyMSPerMB(size_t maxHeap, if ((softRef > 0) && ((maxHeap / M) > (max_uintx / softRef))) { JVMFlag::printError(verbose, "Desired lifetime of SoftReferences cannot be expressed correctly. " - "MaxHeapSize (" SIZE_FORMAT ") or SoftRefLRUPolicyMSPerMB " - "(" INTX_FORMAT ") is too large\n", + "MaxHeapSize (%zu) or SoftRefLRUPolicyMSPerMB " + "(%zd) is too large\n", maxHeap, softRef); return JVMFlag::VIOLATES_CONSTRAINT; } else { @@ -141,8 +140,8 @@ JVMFlag::Error MarkStackSizeConstraintFunc(size_t value, bool verbose) { // value == 0 is handled by the range constraint. if (value > MarkStackSizeMax) { JVMFlag::printError(verbose, - "MarkStackSize (" SIZE_FORMAT ") must be " - "less than or equal to MarkStackSizeMax (" SIZE_FORMAT ")\n", + "MarkStackSize (%zu) must be " + "less than or equal to MarkStackSizeMax (%zu)\n", value, MarkStackSizeMax); return JVMFlag::VIOLATES_CONSTRAINT; } else { @@ -233,8 +232,8 @@ static JVMFlag::Error MaxSizeForAlignment(const char* name, size_t value, size_t size_t aligned_max = ((max_uintx - alignment) & ~(alignment-1)); if (value > aligned_max) { JVMFlag::printError(verbose, - "%s (" SIZE_FORMAT ") must be " - "less than or equal to aligned maximum value (" SIZE_FORMAT ")\n", + "%s (%zu) must be " + "less than or equal to aligned maximum value (%zu)\n", name, value, aligned_max); return JVMFlag::VIOLATES_CONSTRAINT; } @@ -288,8 +287,8 @@ JVMFlag::Error HeapBaseMinAddressConstraintFunc(size_t value, bool verbose) { // Check for this by ensuring that MaxHeapSize plus the requested min base address still fit within max_uintx. if (UseCompressedOops && FLAG_IS_ERGO(MaxHeapSize) && (value > (max_uintx - MaxHeapSize))) { JVMFlag::printError(verbose, - "HeapBaseMinAddress (" SIZE_FORMAT ") or MaxHeapSize (" SIZE_FORMAT ") is too large. " - "Sum of them must be less than or equal to maximum of size_t (" SIZE_FORMAT ")\n", + "HeapBaseMinAddress (%zu) or MaxHeapSize (%zu) is too large. " + "Sum of them must be less than or equal to maximum of size_t (%zu)\n", value, MaxHeapSize, max_uintx); return JVMFlag::VIOLATES_CONSTRAINT; } @@ -312,15 +311,15 @@ JVMFlag::Error MinTLABSizeConstraintFunc(size_t value, bool verbose) { // At least, alignment reserve area is needed. if (value < ThreadLocalAllocBuffer::alignment_reserve_in_bytes()) { JVMFlag::printError(verbose, - "MinTLABSize (" SIZE_FORMAT ") must be " - "greater than or equal to reserved area in TLAB (" SIZE_FORMAT ")\n", + "MinTLABSize (%zu) must be " + "greater than or equal to reserved area in TLAB (%zu)\n", value, ThreadLocalAllocBuffer::alignment_reserve_in_bytes()); return JVMFlag::VIOLATES_CONSTRAINT; } if (value > (ThreadLocalAllocBuffer::max_size() * HeapWordSize)) { JVMFlag::printError(verbose, - "MinTLABSize (" SIZE_FORMAT ") must be " - "less than or equal to ergonomic TLAB maximum (" SIZE_FORMAT ")\n", + "MinTLABSize (%zu) must be " + "less than or equal to ergonomic TLAB maximum (%zu)\n", value, ThreadLocalAllocBuffer::max_size() * HeapWordSize); return JVMFlag::VIOLATES_CONSTRAINT; } @@ -332,15 +331,15 @@ JVMFlag::Error TLABSizeConstraintFunc(size_t value, bool verbose) { if (FLAG_IS_CMDLINE(TLABSize)) { if (value < MinTLABSize) { JVMFlag::printError(verbose, - "TLABSize (" SIZE_FORMAT ") must be " - "greater than or equal to MinTLABSize (" SIZE_FORMAT ")\n", + "TLABSize (%zu) must be " + "greater than or equal to MinTLABSize (%zu)\n", value, MinTLABSize); return JVMFlag::VIOLATES_CONSTRAINT; } if (value > (ThreadLocalAllocBuffer::max_size() * HeapWordSize)) { JVMFlag::printError(verbose, - "TLABSize (" SIZE_FORMAT ") must be " - "less than or equal to ergonomic TLAB maximum size (" SIZE_FORMAT ")\n", + "TLABSize (%zu) must be " + "less than or equal to ergonomic TLAB maximum size (%zu)\n", value, (ThreadLocalAllocBuffer::max_size() * HeapWordSize)); return JVMFlag::VIOLATES_CONSTRAINT; } @@ -357,8 +356,8 @@ JVMFlag::Error TLABWasteIncrementConstraintFunc(uintx value, bool verbose) { // Compare with 'max_uintx' as ThreadLocalAllocBuffer::_refill_waste_limit is 'size_t'. if (refill_waste_limit > (max_uintx - value)) { JVMFlag::printError(verbose, - "TLABWasteIncrement (" UINTX_FORMAT ") must be " - "less than or equal to ergonomic TLAB waste increment maximum size(" SIZE_FORMAT ")\n", + "TLABWasteIncrement (%zu) must be " + "less than or equal to ergonomic TLAB waste increment maximum size(%zu)\n", value, (max_uintx - refill_waste_limit)); return JVMFlag::VIOLATES_CONSTRAINT; } @@ -370,8 +369,8 @@ JVMFlag::Error SurvivorRatioConstraintFunc(uintx value, bool verbose) { if (FLAG_IS_CMDLINE(SurvivorRatio) && (value > (MaxHeapSize / SpaceAlignment))) { JVMFlag::printError(verbose, - "SurvivorRatio (" UINTX_FORMAT ") must be " - "less than or equal to ergonomic SurvivorRatio maximum (" SIZE_FORMAT ")\n", + "SurvivorRatio (%zu) must be " + "less than or equal to ergonomic SurvivorRatio maximum (%zu)\n", value, (MaxHeapSize / SpaceAlignment)); return JVMFlag::VIOLATES_CONSTRAINT; @@ -383,8 +382,8 @@ JVMFlag::Error SurvivorRatioConstraintFunc(uintx value, bool verbose) { JVMFlag::Error MetaspaceSizeConstraintFunc(size_t value, bool verbose) { if (value > MaxMetaspaceSize) { JVMFlag::printError(verbose, - "MetaspaceSize (" SIZE_FORMAT ") must be " - "less than or equal to MaxMetaspaceSize (" SIZE_FORMAT ")\n", + "MetaspaceSize (%zu) must be " + "less than or equal to MaxMetaspaceSize (%zu)\n", value, MaxMetaspaceSize); return JVMFlag::VIOLATES_CONSTRAINT; } else { @@ -395,8 +394,8 @@ JVMFlag::Error MetaspaceSizeConstraintFunc(size_t value, bool verbose) { JVMFlag::Error MaxMetaspaceSizeConstraintFunc(size_t value, bool verbose) { if (value < MetaspaceSize) { JVMFlag::printError(verbose, - "MaxMetaspaceSize (" SIZE_FORMAT ") must be " - "greater than or equal to MetaspaceSize (" SIZE_FORMAT ")\n", + "MaxMetaspaceSize (%zu) must be " + "greater than or equal to MetaspaceSize (%zu)\n", value, MaxMetaspaceSize); return JVMFlag::VIOLATES_CONSTRAINT; } else { diff --git a/src/hotspot/share/gc/shared/locationPrinter.cpp b/src/hotspot/share/gc/shared/locationPrinter.cpp index 62c5ce0df4706..b5efb540d459a 100644 --- a/src/hotspot/share/gc/shared/locationPrinter.cpp +++ b/src/hotspot/share/gc/shared/locationPrinter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/collectedHeap.hpp" #include "gc/shared/locationPrinter.hpp" #include "memory/universe.hpp" diff --git a/src/hotspot/share/gc/shared/markBitMap.cpp b/src/hotspot/share/gc/shared/markBitMap.cpp index bc90032206c42..b2b1e80246226 100644 --- a/src/hotspot/share/gc/shared/markBitMap.cpp +++ b/src/hotspot/share/gc/shared/markBitMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/markBitMap.inline.hpp" #include "memory/universe.hpp" diff --git a/src/hotspot/share/gc/shared/memAllocator.cpp b/src/hotspot/share/gc/shared/memAllocator.cpp index f96ec50e3b0a2..64ca463571890 100644 --- a/src/hotspot/share/gc/shared/memAllocator.cpp +++ b/src/hotspot/share/gc/shared/memAllocator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/javaClasses.hpp" #include "classfile/vmClasses.hpp" #include "gc/shared/allocTracer.hpp" @@ -294,13 +293,13 @@ HeapWord* MemAllocator::mem_allocate_inside_tlab_slow(Allocation& allocation) co mem = Universe::heap()->allocate_new_tlab(min_tlab_size, new_tlab_size, &allocation._allocated_tlab_size); if (mem == nullptr) { assert(allocation._allocated_tlab_size == 0, - "Allocation failed, but actual size was updated. min: " SIZE_FORMAT - ", desired: " SIZE_FORMAT ", actual: " SIZE_FORMAT, + "Allocation failed, but actual size was updated. min: %zu" + ", desired: %zu, actual: %zu", min_tlab_size, new_tlab_size, allocation._allocated_tlab_size); return nullptr; } assert(allocation._allocated_tlab_size != 0, "Allocation succeeded but actual size not updated. mem at: " - PTR_FORMAT " min: " SIZE_FORMAT ", desired: " SIZE_FORMAT, + PTR_FORMAT " min: %zu, desired: %zu", p2i(mem), min_tlab_size, new_tlab_size); // ...and clear or zap just allocated TLAB, if needed. diff --git a/src/hotspot/share/gc/shared/objectCountEventSender.cpp b/src/hotspot/share/gc/shared/objectCountEventSender.cpp index ce78b84770869..a28c52e5c901d 100644 --- a/src/hotspot/share/gc/shared/objectCountEventSender.cpp +++ b/src/hotspot/share/gc/shared/objectCountEventSender.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ */ -#include "precompiled.hpp" #include "gc/shared/gcId.hpp" #include "gc/shared/objectCountEventSender.hpp" #include "jfr/jfrEvents.hpp" diff --git a/src/hotspot/share/gc/shared/oopStorage.cpp b/src/hotspot/share/gc/shared/oopStorage.cpp index 2373d6b1d93a8..ae3e9c46197f1 100644 --- a/src/hotspot/share/gc/shared/oopStorage.cpp +++ b/src/hotspot/share/gc/shared/oopStorage.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/oopStorage.inline.hpp" #include "gc/shared/oopStorageParState.inline.hpp" #include "logging/log.hpp" @@ -323,7 +322,7 @@ void OopStorage::Block::atomic_add_allocated(uintx add) { // facto verifies the precondition held; if there were any set bits in // common, then after the add at least one of them will be zero. uintx sum = Atomic::add(&_allocated_bitmask, add); - assert((sum & add) == add, "some already present: " UINTX_FORMAT ":" UINTX_FORMAT, + assert((sum & add) == add, "some already present: %zu:%zu", sum, add); } @@ -579,7 +578,7 @@ bool OopStorage::expand_active_array() { assert_lock_strong(_allocation_mutex); ActiveArray* old_array = _active_array; size_t new_size = 2 * old_array->size(); - log_debug(oopstorage, blocks)("%s: expand active array " SIZE_FORMAT, + log_debug(oopstorage, blocks)("%s: expand active array %zu", name(), new_size); ActiveArray* new_array = ActiveArray::create(new_size, mem_tag(), @@ -1121,8 +1120,8 @@ bool OopStorage::BasicParState::claim_next_segment(IterationData* data) { bool OopStorage::BasicParState::finish_iteration(const IterationData* data) const { log_info(oopstorage, blocks, stats) - ("Parallel iteration on %s: blocks = " SIZE_FORMAT - ", processed = " SIZE_FORMAT " (%2.f%%)", + ("Parallel iteration on %s: blocks = %zu" + ", processed = %zu (%2.f%%)", _storage->name(), _block_count, data->_processed, percent_of(data->_processed, _block_count)); return false; @@ -1171,7 +1170,7 @@ void OopStorage::print_on(outputStream* st) const { double data_size = section_size * section_count; double alloc_percentage = percent_of((double)allocations, blocks * data_size); - st->print("%s: " SIZE_FORMAT " entries in " SIZE_FORMAT " blocks (%.F%%), " SIZE_FORMAT " bytes", + st->print("%s: %zu entries in %zu blocks (%.F%%), %zu bytes", name(), allocations, blocks, alloc_percentage, total_memory_usage()); if (_concurrent_iteration_count > 0) { st->print(", concurrent iteration active"); diff --git a/src/hotspot/share/gc/shared/oopStorageSet.cpp b/src/hotspot/share/gc/shared/oopStorageSet.cpp index e3a9fccbad3dc..8ff9e1664b273 100644 --- a/src/hotspot/share/gc/shared/oopStorageSet.cpp +++ b/src/hotspot/share/gc/shared/oopStorageSet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/oopStorage.hpp" #include "gc/shared/oopStorageSet.hpp" #include "utilities/debug.hpp" diff --git a/src/hotspot/share/gc/shared/parallelCleaning.cpp b/src/hotspot/share/gc/shared/parallelCleaning.cpp index 3671500995ea8..1b1eaf4d79ae2 100644 --- a/src/hotspot/share/gc/shared/parallelCleaning.cpp +++ b/src/hotspot/share/gc/shared/parallelCleaning.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/symbolTable.hpp" #include "classfile/stringTable.hpp" #include "code/codeCache.hpp" diff --git a/src/hotspot/share/gc/shared/partialArraySplitter.cpp b/src/hotspot/share/gc/shared/partialArraySplitter.cpp index 30a9a802bdbd3..12dd387fbfa5c 100644 --- a/src/hotspot/share/gc/shared/partialArraySplitter.cpp +++ b/src/hotspot/share/gc/shared/partialArraySplitter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/gc_globals.hpp" #include "gc/shared/partialArraySplitter.hpp" #include "gc/shared/partialArrayState.hpp" diff --git a/src/hotspot/share/gc/shared/partialArrayState.cpp b/src/hotspot/share/gc/shared/partialArrayState.cpp index 60067c6547b86..f79e012a36d4f 100644 --- a/src/hotspot/share/gc/shared/partialArrayState.cpp +++ b/src/hotspot/share/gc/shared/partialArrayState.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/partialArrayState.hpp" #include "memory/allocation.inline.hpp" #include "memory/arena.hpp" diff --git a/src/hotspot/share/gc/shared/partialArrayTaskStats.cpp b/src/hotspot/share/gc/shared/partialArrayTaskStats.cpp index 210be11b9256d..ac8a380ec9ad0 100644 --- a/src/hotspot/share/gc/shared/partialArrayTaskStats.cpp +++ b/src/hotspot/share/gc/shared/partialArrayTaskStats.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/partialArrayTaskStats.hpp" #include "logging/log.hpp" #include "logging/logHandle.hpp" diff --git a/src/hotspot/share/gc/shared/partialArrayTaskStepper.cpp b/src/hotspot/share/gc/shared/partialArrayTaskStepper.cpp index 6faa162ac7bed..d91ba347d6c8c 100644 --- a/src/hotspot/share/gc/shared/partialArrayTaskStepper.cpp +++ b/src/hotspot/share/gc/shared/partialArrayTaskStepper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/partialArrayTaskStepper.hpp" #include "oops/arrayOop.hpp" #include "utilities/debug.hpp" diff --git a/src/hotspot/share/gc/shared/plab.cpp b/src/hotspot/share/gc/shared/plab.cpp index ac2025e97a152..7b637709f11b9 100644 --- a/src/hotspot/share/gc/shared/plab.cpp +++ b/src/hotspot/share/gc/shared/plab.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/collectedHeap.hpp" #include "gc/shared/gc_globals.hpp" #include "gc/shared/plab.inline.hpp" @@ -65,7 +64,7 @@ PLAB::PLAB(size_t desired_plab_sz_) : _end(nullptr), _hard_end(nullptr), _allocated(0), _wasted(0), _undo_wasted(0) { assert(min_size() > CollectedHeap::lab_alignment_reserve(), - "Minimum PLAB size " SIZE_FORMAT " must be larger than alignment reserve " SIZE_FORMAT " " + "Minimum PLAB size %zu must be larger than alignment reserve %zu " "to be able to contain objects", min_size(), CollectedHeap::lab_alignment_reserve()); } diff --git a/src/hotspot/share/gc/shared/preservedMarks.cpp b/src/hotspot/share/gc/shared/preservedMarks.cpp index bc241fb5daf45..0576757524347 100644 --- a/src/hotspot/share/gc/shared/preservedMarks.cpp +++ b/src/hotspot/share/gc/shared/preservedMarks.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/fullGCForwarding.inline.hpp" #include "gc/shared/preservedMarks.inline.hpp" #include "gc/shared/workerThread.hpp" @@ -67,10 +66,10 @@ void PreservedMarks::restore_and_increment(volatile size_t* const total_size_add #ifndef PRODUCT void PreservedMarks::assert_empty() { - assert(_stack.is_empty(), "stack expected to be empty, size = " SIZE_FORMAT, + assert(_stack.is_empty(), "stack expected to be empty, size = %zu", _stack.size()); assert(_stack.cache_size() == 0, - "stack expected to have no cached segments, cache size = " SIZE_FORMAT, + "stack expected to have no cached segments, cache size = %zu", _stack.cache_size()); } #endif // ndef PRODUCT diff --git a/src/hotspot/share/gc/shared/pretouchTask.cpp b/src/hotspot/share/gc/shared/pretouchTask.cpp index 427d14fd4e7e3..e06c561b6a8ad 100644 --- a/src/hotspot/share/gc/shared/pretouchTask.cpp +++ b/src/hotspot/share/gc/shared/pretouchTask.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/gc_globals.hpp" #include "gc/shared/pretouchTask.hpp" #include "logging/log.hpp" @@ -43,7 +42,7 @@ PretouchTask::PretouchTask(const char* task_name, _chunk_size(chunk_size) { assert(chunk_size >= page_size, - "Chunk size " SIZE_FORMAT " is smaller than page size " SIZE_FORMAT, + "Chunk size %zu is smaller than page size %zu", chunk_size, page_size); } @@ -79,12 +78,12 @@ void PretouchTask::pretouch(const char* task_name, char* start_address, char* en size_t num_chunks = ((total_bytes - 1) / chunk_size) + 1; uint num_workers = (uint)MIN2(num_chunks, (size_t)pretouch_workers->max_workers()); - log_debug(gc, heap)("Running %s with %u workers for " SIZE_FORMAT " work units pre-touching " SIZE_FORMAT "B.", + log_debug(gc, heap)("Running %s with %u workers for %zu work units pre-touching %zuB.", task.name(), num_workers, num_chunks, total_bytes); pretouch_workers->run_task(&task, num_workers); } else { - log_debug(gc, heap)("Running %s pre-touching " SIZE_FORMAT "B.", + log_debug(gc, heap)("Running %s pre-touching %zuB.", task.name(), total_bytes); task.work(0); } diff --git a/src/hotspot/share/gc/shared/ptrQueue.cpp b/src/hotspot/share/gc/shared/ptrQueue.cpp index 9723db8391298..fd7011700f472 100644 --- a/src/hotspot/share/gc/shared/ptrQueue.cpp +++ b/src/hotspot/share/gc/shared/ptrQueue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/bufferNode.hpp" #include "gc/shared/ptrQueue.hpp" diff --git a/src/hotspot/share/gc/shared/referencePolicy.cpp b/src/hotspot/share/gc/shared/referencePolicy.cpp index 22ef4eabbe6a1..d1867291479c2 100644 --- a/src/hotspot/share/gc/shared/referencePolicy.cpp +++ b/src/hotspot/share/gc/shared/referencePolicy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/javaClasses.hpp" #include "gc/shared/collectedHeap.hpp" #include "gc/shared/gc_globals.hpp" diff --git a/src/hotspot/share/gc/shared/referenceProcessor.cpp b/src/hotspot/share/gc/shared/referenceProcessor.cpp index ff7530f2d32f3..0ee4ac134c2c4 100644 --- a/src/hotspot/share/gc/shared/referenceProcessor.cpp +++ b/src/hotspot/share/gc/shared/referenceProcessor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/javaClasses.inline.hpp" #include "compiler/compilerDefinitions.inline.hpp" #include "gc/shared/collectedHeap.hpp" @@ -175,7 +174,7 @@ size_t ReferenceProcessor::total_count(DiscoveredList lists[]) const { #ifdef ASSERT void ReferenceProcessor::verify_total_count_zero(DiscoveredList lists[], const char* type) { size_t count = total_count(lists); - assert(count == 0, "%ss must be empty but has " SIZE_FORMAT " elements", type, count); + assert(count == 0, "%ss must be empty but has %zu elements", type, count); } #endif @@ -365,7 +364,7 @@ size_t ReferenceProcessor::process_discovered_list_work(DiscoveredList& refs_ refs_list.clear(); } - log_develop_trace(gc, ref)(" Dropped " SIZE_FORMAT " active Refs out of " SIZE_FORMAT + log_develop_trace(gc, ref)(" Dropped %zu active Refs out of %zu" " Refs in discovered list " PTR_FORMAT, iter.removed(), iter.processed(), p2i(&refs_list)); return iter.removed(); @@ -559,10 +558,10 @@ void ReferenceProcessor::log_reflist(const char* prefix, DiscoveredList list[], LogStream ls(lt); ls.print("%s", prefix); for (uint i = 0; i < num_active_queues; i++) { - ls.print(SIZE_FORMAT " ", list[i].length()); + ls.print("%zu ", list[i].length()); total += list[i].length(); } - ls.print_cr("(" SIZE_FORMAT ")", total); + ls.print_cr("(%zu)", total); } #ifndef PRODUCT @@ -574,7 +573,7 @@ void ReferenceProcessor::log_reflist_counts(DiscoveredList ref_lists[], uint num log_reflist("", ref_lists, num_active_queues); #ifdef ASSERT for (uint i = num_active_queues; i < _max_num_queues; i++) { - assert(ref_lists[i].length() == 0, SIZE_FORMAT " unexpected References in %u", + assert(ref_lists[i].length() == 0, "%zu unexpected References in %u", ref_lists[i].length(), i); } #endif @@ -1095,7 +1094,7 @@ bool ReferenceProcessor::preclean_discovered_reflist(DiscoveredList& refs_lis } if (iter.processed() > 0) { - log_develop_trace(gc, ref)(" Dropped " SIZE_FORMAT " Refs out of " SIZE_FORMAT " Refs in discovered list " PTR_FORMAT, + log_develop_trace(gc, ref)(" Dropped %zu Refs out of %zu Refs in discovered list " PTR_FORMAT, iter.removed(), iter.processed(), p2i(&refs_list)); } return false; diff --git a/src/hotspot/share/gc/shared/referenceProcessorPhaseTimes.cpp b/src/hotspot/share/gc/shared/referenceProcessorPhaseTimes.cpp index 2ad55b95424f9..f4b30866d776e 100644 --- a/src/hotspot/share/gc/shared/referenceProcessorPhaseTimes.cpp +++ b/src/hotspot/share/gc/shared/referenceProcessorPhaseTimes.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/gcTimer.hpp" #include "gc/shared/referenceProcessorPhaseTimes.hpp" #include "gc/shared/referenceProcessor.inline.hpp" diff --git a/src/hotspot/share/gc/shared/satbMarkQueue.cpp b/src/hotspot/share/gc/shared/satbMarkQueue.cpp index a0efcc8e66ae8..6e33d27897ccc 100644 --- a/src/hotspot/share/gc/shared/satbMarkQueue.cpp +++ b/src/hotspot/share/gc/shared/satbMarkQueue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/satbMarkQueue.hpp" #include "gc/shared/collectedHeap.hpp" #include "logging/log.hpp" @@ -54,8 +53,8 @@ static void print_satb_buffer(const char* name, void** buf, size_t index, size_t capacity) { - tty->print_cr(" SATB BUFFER [%s] buf: " PTR_FORMAT " index: " SIZE_FORMAT - " capacity: " SIZE_FORMAT, + tty->print_cr(" SATB BUFFER [%s] buf: " PTR_FORMAT " index: %zu" + " capacity: %zu", name, p2i(buf), index, capacity); } diff --git a/src/hotspot/share/gc/shared/scavengableNMethods.cpp b/src/hotspot/share/gc/shared/scavengableNMethods.cpp index c619ddb764aeb..0dff5526911af 100644 --- a/src/hotspot/share/gc/shared/scavengableNMethods.cpp +++ b/src/hotspot/share/gc/shared/scavengableNMethods.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "code/codeCache.hpp" #include "code/nmethod.hpp" #include "gc/shared/scavengableNMethods.hpp" diff --git a/src/hotspot/share/gc/shared/space.cpp b/src/hotspot/share/gc/shared/space.cpp index 0eb9d2520b739..6a9b2b90f44db 100644 --- a/src/hotspot/share/gc/shared/space.cpp +++ b/src/hotspot/share/gc/shared/space.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/vmClasses.hpp" #include "classfile/vmSymbols.hpp" #include "gc/shared/collectedHeap.inline.hpp" diff --git a/src/hotspot/share/gc/shared/spaceDecorator.cpp b/src/hotspot/share/gc/shared/spaceDecorator.cpp index cb554f48e5911..b0668c56e2dc8 100644 --- a/src/hotspot/share/gc/shared/spaceDecorator.cpp +++ b/src/hotspot/share/gc/shared/spaceDecorator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/spaceDecorator.hpp" #include "utilities/copy.hpp" diff --git a/src/hotspot/share/gc/shared/stringdedup/stringDedup.cpp b/src/hotspot/share/gc/shared/stringdedup/stringDedup.cpp index 7c37d642836d3..9ad8decec7e08 100644 --- a/src/hotspot/share/gc/shared/stringdedup/stringDedup.cpp +++ b/src/hotspot/share/gc/shared/stringdedup/stringDedup.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/javaClasses.inline.hpp" #include "classfile/vmClasses.hpp" #include "classfile/vmSymbols.hpp" diff --git a/src/hotspot/share/gc/shared/stringdedup/stringDedupConfig.cpp b/src/hotspot/share/gc/shared/stringdedup/stringDedupConfig.cpp index 3fa3df12891ec..50155a669515d 100644 --- a/src/hotspot/share/gc/shared/stringdedup/stringDedupConfig.cpp +++ b/src/hotspot/share/gc/shared/stringdedup/stringDedupConfig.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/altHashing.hpp" #include "gc/shared/stringdedup/stringDedupConfig.hpp" #include "logging/log.hpp" diff --git a/src/hotspot/share/gc/shared/stringdedup/stringDedupProcessor.cpp b/src/hotspot/share/gc/shared/stringdedup/stringDedupProcessor.cpp index ab85c293941df..f4f69c8269ff6 100644 --- a/src/hotspot/share/gc/shared/stringdedup/stringDedupProcessor.cpp +++ b/src/hotspot/share/gc/shared/stringdedup/stringDedupProcessor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/javaClasses.inline.hpp" #include "classfile/stringTable.hpp" #include "gc/shared/oopStorage.hpp" diff --git a/src/hotspot/share/gc/shared/stringdedup/stringDedupStat.cpp b/src/hotspot/share/gc/shared/stringdedup/stringDedupStat.cpp index cffda333b1335..28e5e9adf2002 100644 --- a/src/hotspot/share/gc/shared/stringdedup/stringDedupStat.cpp +++ b/src/hotspot/share/gc/shared/stringdedup/stringDedupStat.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/stringdedup/stringDedupStat.hpp" #include "logging/log.hpp" #include "utilities/globalDefinitions.hpp" diff --git a/src/hotspot/share/gc/shared/stringdedup/stringDedupStorageUse.cpp b/src/hotspot/share/gc/shared/stringdedup/stringDedupStorageUse.cpp index ee5fc6db5d57e..175c63421e191 100644 --- a/src/hotspot/share/gc/shared/stringdedup/stringDedupStorageUse.cpp +++ b/src/hotspot/share/gc/shared/stringdedup/stringDedupStorageUse.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/stringdedup/stringDedupStorageUse.hpp" #include "runtime/atomic.hpp" #include "runtime/javaThread.hpp" diff --git a/src/hotspot/share/gc/shared/stringdedup/stringDedupTable.cpp b/src/hotspot/share/gc/shared/stringdedup/stringDedupTable.cpp index ac8fc0759cafc..5c6628cba5cdd 100644 --- a/src/hotspot/share/gc/shared/stringdedup/stringDedupTable.cpp +++ b/src/hotspot/share/gc/shared/stringdedup/stringDedupTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/altHashing.hpp" #include "classfile/javaClasses.inline.hpp" #include "classfile/stringTable.hpp" diff --git a/src/hotspot/share/gc/shared/stringdedup/stringDedupThread.cpp b/src/hotspot/share/gc/shared/stringdedup/stringDedupThread.cpp index ef983883e166a..49eb49ca4012a 100644 --- a/src/hotspot/share/gc/shared/stringdedup/stringDedupThread.cpp +++ b/src/hotspot/share/gc/shared/stringdedup/stringDedupThread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/stringdedup/stringDedup.hpp" #include "gc/shared/stringdedup/stringDedupProcessor.hpp" #include "gc/shared/stringdedup/stringDedupThread.hpp" diff --git a/src/hotspot/share/gc/shared/strongRootsScope.cpp b/src/hotspot/share/gc/shared/strongRootsScope.cpp index 0839c72ca5d13..1316df68e5f9d 100644 --- a/src/hotspot/share/gc/shared/strongRootsScope.cpp +++ b/src/hotspot/share/gc/shared/strongRootsScope.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/stringTable.hpp" #include "code/nmethod.hpp" #include "gc/shared/strongRootsScope.hpp" diff --git a/src/hotspot/share/gc/shared/suspendibleThreadSet.cpp b/src/hotspot/share/gc/shared/suspendibleThreadSet.cpp index a0d83ac298da6..35a446de532e9 100644 --- a/src/hotspot/share/gc/shared/suspendibleThreadSet.cpp +++ b/src/hotspot/share/gc/shared/suspendibleThreadSet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/gc_globals.hpp" #include "gc/shared/suspendibleThreadSet.hpp" #include "runtime/javaThread.hpp" diff --git a/src/hotspot/share/gc/shared/taskTerminator.cpp b/src/hotspot/share/gc/shared/taskTerminator.cpp index cd225699f37fe..1353c3f8c8a06 100644 --- a/src/hotspot/share/gc/shared/taskTerminator.cpp +++ b/src/hotspot/share/gc/shared/taskTerminator.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2018, 2020, Red Hat, Inc. All rights reserved. - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/gc_globals.hpp" #include "gc/shared/taskTerminator.hpp" #include "gc/shared/taskqueue.hpp" diff --git a/src/hotspot/share/gc/shared/taskqueue.cpp b/src/hotspot/share/gc/shared/taskqueue.cpp index 61e2899b6738d..a244ba454150b 100644 --- a/src/hotspot/share/gc/shared/taskqueue.cpp +++ b/src/hotspot/share/gc/shared/taskqueue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/taskqueue.hpp" #include "oops/oop.inline.hpp" #include "logging/log.hpp" @@ -75,10 +74,9 @@ void TaskQueueStats::print_header(unsigned int line, outputStream* const stream, void TaskQueueStats::print(outputStream* stream, unsigned int width) const { - #define FMT SIZE_FORMAT_W(*) - stream->print(FMT, width, _stats[0]); + stream->print("%*zu", width, _stats[0]); for (unsigned int i = 1; i < last_stat_id; ++i) { - stream->print(" " FMT, width, _stats[i]); + stream->print(" %*zu", width, _stats[i]); } #undef FMT } diff --git a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp index e967a65555a15..aa0079d814db9 100644 --- a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp +++ b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "compiler/compilerDefinitions.inline.hpp" #include "gc/shared/collectedHeap.hpp" #include "gc/shared/threadLocalAllocBuffer.inline.hpp" @@ -164,7 +163,7 @@ void ThreadLocalAllocBuffer::resize() { size_t aligned_new_size = align_object_size(new_size); log_trace(gc, tlab)("TLAB new size: thread: " PTR_FORMAT " [id: %2d]" - " refills %d alloc: %8.6f desired_size: " SIZE_FORMAT " -> " SIZE_FORMAT, + " refills %d alloc: %8.6f desired_size: %zu -> %zu", p2i(thread()), thread()->osthread()->thread_id(), _target_refills, _allocation_fraction.average(), desired_size(), aligned_new_size); @@ -263,7 +262,7 @@ void ThreadLocalAllocBuffer::startup_initialization() { guarantee(Thread::current()->is_Java_thread(), "tlab initialization thread not Java thread"); Thread::current()->tlab().initialize(); - log_develop_trace(gc, tlab)("TLAB min: " SIZE_FORMAT " initial: " SIZE_FORMAT " max: " SIZE_FORMAT, + log_develop_trace(gc, tlab)("TLAB min: %zu initial: %zu max: %zu", min_size(), Thread::current()->tlab().initial_desired_size(), max_size()); } @@ -299,8 +298,8 @@ void ThreadLocalAllocBuffer::print_stats(const char* tag) { double waste_percent = percent_of(waste, _allocated_size); size_t tlab_used = Universe::heap()->tlab_used(thrd); log.trace("TLAB: %s thread: " PTR_FORMAT " [id: %2d]" - " desired_size: " SIZE_FORMAT "KB" - " slow allocs: %d refill waste: " SIZE_FORMAT "B" + " desired_size: %zuKB" + " slow allocs: %d refill waste: %zuB" " alloc:%8.5f %8.0fKB refills: %d waste %4.1f%% gc: %dB" " slow: %dB", tag, p2i(thrd), thrd->osthread()->thread_id(), @@ -451,8 +450,8 @@ void ThreadLocalAllocStats::publish() { const double waste_percent = percent_of(waste, _total_allocations); log_debug(gc, tlab)("TLAB totals: thrds: %d refills: %d max: %d" " slow allocs: %d max %d waste: %4.1f%%" - " gc: " SIZE_FORMAT "B max: " SIZE_FORMAT "B" - " slow: " SIZE_FORMAT "B max: " SIZE_FORMAT "B", + " gc: %zuB max: %zuB" + " slow: %zuB max: %zuB", _allocating_threads, _total_refills, _max_refills, _total_slow_allocations, _max_slow_allocations, waste_percent, _total_gc_waste * HeapWordSize, _max_gc_waste * HeapWordSize, diff --git a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.inline.hpp b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.inline.hpp index 6910d9c186061..32a830a2bb138 100644 --- a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.inline.hpp +++ b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,11 +61,11 @@ inline size_t ThreadLocalAllocBuffer::compute_size(size_t obj_size) { // Make sure there's enough room for object and filler int[]. if (new_tlab_size < compute_min_size(obj_size)) { // If there isn't enough room for the allocation, return failure. - log_trace(gc, tlab)("ThreadLocalAllocBuffer::compute_size(" SIZE_FORMAT ") returns failure", + log_trace(gc, tlab)("ThreadLocalAllocBuffer::compute_size(%zu) returns failure", obj_size); return 0; } - log_trace(gc, tlab)("ThreadLocalAllocBuffer::compute_size(" SIZE_FORMAT ") returns " SIZE_FORMAT, + log_trace(gc, tlab)("ThreadLocalAllocBuffer::compute_size(%zu) returns %zu", obj_size, new_tlab_size); return new_tlab_size; } @@ -86,9 +86,9 @@ void ThreadLocalAllocBuffer::record_slow_allocation(size_t obj_size) { _slow_allocations++; log_develop_trace(gc, tlab)("TLAB: %s thread: " PTR_FORMAT " [id: %2d]" - " obj: " SIZE_FORMAT - " free: " SIZE_FORMAT - " waste: " SIZE_FORMAT, + " obj: %zu" + " free: %zu" + " waste: %zu", "slow", p2i(thread()), thread()->osthread()->thread_id(), obj_size, free(), refill_waste_limit()); } diff --git a/src/hotspot/share/gc/shared/weakProcessor.cpp b/src/hotspot/share/gc/shared/weakProcessor.cpp index 8adf3fab7d5c1..d7de8b5d8a88a 100644 --- a/src/hotspot/share/gc/shared/weakProcessor.cpp +++ b/src/hotspot/share/gc/shared/weakProcessor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/stringTable.hpp" #include "gc/shared/gc_globals.hpp" #include "gc/shared/oopStorage.inline.hpp" diff --git a/src/hotspot/share/gc/shared/weakProcessorTimes.cpp b/src/hotspot/share/gc/shared/weakProcessorTimes.cpp index 64fc961162394..88fb309882446 100644 --- a/src/hotspot/share/gc/shared/weakProcessorTimes.cpp +++ b/src/hotspot/share/gc/shared/weakProcessorTimes.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/oopStorage.hpp" #include "gc/shared/weakProcessor.hpp" #include "gc/shared/weakProcessorTimes.hpp" diff --git a/src/hotspot/share/gc/shared/workerDataArray.cpp b/src/hotspot/share/gc/shared/workerDataArray.cpp index a16e3219255df..7b3e9e50cb464 100644 --- a/src/hotspot/share/gc/shared/workerDataArray.cpp +++ b/src/hotspot/share/gc/shared/workerDataArray.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/workerDataArray.inline.hpp" #include "utilities/ostream.hpp" @@ -49,9 +48,9 @@ void WorkerDataArray::WDAPrinter::summary(outputStream* out, double min, template <> void WorkerDataArray::WDAPrinter::summary(outputStream* out, size_t min, double avg, size_t max, size_t diff, size_t sum, bool print_sum) { - out->print(" Min: " SIZE_FORMAT ", Avg: %4.1lf, Max: " SIZE_FORMAT ", Diff: " SIZE_FORMAT, min, avg, max, diff); + out->print(" Min: %zu, Avg: %4.1lf, Max: %zu, Diff: %zu", min, avg, max, diff); if (print_sum) { - out->print(", Sum: " SIZE_FORMAT, sum); + out->print(", Sum: %zu", sum); } } @@ -75,7 +74,7 @@ void WorkerDataArray::WDAPrinter::details(const WorkerDataArray* for (uint i = 0; i < phase->_length; ++i) { size_t value = phase->get(i); if (value != phase->uninitialized()) { - out->print(" " SIZE_FORMAT, phase->get(i)); + out->print(" %zu", phase->get(i)); } else { out->print(" -"); } diff --git a/src/hotspot/share/gc/shared/workerPolicy.cpp b/src/hotspot/share/gc/shared/workerPolicy.cpp index 4ab178dd6a70f..7ab019d13d57f 100644 --- a/src/hotspot/share/gc/shared/workerPolicy.cpp +++ b/src/hotspot/share/gc/shared/workerPolicy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/collectedHeap.hpp" #include "gc/shared/workerPolicy.hpp" #include "logging/log.hpp" @@ -130,9 +129,9 @@ uint WorkerPolicy::calc_default_active_workers(uintx total_workers, assert(new_active_workers <= total_workers, "Total workers not observed"); log_trace(gc, task)("WorkerPolicy::calc_default_active_workers() : " - "active_workers(): " UINTX_FORMAT " new_active_workers: " UINTX_FORMAT " " - "prev_active_workers: " UINTX_FORMAT "\n" - " active_workers_by_JT: " UINTX_FORMAT " active_workers_by_heap_size: " UINTX_FORMAT, + "active_workers(): %zu new_active_workers: %zu " + "prev_active_workers: %zu\n" + " active_workers_by_JT: %zu active_workers_by_heap_size: %zu", active_workers, new_active_workers, prev_active_workers, active_workers_by_JT, active_workers_by_heap_size); assert(new_active_workers > 0, "Always need at least 1"); diff --git a/src/hotspot/share/gc/shared/workerThread.cpp b/src/hotspot/share/gc/shared/workerThread.cpp index 4dde8e3938797..ffeb3a4194b7b 100644 --- a/src/hotspot/share/gc/shared/workerThread.cpp +++ b/src/hotspot/share/gc/shared/workerThread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/gc_globals.hpp" #include "gc/shared/workerThread.hpp" #include "logging/log.hpp" diff --git a/src/hotspot/share/gc/shared/workerUtils.cpp b/src/hotspot/share/gc/shared/workerUtils.cpp index 41662092966df..40b78d3f6223b 100644 --- a/src/hotspot/share/gc/shared/workerUtils.cpp +++ b/src/hotspot/share/gc/shared/workerUtils.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/workerUtils.hpp" #include "runtime/atomic.hpp" #include "runtime/mutexLocker.hpp" diff --git a/src/hotspot/share/gc/shenandoah/c1/shenandoahBarrierSetC1.cpp b/src/hotspot/share/gc/shenandoah/c1/shenandoahBarrierSetC1.cpp index ade0504b9730c..d27b98adc9f47 100644 --- a/src/hotspot/share/gc/shenandoah/c1/shenandoahBarrierSetC1.cpp +++ b/src/hotspot/share/gc/shenandoah/c1/shenandoahBarrierSetC1.cpp @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_IR.hpp" #include "gc/shared/satbMarkQueue.hpp" #include "gc/shenandoah/mode/shenandoahMode.hpp" diff --git a/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp b/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp index 9adc74aae3ae1..514cc8fd83913 100644 --- a/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp +++ b/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "classfile/javaClasses.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shenandoah/shenandoahBarrierSet.hpp" diff --git a/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp b/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp index fd127df3cdec3..860bcb38038ff 100644 --- a/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp +++ b/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "classfile/javaClasses.hpp" #include "gc/shenandoah/c2/shenandoahSupport.hpp" diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.cpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.cpp index 94c544a7ea36b..02a363d239211 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.cpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) 2018, 2019, Red Hat, Inc. All rights reserved. * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * 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 +24,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/gcCause.hpp" #include "gc/shenandoah/heuristics/shenandoahHeuristics.hpp" @@ -96,8 +96,8 @@ void ShenandoahAdaptiveHeuristics::choose_collection_set_from_regiondata(Shenand size_t free_target = (capacity / 100 * ShenandoahMinFreeThreshold) + max_cset; size_t min_garbage = (free_target > actual_free ? (free_target - actual_free) : 0); - log_info(gc, ergo)("Adaptive CSet Selection. Target Free: " SIZE_FORMAT "%s, Actual Free: " - SIZE_FORMAT "%s, Max Evacuation: " SIZE_FORMAT "%s, Min Garbage: " SIZE_FORMAT "%s", + log_info(gc, ergo)("Adaptive CSet Selection. Target Free: %zu%s, Actual Free: " + "%zu%s, Max Evacuation: %zu%s, Min Garbage: %zu%s", byte_size_in_proper_unit(free_target), proper_unit_for_byte_size(free_target), byte_size_in_proper_unit(actual_free), proper_unit_for_byte_size(actual_free), byte_size_in_proper_unit(max_cset), proper_unit_for_byte_size(max_cset), @@ -142,7 +142,7 @@ void ShenandoahAdaptiveHeuristics::record_success_concurrent() { if (available_sd > 0) { double available_avg = _available.avg(); z_score = (double(available) - available_avg) / available_sd; - log_debug(gc, ergo)("Available: " SIZE_FORMAT " %sB, z-score=%.3f. Average available: %.1f %sB +/- %.1f %sB.", + log_debug(gc, ergo)("Available: %zu %sB, z-score=%.3f. Average available: %.1f %sB +/- %.1f %sB.", byte_size_in_proper_unit(available), proper_unit_for_byte_size(available), z_score, byte_size_in_proper_unit(available_avg), proper_unit_for_byte_size(available_avg), @@ -237,8 +237,8 @@ bool ShenandoahAdaptiveHeuristics::should_start_gc() { size_t available = _space_info->soft_available(); size_t allocated = _space_info->bytes_allocated_since_gc_start(); - log_debug(gc)("should_start_gc? available: " SIZE_FORMAT ", soft_max_capacity: " SIZE_FORMAT - ", allocated: " SIZE_FORMAT, available, capacity, allocated); + log_debug(gc)("should_start_gc? available: %zu, soft_max_capacity: %zu" + ", allocated: %zu", available, capacity, allocated); // Track allocation rate even if we decide to start a cycle for other reasons. double rate = _allocation_rate.sample(allocated); @@ -246,7 +246,7 @@ bool ShenandoahAdaptiveHeuristics::should_start_gc() { size_t min_threshold = min_free_threshold(); if (available < min_threshold) { - log_trigger("Free (" SIZE_FORMAT "%s) is below minimum threshold (" SIZE_FORMAT "%s)", + log_trigger("Free (%zu%s) is below minimum threshold (%zu%s)", byte_size_in_proper_unit(available), proper_unit_for_byte_size(available), byte_size_in_proper_unit(min_threshold), proper_unit_for_byte_size(min_threshold)); return true; @@ -257,7 +257,7 @@ bool ShenandoahAdaptiveHeuristics::should_start_gc() { if (_gc_times_learned < max_learn) { size_t init_threshold = capacity / 100 * ShenandoahInitFreeThreshold; if (available < init_threshold) { - log_trigger("Learning " SIZE_FORMAT " of " SIZE_FORMAT ". Free (" SIZE_FORMAT "%s) is below initial threshold (" SIZE_FORMAT "%s)", + log_trigger("Learning %zu of %zu. Free (%zu%s) is below initial threshold (%zu%s)", _gc_times_learned + 1, max_learn, byte_size_in_proper_unit(available), proper_unit_for_byte_size(available), byte_size_in_proper_unit(init_threshold), proper_unit_for_byte_size(init_threshold)); @@ -282,12 +282,12 @@ bool ShenandoahAdaptiveHeuristics::should_start_gc() { avg_cycle_time * 1000, byte_size_in_proper_unit(avg_alloc_rate), proper_unit_for_byte_size(avg_alloc_rate)); if (avg_cycle_time * avg_alloc_rate > allocation_headroom) { log_trigger("Average GC time (%.2f ms) is above the time for average allocation rate (%.0f %sB/s)" - " to deplete free headroom (" SIZE_FORMAT "%s) (margin of error = %.2f)", + " to deplete free headroom (%zu%s) (margin of error = %.2f)", avg_cycle_time * 1000, byte_size_in_proper_unit(avg_alloc_rate), proper_unit_for_byte_size(avg_alloc_rate), byte_size_in_proper_unit(allocation_headroom), proper_unit_for_byte_size(allocation_headroom), _margin_of_error_sd); - log_info(gc, ergo)("Free headroom: " SIZE_FORMAT "%s (free) - " SIZE_FORMAT "%s (spike) - " SIZE_FORMAT "%s (penalties) = " SIZE_FORMAT "%s", + log_info(gc, ergo)("Free headroom: %zu%s (free) - %zu%s (spike) - %zu%s (penalties) = %zu%s", byte_size_in_proper_unit(available), proper_unit_for_byte_size(available), byte_size_in_proper_unit(spike_headroom), proper_unit_for_byte_size(spike_headroom), byte_size_in_proper_unit(penalties), proper_unit_for_byte_size(penalties), @@ -298,7 +298,7 @@ bool ShenandoahAdaptiveHeuristics::should_start_gc() { bool is_spiking = _allocation_rate.is_spiking(rate, _spike_threshold_sd); if (is_spiking && avg_cycle_time > allocation_headroom / rate) { - log_trigger("Average GC time (%.2f ms) is above the time for instantaneous allocation rate (%.0f %sB/s) to deplete free headroom (" SIZE_FORMAT "%s) (spike threshold = %.2f)", + log_trigger("Average GC time (%.2f ms) is above the time for instantaneous allocation rate (%.0f %sB/s) to deplete free headroom (%zu%s) (spike threshold = %.2f)", avg_cycle_time * 1000, byte_size_in_proper_unit(rate), proper_unit_for_byte_size(rate), byte_size_in_proper_unit(allocation_headroom), proper_unit_for_byte_size(allocation_headroom), diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAggressiveHeuristics.cpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAggressiveHeuristics.cpp index cdae9bb1285a2..63a4e74fb1d23 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAggressiveHeuristics.cpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAggressiveHeuristics.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/heuristics/shenandoahAggressiveHeuristics.hpp" #include "gc/shenandoah/shenandoahCollectionSet.hpp" diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahCompactHeuristics.cpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahCompactHeuristics.cpp index 2c7594e10dc5d..9d98ff6bf7379 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahCompactHeuristics.cpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahCompactHeuristics.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2018, 2019, Red Hat, Inc. All rights reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahCollectionSet.hpp" #include "gc/shenandoah/heuristics/shenandoahCompactHeuristics.hpp" @@ -58,7 +58,7 @@ bool ShenandoahCompactHeuristics::should_start_gc() { size_t min_threshold = capacity / 100 * ShenandoahMinFreeThreshold; if (available < min_threshold) { - log_trigger("Free (" SIZE_FORMAT "%s) is below minimum threshold (" SIZE_FORMAT "%s)", + log_trigger("Free (%zu%s) is below minimum threshold (%zu%s)", byte_size_in_proper_unit(available), proper_unit_for_byte_size(available), byte_size_in_proper_unit(min_threshold), proper_unit_for_byte_size(min_threshold)); return true; @@ -66,7 +66,7 @@ bool ShenandoahCompactHeuristics::should_start_gc() { size_t bytes_allocated = _space_info->bytes_allocated_since_gc_start(); if (bytes_allocated > threshold_bytes_allocated) { - log_trigger("Allocated since last cycle (" SIZE_FORMAT "%s) is larger than allocation threshold (" SIZE_FORMAT "%s)", + log_trigger("Allocated since last cycle (%zu%s) is larger than allocation threshold (%zu%s)", byte_size_in_proper_unit(bytes_allocated), proper_unit_for_byte_size(bytes_allocated), byte_size_in_proper_unit(threshold_bytes_allocated), proper_unit_for_byte_size(threshold_bytes_allocated)); return true; @@ -81,7 +81,7 @@ void ShenandoahCompactHeuristics::choose_collection_set_from_regiondata(Shenando // Do not select too large CSet that would overflow the available free space size_t max_cset = actual_free * 3 / 4; - log_info(gc, ergo)("CSet Selection. Actual Free: " SIZE_FORMAT "%s, Max CSet: " SIZE_FORMAT "%s", + log_info(gc, ergo)("CSet Selection. Actual Free: %zu%s, Max CSet: %zu%s", byte_size_in_proper_unit(actual_free), proper_unit_for_byte_size(actual_free), byte_size_in_proper_unit(max_cset), proper_unit_for_byte_size(max_cset)); diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGenerationalHeuristics.cpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGenerationalHeuristics.cpp index 5b6d82d97a4c9..757cab8f68682 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGenerationalHeuristics.cpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGenerationalHeuristics.cpp @@ -1,5 +1,6 @@ /* * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * 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 +23,6 @@ * */ -#include "precompiled.hpp" - #include "gc/shenandoah/heuristics/shenandoahGenerationalHeuristics.hpp" #include "gc/shenandoah/shenandoahCollectionSet.hpp" #include "gc/shenandoah/shenandoahCollectorPolicy.hpp" @@ -134,7 +133,7 @@ void ShenandoahGenerationalHeuristics::choose_collection_set(ShenandoahCollectio bool reg_live = region->has_live(); bool bm_live = heap->complete_marking_context()->is_marked(cast_to_oop(region->bottom())); assert(reg_live == bm_live, - "Humongous liveness and marks should agree. Region live: %s; Bitmap live: %s; Region Live Words: " SIZE_FORMAT, + "Humongous liveness and marks should agree. Region live: %s; Bitmap live: %s; Region Live Words: %zu", BOOL_TO_STR(reg_live), BOOL_TO_STR(bm_live), region->get_live_data_words()); #endif if (!region->has_live()) { @@ -158,8 +157,8 @@ void ShenandoahGenerationalHeuristics::choose_collection_set(ShenandoahCollectio } heap->old_generation()->set_expected_humongous_region_promotions(humongous_regions_promoted); heap->old_generation()->set_expected_regular_region_promotions(regular_regions_promoted_in_place); - log_info(gc, ergo)("Planning to promote in place " SIZE_FORMAT " humongous regions and " SIZE_FORMAT - " regular regions, spanning a total of " SIZE_FORMAT " used bytes", + log_info(gc, ergo)("Planning to promote in place %zu humongous regions and %zu" + " regular regions, spanning a total of %zu used bytes", humongous_regions_promoted, regular_regions_promoted_in_place, humongous_regions_promoted * ShenandoahHeapRegion::region_size_bytes() + regular_regions_promoted_usage); @@ -168,7 +167,7 @@ void ShenandoahGenerationalHeuristics::choose_collection_set(ShenandoahCollectio // given the amount of immediately reclaimable garbage. If we do, figure out the collection set. assert (immediate_garbage <= total_garbage, - "Cannot have more immediate garbage than total garbage: " SIZE_FORMAT "%s vs " SIZE_FORMAT "%s", + "Cannot have more immediate garbage than total garbage: %zu%s vs %zu%s", byte_size_in_proper_unit(immediate_garbage), proper_unit_for_byte_size(immediate_garbage), byte_size_in_proper_unit(total_garbage), proper_unit_for_byte_size(total_garbage)); @@ -193,9 +192,9 @@ void ShenandoahGenerationalHeuristics::choose_collection_set(ShenandoahCollectio size_t collectable_garbage = collection_set->garbage() + immediate_garbage; size_t collectable_garbage_percent = (total_garbage == 0) ? 0 : (collectable_garbage * 100 / total_garbage); - log_info(gc, ergo)("Collectable Garbage: " SIZE_FORMAT "%s (" SIZE_FORMAT "%%), " - "Immediate: " SIZE_FORMAT "%s (" SIZE_FORMAT "%%), " SIZE_FORMAT " regions, " - "CSet: " SIZE_FORMAT "%s (" SIZE_FORMAT "%%), " SIZE_FORMAT " regions", + log_info(gc, ergo)("Collectable Garbage: %zu%s (%zu%%), " + "Immediate: %zu%s (%zu%%), %zu regions, " + "CSet: %zu%s (%zu%%), %zu regions", byte_size_in_proper_unit(collectable_garbage), proper_unit_for_byte_size(collectable_garbage), @@ -216,10 +215,10 @@ void ShenandoahGenerationalHeuristics::choose_collection_set(ShenandoahCollectio size_t promote_evac_bytes = collection_set->get_young_bytes_to_be_promoted(); size_t old_evac_bytes = collection_set->get_old_bytes_reserved_for_evacuation(); size_t total_evac_bytes = young_evac_bytes + promote_evac_bytes + old_evac_bytes; - log_info(gc, ergo)("Evacuation Targets: YOUNG: " SIZE_FORMAT "%s, " - "PROMOTE: " SIZE_FORMAT "%s, " - "OLD: " SIZE_FORMAT "%s, " - "TOTAL: " SIZE_FORMAT "%s", + log_info(gc, ergo)("Evacuation Targets: YOUNG: %zu%s, " + "PROMOTE: %zu%s, " + "OLD: %zu%s, " + "TOTAL: %zu%s", byte_size_in_proper_unit(young_evac_bytes), proper_unit_for_byte_size(young_evac_bytes), byte_size_in_proper_unit(promote_evac_bytes), proper_unit_for_byte_size(promote_evac_bytes), byte_size_in_proper_unit(old_evac_bytes), proper_unit_for_byte_size(old_evac_bytes), @@ -282,8 +281,8 @@ void ShenandoahGenerationalHeuristics::log_cset_composition(ShenandoahCollection size_t collected_young = cset->get_young_bytes_reserved_for_evacuation(); log_info(gc, ergo)( - "Chosen CSet evacuates young: " SIZE_FORMAT "%s (of which at least: " SIZE_FORMAT "%s are to be promoted), " - "old: " SIZE_FORMAT "%s", + "Chosen CSet evacuates young: %zu%s (of which at least: %zu%s are to be promoted), " + "old: %zu%s", byte_size_in_proper_unit(collected_young), proper_unit_for_byte_size(collected_young), byte_size_in_proper_unit(collected_promoted), proper_unit_for_byte_size(collected_promoted), byte_size_in_proper_unit(collected_old), proper_unit_for_byte_size(collected_old)); diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGlobalHeuristics.cpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGlobalHeuristics.cpp index 4c1e6b7bdff1e..919f6c88afa9e 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGlobalHeuristics.cpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGlobalHeuristics.cpp @@ -1,5 +1,6 @@ /* * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * 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 +23,6 @@ * */ -#include "precompiled.hpp" - #include "gc/shenandoah/heuristics/shenandoahGlobalHeuristics.hpp" #include "gc/shenandoah/shenandoahCollectorPolicy.hpp" #include "gc/shenandoah/shenandoahGlobalGeneration.hpp" @@ -92,8 +91,8 @@ void ShenandoahGlobalHeuristics::choose_global_collection_set(ShenandoahCollecti size_t free_target = (capacity * ShenandoahMinFreeThreshold) / 100 + max_young_cset; size_t min_garbage = (free_target > actual_free) ? (free_target - actual_free) : 0; - log_info(gc, ergo)("Adaptive CSet Selection for GLOBAL. Max Young Evacuation: " SIZE_FORMAT - "%s, Max Old Evacuation: " SIZE_FORMAT "%s, Actual Free: " SIZE_FORMAT "%s.", + log_info(gc, ergo)("Adaptive CSet Selection for GLOBAL. Max Young Evacuation: %zu" + "%s, Max Old Evacuation: %zu%s, Actual Free: %zu%s.", byte_size_in_proper_unit(max_young_cset), proper_unit_for_byte_size(max_young_cset), byte_size_in_proper_unit(max_old_cset), proper_unit_for_byte_size(max_old_cset), byte_size_in_proper_unit(actual_free), proper_unit_for_byte_size(actual_free)); diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahHeuristics.cpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahHeuristics.cpp index c2ad809f43a2f..fe0d82a72e367 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahHeuristics.cpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahHeuristics.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) 2018, 2020, Red Hat, Inc. All rights reserved. * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * 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 +24,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/gcCause.hpp" #include "gc/shenandoah/shenandoahCollectorPolicy.hpp" #include "gc/shenandoah/shenandoahHeapRegion.inline.hpp" @@ -121,7 +121,7 @@ void ShenandoahHeuristics::choose_collection_set(ShenandoahCollectionSet* collec bool reg_live = region->has_live(); bool bm_live = ctx->is_marked(cast_to_oop(region->bottom())); assert(reg_live == bm_live, - "Humongous liveness and marks should agree. Region live: %s; Bitmap live: %s; Region Live Words: " SIZE_FORMAT, + "Humongous liveness and marks should agree. Region live: %s; Bitmap live: %s; Region Live Words: %zu", BOOL_TO_STR(reg_live), BOOL_TO_STR(bm_live), region->get_live_data_words()); #endif if (!region->has_live()) { @@ -142,7 +142,7 @@ void ShenandoahHeuristics::choose_collection_set(ShenandoahCollectionSet* collec // given the amount of immediately reclaimable garbage. If we do, figure out the collection set. assert (immediate_garbage <= total_garbage, - "Cannot have more immediate garbage than total garbage: " SIZE_FORMAT "%s vs " SIZE_FORMAT "%s", + "Cannot have more immediate garbage than total garbage: %zu%s vs %zu%s", byte_size_in_proper_unit(immediate_garbage), proper_unit_for_byte_size(immediate_garbage), byte_size_in_proper_unit(total_garbage), proper_unit_for_byte_size(total_garbage)); @@ -156,9 +156,9 @@ void ShenandoahHeuristics::choose_collection_set(ShenandoahCollectionSet* collec size_t collectable_garbage = collection_set->garbage() + immediate_garbage; size_t collectable_garbage_percent = (total_garbage == 0) ? 0 : (collectable_garbage * 100 / total_garbage); - log_info(gc, ergo)("Collectable Garbage: " SIZE_FORMAT "%s (" SIZE_FORMAT "%%), " - "Immediate: " SIZE_FORMAT "%s (" SIZE_FORMAT "%%), " SIZE_FORMAT " regions, " - "CSet: " SIZE_FORMAT "%s (" SIZE_FORMAT "%%), " SIZE_FORMAT " regions", + log_info(gc, ergo)("Collectable Garbage: %zu%s (%zu%%), " + "Immediate: %zu%s (%zu%%), %zu regions, " + "CSet: %zu%s (%zu%%), %zu regions", byte_size_in_proper_unit(collectable_garbage), proper_unit_for_byte_size(collectable_garbage), @@ -194,7 +194,7 @@ bool ShenandoahHeuristics::should_start_gc() { if (_guaranteed_gc_interval > 0) { double last_time_ms = (os::elapsedTime() - _last_cycle_end) * 1000; if (last_time_ms > _guaranteed_gc_interval) { - log_trigger("Time since last GC (%.0f ms) is larger than guaranteed interval (" UINTX_FORMAT " ms)", + log_trigger("Time since last GC (%.0f ms) is larger than guaranteed interval (%zu ms)", last_time_ms, _guaranteed_gc_interval); return true; } @@ -209,7 +209,7 @@ bool ShenandoahHeuristics::should_degenerate_cycle() { void ShenandoahHeuristics::adjust_penalty(intx step) { assert(0 <= _gc_time_penalties && _gc_time_penalties <= 100, - "In range before adjustment: " INTX_FORMAT, _gc_time_penalties); + "In range before adjustment: %zd", _gc_time_penalties); intx new_val = _gc_time_penalties + step; if (new_val < 0) { @@ -221,7 +221,7 @@ void ShenandoahHeuristics::adjust_penalty(intx step) { _gc_time_penalties = new_val; assert(0 <= _gc_time_penalties && _gc_time_penalties <= 100, - "In range after adjustment: " INTX_FORMAT, _gc_time_penalties); + "In range after adjustment: %zd", _gc_time_penalties); } void ShenandoahHeuristics::log_trigger(const char* fmt, ...) { diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahOldHeuristics.cpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahOldHeuristics.cpp index abb2b7b266ad7..0393a2bb3664a 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahOldHeuristics.cpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahOldHeuristics.cpp @@ -1,5 +1,6 @@ /* * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * 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 +23,6 @@ * */ -#include "precompiled.hpp" - #include "gc/shenandoah/heuristics/shenandoahOldHeuristics.hpp" #include "gc/shenandoah/shenandoahCollectionSet.hpp" #include "gc/shenandoah/shenandoahCollectorPolicy.hpp" @@ -122,7 +121,7 @@ bool ShenandoahOldHeuristics::prime_collection_set(ShenandoahCollectionSet* coll } size_t remaining_old_evacuation_budget = old_evacuation_budget; - log_debug(gc)("Choose old regions for mixed collection: old evacuation budget: " SIZE_FORMAT "%s, candidates: %u", + log_debug(gc)("Choose old regions for mixed collection: old evacuation budget: %zu%s, candidates: %u", byte_size_in_proper_unit(old_evacuation_budget), proper_unit_for_byte_size(old_evacuation_budget), unprocessed_old_collection_candidates()); @@ -362,7 +361,7 @@ void ShenandoahOldHeuristics::prepare_for_old_collections() { immediate_regions++; immediate_garbage += garbage; size_t region_count = heap->trash_humongous_region_at(region); - log_debug(gc)("Trashed " SIZE_FORMAT " regions for humongous object.", region_count); + log_debug(gc)("Trashed %zu regions for humongous object.", region_count); } } else if (region->is_trash()) { // Count humongous objects made into trash here. @@ -443,7 +442,7 @@ void ShenandoahOldHeuristics::prepare_for_old_collections() { while ((defrag_count < bound_on_additional_regions) && (total_uncollected_old_regions < 7 * span_of_uncollected_regions / 8)) { ShenandoahHeapRegion* r = candidates[_last_old_collection_candidate].get_region(); - assert(r->is_regular() || r->is_regular_pinned(), "Region " SIZE_FORMAT " has wrong state for collection: %s", + assert(r->is_regular() || r->is_regular_pinned(), "Region %zu has wrong state for collection: %s", r->index(), ShenandoahHeapRegion::region_state_to_string(r->state())); const size_t region_garbage = r->garbage(); const size_t region_free = r->free(); @@ -466,12 +465,12 @@ void ShenandoahOldHeuristics::prepare_for_old_collections() { const size_t mixed_evac_live = old_candidates * region_size_bytes - (candidates_garbage + unfragmented); set_unprocessed_old_collection_candidates_live_memory(mixed_evac_live); - log_info(gc, ergo)("Old-Gen Collectable Garbage: " PROPERFMT " consolidated with free: " PROPERFMT ", over " SIZE_FORMAT " regions", + log_info(gc, ergo)("Old-Gen Collectable Garbage: " PROPERFMT " consolidated with free: " PROPERFMT ", over %zu regions", PROPERFMTARGS(collectable_garbage), PROPERFMTARGS(unfragmented), old_candidates); - log_info(gc, ergo)("Old-Gen Immediate Garbage: " PROPERFMT " over " SIZE_FORMAT " regions", + log_info(gc, ergo)("Old-Gen Immediate Garbage: " PROPERFMT " over %zu regions", PROPERFMTARGS(immediate_garbage), immediate_regions); - log_info(gc, ergo)("Old regions selected for defragmentation: " SIZE_FORMAT, defrag_count); - log_info(gc, ergo)("Old regions not selected: " SIZE_FORMAT, total_uncollected_old_regions); + log_info(gc, ergo)("Old regions selected for defragmentation: %zu", defrag_count); + log_info(gc, ergo)("Old regions not selected: %zu", total_uncollected_old_regions); if (unprocessed_old_collection_candidates() > 0) { _old_generation->transition_to(ShenandoahOldGeneration::EVACUATING); @@ -608,7 +607,7 @@ void ShenandoahOldHeuristics::set_trigger_if_old_is_overgrown() { size_t trigger_threshold = _old_gen->usage_trigger_threshold(); // Detects unsigned arithmetic underflow assert(old_used <= _heap->capacity(), - "Old used (" SIZE_FORMAT ", " SIZE_FORMAT") must not be more than heap capacity (" SIZE_FORMAT ")", + "Old used (%zu, %zu) must not be more than heap capacity (%zu)", _old_gen->used(), _old_gen->get_humongous_waste(), _heap->capacity()); if (old_used > trigger_threshold) { _growth_trigger = true; @@ -635,7 +634,7 @@ bool ShenandoahOldHeuristics::should_start_gc() { const size_t old_gen_capacity = _old_generation->max_capacity(); const size_t heap_capacity = heap->capacity(); const double percent = percent_of(old_gen_capacity, heap_capacity); - log_trigger("Expansion failure, current size: " SIZE_FORMAT "%s which is %.1f%% of total heap size", + log_trigger("Expansion failure, current size: %zu%s which is %.1f%% of total heap size", byte_size_in_proper_unit(old_gen_capacity), proper_unit_for_byte_size(old_gen_capacity), percent); return true; } @@ -655,8 +654,8 @@ bool ShenandoahOldHeuristics::should_start_gc() { const size_t fragmented_free = used_regions_size - used; log_trigger("Old has become fragmented: " - SIZE_FORMAT "%s available bytes spread between range spanned from " - SIZE_FORMAT " to " SIZE_FORMAT " (" SIZE_FORMAT "), density: %.1f%%", + "%zu%s available bytes spread between range spanned from " + "%zu to %zu (%zu), density: %.1f%%", byte_size_in_proper_unit(fragmented_free), proper_unit_for_byte_size(fragmented_free), first_old_region, last_old_region, span_of_old_regions, density * 100); return true; @@ -673,8 +672,8 @@ bool ShenandoahOldHeuristics::should_start_gc() { if ((current_usage < ignore_threshold) && ((consecutive_young_cycles = heap->shenandoah_policy()->consecutive_young_gc_count()) < ShenandoahDoNotIgnoreGrowthAfterYoungCycles)) { - log_debug(gc)("Ignoring Trigger: Old has overgrown: usage (" SIZE_FORMAT "%s) is below threshold (" - SIZE_FORMAT "%s) after " SIZE_FORMAT " consecutive completed young GCs", + log_debug(gc)("Ignoring Trigger: Old has overgrown: usage (%zu%s) is below threshold (" + "%zu%s) after %zu consecutive completed young GCs", byte_size_in_proper_unit(current_usage), proper_unit_for_byte_size(current_usage), byte_size_in_proper_unit(ignore_threshold), proper_unit_for_byte_size(ignore_threshold), consecutive_young_cycles); @@ -683,7 +682,7 @@ bool ShenandoahOldHeuristics::should_start_gc() { const size_t live_at_previous_old = _old_generation->get_live_bytes_after_last_mark(); const double percent_growth = percent_of(current_usage - live_at_previous_old, live_at_previous_old); log_trigger("Old has overgrown, live at end of previous OLD marking: " - SIZE_FORMAT "%s, current usage: " SIZE_FORMAT "%s, percent growth: %.1f%%", + "%zu%s, current usage: %zu%s, percent growth: %.1f%%", byte_size_in_proper_unit(live_at_previous_old), proper_unit_for_byte_size(live_at_previous_old), byte_size_in_proper_unit(current_usage), proper_unit_for_byte_size(current_usage), percent_growth); return true; diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahPassiveHeuristics.cpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahPassiveHeuristics.cpp index 7c65482d8c4f8..a0f209b0d20dd 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahPassiveHeuristics.cpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahPassiveHeuristics.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2018, 2019, Red Hat, Inc. All rights reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/heuristics/shenandoahPassiveHeuristics.hpp" #include "gc/shenandoah/shenandoahCollectionSet.hpp" @@ -60,7 +60,7 @@ void ShenandoahPassiveHeuristics::choose_collection_set_from_regiondata(Shenando size_t available = MAX2(max_capacity / 100 * ShenandoahEvacReserve, actual_free); size_t max_cset = (size_t)(available / ShenandoahEvacWaste); - log_info(gc, ergo)("CSet Selection. Actual Free: " SIZE_FORMAT "%s, Max CSet: " SIZE_FORMAT "%s", + log_info(gc, ergo)("CSet Selection. Actual Free: %zu%s, Max CSet: %zu%s", byte_size_in_proper_unit(actual_free), proper_unit_for_byte_size(actual_free), byte_size_in_proper_unit(max_cset), proper_unit_for_byte_size(max_cset)); diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahStaticHeuristics.cpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahStaticHeuristics.cpp index db179d0a80a81..8918d1b3d946a 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahStaticHeuristics.cpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahStaticHeuristics.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2018, 2019, Red Hat, Inc. All rights reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/heuristics/shenandoahStaticHeuristics.hpp" #include "gc/shenandoah/shenandoahCollectionSet.hpp" @@ -52,7 +52,7 @@ bool ShenandoahStaticHeuristics::should_start_gc() { size_t threshold_available = capacity / 100 * ShenandoahMinFreeThreshold; if (available < threshold_available) { - log_trigger("Free (" SIZE_FORMAT "%s) is below minimum threshold (" SIZE_FORMAT "%s)", + log_trigger("Free (%zu%s) is below minimum threshold (%zu%s)", byte_size_in_proper_unit(available), proper_unit_for_byte_size(available), byte_size_in_proper_unit(threshold_available), proper_unit_for_byte_size(threshold_available)); return true; diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahYoungHeuristics.cpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahYoungHeuristics.cpp index ced406611b1e0..8e983f62ce192 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahYoungHeuristics.cpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahYoungHeuristics.cpp @@ -1,5 +1,6 @@ /* * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * 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 +23,6 @@ * */ -#include "precompiled.hpp" - #include "gc/shenandoah/heuristics/shenandoahOldHeuristics.hpp" #include "gc/shenandoah/heuristics/shenandoahYoungHeuristics.hpp" #include "gc/shenandoah/shenandoahCollectorPolicy.hpp" @@ -82,7 +81,7 @@ void ShenandoahYoungHeuristics::choose_young_collection_set(ShenandoahCollection log_info(gc, ergo)( - "Adaptive CSet Selection for YOUNG. Max Evacuation: " SIZE_FORMAT "%s, Actual Free: " SIZE_FORMAT "%s.", + "Adaptive CSet Selection for YOUNG. Max Evacuation: %zu%s, Actual Free: %zu%s.", byte_size_in_proper_unit(max_cset), proper_unit_for_byte_size(max_cset), byte_size_in_proper_unit(actual_free), proper_unit_for_byte_size(actual_free)); @@ -150,7 +149,7 @@ bool ShenandoahYoungHeuristics::should_start_gc() { // If concurrent weak root processing is in progress, it means the old cycle has chosen mixed collection // candidates, but has not completed. There is no point in trying to start the young cycle before the old // cycle completes. - log_trigger("Expedite mixed evacuation of " SIZE_FORMAT " regions", mixed_candidates); + log_trigger("Expedite mixed evacuation of %zu regions", mixed_candidates); return true; } @@ -221,4 +220,3 @@ size_t ShenandoahYoungHeuristics::bytes_of_allocation_runway_before_gc_trigger(s size_t evac_min_threshold = (anticipated_available > threshold)? anticipated_available - threshold: 0; return MIN3(evac_slack_spiking, evac_slack_avg, evac_min_threshold); } - diff --git a/src/hotspot/share/gc/shenandoah/mode/shenandoahGenerationalMode.cpp b/src/hotspot/share/gc/shenandoah/mode/shenandoahGenerationalMode.cpp index 3a34a9aa6a88a..6c8858341555d 100644 --- a/src/hotspot/share/gc/shenandoah/mode/shenandoahGenerationalMode.cpp +++ b/src/hotspot/share/gc/shenandoah/mode/shenandoahGenerationalMode.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/heuristics/shenandoahYoungHeuristics.hpp" #include "gc/shenandoah/heuristics/shenandoahHeuristics.hpp" #include "gc/shenandoah/mode/shenandoahGenerationalMode.hpp" diff --git a/src/hotspot/share/gc/shenandoah/mode/shenandoahMode.cpp b/src/hotspot/share/gc/shenandoah/mode/shenandoahMode.cpp index 126062ab9931a..5ef21719ed474 100644 --- a/src/hotspot/share/gc/shenandoah/mode/shenandoahMode.cpp +++ b/src/hotspot/share/gc/shenandoah/mode/shenandoahMode.cpp @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.hpp" #include "gc/shenandoah/heuristics/shenandoahAggressiveHeuristics.hpp" #include "gc/shenandoah/heuristics/shenandoahCompactHeuristics.hpp" @@ -51,4 +50,3 @@ ShenandoahHeuristics* ShenandoahMode::initialize_heuristics(ShenandoahSpaceInfo* ShouldNotReachHere(); return nullptr; } - diff --git a/src/hotspot/share/gc/shenandoah/mode/shenandoahPassiveMode.cpp b/src/hotspot/share/gc/shenandoah/mode/shenandoahPassiveMode.cpp index 5c0ec2f884f03..893321db1dc2f 100644 --- a/src/hotspot/share/gc/shenandoah/mode/shenandoahPassiveMode.cpp +++ b/src/hotspot/share/gc/shenandoah/mode/shenandoahPassiveMode.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/heuristics/shenandoahHeuristics.hpp" #include "gc/shenandoah/heuristics/shenandoahSpaceInfo.hpp" #include "gc/shenandoah/heuristics/shenandoahPassiveHeuristics.hpp" diff --git a/src/hotspot/share/gc/shenandoah/mode/shenandoahSATBMode.cpp b/src/hotspot/share/gc/shenandoah/mode/shenandoahSATBMode.cpp index f5023c7cae963..7ac2d7b818f79 100644 --- a/src/hotspot/share/gc/shenandoah/mode/shenandoahSATBMode.cpp +++ b/src/hotspot/share/gc/shenandoah/mode/shenandoahSATBMode.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/heuristics/shenandoahHeuristics.hpp" #include "gc/shenandoah/mode/shenandoahSATBMode.hpp" #include "logging/log.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahAgeCensus.cpp b/src/hotspot/share/gc/shenandoah/shenandoahAgeCensus.cpp index 7c574a9d0dd7e..94c98b78f1bc0 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahAgeCensus.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahAgeCensus.cpp @@ -1,5 +1,6 @@ /* * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * 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 +23,6 @@ * */ -#include "precompiled.hpp" - #include "gc/shenandoah/mode/shenandoahGenerationalMode.hpp" #include "gc/shenandoah/shenandoahAgeCensus.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" @@ -32,8 +31,8 @@ ShenandoahAgeCensus::ShenandoahAgeCensus() { assert(ShenandoahHeap::heap()->mode()->is_generational(), "Only in generational mode"); if (ShenandoahGenerationalMinTenuringAge > ShenandoahGenerationalMaxTenuringAge) { vm_exit_during_initialization( - err_msg("ShenandoahGenerationalMinTenuringAge=" SIZE_FORMAT - " should be no more than ShenandoahGenerationalMaxTenuringAge=" SIZE_FORMAT, + err_msg("ShenandoahGenerationalMinTenuringAge=%zu" + " should be no more than ShenandoahGenerationalMaxTenuringAge=%zu", ShenandoahGenerationalMinTenuringAge, ShenandoahGenerationalMaxTenuringAge)); } @@ -247,7 +246,7 @@ void ShenandoahAgeCensus::update_tenuring_threshold() { _tenuring_threshold[_epoch] = tt; } print(); - log_trace(gc, age)("New tenuring threshold " UINTX_FORMAT " (min " UINTX_FORMAT ", max " UINTX_FORMAT")", + log_trace(gc, age)("New tenuring threshold %zu (min %zu, max %zu)", (uintx) _tenuring_threshold[_epoch], ShenandoahGenerationalMinTenuringAge, ShenandoahGenerationalMaxTenuringAge); } @@ -326,7 +325,7 @@ double ShenandoahAgeCensus::mortality_rate(size_t prev_pop, size_t cur_pop) { // or increased. if (cur_pop > prev_pop) { log_trace(gc, age) - (" (dark matter) Cohort population " SIZE_FORMAT_W(10) " to " SIZE_FORMAT_W(10), + (" (dark matter) Cohort population %10zu to %10zu", prev_pop*oopSize, cur_pop*oopSize); } return 0.0; @@ -355,7 +354,7 @@ void ShenandoahAgeCensus::print() { // Suppress printing when everything is zero if (prev_pop + cur_pop > 0) { log_info(gc, age) - (" - age %3u: prev " SIZE_FORMAT_W(10) " bytes, curr " SIZE_FORMAT_W(10) " bytes, mortality %.2f ", + (" - age %3u: prev %10zu bytes, curr %10zu bytes, mortality %.2f ", i, prev_pop*oopSize, cur_pop*oopSize, mr); } total += cur_pop; @@ -374,8 +373,8 @@ void ShenandoahNoiseStats::print(size_t total) { float f_aged = (float)aged/(float)total; float f_clamped = (float)clamped/(float)total; float f_young = (float)young/(float)total; - log_info(gc, age)("Skipped: " SIZE_FORMAT_W(10) " (%.2f), R-Aged: " SIZE_FORMAT_W(10) " (%.2f), " - "Clamped: " SIZE_FORMAT_W(10) " (%.2f), R-Young: " SIZE_FORMAT_W(10) " (%.2f)", + log_info(gc, age)("Skipped: %10zu (%.2f), R-Aged: %10zu (%.2f), " + "Clamped: %10zu (%.2f), R-Young: %10zu (%.2f)", skipped*oopSize, f_skipped, aged*oopSize, f_aged, clamped*oopSize, f_clamped, young*oopSize, f_young); } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahArguments.cpp b/src/hotspot/share/gc/shenandoah/shenandoahArguments.cpp index fa3f9019af425..cd1949b19ad51 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahArguments.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahArguments.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) 2018, 2022, Red Hat, Inc. All rights reserved. * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * 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 +24,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/fullGCForwarding.hpp" #include "gc/shared/gcArguments.hpp" #include "gc/shared/tlab_globals.hpp" @@ -60,7 +60,7 @@ void ShenandoahArguments::initialize() { if (UseLargePages) { size_t large_page_size = os::large_page_size(); if ((align_up(MaxHeapSize, large_page_size) / large_page_size) < ShenandoahHeapRegion::MIN_NUM_REGIONS) { - warning("Large pages size (" SIZE_FORMAT "K) is too large to afford page-sized regions, disabling uncommit", + warning("Large pages size (%zuK) is too large to afford page-sized regions, disabling uncommit", os::large_page_size() / K); FLAG_SET_DEFAULT(ShenandoahUncommit, false); } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahAsserts.cpp b/src/hotspot/share/gc/shenandoah/shenandoahAsserts.cpp index 437646becce6a..ffafcc5840d78 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahAsserts.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahAsserts.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahAsserts.hpp" #include "gc/shenandoah/shenandoahForwarding.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.cpp b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.cpp index 62067bccb1ed7..10dc344657fe4 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.cpp @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/barrierSetNMethod.hpp" #include "gc/shenandoah/shenandoahBarrierSetClone.inline.hpp" #include "gc/shenandoah/shenandoahBarrierSetAssembler.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp index f3ce9418d35de..5d00688f67119 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp @@ -67,8 +67,7 @@ inline oop ShenandoahBarrierSet::load_reference_barrier_mutator(oop obj, T* load oop fwd = resolve_forwarded_not_null_mutator(obj); if (obj == fwd) { - assert(_heap->is_evacuation_in_progress(), - "evac should be in progress"); + assert(_heap->is_evacuation_in_progress(), "evac should be in progress"); Thread* const t = Thread::current(); ShenandoahEvacOOMScope scope(t); fwd = _heap->evacuate_object(obj, t); @@ -86,8 +85,8 @@ inline oop ShenandoahBarrierSet::load_reference_barrier(oop obj) { if (!ShenandoahLoadRefBarrier) { return obj; } - if (_heap->has_forwarded_objects() && - _heap->in_collection_set(obj)) { // Subsumes null-check + if (_heap->has_forwarded_objects() && _heap->in_collection_set(obj)) { + // Subsumes null-check assert(obj != nullptr, "cset check must have subsumed null-check"); oop fwd = resolve_forwarded_not_null(obj); if (obj == fwd && _heap->is_evacuation_in_progress()) { @@ -381,7 +380,7 @@ void ShenandoahBarrierSet::arraycopy_work(T* src, size_t count) { // this barrier will be called with ENQUEUE=true and HAS_FWD=false, even though the young generation // may have forwarded objects. In this case, the `arraycopy_work` is first called with HAS_FWD=true and // ENQUEUE=false. - assert(HAS_FWD == _heap->has_forwarded_objects() || (_heap->gc_state() & ShenandoahHeap::OLD_MARKING) != 0, + assert(HAS_FWD == _heap->has_forwarded_objects() || _heap->is_concurrent_old_mark_in_progress(), "Forwarded object status is sane"); // This function cannot be called to handle marking and evacuation at the same time (they operate on // different sides of the copy). @@ -418,10 +417,10 @@ void ShenandoahBarrierSet::arraycopy_barrier(T* src, T* dst, size_t count) { return; } - int gc_state = _heap->gc_state(); + char gc_state = ShenandoahThreadLocalData::gc_state(Thread::current()); if ((gc_state & ShenandoahHeap::EVACUATION) != 0) { arraycopy_evacuation(src, count); - } else if ((gc_state & ShenandoahHeap::UPDATEREFS) != 0) { + } else if ((gc_state & ShenandoahHeap::UPDATE_REFS) != 0) { arraycopy_update(src, count); } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSetClone.inline.hpp b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSetClone.inline.hpp index 3b7bf9864deb0..8b83cc6b32cf9 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSetClone.inline.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSetClone.inline.hpp @@ -95,8 +95,7 @@ void ShenandoahBarrierSet::clone_barrier(oop obj) { assert(ShenandoahCloneBarrier, "only get here with clone barriers enabled"); shenandoah_assert_correct(nullptr, obj); - int gc_state = _heap->gc_state(); - if ((gc_state & ShenandoahHeap::EVACUATION) != 0) { + if (_heap->is_evacuation_in_progress()) { clone_evacuation(obj); } else { clone_update(obj); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSetNMethod.cpp b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSetNMethod.cpp index 7b30e1ecbac70..c6e6108fda81c 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSetNMethod.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSetNMethod.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahBarrierSetNMethod.hpp" #include "gc/shenandoah/shenandoahClosures.inline.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSetStackChunk.cpp b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSetStackChunk.cpp index 658b1da090233..224d9e1870a80 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSetStackChunk.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSetStackChunk.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahBarrierSet.inline.hpp" #include "gc/shenandoah/shenandoahBarrierSetStackChunk.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahBreakpoint.cpp b/src/hotspot/share/gc/shenandoah/shenandoahBreakpoint.cpp index fb0de2bc74106..af18a8219b1a3 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahBreakpoint.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahBreakpoint.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2021, Red Hat, Inc. All rights reserved. - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/concurrentGCBreakpoints.hpp" #include "gc/shenandoah/shenandoahBreakpoint.hpp" #include "runtime/mutexLocker.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahCardStats.cpp b/src/hotspot/share/gc/shenandoah/shenandoahCardStats.cpp index ef2d6e134b2e2..fc59af99817e1 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahCardStats.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahCardStats.cpp @@ -1,5 +1,6 @@ /* * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. * + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * 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 +24,6 @@ */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahCardStats.hpp" #include "logging/log.hpp" @@ -31,9 +31,9 @@ #ifndef PRODUCT void ShenandoahCardStats::log() const { if (ShenandoahEnableCardStats) { - log_info(gc,remset)("Card stats: dirty " SIZE_FORMAT " (max run: " SIZE_FORMAT ")," - " clean " SIZE_FORMAT " (max run: " SIZE_FORMAT ")," - " dirty scans/objs " SIZE_FORMAT, + log_info(gc,remset)("Card stats: dirty %zu (max run: %zu)," + " clean %zu (max run: %zu)," + " dirty scans/objs %zu", _dirty_card_cnt, _max_dirty_run, _clean_card_cnt, _max_clean_run, _dirty_scan_obj_cnt); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahCardTable.cpp b/src/hotspot/share/gc/shenandoah/shenandoahCardTable.cpp index 692144344d077..05bb5d00d8fdf 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahCardTable.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahCardTable.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahCardTable.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "gc/shenandoah/shenandoahUtils.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahCodeRoots.cpp b/src/hotspot/share/gc/shenandoah/shenandoahCodeRoots.cpp index 657cd681f4f64..49d2df0cc936c 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahCodeRoots.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahCodeRoots.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2022, Red Hat, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "code/codeCache.hpp" #include "code/nmethod.hpp" #include "gc/shared/classUnloadingContext.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.cpp b/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.cpp index 4d521d2e7f071..c27b790fbf7dd 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2016, 2023, Red Hat, Inc. All rights reserved. - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahAgeCensus.hpp" #include "gc/shenandoah/shenandoahCollectionSet.hpp" @@ -186,7 +185,7 @@ ShenandoahHeapRegion* ShenandoahCollectionSet::next() { void ShenandoahCollectionSet::print_on(outputStream* out) const { out->print_cr("Collection Set: Regions: " - SIZE_FORMAT ", Garbage: " SIZE_FORMAT "%s, Live: " SIZE_FORMAT "%s, Used: " SIZE_FORMAT "%s", count(), + "%zu, Garbage: %zu%s, Live: %zu%s, Used: %zu%s", count(), byte_size_in_proper_unit(garbage()), proper_unit_for_byte_size(garbage()), byte_size_in_proper_unit(live()), proper_unit_for_byte_size(live()), byte_size_in_proper_unit(used()), proper_unit_for_byte_size(used())); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahCollectorPolicy.cpp b/src/hotspot/share/gc/shenandoah/shenandoahCollectorPolicy.cpp index 42500ae877892..782db285c2ad0 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahCollectorPolicy.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahCollectorPolicy.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) 2013, 2021, Red Hat, Inc. All rights reserved. * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * 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 +24,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahCollectorPolicy.hpp" #include "gc/shenandoah/shenandoahGC.hpp" @@ -179,7 +179,7 @@ void ShenandoahCollectorPolicy::print_gc_stats(outputStream* out) const { out->cr(); size_t completed_gcs = _success_full_gcs + _success_degenerated_gcs + _success_concurrent_gcs + _success_old_gcs; - out->print_cr(SIZE_FORMAT_W(5) " Completed GCs", completed_gcs); + out->print_cr("%5zu Completed GCs", completed_gcs); size_t explicit_requests = 0; size_t implicit_requests = 0; @@ -193,48 +193,48 @@ void ShenandoahCollectorPolicy::print_gc_stats(outputStream* out) const { implicit_requests += cause_count; } const char* desc = GCCause::to_string(cause); - out->print_cr(" " SIZE_FORMAT_W(5) " caused by %s (%.2f%%)", cause_count, desc, percent_of(cause_count, completed_gcs)); + out->print_cr(" %5zu caused by %s (%.2f%%)", cause_count, desc, percent_of(cause_count, completed_gcs)); } } out->cr(); - out->print_cr(SIZE_FORMAT_W(5) " Successful Concurrent GCs (%.2f%%)", _success_concurrent_gcs, percent_of(_success_concurrent_gcs, completed_gcs)); + out->print_cr("%5zu Successful Concurrent GCs (%.2f%%)", _success_concurrent_gcs, percent_of(_success_concurrent_gcs, completed_gcs)); if (ExplicitGCInvokesConcurrent) { - out->print_cr(" " SIZE_FORMAT_W(5) " invoked explicitly (%.2f%%)", explicit_requests, percent_of(explicit_requests, _success_concurrent_gcs)); + out->print_cr(" %5zu invoked explicitly (%.2f%%)", explicit_requests, percent_of(explicit_requests, _success_concurrent_gcs)); } if (ShenandoahImplicitGCInvokesConcurrent) { - out->print_cr(" " SIZE_FORMAT_W(5) " invoked implicitly (%.2f%%)", implicit_requests, percent_of(implicit_requests, _success_concurrent_gcs)); + out->print_cr(" %5zu invoked implicitly (%.2f%%)", implicit_requests, percent_of(implicit_requests, _success_concurrent_gcs)); } - out->print_cr(" " SIZE_FORMAT_W(5) " abbreviated (%.2f%%)", _abbreviated_concurrent_gcs, percent_of(_abbreviated_concurrent_gcs, _success_concurrent_gcs)); + out->print_cr(" %5zu abbreviated (%.2f%%)", _abbreviated_concurrent_gcs, percent_of(_abbreviated_concurrent_gcs, _success_concurrent_gcs)); out->cr(); if (ShenandoahHeap::heap()->mode()->is_generational()) { - out->print_cr(SIZE_FORMAT_W(5) " Completed Old GCs (%.2f%%)", _success_old_gcs, percent_of(_success_old_gcs, completed_gcs)); - out->print_cr(" " SIZE_FORMAT_W(5) " mixed", _mixed_gcs); - out->print_cr(" " SIZE_FORMAT_W(5) " interruptions", _interrupted_old_gcs); + out->print_cr("%5zu Completed Old GCs (%.2f%%)", _success_old_gcs, percent_of(_success_old_gcs, completed_gcs)); + out->print_cr(" %5zu mixed", _mixed_gcs); + out->print_cr(" %5zu interruptions", _interrupted_old_gcs); out->cr(); } size_t degenerated_gcs = _alloc_failure_degenerated_upgrade_to_full + _success_degenerated_gcs; - out->print_cr(SIZE_FORMAT_W(5) " Degenerated GCs (%.2f%%)", degenerated_gcs, percent_of(degenerated_gcs, completed_gcs)); - out->print_cr(" " SIZE_FORMAT_W(5) " upgraded to Full GC (%.2f%%)", _alloc_failure_degenerated_upgrade_to_full, percent_of(_alloc_failure_degenerated_upgrade_to_full, degenerated_gcs)); - out->print_cr(" " SIZE_FORMAT_W(5) " caused by allocation failure (%.2f%%)", _alloc_failure_degenerated, percent_of(_alloc_failure_degenerated, degenerated_gcs)); - out->print_cr(" " SIZE_FORMAT_W(5) " abbreviated (%.2f%%)", _abbreviated_degenerated_gcs, percent_of(_abbreviated_degenerated_gcs, degenerated_gcs)); + out->print_cr("%5zu Degenerated GCs (%.2f%%)", degenerated_gcs, percent_of(degenerated_gcs, completed_gcs)); + out->print_cr(" %5zu upgraded to Full GC (%.2f%%)", _alloc_failure_degenerated_upgrade_to_full, percent_of(_alloc_failure_degenerated_upgrade_to_full, degenerated_gcs)); + out->print_cr(" %5zu caused by allocation failure (%.2f%%)", _alloc_failure_degenerated, percent_of(_alloc_failure_degenerated, degenerated_gcs)); + out->print_cr(" %5zu abbreviated (%.2f%%)", _abbreviated_degenerated_gcs, percent_of(_abbreviated_degenerated_gcs, degenerated_gcs)); for (int c = 0; c < ShenandoahGC::_DEGENERATED_LIMIT; c++) { if (_degen_point_counts[c] > 0) { const char* desc = ShenandoahGC::degen_point_to_string((ShenandoahGC::ShenandoahDegenPoint)c); - out->print_cr(" " SIZE_FORMAT_W(5) " happened at %s", _degen_point_counts[c], desc); + out->print_cr(" %5zu happened at %s", _degen_point_counts[c], desc); } } out->cr(); - out->print_cr(SIZE_FORMAT_W(5) " Full GCs (%.2f%%)", _success_full_gcs, percent_of(_success_full_gcs, completed_gcs)); + out->print_cr("%5zu Full GCs (%.2f%%)", _success_full_gcs, percent_of(_success_full_gcs, completed_gcs)); if (!ExplicitGCInvokesConcurrent) { - out->print_cr(" " SIZE_FORMAT_W(5) " invoked explicitly (%.2f%%)", explicit_requests, percent_of(explicit_requests, _success_concurrent_gcs)); + out->print_cr(" %5zu invoked explicitly (%.2f%%)", explicit_requests, percent_of(explicit_requests, _success_concurrent_gcs)); } if (!ShenandoahImplicitGCInvokesConcurrent) { - out->print_cr(" " SIZE_FORMAT_W(5) " invoked implicitly (%.2f%%)", implicit_requests, percent_of(implicit_requests, _success_concurrent_gcs)); + out->print_cr(" %5zu invoked implicitly (%.2f%%)", implicit_requests, percent_of(implicit_requests, _success_concurrent_gcs)); } - out->print_cr(" " SIZE_FORMAT_W(5) " caused by allocation failure (%.2f%%)", _alloc_failure_full, percent_of(_alloc_failure_full, _success_full_gcs)); - out->print_cr(" " SIZE_FORMAT_W(5) " upgraded from Degenerated GC (%.2f%%)", _alloc_failure_degenerated_upgrade_to_full, percent_of(_alloc_failure_degenerated_upgrade_to_full, _success_full_gcs)); + out->print_cr(" %5zu caused by allocation failure (%.2f%%)", _alloc_failure_full, percent_of(_alloc_failure_full, _success_full_gcs)); + out->print_cr(" %5zu upgraded from Degenerated GC (%.2f%%)", _alloc_failure_degenerated_upgrade_to_full, percent_of(_alloc_failure_degenerated_upgrade_to_full, _success_full_gcs)); } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.cpp b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.cpp index b1c2e72ef82b6..5ac7ceeab05dd 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021, 2022, Red Hat, Inc. All rights reserved. * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/barrierSetNMethod.hpp" #include "gc/shared/collectorCounters.hpp" @@ -192,20 +191,26 @@ bool ShenandoahConcurrentGC::collect(GCCause::Cause cause) { return false; } + // Evacuation is complete, retire gc labs + heap->concurrent_prepare_for_update_refs(); + // Perform update-refs phase. - vmop_entry_init_updaterefs(); - entry_updaterefs(); - if (check_cancellation_and_abort(ShenandoahDegenPoint::_degenerated_updaterefs)) { + if (ShenandoahVerify || ShenandoahPacing) { + vmop_entry_init_update_refs(); + } + + entry_update_refs(); + if (check_cancellation_and_abort(ShenandoahDegenPoint::_degenerated_update_refs)) { return false; } // Concurrent update thread roots entry_update_thread_roots(); - if (check_cancellation_and_abort(ShenandoahDegenPoint::_degenerated_updaterefs)) { + if (check_cancellation_and_abort(ShenandoahDegenPoint::_degenerated_update_refs)) { return false; } - vmop_entry_final_updaterefs(); + vmop_entry_final_update_refs(); // Update references freed up collection set, kick the cleanup to reclaim the space. entry_cleanup_complete(); @@ -259,7 +264,7 @@ void ShenandoahConcurrentGC::vmop_entry_final_mark() { VMThread::execute(&op); // jump to entry_final_mark under safepoint } -void ShenandoahConcurrentGC::vmop_entry_init_updaterefs() { +void ShenandoahConcurrentGC::vmop_entry_init_update_refs() { ShenandoahHeap* const heap = ShenandoahHeap::heap(); TraceCollectorStats tcs(heap->monitoring_support()->stw_collection_counters()); ShenandoahTimingsTracker timing(ShenandoahPhaseTimings::init_update_refs_gross); @@ -269,7 +274,7 @@ void ShenandoahConcurrentGC::vmop_entry_init_updaterefs() { VMThread::execute(&op); } -void ShenandoahConcurrentGC::vmop_entry_final_updaterefs() { +void ShenandoahConcurrentGC::vmop_entry_final_update_refs() { ShenandoahHeap* const heap = ShenandoahHeap::heap(); TraceCollectorStats tcs(heap->monitoring_support()->stw_collection_counters()); ShenandoahTimingsTracker timing(ShenandoahPhaseTimings::final_update_refs_gross); @@ -314,16 +319,16 @@ void ShenandoahConcurrentGC::entry_final_mark() { op_final_mark(); } -void ShenandoahConcurrentGC::entry_init_updaterefs() { +void ShenandoahConcurrentGC::entry_init_update_refs() { static const char* msg = "Pause Init Update Refs"; ShenandoahPausePhase gc_phase(msg, ShenandoahPhaseTimings::init_update_refs); EventMark em("%s", msg); // No workers used in this phase, no setup required - op_init_updaterefs(); + op_init_update_refs(); } -void ShenandoahConcurrentGC::entry_final_updaterefs() { +void ShenandoahConcurrentGC::entry_final_update_refs() { static const char* msg = "Pause Final Update Refs"; ShenandoahPausePhase gc_phase(msg, ShenandoahPhaseTimings::final_update_refs); EventMark em("%s", msg); @@ -332,7 +337,7 @@ void ShenandoahConcurrentGC::entry_final_updaterefs() { ShenandoahWorkerPolicy::calc_workers_for_final_update_ref(), "final reference update"); - op_final_updaterefs(); + op_final_update_refs(); } void ShenandoahConcurrentGC::entry_final_roots() { @@ -551,7 +556,7 @@ void ShenandoahConcurrentGC::entry_update_thread_roots() { op_update_thread_roots(); } -void ShenandoahConcurrentGC::entry_updaterefs() { +void ShenandoahConcurrentGC::entry_update_refs() { ShenandoahHeap* const heap = ShenandoahHeap::heap(); TraceCollectorStats tcs(heap->monitoring_support()->concurrent_collection_counters()); static const char* msg = "Concurrent update references"; @@ -563,7 +568,7 @@ void ShenandoahConcurrentGC::entry_updaterefs() { "concurrent reference update"); heap->try_inject_alloc_failure(); - op_updaterefs(); + op_update_refs(); } void ShenandoahConcurrentGC::entry_cleanup_complete() { @@ -593,7 +598,7 @@ class ShenandoahInitMarkUpdateRegionStateClosure : public ShenandoahHeapRegionCl ShenandoahInitMarkUpdateRegionStateClosure() : _ctx(ShenandoahHeap::heap()->marking_context()) {} void heap_region_do(ShenandoahHeapRegion* r) { - assert(!r->has_live(), "Region " SIZE_FORMAT " should have no live data", r->index()); + assert(!r->has_live(), "Region %zu should have no live data", r->index()); if (r->is_active()) { // Check if region needs updating its TAMS. We have updated it already during concurrent // reset, so it is very likely we don't need to do another write here. Since most regions @@ -603,7 +608,7 @@ class ShenandoahInitMarkUpdateRegionStateClosure : public ShenandoahHeapRegionCl } } else { assert(_ctx->top_at_mark_start(r) == r->top(), - "Region " SIZE_FORMAT " should already have correct TAMS", r->index()); + "Region %zu should already have correct TAMS", r->index()); } } @@ -748,10 +753,6 @@ void ShenandoahConcurrentGC::op_final_mark() { heap->verifier()->verify_after_concmark(); } } - - if (VerifyAfterGC) { - Universe::verify(); - } } } } @@ -920,8 +921,8 @@ class ShenandoahConcurrentWeakRootsEvacUpdateTask : public WorkerTask { } // If we are going to perform concurrent class unloading later on, we need to - // cleanup the weak oops in CLD and determinate nmethod's unloading state, so that we - // can cleanup immediate garbage sooner. + // clean up the weak oops in CLD and determine nmethod's unloading state, so that we + // can clean up immediate garbage sooner. if (ShenandoahHeap::heap()->unload_classes()) { // Applies ShenandoahIsCLDAlive closure to CLDs, native barrier will either null the // CLD's holder or evacuate it. @@ -947,21 +948,10 @@ void ShenandoahConcurrentGC::op_weak_roots() { ShenandoahHeap* const heap = ShenandoahHeap::heap(); assert(heap->is_concurrent_weak_root_in_progress(), "Only during this phase"); // Concurrent weak root processing - { - ShenandoahTimingsTracker t(ShenandoahPhaseTimings::conc_weak_roots_work); - ShenandoahGCWorkerPhase worker_phase(ShenandoahPhaseTimings::conc_weak_roots_work); - ShenandoahConcurrentWeakRootsEvacUpdateTask task(ShenandoahPhaseTimings::conc_weak_roots_work); - heap->workers()->run_task(&task); - } - - // Perform handshake to flush out dead oops - { - ShenandoahTimingsTracker t(ShenandoahPhaseTimings::conc_weak_roots_rendezvous); - heap->rendezvous_threads("Shenandoah Concurrent Weak Roots"); - } - // We can only toggle concurrent_weak_root_in_progress flag - // at a safepoint, so that mutators see a consistent - // value. The flag will be cleared at the next safepoint. + ShenandoahTimingsTracker t(ShenandoahPhaseTimings::conc_weak_roots_work); + ShenandoahGCWorkerPhase worker_phase(ShenandoahPhaseTimings::conc_weak_roots_work); + ShenandoahConcurrentWeakRootsEvacUpdateTask task(ShenandoahPhaseTimings::conc_weak_roots_work); + heap->workers()->run_task(&task); } void ShenandoahConcurrentGC::op_class_unloading() { @@ -1056,21 +1046,17 @@ void ShenandoahConcurrentGC::op_evacuate() { ShenandoahHeap::heap()->evacuate_collection_set(true /*concurrent*/); } -void ShenandoahConcurrentGC::op_init_updaterefs() { +void ShenandoahConcurrentGC::op_init_update_refs() { ShenandoahHeap* const heap = ShenandoahHeap::heap(); - heap->set_evacuation_in_progress(false); - heap->set_concurrent_weak_root_in_progress(false); - heap->prepare_update_heap_references(true /*concurrent*/); - heap->set_update_refs_in_progress(true); if (ShenandoahVerify) { - heap->verifier()->verify_before_updaterefs(); + heap->verifier()->verify_before_update_refs(); } if (ShenandoahPacing) { - heap->pacer()->setup_for_updaterefs(); + heap->pacer()->setup_for_update_refs(); } } -void ShenandoahConcurrentGC::op_updaterefs() { +void ShenandoahConcurrentGC::op_update_refs() { ShenandoahHeap::heap()->update_heap_references(true /*concurrent*/); } @@ -1102,7 +1088,7 @@ void ShenandoahConcurrentGC::op_update_thread_roots() { Handshake::execute(&cl); } -void ShenandoahConcurrentGC::op_final_updaterefs() { +void ShenandoahConcurrentGC::op_final_update_refs() { ShenandoahHeap* const heap = ShenandoahHeap::heap(); assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "must be at safepoint"); assert(!heap->_update_refs_iterator.has_next(), "Should have finished update references"); @@ -1150,7 +1136,7 @@ void ShenandoahConcurrentGC::op_final_updaterefs() { } if (ShenandoahVerify) { - heap->verifier()->verify_after_updaterefs(); + heap->verifier()->verify_after_update_refs(); } if (VerifyAfterGC) { @@ -1178,6 +1164,10 @@ void ShenandoahConcurrentGC::op_final_roots() { ShenandoahGenerationalHeap::heap()->update_region_ages(_generation->complete_marking_context()); } } + + if (VerifyAfterGC) { + Universe::verify(); + } } void ShenandoahConcurrentGC::op_cleanup_complete() { diff --git a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.hpp b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.hpp index a1837068a7cc0..b4c858bb24551 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.hpp @@ -67,16 +67,16 @@ class ShenandoahConcurrentGC : public ShenandoahGC { // call the entry method below void vmop_entry_init_mark(); void vmop_entry_final_mark(); - void vmop_entry_init_updaterefs(); - void vmop_entry_final_updaterefs(); + void vmop_entry_init_update_refs(); + void vmop_entry_final_update_refs(); void vmop_entry_final_roots(); // Entry methods to normally STW GC operations. These set up logging, monitoring // and workers for net VM operation void entry_init_mark(); void entry_final_mark(); - void entry_init_updaterefs(); - void entry_final_updaterefs(); + void entry_init_update_refs(); + void entry_final_update_refs(); void entry_final_roots(); // Entry methods to normally concurrent GC operations. These set up logging, monitoring @@ -93,7 +93,7 @@ class ShenandoahConcurrentGC : public ShenandoahGC { void entry_cleanup_early(); void entry_evacuate(); void entry_update_thread_roots(); - void entry_updaterefs(); + void entry_update_refs(); void entry_cleanup_complete(); // Called when the collection set is empty, but the generational mode has regions to promote in place @@ -112,10 +112,10 @@ class ShenandoahConcurrentGC : public ShenandoahGC { void op_strong_roots(); void op_cleanup_early(); void op_evacuate(); - void op_init_updaterefs(); - void op_updaterefs(); + void op_init_update_refs(); + void op_update_refs(); void op_update_thread_roots(); - void op_final_updaterefs(); + void op_final_update_refs(); void op_final_roots(); void op_cleanup_complete(); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp index 1709844a8c39a..1feb19f6e4a9a 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/satbMarkQueue.hpp" #include "gc/shared/strongRootsScope.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp b/src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp index 136ac22d840ff..7208a0926828e 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahCollectorPolicy.hpp" #include "gc/shenandoah/shenandoahConcurrentGC.hpp" #include "gc/shenandoah/shenandoahControlThread.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahController.cpp b/src/hotspot/share/gc/shenandoah/shenandoahController.cpp index effa4a8f1fc9c..a4d5a57234918 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahController.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahController.cpp @@ -1,5 +1,6 @@ /* * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * 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 +22,6 @@ * questions. * */ -#include "precompiled.hpp" #include "gc/shared/gc_globals.hpp" #include "gc/shenandoah/shenandoahController.hpp" @@ -61,7 +61,7 @@ void ShenandoahController::handle_alloc_failure(ShenandoahAllocRequest& req, boo if (try_set_alloc_failure_gc(is_humongous)) { // Only report the first allocation failure - log_info(gc)("Failed to allocate %s, " SIZE_FORMAT "%s", + log_info(gc)("Failed to allocate %s, %zu%s", req.type_string(), byte_size_in_proper_unit(req.size() * HeapWordSize), proper_unit_for_byte_size(req.size() * HeapWordSize)); @@ -84,7 +84,7 @@ void ShenandoahController::handle_alloc_failure_evac(size_t words) { if (try_set_alloc_failure_gc(is_humongous)) { // Only report the first allocation failure - log_info(gc)("Failed to allocate " SIZE_FORMAT "%s for evacuation", + log_info(gc)("Failed to allocate %zu%s for evacuation", byte_size_in_proper_unit(words * HeapWordSize), proper_unit_for_byte_size(words * HeapWordSize)); } @@ -109,4 +109,3 @@ bool ShenandoahController::try_set_alloc_failure_gc(bool is_humongous) { bool ShenandoahController::is_alloc_failure_gc() { return _alloc_failure_gc.is_set(); } - diff --git a/src/hotspot/share/gc/shenandoah/shenandoahDegeneratedGC.cpp b/src/hotspot/share/gc/shenandoah/shenandoahDegeneratedGC.cpp index 7d2690ef5f614..95d8543f46ab7 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahDegeneratedGC.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahDegeneratedGC.cpp @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/collectorCounters.hpp" #include "gc/shenandoah/shenandoahCollectorPolicy.hpp" @@ -264,15 +263,15 @@ void ShenandoahDegenGC::op_degenerated() { // If heuristics thinks we should do the cycle, this flag would be set, // and we need to do update-refs. Otherwise, it would be the shortcut cycle. if (heap->has_forwarded_objects()) { - op_init_updaterefs(); + op_init_update_refs(); assert(!heap->cancelled_gc(), "STW reference update can not OOM"); } else { _abbreviated = true; } - case _degenerated_updaterefs: + case _degenerated_update_refs: if (heap->has_forwarded_objects()) { - op_updaterefs(); + op_update_refs(); op_update_roots(); assert(!heap->cancelled_gc(), "STW reference update can not OOM"); } @@ -387,16 +386,16 @@ void ShenandoahDegenGC::op_evacuate() { ShenandoahHeap::heap()->evacuate_collection_set(false /* concurrent*/); } -void ShenandoahDegenGC::op_init_updaterefs() { +void ShenandoahDegenGC::op_init_update_refs() { // Evacuation has completed ShenandoahHeap* const heap = ShenandoahHeap::heap(); heap->prepare_update_heap_references(false /*concurrent*/); heap->set_update_refs_in_progress(true); } -void ShenandoahDegenGC::op_updaterefs() { +void ShenandoahDegenGC::op_update_refs() { ShenandoahHeap* const heap = ShenandoahHeap::heap(); - ShenandoahGCPhase phase(ShenandoahPhaseTimings::degen_gc_updaterefs); + ShenandoahGCPhase phase(ShenandoahPhaseTimings::degen_gc_update_refs); // Handed over from concurrent update references phase heap->update_heap_references(false /*concurrent*/); @@ -412,7 +411,7 @@ void ShenandoahDegenGC::op_update_roots() { heap->update_heap_region_states(false /*concurrent*/); if (ShenandoahVerify) { - heap->verifier()->verify_after_updaterefs(); + heap->verifier()->verify_after_update_refs(); } if (VerifyAfterGC) { @@ -447,7 +446,7 @@ const char* ShenandoahDegenGC::degen_event_message(ShenandoahDegenPoint point) c SHENANDOAH_RETURN_EVENT_MESSAGE(_generation->type(), "Pause Degenerated GC", " (Mark)"); case _degenerated_evac: SHENANDOAH_RETURN_EVENT_MESSAGE(_generation->type(), "Pause Degenerated GC", " (Evacuation)"); - case _degenerated_updaterefs: + case _degenerated_update_refs: SHENANDOAH_RETURN_EVENT_MESSAGE(_generation->type(), "Pause Degenerated GC", " (Update Refs)"); default: ShouldNotReachHere(); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahDegeneratedGC.hpp b/src/hotspot/share/gc/shenandoah/shenandoahDegeneratedGC.hpp index 8dc8ecea75fb2..971bd67eb0df8 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahDegeneratedGC.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahDegeneratedGC.hpp @@ -53,8 +53,8 @@ class ShenandoahDegenGC : public ShenandoahGC { void op_cleanup_early(); void op_evacuate(); - void op_init_updaterefs(); - void op_updaterefs(); + void op_init_update_refs(); + void op_update_refs(); void op_update_roots(); void op_cleanup_complete(); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahEvacOOMHandler.cpp b/src/hotspot/share/gc/shenandoah/shenandoahEvacOOMHandler.cpp index 8334126b6f829..9c84ac41e8415 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahEvacOOMHandler.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahEvacOOMHandler.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahEvacOOMHandler.inline.hpp" #include "gc/shenandoah/shenandoahUtils.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahEvacTracker.cpp b/src/hotspot/share/gc/shenandoah/shenandoahEvacTracker.cpp index ededb99b24ecf..3ddc8bf636e91 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahEvacTracker.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahEvacTracker.cpp @@ -1,5 +1,6 @@ /* * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * 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 +22,6 @@ * questions. * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahAgeCensus.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" @@ -84,8 +84,8 @@ void ShenandoahEvacuationStats::print_on(outputStream* st) { #ifndef PRODUCT size_t abandoned_size = _bytes_attempted - _bytes_completed; size_t abandoned_count = _evacuations_attempted - _evacuations_completed; - st->print_cr("Evacuated " SIZE_FORMAT "%s across " SIZE_FORMAT " objects, " - "abandoned " SIZE_FORMAT "%s across " SIZE_FORMAT " objects.", + st->print_cr("Evacuated %zu%s across %zu objects, " + "abandoned %zu%s across %zu objects.", byte_size_in_proper_unit(_bytes_completed), proper_unit_for_byte_size(_bytes_completed), _evacuations_completed, byte_size_in_proper_unit(abandoned_size), proper_unit_for_byte_size(abandoned_size), diff --git a/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp b/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp index 89a04d23cec92..138e032074831 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) 2016, 2021, Red Hat, Inc. All rights reserved. * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * 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 +24,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/tlab_globals.hpp" #include "gc/shenandoah/shenandoahAffiliation.hpp" #include "gc/shenandoah/shenandoahFreeSet.hpp" @@ -65,7 +65,7 @@ class ShenandoahLeftRightIterator { bool has_next() const { if (_idx <= _end) { - assert(_partitions->in_free_set(_partition, _idx), "Boundaries or find_last_set_bit failed: " SSIZE_FORMAT, _idx); + assert(_partitions->in_free_set(_partition, _idx), "Boundaries or find_last_set_bit failed: %zd", _idx); return true; } return false; @@ -96,7 +96,7 @@ class ShenandoahRightLeftIterator { bool has_next() const { if (_idx >= _end) { - assert(_partitions->in_free_set(_partition, _idx), "Boundaries or find_last_set_bit failed: " SSIZE_FORMAT, _idx); + assert(_partitions->in_free_set(_partition, _idx), "Boundaries or find_last_set_bit failed: %zd", _idx); return true; } return false; @@ -114,17 +114,17 @@ class ShenandoahRightLeftIterator { #ifndef PRODUCT void ShenandoahRegionPartitions::dump_bitmap() const { - log_debug(gc)("Mutator range [" SSIZE_FORMAT ", " SSIZE_FORMAT "], Collector range [" SSIZE_FORMAT ", " SSIZE_FORMAT - "], Old Collector range [" SSIZE_FORMAT ", " SSIZE_FORMAT "]", + log_debug(gc)("Mutator range [%zd, %zd], Collector range [%zd, %zd" + "], Old Collector range [%zd, %zd]", _leftmosts[int(ShenandoahFreeSetPartitionId::Mutator)], _rightmosts[int(ShenandoahFreeSetPartitionId::Mutator)], _leftmosts[int(ShenandoahFreeSetPartitionId::Collector)], _rightmosts[int(ShenandoahFreeSetPartitionId::Collector)], _leftmosts[int(ShenandoahFreeSetPartitionId::OldCollector)], _rightmosts[int(ShenandoahFreeSetPartitionId::OldCollector)]); - log_debug(gc)("Empty Mutator range [" SSIZE_FORMAT ", " SSIZE_FORMAT - "], Empty Collector range [" SSIZE_FORMAT ", " SSIZE_FORMAT - "], Empty Old Collecto range [" SSIZE_FORMAT ", " SSIZE_FORMAT "]", + log_debug(gc)("Empty Mutator range [%zd, %zd" + "], Empty Collector range [%zd, %zd" + "], Empty Old Collecto range [%zd, %zd]", _leftmosts_empty[int(ShenandoahFreeSetPartitionId::Mutator)], _rightmosts_empty[int(ShenandoahFreeSetPartitionId::Mutator)], _leftmosts_empty[int(ShenandoahFreeSetPartitionId::Collector)], @@ -156,7 +156,7 @@ void ShenandoahRegionPartitions::dump_bitmap_row(idx_t region_idx) const { uintx old_collector_bits = _membership[int(ShenandoahFreeSetPartitionId::OldCollector)].bits_at(aligned_idx); uintx free_bits = mutator_bits | collector_bits | old_collector_bits; uintx notfree_bits = ~free_bits; - log_debug(gc)(SSIZE_FORMAT_W(6) ": " SIZE_FORMAT_X_0 " 0x" SIZE_FORMAT_X_0 " 0x" SIZE_FORMAT_X_0 " 0x" SIZE_FORMAT_X_0, + log_debug(gc)("%6zd : " SIZE_FORMAT_X_0 " 0x" SIZE_FORMAT_X_0 " 0x" SIZE_FORMAT_X_0 " 0x" SIZE_FORMAT_X_0, aligned_idx, mutator_bits, collector_bits, old_collector_bits, notfree_bits); } #endif @@ -272,7 +272,7 @@ void ShenandoahRegionPartitions::increase_used(ShenandoahFreeSetPartitionId whic assert (which_partition < NumPartitions, "Partition must be valid"); _used[int(which_partition)] += bytes; assert (_used[int(which_partition)] <= _capacity[int(which_partition)], - "Must not use (" SIZE_FORMAT ") more than capacity (" SIZE_FORMAT ") after increase by " SIZE_FORMAT, + "Must not use (%zu) more than capacity (%zu) after increase by %zu", _used[int(which_partition)], _capacity[int(which_partition)], bytes); } @@ -337,7 +337,7 @@ void ShenandoahRegionPartitions::retire_range_from_partition( ShenandoahFreeSetPartitionId partition, idx_t low_idx, idx_t high_idx) { // Note: we may remove from free partition even if region is not entirely full, such as when available < PLAB::min_size() - assert ((low_idx < _max) && (high_idx < _max), "Both indices are sane: " SIZE_FORMAT " and " SIZE_FORMAT " < " SIZE_FORMAT, + assert ((low_idx < _max) && (high_idx < _max), "Both indices are sane: %zu and %zu < %zu", low_idx, high_idx, _max); assert (partition < NumPartitions, "Cannot remove from free partitions if not already free"); @@ -352,7 +352,7 @@ void ShenandoahRegionPartitions::retire_range_from_partition( void ShenandoahRegionPartitions::retire_from_partition(ShenandoahFreeSetPartitionId partition, idx_t idx, size_t used_bytes) { // Note: we may remove from free partition even if region is not entirely full, such as when available < PLAB::min_size() - assert (idx < _max, "index is sane: " SIZE_FORMAT " < " SIZE_FORMAT, idx, _max); + assert (idx < _max, "index is sane: %zu < %zu", idx, _max); assert (partition < NumPartitions, "Cannot remove from free partitions if not already free"); assert (in_free_set(partition, idx), "Must be in partition to remove from partition"); @@ -366,7 +366,7 @@ void ShenandoahRegionPartitions::retire_from_partition(ShenandoahFreeSetPartitio } void ShenandoahRegionPartitions::make_free(idx_t idx, ShenandoahFreeSetPartitionId which_partition, size_t available) { - assert (idx < _max, "index is sane: " SIZE_FORMAT " < " SIZE_FORMAT, idx, _max); + assert (idx < _max, "index is sane: %zu < %zu", idx, _max); assert (membership(idx) == ShenandoahFreeSetPartitionId::NotFree, "Cannot make free if already free"); assert (which_partition < NumPartitions, "selected free partition must be valid"); assert (available <= _region_size_bytes, "Available cannot exceed region size"); @@ -398,14 +398,14 @@ bool ShenandoahRegionPartitions::available_implies_empty(size_t available_in_reg void ShenandoahRegionPartitions::move_from_partition_to_partition(idx_t idx, ShenandoahFreeSetPartitionId orig_partition, ShenandoahFreeSetPartitionId new_partition, size_t available) { ShenandoahHeapRegion* r = ShenandoahHeap::heap()->get_region(idx); - assert (idx < _max, "index is sane: " SIZE_FORMAT " < " SIZE_FORMAT, idx, _max); + assert (idx < _max, "index is sane: %zu < %zu", idx, _max); assert (orig_partition < NumPartitions, "Original partition must be valid"); assert (new_partition < NumPartitions, "New partition must be valid"); assert (available <= _region_size_bytes, "Available cannot exceed region size"); assert (_membership[int(orig_partition)].is_set(idx), "Cannot move from partition unless in partition"); assert ((r != nullptr) && ((r->is_trash() && (available == _region_size_bytes)) || (r->used() + available == _region_size_bytes)), - "Used: " SIZE_FORMAT " + available: " SIZE_FORMAT " should equal region size: " SIZE_FORMAT, + "Used: %zu + available: %zu should equal region size: %zu", ShenandoahHeap::heap()->get_region(idx)->used(), available, _region_size_bytes); // Expected transitions: @@ -422,13 +422,13 @@ void ShenandoahRegionPartitions::move_from_partition_to_partition(idx_t idx, She (is_young_collector_partition(orig_partition) && is_mutator_partition(new_partition)) || (is_old_collector_partition(orig_partition) && available_implies_empty(available) && is_mutator_partition(new_partition)), - "Unexpected movement between partitions, available: " SIZE_FORMAT ", _region_size_bytes: " SIZE_FORMAT + "Unexpected movement between partitions, available: %zu, _region_size_bytes: %zu" ", orig_partition: %s, new_partition: %s", available, _region_size_bytes, partition_name(orig_partition), partition_name(new_partition)); size_t used = _region_size_bytes - available; assert (_used[int(orig_partition)] >= used, - "Orig partition used: " SIZE_FORMAT " must exceed moved used: " SIZE_FORMAT " within region " SSIZE_FORMAT, + "Orig partition used: %zu must exceed moved used: %zu within region %zd", _used[int(orig_partition)], used, idx); _membership[int(orig_partition)].clear_bit(idx); @@ -451,7 +451,7 @@ const char* ShenandoahRegionPartitions::partition_membership_name(idx_t idx) con } inline ShenandoahFreeSetPartitionId ShenandoahRegionPartitions::membership(idx_t idx) const { - assert (idx < _max, "index is sane: " SIZE_FORMAT " < " SIZE_FORMAT, idx, _max); + assert (idx < _max, "index is sane: %zu < %zu", idx, _max); ShenandoahFreeSetPartitionId result = ShenandoahFreeSetPartitionId::NotFree; for (uint partition_id = 0; partition_id < UIntNumPartitions; partition_id++) { if (_membership[partition_id].is_set(idx)) { @@ -464,7 +464,7 @@ inline ShenandoahFreeSetPartitionId ShenandoahRegionPartitions::membership(idx_t #ifdef ASSERT inline bool ShenandoahRegionPartitions::partition_id_matches(idx_t idx, ShenandoahFreeSetPartitionId test_partition) const { - assert (idx < _max, "index is sane: " SIZE_FORMAT " < " SIZE_FORMAT, idx, _max); + assert (idx < _max, "index is sane: %zu < %zu", idx, _max); assert (test_partition < ShenandoahFreeSetPartitionId::NotFree, "must be a valid partition"); return membership(idx) == test_partition; @@ -543,7 +543,7 @@ idx_t ShenandoahRegionPartitions::leftmost_empty(ShenandoahFreeSetPartitionId wh } for (idx_t idx = find_index_of_next_available_region(which_partition, _leftmosts_empty[int(which_partition)]); idx < max_regions; ) { - assert(in_free_set(which_partition, idx), "Boundaries or find_last_set_bit failed: " SSIZE_FORMAT, idx); + assert(in_free_set(which_partition, idx), "Boundaries or find_last_set_bit failed: %zd", idx); if (_free_set->alloc_capacity(idx) == _region_size_bytes) { _leftmosts_empty[int(which_partition)] = idx; return idx; @@ -562,7 +562,7 @@ idx_t ShenandoahRegionPartitions::rightmost_empty(ShenandoahFreeSetPartitionId w } for (idx_t idx = find_index_of_previous_available_region(which_partition, _rightmosts_empty[int(which_partition)]); idx >= 0; ) { - assert(in_free_set(which_partition, idx), "Boundaries or find_last_set_bit failed: " SSIZE_FORMAT, idx); + assert(in_free_set(which_partition, idx), "Boundaries or find_last_set_bit failed: %zd", idx); if (_free_set->alloc_capacity(idx) == _region_size_bytes) { _rightmosts_empty[int(which_partition)] = idx; return idx; @@ -625,103 +625,103 @@ void ShenandoahRegionPartitions::assert_bounds() { // Performance invariants. Failing these would not break the free partition, but performance would suffer. assert (leftmost(ShenandoahFreeSetPartitionId::Mutator) <= _max, - "leftmost in bounds: " SSIZE_FORMAT " < " SSIZE_FORMAT, leftmost(ShenandoahFreeSetPartitionId::Mutator), _max); + "leftmost in bounds: %zd < %zd", leftmost(ShenandoahFreeSetPartitionId::Mutator), _max); assert (rightmost(ShenandoahFreeSetPartitionId::Mutator) < _max, - "rightmost in bounds: " SSIZE_FORMAT " < " SSIZE_FORMAT, rightmost(ShenandoahFreeSetPartitionId::Mutator), _max); + "rightmost in bounds: %zd < %zd", rightmost(ShenandoahFreeSetPartitionId::Mutator), _max); assert (leftmost(ShenandoahFreeSetPartitionId::Mutator) == _max || partition_id_matches(leftmost(ShenandoahFreeSetPartitionId::Mutator), ShenandoahFreeSetPartitionId::Mutator), - "leftmost region should be free: " SSIZE_FORMAT, leftmost(ShenandoahFreeSetPartitionId::Mutator)); + "leftmost region should be free: %zd", leftmost(ShenandoahFreeSetPartitionId::Mutator)); assert (leftmost(ShenandoahFreeSetPartitionId::Mutator) == _max || partition_id_matches(rightmost(ShenandoahFreeSetPartitionId::Mutator), ShenandoahFreeSetPartitionId::Mutator), - "rightmost region should be free: " SSIZE_FORMAT, rightmost(ShenandoahFreeSetPartitionId::Mutator)); + "rightmost region should be free: %zd", rightmost(ShenandoahFreeSetPartitionId::Mutator)); // If Mutator partition is empty, leftmosts will both equal max, rightmosts will both equal zero. // Likewise for empty region partitions. idx_t beg_off = leftmosts[int(ShenandoahFreeSetPartitionId::Mutator)]; idx_t end_off = rightmosts[int(ShenandoahFreeSetPartitionId::Mutator)]; assert (beg_off >= leftmost(ShenandoahFreeSetPartitionId::Mutator), - "free regions before the leftmost: " SSIZE_FORMAT ", bound " SSIZE_FORMAT, + "free regions before the leftmost: %zd, bound %zd", beg_off, leftmost(ShenandoahFreeSetPartitionId::Mutator)); assert (end_off <= rightmost(ShenandoahFreeSetPartitionId::Mutator), - "free regions past the rightmost: " SSIZE_FORMAT ", bound " SSIZE_FORMAT, + "free regions past the rightmost: %zd, bound %zd", end_off, rightmost(ShenandoahFreeSetPartitionId::Mutator)); beg_off = empty_leftmosts[int(ShenandoahFreeSetPartitionId::Mutator)]; end_off = empty_rightmosts[int(ShenandoahFreeSetPartitionId::Mutator)]; assert (beg_off >= leftmost_empty(ShenandoahFreeSetPartitionId::Mutator), - "free empty regions before the leftmost: " SSIZE_FORMAT ", bound " SSIZE_FORMAT, + "free empty regions before the leftmost: %zd, bound %zd", beg_off, leftmost_empty(ShenandoahFreeSetPartitionId::Mutator)); assert (end_off <= rightmost_empty(ShenandoahFreeSetPartitionId::Mutator), - "free empty regions past the rightmost: " SSIZE_FORMAT ", bound " SSIZE_FORMAT, + "free empty regions past the rightmost: %zd, bound %zd", end_off, rightmost_empty(ShenandoahFreeSetPartitionId::Mutator)); // Performance invariants. Failing these would not break the free partition, but performance would suffer. - assert (leftmost(ShenandoahFreeSetPartitionId::Collector) <= _max, "leftmost in bounds: " SSIZE_FORMAT " < " SSIZE_FORMAT, + assert (leftmost(ShenandoahFreeSetPartitionId::Collector) <= _max, "leftmost in bounds: %zd < %zd", leftmost(ShenandoahFreeSetPartitionId::Collector), _max); - assert (rightmost(ShenandoahFreeSetPartitionId::Collector) < _max, "rightmost in bounds: " SSIZE_FORMAT " < " SSIZE_FORMAT, + assert (rightmost(ShenandoahFreeSetPartitionId::Collector) < _max, "rightmost in bounds: %zd < %zd", rightmost(ShenandoahFreeSetPartitionId::Collector), _max); assert (leftmost(ShenandoahFreeSetPartitionId::Collector) == _max || partition_id_matches(leftmost(ShenandoahFreeSetPartitionId::Collector), ShenandoahFreeSetPartitionId::Collector), - "leftmost region should be free: " SSIZE_FORMAT, leftmost(ShenandoahFreeSetPartitionId::Collector)); + "leftmost region should be free: %zd", leftmost(ShenandoahFreeSetPartitionId::Collector)); assert (leftmost(ShenandoahFreeSetPartitionId::Collector) == _max || partition_id_matches(rightmost(ShenandoahFreeSetPartitionId::Collector), ShenandoahFreeSetPartitionId::Collector), - "rightmost region should be free: " SSIZE_FORMAT, rightmost(ShenandoahFreeSetPartitionId::Collector)); + "rightmost region should be free: %zd", rightmost(ShenandoahFreeSetPartitionId::Collector)); // If Collector partition is empty, leftmosts will both equal max, rightmosts will both equal zero. // Likewise for empty region partitions. beg_off = leftmosts[int(ShenandoahFreeSetPartitionId::Collector)]; end_off = rightmosts[int(ShenandoahFreeSetPartitionId::Collector)]; assert (beg_off >= leftmost(ShenandoahFreeSetPartitionId::Collector), - "free regions before the leftmost: " SSIZE_FORMAT ", bound " SSIZE_FORMAT, + "free regions before the leftmost: %zd, bound %zd", beg_off, leftmost(ShenandoahFreeSetPartitionId::Collector)); assert (end_off <= rightmost(ShenandoahFreeSetPartitionId::Collector), - "free regions past the rightmost: " SSIZE_FORMAT ", bound " SSIZE_FORMAT, + "free regions past the rightmost: %zd, bound %zd", end_off, rightmost(ShenandoahFreeSetPartitionId::Collector)); beg_off = empty_leftmosts[int(ShenandoahFreeSetPartitionId::Collector)]; end_off = empty_rightmosts[int(ShenandoahFreeSetPartitionId::Collector)]; assert (beg_off >= _leftmosts_empty[int(ShenandoahFreeSetPartitionId::Collector)], - "free empty regions before the leftmost: " SSIZE_FORMAT ", bound " SSIZE_FORMAT, + "free empty regions before the leftmost: %zd, bound %zd", beg_off, leftmost_empty(ShenandoahFreeSetPartitionId::Collector)); assert (end_off <= _rightmosts_empty[int(ShenandoahFreeSetPartitionId::Collector)], - "free empty regions past the rightmost: " SSIZE_FORMAT ", bound " SSIZE_FORMAT, + "free empty regions past the rightmost: %zd, bound %zd", end_off, rightmost_empty(ShenandoahFreeSetPartitionId::Collector)); // Performance invariants. Failing these would not break the free partition, but performance would suffer. - assert (leftmost(ShenandoahFreeSetPartitionId::OldCollector) <= _max, "leftmost in bounds: " SSIZE_FORMAT " < " SSIZE_FORMAT, + assert (leftmost(ShenandoahFreeSetPartitionId::OldCollector) <= _max, "leftmost in bounds: %zd < %zd", leftmost(ShenandoahFreeSetPartitionId::OldCollector), _max); - assert (rightmost(ShenandoahFreeSetPartitionId::OldCollector) < _max, "rightmost in bounds: " SSIZE_FORMAT " < " SSIZE_FORMAT, + assert (rightmost(ShenandoahFreeSetPartitionId::OldCollector) < _max, "rightmost in bounds: %zd < %zd", rightmost(ShenandoahFreeSetPartitionId::OldCollector), _max); assert (leftmost(ShenandoahFreeSetPartitionId::OldCollector) == _max || partition_id_matches(leftmost(ShenandoahFreeSetPartitionId::OldCollector), ShenandoahFreeSetPartitionId::OldCollector), - "leftmost region should be free: " SSIZE_FORMAT, leftmost(ShenandoahFreeSetPartitionId::OldCollector)); + "leftmost region should be free: %zd", leftmost(ShenandoahFreeSetPartitionId::OldCollector)); assert (leftmost(ShenandoahFreeSetPartitionId::OldCollector) == _max || partition_id_matches(rightmost(ShenandoahFreeSetPartitionId::OldCollector), ShenandoahFreeSetPartitionId::OldCollector), - "rightmost region should be free: " SSIZE_FORMAT, rightmost(ShenandoahFreeSetPartitionId::OldCollector)); + "rightmost region should be free: %zd", rightmost(ShenandoahFreeSetPartitionId::OldCollector)); // If OldCollector partition is empty, leftmosts will both equal max, rightmosts will both equal zero. // Likewise for empty region partitions. beg_off = leftmosts[int(ShenandoahFreeSetPartitionId::OldCollector)]; end_off = rightmosts[int(ShenandoahFreeSetPartitionId::OldCollector)]; assert (beg_off >= leftmost(ShenandoahFreeSetPartitionId::OldCollector), - "free regions before the leftmost: " SSIZE_FORMAT ", bound " SSIZE_FORMAT, + "free regions before the leftmost: %zd, bound %zd", beg_off, leftmost(ShenandoahFreeSetPartitionId::OldCollector)); assert (end_off <= rightmost(ShenandoahFreeSetPartitionId::OldCollector), - "free regions past the rightmost: " SSIZE_FORMAT ", bound " SSIZE_FORMAT, + "free regions past the rightmost: %zd, bound %zd", end_off, rightmost(ShenandoahFreeSetPartitionId::OldCollector)); beg_off = empty_leftmosts[int(ShenandoahFreeSetPartitionId::OldCollector)]; end_off = empty_rightmosts[int(ShenandoahFreeSetPartitionId::OldCollector)]; assert (beg_off >= _leftmosts_empty[int(ShenandoahFreeSetPartitionId::OldCollector)], - "free empty regions before the leftmost: " SSIZE_FORMAT ", bound " SSIZE_FORMAT, + "free empty regions before the leftmost: %zd, bound %zd", beg_off, leftmost_empty(ShenandoahFreeSetPartitionId::OldCollector)); assert (end_off <= _rightmosts_empty[int(ShenandoahFreeSetPartitionId::OldCollector)], - "free empty regions past the rightmost: " SSIZE_FORMAT ", bound " SSIZE_FORMAT, + "free empty regions past the rightmost: %zd, bound %zd", end_off, rightmost_empty(ShenandoahFreeSetPartitionId::OldCollector)); } #endif @@ -937,7 +937,7 @@ HeapWord* ShenandoahFreeSet::try_allocate_from_mutator(ShenandoahAllocRequest& r } // Region r is entirely empty. If try_allocate_in fails on region r, something else is really wrong. // Don't bother to retry with other regions. - log_debug(gc, free)("Flipped region " SIZE_FORMAT " to gc for request: " PTR_FORMAT, idx, p2i(&req)); + log_debug(gc, free)("Flipped region %zu to gc for request: " PTR_FORMAT, idx, p2i(&req)); return try_allocate_in(r, req, in_new_region); } } @@ -996,8 +996,10 @@ HeapWord* ShenandoahFreeSet::allocate_aligned_plab(size_t size, ShenandoahAllocR } HeapWord* ShenandoahFreeSet::try_allocate_in(ShenandoahHeapRegion* r, ShenandoahAllocRequest& req, bool& in_new_region) { - assert (has_alloc_capacity(r), "Performance: should avoid full regions on this path: " SIZE_FORMAT, r->index()); + assert (has_alloc_capacity(r), "Performance: should avoid full regions on this path: %zu", r->index()); if (_heap->is_concurrent_weak_root_in_progress() && r->is_trash()) { + // We cannot use this region for allocation when weak roots are in progress because the collector may need + // to reference unmarked oops during concurrent classunloading. return nullptr; } HeapWord* result = nullptr; @@ -1005,9 +1007,10 @@ HeapWord* ShenandoahFreeSet::try_allocate_in(ShenandoahHeapRegion* r, Shenandoah in_new_region = r->is_empty(); if (in_new_region) { - log_debug(gc)("Using new region (" SIZE_FORMAT ") for %s (" PTR_FORMAT ").", - r->index(), ShenandoahAllocRequest::alloc_type_to_string(req.type()), p2i(&req)); - assert(!r->is_affiliated(), "New region " SIZE_FORMAT " should be unaffiliated", r->index()); + log_debug(gc, free)("Using new region (%zu) for %s (" PTR_FORMAT ").", + r->index(), ShenandoahAllocRequest::alloc_type_to_string(req.type()), p2i(&req)); + assert(!r->is_affiliated(), "New region %zu should be unaffiliated", r->index()); + r->set_affiliation(req.affiliation()); if (r->is_old()) { // Any OLD region allocated during concurrent coalesce-and-fill does not need to be coalesced and filled because @@ -1026,10 +1029,10 @@ HeapWord* ShenandoahFreeSet::try_allocate_in(ShenandoahHeapRegion* r, Shenandoah assert(ctx->top_at_mark_start(r) == r->bottom(), "Newly established allocation region starts with TAMS equal to bottom"); assert(ctx->is_bitmap_range_within_region_clear(ctx->top_bitmap(r), r->end()), "Bitmap above top_bitmap() must be clear"); #endif - log_debug(gc)("Using new region (" SIZE_FORMAT ") for %s (" PTR_FORMAT ").", - r->index(), ShenandoahAllocRequest::alloc_type_to_string(req.type()), p2i(&req)); + log_debug(gc, free)("Using new region (%zu) for %s (" PTR_FORMAT ").", + r->index(), ShenandoahAllocRequest::alloc_type_to_string(req.type()), p2i(&req)); } else { - assert(r->is_affiliated(), "Region " SIZE_FORMAT " that is not new should be affiliated", r->index()); + assert(r->is_affiliated(), "Region %zu that is not new should be affiliated", r->index()); if (r->affiliation() != req.affiliation()) { assert(_heap->mode()->is_generational(), "Request for %s from %s region should only happen in generational mode.", req.affiliation_name(), r->affiliation_name()); @@ -1060,8 +1063,8 @@ HeapWord* ShenandoahFreeSet::try_allocate_in(ShenandoahHeapRegion* r, Shenandoah req.set_actual_size(adjusted_size); } else { // Otherwise, leave result == nullptr because the adjusted size is smaller than min size. - log_trace(gc, free)("Failed to shrink PLAB request (" SIZE_FORMAT ") in region " SIZE_FORMAT " to " SIZE_FORMAT - " because min_size() is " SIZE_FORMAT, req.size(), r->index(), adjusted_size, req.min_size()); + log_trace(gc, free)("Failed to shrink PLAB request (%zu) in region %zu to %zu" + " because min_size() is %zu", req.size(), r->index(), adjusted_size, req.min_size()); } } else { // This is a GCLAB or a TLAB allocation @@ -1072,11 +1075,11 @@ HeapWord* ShenandoahFreeSet::try_allocate_in(ShenandoahHeapRegion* r, Shenandoah } if (adjusted_size >= req.min_size()) { result = r->allocate(adjusted_size, req); - assert (result != nullptr, "Allocation must succeed: free " SIZE_FORMAT ", actual " SIZE_FORMAT, free, adjusted_size); + assert (result != nullptr, "Allocation must succeed: free %zu, actual %zu", free, adjusted_size); req.set_actual_size(adjusted_size); } else { - log_trace(gc, free)("Failed to shrink TLAB or GCLAB request (" SIZE_FORMAT ") in region " SIZE_FORMAT " to " SIZE_FORMAT - " because min_size() is " SIZE_FORMAT, req.size(), r->index(), adjusted_size, req.min_size()); + log_trace(gc, free)("Failed to shrink TLAB or GCLAB request (%zu) in region %zu to %zu" + " because min_size() is %zu", req.size(), r->index(), adjusted_size, req.min_size()); } } } else { @@ -1292,7 +1295,7 @@ void ShenandoahFreeSet::flip_to_old_gc(ShenandoahHeapRegion* r) { _heap->old_generation()->augment_evacuation_reserve(region_capacity); bool transferred = gen_heap->generation_sizer()->transfer_to_old(1); if (!transferred) { - log_warning(gc, free)("Forcing transfer of " SIZE_FORMAT " to old reserve.", idx); + log_warning(gc, free)("Forcing transfer of %zu to old reserve.", idx); gen_heap->generation_sizer()->force_transfer_to_old(1); } // We do not ensure that the region is no longer trash, relying on try_allocate_in(), which always comes next, @@ -1424,23 +1427,24 @@ void ShenandoahFreeSet::find_regions_with_alloc_capacity(size_t &young_cset_regi } } } - log_debug(gc)(" At end of prep_to_rebuild, mutator_leftmost: " SIZE_FORMAT - ", mutator_rightmost: " SIZE_FORMAT - ", mutator_leftmost_empty: " SIZE_FORMAT - ", mutator_rightmost_empty: " SIZE_FORMAT - ", mutator_regions: " SIZE_FORMAT - ", mutator_used: " SIZE_FORMAT, - mutator_leftmost, mutator_rightmost, mutator_leftmost_empty, mutator_rightmost_empty, - mutator_regions, mutator_used); - - log_debug(gc)(" old_collector_leftmost: " SIZE_FORMAT - ", old_collector_rightmost: " SIZE_FORMAT - ", old_collector_leftmost_empty: " SIZE_FORMAT - ", old_collector_rightmost_empty: " SIZE_FORMAT - ", old_collector_regions: " SIZE_FORMAT - ", old_collector_used: " SIZE_FORMAT, - old_collector_leftmost, old_collector_rightmost, old_collector_leftmost_empty, old_collector_rightmost_empty, - old_collector_regions, old_collector_used); + log_debug(gc, free)(" At end of prep_to_rebuild, mutator_leftmost: %zu" + ", mutator_rightmost: %zu" + ", mutator_leftmost_empty: %zu" + ", mutator_rightmost_empty: %zu" + ", mutator_regions: %zu" + ", mutator_used: %zu", + mutator_leftmost, mutator_rightmost, mutator_leftmost_empty, mutator_rightmost_empty, + mutator_regions, mutator_used); + + log_debug(gc, free)(" old_collector_leftmost: %zu" + ", old_collector_rightmost: %zu" + ", old_collector_leftmost_empty: %zu" + ", old_collector_rightmost_empty: %zu" + ", old_collector_regions: %zu" + ", old_collector_used: %zu", + old_collector_leftmost, old_collector_rightmost, old_collector_leftmost_empty, old_collector_rightmost_empty, + old_collector_regions, old_collector_used); + idx_t rightmost_idx = (mutator_leftmost == max_regions)? -1: (idx_t) mutator_rightmost; idx_t rightmost_empty_idx = (mutator_leftmost_empty == max_regions)? -1: (idx_t) mutator_rightmost_empty; @@ -1450,12 +1454,12 @@ void ShenandoahFreeSet::find_regions_with_alloc_capacity(size_t &young_cset_regi rightmost_empty_idx = (old_collector_leftmost_empty == max_regions)? -1: (idx_t) old_collector_rightmost_empty; _partitions.establish_old_collector_intervals(old_collector_leftmost, rightmost_idx, old_collector_leftmost_empty, rightmost_empty_idx, old_collector_regions, old_collector_used); - log_debug(gc)(" After find_regions_with_alloc_capacity(), Mutator range [" SSIZE_FORMAT ", " SSIZE_FORMAT "]," - " Old Collector range [" SSIZE_FORMAT ", " SSIZE_FORMAT "]", - _partitions.leftmost(ShenandoahFreeSetPartitionId::Mutator), - _partitions.rightmost(ShenandoahFreeSetPartitionId::Mutator), - _partitions.leftmost(ShenandoahFreeSetPartitionId::OldCollector), - _partitions.rightmost(ShenandoahFreeSetPartitionId::OldCollector)); + log_debug(gc, free)(" After find_regions_with_alloc_capacity(), Mutator range [%zd, %zd]," + " Old Collector range [%zd, %zd]", + _partitions.leftmost(ShenandoahFreeSetPartitionId::Mutator), + _partitions.rightmost(ShenandoahFreeSetPartitionId::Mutator), + _partitions.leftmost(ShenandoahFreeSetPartitionId::OldCollector), + _partitions.rightmost(ShenandoahFreeSetPartitionId::OldCollector)); } // Returns number of regions transferred, adds transferred bytes to var argument bytes_transferred @@ -1466,7 +1470,6 @@ size_t ShenandoahFreeSet::transfer_empty_regions_from_collector_set_to_mutator_s const size_t region_size_bytes = ShenandoahHeapRegion::region_size_bytes(); size_t transferred_regions = 0; ShenandoahLeftRightIterator iterator(&_partitions, which_collector, true); - idx_t rightmost = _partitions.rightmost_empty(which_collector); for (idx_t idx = iterator.current(); transferred_regions < max_xfer_regions && iterator.has_next(); idx = iterator.next()) { // Note: can_allocate_from() denotes that region is entirely empty if (can_allocate_from(idx)) { @@ -1534,8 +1537,8 @@ void ShenandoahFreeSet::move_regions_from_collector_to_mutator(size_t max_xfer_r } size_t total_xfer = collector_xfer + old_collector_xfer; - log_info(gc, ergo)("At start of update refs, moving " SIZE_FORMAT "%s to Mutator free set from Collector Reserve (" - SIZE_FORMAT "%s) and from Old Collector Reserve (" SIZE_FORMAT "%s)", + log_info(gc, ergo)("At start of update refs, moving %zu%s to Mutator free set from Collector Reserve (" + "%zu%s) and from Old Collector Reserve (%zu%s)", byte_size_in_proper_unit(total_xfer), proper_unit_for_byte_size(total_xfer), byte_size_in_proper_unit(collector_xfer), proper_unit_for_byte_size(collector_xfer), byte_size_in_proper_unit(old_collector_xfer), proper_unit_for_byte_size(old_collector_xfer)); @@ -1571,11 +1574,11 @@ void ShenandoahFreeSet::establish_generation_sizes(size_t young_region_count, si if (new_old_capacity > original_old_capacity) { size_t region_count = (new_old_capacity - original_old_capacity) / region_size_bytes; - log_info(gc, ergo)("Transfer " SIZE_FORMAT " region(s) from %s to %s, yielding increased size: " PROPERFMT, + log_info(gc, ergo)("Transfer %zu region(s) from %s to %s, yielding increased size: " PROPERFMT, region_count, young_gen->name(), old_gen->name(), PROPERFMTARGS(new_old_capacity)); } else if (new_old_capacity < original_old_capacity) { size_t region_count = (original_old_capacity - new_old_capacity) / region_size_bytes; - log_info(gc, ergo)("Transfer " SIZE_FORMAT " region(s) from %s to %s, yielding increased size: " PROPERFMT, + log_info(gc, ergo)("Transfer %zu region(s) from %s to %s, yielding increased size: " PROPERFMT, region_count, old_gen->name(), young_gen->name(), PROPERFMTARGS(new_young_capacity)); } // This balances generations, so clear any pending request to balance. @@ -1653,7 +1656,7 @@ void ShenandoahFreeSet::compute_young_and_old_reserves(size_t young_cset_regions young_reserve_result = young_generation->get_evacuation_reserve(); old_reserve_result = promoted_reserve + old_evac_reserve; assert(old_reserve_result <= old_available, - "Cannot reserve (" SIZE_FORMAT " + " SIZE_FORMAT") more OLD than is available: " SIZE_FORMAT, + "Cannot reserve (%zu + %zu) more OLD than is available: %zu", promoted_reserve, old_evac_reserve, old_available); } else { // We are rebuilding at end of GC, so we set aside budgets specified on command line (or defaults) @@ -1712,13 +1715,14 @@ void ShenandoahFreeSet::reserve_regions(size_t to_reserve, size_t to_reserve_old // OLD regions that have available memory are already in the old_collector free set. _partitions.move_from_partition_to_partition(idx, ShenandoahFreeSetPartitionId::Mutator, ShenandoahFreeSetPartitionId::OldCollector, ac); - log_debug(gc)(" Shifting region " SIZE_FORMAT " from mutator_free to old_collector_free", idx); - log_debug(gc)(" Shifted Mutator range [" SSIZE_FORMAT ", " SSIZE_FORMAT "]," - " Old Collector range [" SSIZE_FORMAT ", " SSIZE_FORMAT "]", - _partitions.leftmost(ShenandoahFreeSetPartitionId::Mutator), - _partitions.rightmost(ShenandoahFreeSetPartitionId::Mutator), - _partitions.leftmost(ShenandoahFreeSetPartitionId::OldCollector), - _partitions.rightmost(ShenandoahFreeSetPartitionId::OldCollector)); + log_trace(gc, free)(" Shifting region %zu from mutator_free to old_collector_free", idx); + log_trace(gc, free)(" Shifted Mutator range [%zd, %zd]," + " Old Collector range [%zd, %zd]", + _partitions.leftmost(ShenandoahFreeSetPartitionId::Mutator), + _partitions.rightmost(ShenandoahFreeSetPartitionId::Mutator), + _partitions.leftmost(ShenandoahFreeSetPartitionId::OldCollector), + _partitions.rightmost(ShenandoahFreeSetPartitionId::OldCollector)); + old_region_count++; continue; } @@ -1735,13 +1739,14 @@ void ShenandoahFreeSet::reserve_regions(size_t to_reserve, size_t to_reserve_old // collection set, and they are easily evacuated because they have low density of live objects. _partitions.move_from_partition_to_partition(idx, ShenandoahFreeSetPartitionId::Mutator, ShenandoahFreeSetPartitionId::Collector, ac); - log_debug(gc)(" Shifting region " SIZE_FORMAT " from mutator_free to collector_free", idx); - log_debug(gc)(" Shifted Mutator range [" SSIZE_FORMAT ", " SSIZE_FORMAT "]," - " Collector range [" SSIZE_FORMAT ", " SSIZE_FORMAT "]", - _partitions.leftmost(ShenandoahFreeSetPartitionId::Mutator), - _partitions.rightmost(ShenandoahFreeSetPartitionId::Mutator), - _partitions.leftmost(ShenandoahFreeSetPartitionId::Collector), - _partitions.rightmost(ShenandoahFreeSetPartitionId::Collector)); + log_trace(gc, free)(" Shifting region %zu from mutator_free to collector_free", idx); + log_trace(gc, free)(" Shifted Mutator range [%zd, %zd]," + " Collector range [%zd, %zd]", + _partitions.leftmost(ShenandoahFreeSetPartitionId::Mutator), + _partitions.rightmost(ShenandoahFreeSetPartitionId::Mutator), + _partitions.leftmost(ShenandoahFreeSetPartitionId::Collector), + _partitions.rightmost(ShenandoahFreeSetPartitionId::Collector)); + } } @@ -1753,8 +1758,8 @@ void ShenandoahFreeSet::reserve_regions(size_t to_reserve, size_t to_reserve_old } size_t reserve = _partitions.available_in(ShenandoahFreeSetPartitionId::Collector); if (reserve < to_reserve) { - log_debug(gc)("Wanted " PROPERFMT " for young reserve, but only reserved: " PROPERFMT, - PROPERFMTARGS(to_reserve), PROPERFMTARGS(reserve)); + log_info(gc, free)("Wanted " PROPERFMT " for young reserve, but only reserved: " PROPERFMT, + PROPERFMTARGS(to_reserve), PROPERFMTARGS(reserve)); } } } @@ -1805,34 +1810,42 @@ void ShenandoahFreeSet::log_status() { #ifdef ASSERT // Dump of the FreeSet details is only enabled if assertions are enabled - if (LogTarget(Debug, gc, free)::is_enabled()) { + LogTarget(Debug, gc, free) debug_free; + if (debug_free.is_enabled()) { #define BUFFER_SIZE 80 + LogStream ls(debug_free); char buffer[BUFFER_SIZE]; for (uint i = 0; i < BUFFER_SIZE; i++) { buffer[i] = '\0'; } - log_debug(gc)("FreeSet map legend:" - " M:mutator_free C:collector_free O:old_collector_free" - " H:humongous ~:retired old _:retired young"); - log_debug(gc)(" mutator free range [" SIZE_FORMAT ".." SIZE_FORMAT "] allocating from %s, " - " collector free range [" SIZE_FORMAT ".." SIZE_FORMAT "], " - "old collector free range [" SIZE_FORMAT ".." SIZE_FORMAT "] allocates from %s", - _partitions.leftmost(ShenandoahFreeSetPartitionId::Mutator), - _partitions.rightmost(ShenandoahFreeSetPartitionId::Mutator), - _partitions.alloc_from_left_bias(ShenandoahFreeSetPartitionId::Mutator)? "left to right": "right to left", - _partitions.leftmost(ShenandoahFreeSetPartitionId::Collector), - _partitions.rightmost(ShenandoahFreeSetPartitionId::Collector), - _partitions.leftmost(ShenandoahFreeSetPartitionId::OldCollector), - _partitions.rightmost(ShenandoahFreeSetPartitionId::OldCollector), - _partitions.alloc_from_left_bias(ShenandoahFreeSetPartitionId::OldCollector)? "left to right": "right to left"); + + ls.cr(); + ls.print_cr("Mutator free range [%zd..%zd] allocating from %s", + _partitions.leftmost(ShenandoahFreeSetPartitionId::Mutator), + _partitions.rightmost(ShenandoahFreeSetPartitionId::Mutator), + _partitions.alloc_from_left_bias(ShenandoahFreeSetPartitionId::Mutator)? "left to right": "right to left"); + + ls.print_cr("Collector free range [%zd..%zd] allocating from %s", + _partitions.leftmost(ShenandoahFreeSetPartitionId::Collector), + _partitions.rightmost(ShenandoahFreeSetPartitionId::Collector), + _partitions.alloc_from_left_bias(ShenandoahFreeSetPartitionId::Collector)? "left to right": "right to left"); + + ls.print_cr("Old collector free range [%zd..%zd] allocates from %s", + _partitions.leftmost(ShenandoahFreeSetPartitionId::OldCollector), + _partitions.rightmost(ShenandoahFreeSetPartitionId::OldCollector), + _partitions.alloc_from_left_bias(ShenandoahFreeSetPartitionId::OldCollector)? "left to right": "right to left"); + ls.cr(); + ls.print_cr("FreeSet map legend:"); + ls.print_cr(" M/m:mutator, C/c:collector O/o:old_collector (Empty/Occupied)"); + ls.print_cr(" H/h:humongous, X/x:no alloc capacity, ~/_:retired (Old/Young)"); for (uint i = 0; i < _heap->num_regions(); i++) { ShenandoahHeapRegion *r = _heap->get_region(i); uint idx = i % 64; if ((i != 0) && (idx == 0)) { - log_debug(gc)(" %6u: %s", i-64, buffer); + ls.print_cr(" %6u: %s", i-64, buffer); } if (_partitions.in_free_set(ShenandoahFreeSetPartitionId::Mutator, i)) { size_t capacity = alloc_capacity(r); @@ -1846,17 +1859,11 @@ void ShenandoahFreeSet::log_status() { size_t capacity = alloc_capacity(r); buffer[idx] = (capacity == ShenandoahHeapRegion::region_size_bytes()) ? 'O' : 'o'; } else if (r->is_humongous()) { - if (r->is_old()) { - buffer[idx] = 'H'; - } else { - buffer[idx] = 'h'; - } + buffer[idx] = (r->is_old() ? 'H' : 'h'); + } else if (alloc_capacity(r) == 0) { + buffer[idx] = (r->is_old() ? 'X' : 'x'); } else { - if (r->is_old()) { - buffer[idx] = '~'; - } else { - buffer[idx] = '_'; - } + buffer[idx] = (r->is_old() ? '~' : '_'); } } uint remnant = _heap->num_regions() % 64; @@ -1865,7 +1872,7 @@ void ShenandoahFreeSet::log_status() { } else { remnant = 64; } - log_debug(gc)(" %6u: %s", (uint) (_heap->num_regions() - remnant), buffer); + ls.print_cr(" %6u: %s", (uint) (_heap->num_regions() - remnant), buffer); } #endif @@ -1914,7 +1921,7 @@ void ShenandoahFreeSet::log_status() { // retired, the sum of used and capacities within regions that are still in the Mutator free partition may not match // my internally tracked values of used() and free(). assert(free == total_free, "Free memory should match"); - ls.print("Free: " SIZE_FORMAT "%s, Max: " SIZE_FORMAT "%s regular, " SIZE_FORMAT "%s humongous, ", + ls.print("Free: %zu%s, Max: %zu%s regular, %zu%s humongous, ", byte_size_in_proper_unit(total_free), proper_unit_for_byte_size(total_free), byte_size_in_proper_unit(max), proper_unit_for_byte_size(max), byte_size_in_proper_unit(max_humongous), proper_unit_for_byte_size(max_humongous) @@ -1927,7 +1934,7 @@ void ShenandoahFreeSet::log_status() { } else { frag_ext = 0; } - ls.print(SIZE_FORMAT "%% external, ", frag_ext); + ls.print("%zu%% external, ", frag_ext); size_t frag_int; if (_partitions.count(ShenandoahFreeSetPartitionId::Mutator) > 0) { @@ -1936,8 +1943,8 @@ void ShenandoahFreeSet::log_status() { } else { frag_int = 0; } - ls.print(SIZE_FORMAT "%% internal; ", frag_int); - ls.print("Used: " SIZE_FORMAT "%s, Mutator Free: " SIZE_FORMAT, + ls.print("%zu%% internal; ", frag_int); + ls.print("Used: %zu%s, Mutator Free: %zu", byte_size_in_proper_unit(total_used), proper_unit_for_byte_size(total_used), _partitions.count(ShenandoahFreeSetPartitionId::Mutator)); } @@ -1957,7 +1964,7 @@ void ShenandoahFreeSet::log_status() { total_used += r->used(); } } - ls.print(" Collector Reserve: " SIZE_FORMAT "%s, Max: " SIZE_FORMAT "%s; Used: " SIZE_FORMAT "%s", + ls.print(" Collector Reserve: %zu%s, Max: %zu%s; Used: %zu%s", byte_size_in_proper_unit(total_free), proper_unit_for_byte_size(total_free), byte_size_in_proper_unit(max), proper_unit_for_byte_size(max), byte_size_in_proper_unit(total_used), proper_unit_for_byte_size(total_used)); @@ -1978,7 +1985,7 @@ void ShenandoahFreeSet::log_status() { total_used += r->used(); } } - ls.print_cr(" Old Collector Reserve: " SIZE_FORMAT "%s, Max: " SIZE_FORMAT "%s; Used: " SIZE_FORMAT "%s", + ls.print_cr(" Old Collector Reserve: %zu%s, Max: %zu%s; Used: %zu%s", byte_size_in_proper_unit(total_free), proper_unit_for_byte_size(total_free), byte_size_in_proper_unit(max), proper_unit_for_byte_size(max), byte_size_in_proper_unit(total_used), proper_unit_for_byte_size(total_used)); @@ -1998,7 +2005,7 @@ HeapWord* ShenandoahFreeSet::allocate(ShenandoahAllocRequest& req, bool& in_new_ case ShenandoahAllocRequest::_alloc_gclab: case ShenandoahAllocRequest::_alloc_tlab: in_new_region = false; - assert(false, "Trying to allocate TLAB in humongous region: " SIZE_FORMAT, req.size()); + assert(false, "Trying to allocate TLAB in humongous region: %zu", req.size()); return nullptr; default: ShouldNotReachHere(); @@ -2010,20 +2017,20 @@ HeapWord* ShenandoahFreeSet::allocate(ShenandoahAllocRequest& req, bool& in_new_ } void ShenandoahFreeSet::print_on(outputStream* out) const { - out->print_cr("Mutator Free Set: " SIZE_FORMAT "", _partitions.count(ShenandoahFreeSetPartitionId::Mutator)); + out->print_cr("Mutator Free Set: %zu", _partitions.count(ShenandoahFreeSetPartitionId::Mutator)); ShenandoahLeftRightIterator mutator(const_cast(&_partitions), ShenandoahFreeSetPartitionId::Mutator); for (idx_t index = mutator.current(); mutator.has_next(); index = mutator.next()) { _heap->get_region(index)->print_on(out); } - out->print_cr("Collector Free Set: " SIZE_FORMAT "", _partitions.count(ShenandoahFreeSetPartitionId::Collector)); + out->print_cr("Collector Free Set: %zu", _partitions.count(ShenandoahFreeSetPartitionId::Collector)); ShenandoahLeftRightIterator collector(const_cast(&_partitions), ShenandoahFreeSetPartitionId::Collector); for (idx_t index = collector.current(); collector.has_next(); index = collector.next()) { _heap->get_region(index)->print_on(out); } if (_heap->mode()->is_generational()) { - out->print_cr("Old Collector Free Set: " SIZE_FORMAT "", _partitions.count(ShenandoahFreeSetPartitionId::OldCollector)); + out->print_cr("Old Collector Free Set: %zu", _partitions.count(ShenandoahFreeSetPartitionId::OldCollector)); for (idx_t index = _partitions.leftmost(ShenandoahFreeSetPartitionId::OldCollector); index <= _partitions.rightmost(ShenandoahFreeSetPartitionId::OldCollector); index++) { if (_partitions.in_free_set(ShenandoahFreeSetPartitionId::OldCollector, index)) { diff --git a/src/hotspot/share/gc/shenandoah/shenandoahFullGC.cpp b/src/hotspot/share/gc/shenandoah/shenandoahFullGC.cpp index 2847d7c78ba18..c83de047e976c 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahFullGC.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahFullGC.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) 2014, 2021, Red Hat, Inc. All rights reserved. * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * 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 +24,6 @@ * */ -#include "precompiled.hpp" #include "compiler/oopMap.hpp" #include "gc/shared/continuationGCSupport.hpp" @@ -501,7 +501,7 @@ void ShenandoahFullGC::calculate_target_humongous_objects() { size_t to_begin = heap->num_regions(); size_t to_end = heap->num_regions(); - log_debug(gc)("Full GC calculating target humongous objects from end " SIZE_FORMAT, to_end); + log_debug(gc)("Full GC calculating target humongous objects from end %zu", to_end); for (size_t c = heap->num_regions(); c > 0; c--) { ShenandoahHeapRegion *r = heap->get_region(c - 1); if (r->is_humongous_continuation() || (r->new_top() == r->bottom())) { @@ -550,7 +550,7 @@ class ShenandoahEnsureHeapActiveClosure: public ShenandoahHeapRegionClosure { if (r->is_empty_uncommitted()) { r->make_committed_bypass(); } - assert (r->is_committed(), "only committed regions in heap now, see region " SIZE_FORMAT, r->index()); + assert (r->is_committed(), "only committed regions in heap now, see region %zu", r->index()); // Record current region occupancy: this communicates empty regions are free // to the rest of Full GC code. @@ -572,14 +572,14 @@ class ShenandoahTrashImmediateGarbageClosure: public ShenandoahHeapRegionClosure if (r->is_humongous_start()) { oop humongous_obj = cast_to_oop(r->bottom()); if (!_ctx->is_marked(humongous_obj)) { - assert(!r->has_live(), "Region " SIZE_FORMAT " is not marked, should not have live", r->index()); + assert(!r->has_live(), "Region %zu is not marked, should not have live", r->index()); _heap->trash_humongous_region_at(r); } else { - assert(r->has_live(), "Region " SIZE_FORMAT " should have live", r->index()); + assert(r->has_live(), "Region %zu should have live", r->index()); } } else if (r->is_humongous_continuation()) { // If we hit continuation, the non-live humongous starts should have been trashed already - assert(r->humongous_start_region()->has_live(), "Region " SIZE_FORMAT " should have live", r->index()); + assert(r->humongous_start_region()->has_live(), "Region %zu should have live", r->index()); } else if (r->is_regular()) { if (!r->has_live()) { r->make_trash_immediate(); @@ -715,8 +715,8 @@ void ShenandoahFullGC::distribute_slices(ShenandoahHeapRegionSet** worker_slices ShenandoahHeapRegion* r = it.next(); while (r != nullptr) { size_t idx = r->index(); - assert(ShenandoahPrepareForCompactionTask::is_candidate_region(r), "Sanity: " SIZE_FORMAT, idx); - assert(!map.at(idx), "No region distributed twice: " SIZE_FORMAT, idx); + assert(ShenandoahPrepareForCompactionTask::is_candidate_region(r), "Sanity: %zu", idx); + assert(!map.at(idx), "No region distributed twice: %zu", idx); map.at_put(idx, true); r = it.next(); } @@ -725,7 +725,7 @@ void ShenandoahFullGC::distribute_slices(ShenandoahHeapRegionSet** worker_slices for (size_t rid = 0; rid < n_regions; rid++) { bool is_candidate = ShenandoahPrepareForCompactionTask::is_candidate_region(heap->get_region(rid)); bool is_distributed = map.at(rid); - assert(is_distributed || !is_candidate, "All candidates are distributed: " SIZE_FORMAT, rid); + assert(is_distributed || !is_candidate, "All candidates are distributed: %zu", rid); } #endif } @@ -1045,9 +1045,9 @@ void ShenandoahFullGC::compact_humongous_objects() { size_t new_start = heap->heap_region_index_containing(FullGCForwarding::forwardee(old_obj)); size_t new_end = new_start + num_regions - 1; assert(old_start != new_start, "must be real move"); - assert(r->is_stw_move_allowed(), "Region " SIZE_FORMAT " should be movable", r->index()); + assert(r->is_stw_move_allowed(), "Region %zu should be movable", r->index()); - log_debug(gc)("Full GC compaction moves humongous object from region " SIZE_FORMAT " to region " SIZE_FORMAT, old_start, new_start); + log_debug(gc)("Full GC compaction moves humongous object from region %zu to region %zu", old_start, new_start); Copy::aligned_conjoint_words(r->bottom(), heap->get_region(new_start)->bottom(), words_size); ContinuationGCSupport::relativize_stack_chunk(cast_to_oop(r->bottom())); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahGC.cpp b/src/hotspot/share/gc/shenandoah/shenandoahGC.cpp index 99ee88d98d126..5a1e8b67694d7 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahGC.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahGC.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "compiler/oopMap.hpp" #include "gc/shared/workerThread.hpp" @@ -45,7 +44,7 @@ const char* ShenandoahGC::degen_point_to_string(ShenandoahDegenPoint point) { return "Mark"; case _degenerated_evac: return "Evacuation"; - case _degenerated_updaterefs: + case _degenerated_update_refs: return "Update References"; default: ShouldNotReachHere(); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahGC.hpp b/src/hotspot/share/gc/shenandoah/shenandoahGC.hpp index 37b228489177c..f10d5eef969da 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahGC.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahGC.hpp @@ -53,7 +53,7 @@ class ShenandoahGC : public StackObj { _degenerated_roots, _degenerated_mark, _degenerated_evac, - _degenerated_updaterefs, + _degenerated_update_refs, _DEGENERATED_LIMIT }; diff --git a/src/hotspot/share/gc/shenandoah/shenandoahGeneration.cpp b/src/hotspot/share/gc/shenandoah/shenandoahGeneration.cpp index c72940c3c3a75..d00d5168ee7c3 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahGeneration.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahGeneration.cpp @@ -1,5 +1,6 @@ /* * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahCollectorPolicy.hpp" #include "gc/shenandoah/shenandoahCollectionSetPreselector.hpp" #include "gc/shenandoah/shenandoahFreeSet.hpp" @@ -419,7 +419,7 @@ void ShenandoahGeneration::adjust_evacuation_budgets(ShenandoahHeap* const heap, if (old_evacuated_committed > old_evacuation_reserve) { // This should only happen due to round-off errors when enforcing ShenandoahOldEvacWaste assert(old_evacuated_committed <= (33 * old_evacuation_reserve) / 32, - "Round-off errors should be less than 3.125%%, committed: " SIZE_FORMAT ", reserved: " SIZE_FORMAT, + "Round-off errors should be less than 3.125%%, committed: %zu, reserved: %zu", old_evacuated_committed, old_evacuation_reserve); old_evacuated_committed = old_evacuation_reserve; // Leave old_evac_reserve as previously configured @@ -449,13 +449,13 @@ void ShenandoahGeneration::adjust_evacuation_budgets(ShenandoahHeap* const heap, // This can happen due to round-off errors when adding the results of truncated integer arithmetic. // We've already truncated old_evacuated_committed. Truncate young_advance_promoted_reserve_used here. assert(young_advance_promoted_reserve_used <= (33 * (old_available - old_evacuated_committed)) / 32, - "Round-off errors should be less than 3.125%%, committed: " SIZE_FORMAT ", reserved: " SIZE_FORMAT, + "Round-off errors should be less than 3.125%%, committed: %zu, reserved: %zu", young_advance_promoted_reserve_used, old_available - old_evacuated_committed); young_advance_promoted_reserve_used = old_available - old_evacuated_committed; old_consumed = old_evacuated_committed + young_advance_promoted_reserve_used; } - assert(old_available >= old_consumed, "Cannot consume (" SIZE_FORMAT ") more than is available (" SIZE_FORMAT ")", + assert(old_available >= old_consumed, "Cannot consume (%zu) more than is available (%zu)", old_consumed, old_available); size_t excess_old = old_available - old_consumed; size_t unaffiliated_old_regions = old_generation->free_unaffiliated_regions(); @@ -494,10 +494,10 @@ void ShenandoahGeneration::adjust_evacuation_budgets(ShenandoahHeap* const heap, if (regions_to_xfer > 0) { bool result = ShenandoahGenerationalHeap::cast(heap)->generation_sizer()->transfer_to_young(regions_to_xfer); assert(excess_old >= regions_to_xfer * region_size_bytes, - "Cannot transfer (" SIZE_FORMAT ", " SIZE_FORMAT ") more than excess old (" SIZE_FORMAT ")", + "Cannot transfer (%zu, %zu) more than excess old (%zu)", regions_to_xfer, region_size_bytes, excess_old); excess_old -= regions_to_xfer * region_size_bytes; - log_debug(gc, ergo)("%s transferred " SIZE_FORMAT " excess regions to young before start of evacuation", + log_debug(gc, ergo)("%s transferred %zu excess regions to young before start of evacuation", result? "Successfully": "Unsuccessfully", regions_to_xfer); } @@ -527,7 +527,7 @@ inline void assert_no_in_place_promotions() { public: void heap_region_do(ShenandoahHeapRegion *r) override { assert(r->get_top_before_promote() == nullptr, - "Region " SIZE_FORMAT " should not be ready for in-place promotion", r->index()); + "Region %zu should not be ready for in-place promotion", r->index()); } } cl; ShenandoahHeap::heap()->heap_region_iterate(&cl); @@ -671,8 +671,8 @@ size_t ShenandoahGeneration::select_aged_regions(size_t old_available) { // We keep going even if one region is excluded from selection because we need to accumulate all eligible // regions that are not preselected into promo_potential } - log_debug(gc)("Preselected " SIZE_FORMAT " regions containing " SIZE_FORMAT " live bytes," - " consuming: " SIZE_FORMAT " of budgeted: " SIZE_FORMAT, + log_debug(gc)("Preselected %zu regions containing %zu live bytes," + " consuming: %zu of budgeted: %zu", selected_regions, selected_live, old_consumed, old_available); } @@ -724,7 +724,7 @@ void ShenandoahGeneration::prepare_regions_and_collection_set(bool concurrent) { // We use integer division so anything up to just less than 2 is considered // reasonable, and the "+1" is to avoid divide-by-zero. assert((total_pop+1)/(total_census+1) == 1, "Extreme divergence: " - SIZE_FORMAT "/" SIZE_FORMAT, total_pop, total_census); + "%zu/%zu", total_pop, total_census); #endif } @@ -941,7 +941,7 @@ void ShenandoahGeneration::increase_humongous_waste(size_t bytes) { void ShenandoahGeneration::decrease_humongous_waste(size_t bytes) { if (bytes > 0) { assert(ShenandoahHeap::heap()->is_full_gc_in_progress() || (_humongous_waste >= bytes), - "Waste (" SIZE_FORMAT ") cannot be negative (after subtracting " SIZE_FORMAT ")", _humongous_waste, bytes); + "Waste (%zu) cannot be negative (after subtracting %zu)", _humongous_waste, bytes); Atomic::sub(&_humongous_waste, bytes); } } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahGenerationSizer.cpp b/src/hotspot/share/gc/shenandoah/shenandoahGenerationSizer.cpp index dfbc6b673ffab..c6827878cd1f2 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahGenerationSizer.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahGenerationSizer.cpp @@ -1,5 +1,6 @@ /* * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * 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 +23,6 @@ * */ -#include "precompiled.hpp" - #include "gc/shenandoah/shenandoahGeneration.hpp" #include "gc/shenandoah/shenandoahGenerationSizer.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" @@ -51,8 +50,8 @@ ShenandoahGenerationSizer::ShenandoahGenerationSizer() if (NewSize > MaxNewSize) { if (FLAG_IS_CMDLINE(MaxNewSize)) { - log_warning(gc, ergo)("NewSize (" SIZE_FORMAT "k) is greater than the MaxNewSize (" SIZE_FORMAT "k). " - "A new max generation size of " SIZE_FORMAT "k will be used.", + log_warning(gc, ergo)("NewSize (%zuk) is greater than the MaxNewSize (%zuk). " + "A new max generation size of %zuk will be used.", NewSize/K, MaxNewSize/K, NewSize/K); } FLAG_SET_ERGO(MaxNewSize, NewSize); @@ -138,7 +137,7 @@ bool ShenandoahGenerationSizer::transfer_regions(ShenandoahGeneration* src, Shen src->decrease_capacity(bytes_to_transfer); dst->increase_capacity(bytes_to_transfer); const size_t new_size = dst->max_capacity(); - log_info(gc, ergo)("Transfer " SIZE_FORMAT " region(s) from %s to %s, yielding increased size: " PROPERFMT, + log_info(gc, ergo)("Transfer %zu region(s) from %s to %s, yielding increased size: " PROPERFMT, regions, src->name(), dst->name(), PROPERFMTARGS(new_size)); return true; } @@ -190,7 +189,7 @@ void ShenandoahGenerationSizer::force_transfer_to_old(size_t regions) const { young_gen->decrease_capacity(bytes_to_transfer); old_gen->increase_capacity(bytes_to_transfer); const size_t new_size = old_gen->max_capacity(); - log_info(gc, ergo)("Forcing transfer of " SIZE_FORMAT " region(s) from %s to %s, yielding increased size: " PROPERFMT, + log_info(gc, ergo)("Forcing transfer of %zu region(s) from %s to %s, yielding increased size: " PROPERFMT, regions, young_gen->name(), old_gen->name(), PROPERFMTARGS(new_size)); } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahGenerationalControlThread.cpp b/src/hotspot/share/gc/shenandoah/shenandoahGenerationalControlThread.cpp index 33af35c6b9555..8144b32aee076 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahGenerationalControlThread.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahGenerationalControlThread.cpp @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/mode/shenandoahMode.hpp" #include "gc/shenandoah/shenandoahAsserts.hpp" #include "gc/shenandoah/shenandoahCollectorPolicy.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahGenerationalEvacuationTask.cpp b/src/hotspot/share/gc/shenandoah/shenandoahGenerationalEvacuationTask.cpp index 9dcdf002b7e8c..5672463799af4 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahGenerationalEvacuationTask.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahGenerationalEvacuationTask.cpp @@ -1,5 +1,6 @@ /* * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * 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 +23,6 @@ * */ -#include "precompiled.hpp" - #include "gc/shenandoah/shenandoahAsserts.hpp" #include "gc/shenandoah/shenandoahFreeSet.hpp" #include "gc/shenandoah/shenandoahGenerationalEvacuationTask.hpp" @@ -89,7 +88,7 @@ void ShenandoahGenerationalEvacuationTask::do_work() { } void log_region(const ShenandoahHeapRegion* r, LogStream* ls) { - ls->print_cr("GenerationalEvacuationTask, looking at %s region " SIZE_FORMAT ", (age: %d) [%s, %s, %s]", + ls->print_cr("GenerationalEvacuationTask, looking at %s region %zu, (age: %d) [%s, %s, %s]", r->is_old()? "old": r->is_young()? "young": "free", r->index(), r->age(), r->is_active()? "active": "inactive", r->is_humongous()? (r->is_humongous_start()? "humongous_start": "humongous_continuation"): "regular", @@ -126,7 +125,7 @@ void ShenandoahGenerationalEvacuationTask::evacuate_and_promote_regions() { } if (r->is_cset()) { - assert(r->has_live(), "Region " SIZE_FORMAT " should have been reclaimed early", r->index()); + assert(r->has_live(), "Region %zu should have been reclaimed early", r->index()); _heap->marked_object_iterate(r, &cl); if (ShenandoahPacing) { _heap->pacer()->report_evac(r->used() >> LogHeapWordSize); @@ -177,11 +176,11 @@ void ShenandoahGenerationalEvacuationTask::promote_in_place(ShenandoahHeapRegion const size_t old_garbage_threshold = (ShenandoahHeapRegion::region_size_bytes() * ShenandoahOldGarbageThreshold) / 100; shenandoah_assert_generations_reconciled(); assert(!_heap->is_concurrent_old_mark_in_progress(), "Cannot promote in place during old marking"); - assert(region->garbage_before_padded_for_promote() < old_garbage_threshold, "Region " SIZE_FORMAT " has too much garbage for promotion", region->index()); + assert(region->garbage_before_padded_for_promote() < old_garbage_threshold, "Region %zu has too much garbage for promotion", region->index()); assert(region->is_young(), "Only young regions can be promoted"); assert(region->is_regular(), "Use different service to promote humongous regions"); assert(region->age() >= _tenuring_threshold, "Only promote regions that are sufficiently aged"); - assert(region->get_top_before_promote() == tams, "Region " SIZE_FORMAT " has been used for allocations before promotion", region->index()); + assert(region->get_top_before_promote() == tams, "Region %zu has been used for allocations before promotion", region->index()); } ShenandoahOldGeneration* const old_gen = _heap->old_generation(); @@ -280,7 +279,7 @@ void ShenandoahGenerationalEvacuationTask::promote_humongous(ShenandoahHeapRegio // We promote humongous objects unconditionally, without checking for availability. We adjust // usage totals, including humongous waste, after evacuation is done. - log_debug(gc)("promoting humongous region " SIZE_FORMAT ", spanning " SIZE_FORMAT, region->index(), spanned_regions); + log_debug(gc)("promoting humongous region %zu, spanning %zu", region->index(), spanned_regions); young_gen->decrease_used(used_bytes); young_gen->decrease_humongous_waste(humongous_waste); @@ -294,7 +293,7 @@ void ShenandoahGenerationalEvacuationTask::promote_humongous(ShenandoahHeapRegio // in the last humongous region that is not spanned by obj is currently not used. for (size_t i = region->index(); i < index_limit; i++) { ShenandoahHeapRegion* r = _heap->get_region(i); - log_debug(gc)("promoting humongous region " SIZE_FORMAT ", from " PTR_FORMAT " to " PTR_FORMAT, + log_debug(gc)("promoting humongous region %zu, from " PTR_FORMAT " to " PTR_FORMAT, r->index(), p2i(r->bottom()), p2i(r->top())); // We mark the entire humongous object's range as dirty after loop terminates, so no need to dirty the range here r->set_affiliation(OLD_GENERATION); @@ -314,13 +313,12 @@ void ShenandoahGenerationalEvacuationTask::promote_humongous(ShenandoahHeapRegio if (obj->is_typeArray()) { // Primitive arrays don't need to be scanned. - log_debug(gc)("Clean cards for promoted humongous object (Region " SIZE_FORMAT ") from " PTR_FORMAT " to " PTR_FORMAT, + log_debug(gc)("Clean cards for promoted humongous object (Region %zu) from " PTR_FORMAT " to " PTR_FORMAT, region->index(), p2i(humongous_bottom), p2i(humongous_bottom + obj->size())); scanner->mark_range_as_clean(humongous_bottom, obj->size()); } else { - log_debug(gc)("Dirty cards for promoted humongous object (Region " SIZE_FORMAT ") from " PTR_FORMAT " to " PTR_FORMAT, + log_debug(gc)("Dirty cards for promoted humongous object (Region %zu) from " PTR_FORMAT " to " PTR_FORMAT, region->index(), p2i(humongous_bottom), p2i(humongous_bottom + obj->size())); scanner->mark_range_as_dirty(humongous_bottom, obj->size()); } } - diff --git a/src/hotspot/share/gc/shenandoah/shenandoahGenerationalFullGC.cpp b/src/hotspot/share/gc/shenandoah/shenandoahGenerationalFullGC.cpp index fe38c996bd81c..a54f219faefc3 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahGenerationalFullGC.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahGenerationalFullGC.cpp @@ -1,5 +1,6 @@ /* * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * 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,9 +23,6 @@ * */ - -#include "precompiled.hpp" - #include "gc/shared/fullGCForwarding.inline.hpp" #include "gc/shared/preservedMarks.inline.hpp" #include "gc/shenandoah/shenandoahGenerationalFullGC.hpp" @@ -219,7 +217,7 @@ ShenandoahPrepareForGenerationalCompactionObjectClosure::ShenandoahPrepareForGen } void ShenandoahPrepareForGenerationalCompactionObjectClosure::set_from_region(ShenandoahHeapRegion* from_region) { - log_debug(gc)("Worker %u compacting %s Region " SIZE_FORMAT " which had used " SIZE_FORMAT " and %s live", + log_debug(gc)("Worker %u compacting %s Region %zu which had used %zu and %s live", _worker_id, from_region->affiliation_name(), from_region->index(), from_region->used(), from_region->has_live()? "has": "does not have"); @@ -248,7 +246,7 @@ void ShenandoahPrepareForGenerationalCompactionObjectClosure::finish() { void ShenandoahPrepareForGenerationalCompactionObjectClosure::finish_old_region() { if (_old_to_region != nullptr) { - log_debug(gc)("Planned compaction into Old Region " SIZE_FORMAT ", used: " SIZE_FORMAT " tabulated by worker %u", + log_debug(gc)("Planned compaction into Old Region %zu, used: %zu tabulated by worker %u", _old_to_region->index(), _old_compact_point - _old_to_region->bottom(), _worker_id); _old_to_region->set_new_top(_old_compact_point); _old_to_region = nullptr; @@ -257,7 +255,7 @@ void ShenandoahPrepareForGenerationalCompactionObjectClosure::finish_old_region( void ShenandoahPrepareForGenerationalCompactionObjectClosure::finish_young_region() { if (_young_to_region != nullptr) { - log_debug(gc)("Worker %u planned compaction into Young Region " SIZE_FORMAT ", used: " SIZE_FORMAT, + log_debug(gc)("Worker %u planned compaction into Young Region %zu, used: %zu", _worker_id, _young_to_region->index(), _young_compact_point - _young_to_region->bottom()); _young_to_region->set_new_top(_young_compact_point); _young_to_region = nullptr; @@ -307,7 +305,7 @@ void ShenandoahPrepareForGenerationalCompactionObjectClosure::do_object(oop p) { if (_old_compact_point + obj_size > _old_to_region->end()) { ShenandoahHeapRegion* new_to_region; - log_debug(gc)("Worker %u finishing old region " SIZE_FORMAT ", compact_point: " PTR_FORMAT ", obj_size: " SIZE_FORMAT + log_debug(gc)("Worker %u finishing old region %zu, compact_point: " PTR_FORMAT ", obj_size: %zu" ", &compact_point[obj_size]: " PTR_FORMAT ", region end: " PTR_FORMAT, _worker_id, _old_to_region->index(), p2i(_old_compact_point), obj_size, p2i(_old_compact_point + obj_size), p2i(_old_to_region->end())); @@ -354,7 +352,7 @@ void ShenandoahPrepareForGenerationalCompactionObjectClosure::do_object(oop p) { if (_young_compact_point + obj_size > _young_to_region->end()) { ShenandoahHeapRegion* new_to_region; - log_debug(gc)("Worker %u finishing young region " SIZE_FORMAT ", compact_point: " PTR_FORMAT ", obj_size: " SIZE_FORMAT + log_debug(gc)("Worker %u finishing young region %zu, compact_point: " PTR_FORMAT ", obj_size: %zu" ", &compact_point[obj_size]: " PTR_FORMAT ", region end: " PTR_FORMAT, _worker_id, _young_to_region->index(), p2i(_young_compact_point), obj_size, p2i(_young_compact_point + obj_size), p2i(_young_to_region->end())); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahGenerationalHeap.cpp b/src/hotspot/share/gc/shenandoah/shenandoahGenerationalHeap.cpp index 2ad35fcb288b4..09b985e3b8d55 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahGenerationalHeap.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahGenerationalHeap.cpp @@ -1,5 +1,6 @@ /* * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * 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 +23,6 @@ * */ -#include "precompiled.hpp" - #include "gc/shenandoah/shenandoahAgeCensus.hpp" #include "gc/shenandoah/shenandoahClosures.inline.hpp" #include "gc/shenandoah/shenandoahCollectorPolicy.hpp" @@ -460,20 +459,20 @@ HeapWord* ShenandoahGenerationalHeap::allocate_from_plab_slow(Thread* thread, si size_t future_size = MIN2(cur_size * 2, plab_max_size()); // Doubling, starting at a card-multiple, should give us a card-multiple. (Ceiling and floor // are card multiples.) - assert(is_aligned(future_size, CardTable::card_size_in_words()), "Card multiple by construction, future_size: " SIZE_FORMAT - ", card_size: " SIZE_FORMAT ", cur_size: " SIZE_FORMAT ", max: " SIZE_FORMAT, + assert(is_aligned(future_size, CardTable::card_size_in_words()), "Card multiple by construction, future_size: %zu" + ", card_size: %zu, cur_size: %zu, max: %zu", future_size, (size_t) CardTable::card_size_in_words(), cur_size, plab_max_size()); // Record new heuristic value even if we take any shortcut. This captures // the case when moderately-sized objects always take a shortcut. At some point, // heuristics should catch up with them. Note that the requested cur_size may // not be honored, but we remember that this is the preferred size. - log_debug(gc, free)("Set new PLAB size: " SIZE_FORMAT, future_size); + log_debug(gc, free)("Set new PLAB size: %zu", future_size); ShenandoahThreadLocalData::set_plab_size(thread, future_size); if (cur_size < size) { // The PLAB to be allocated is still not large enough to hold the object. Fall back to shared allocation. // This avoids retiring perfectly good PLABs in order to represent a single large object allocation. - log_debug(gc, free)("Current PLAB size (" SIZE_FORMAT ") is too small for " SIZE_FORMAT, cur_size, size); + log_debug(gc, free)("Current PLAB size (%zu) is too small for %zu", cur_size, size); return nullptr; } @@ -570,7 +569,7 @@ void ShenandoahGenerationalHeap::retire_plab(PLAB* plab, Thread* thread) { if (top != nullptr && plab->waste() > original_waste && is_in_old(top)) { // If retiring the plab created a filler object, then we need to register it with our card scanner so it can // safely walk the region backing the plab. - log_debug(gc)("retire_plab() is registering remnant of size " SIZE_FORMAT " at " PTR_FORMAT, + log_debug(gc)("retire_plab() is registering remnant of size %zu at " PTR_FORMAT, plab->waste() - original_waste, p2i(top)); // No lock is necessary because the PLAB memory is aligned on card boundaries. old_generation()->card_scan()->register_object_without_lock(top); @@ -714,7 +713,7 @@ void ShenandoahGenerationalHeap::TransferResult::print_on(const char* when, outp ShenandoahOldGeneration* const old_gen = heap->old_generation(); const size_t young_available = young_gen->available(); const size_t old_available = old_gen->available(); - ss->print_cr("After %s, %s " SIZE_FORMAT " regions to %s to prepare for next gc, old available: " + ss->print_cr("After %s, %s %zu regions to %s to prepare for next gc, old available: " PROPERFMT ", young_available: " PROPERFMT, when, success? "successfully transferred": "failed to transfer", region_count, region_destination, @@ -819,7 +818,7 @@ class ShenandoahGenerationalUpdateHeapRefsTask : public WorkerTask { HeapWord* update_watermark = r->get_update_watermark(); assert(update_watermark >= r->bottom(), "sanity"); - log_debug(gc)("Update refs worker " UINT32_FORMAT ", looking at region " SIZE_FORMAT, worker_id, r->index()); + log_debug(gc)("Update refs worker " UINT32_FORMAT ", looking at region %zu", worker_id, r->index()); bool region_progress = false; if (r->is_active() && !r->is_cset()) { if (r->is_young()) { @@ -845,13 +844,13 @@ class ShenandoahGenerationalUpdateHeapRefsTask : public WorkerTask { // updated. assert(r->get_update_watermark() == r->bottom(), - "%s Region " SIZE_FORMAT " is_active but not recognized as YOUNG or OLD so must be newly transitioned from FREE", + "%s Region %zu is_active but not recognized as YOUNG or OLD so must be newly transitioned from FREE", r->affiliation_name(), r->index()); } } if (region_progress && ShenandoahPacing) { - _heap->pacer()->report_updaterefs(pointer_delta(update_watermark, r->bottom())); + _heap->pacer()->report_update_refs(pointer_delta(update_watermark, r->bottom())); } if (_heap->check_cancelled_gc_and_yield(CONCURRENT)) { @@ -911,7 +910,7 @@ class ShenandoahGenerationalUpdateHeapRefsTask : public WorkerTask { } if (ShenandoahPacing) { - _heap->pacer()->report_updaterefs(pointer_delta(end_of_range, start_of_range)); + _heap->pacer()->report_update_refs(pointer_delta(end_of_range, start_of_range)); } } } @@ -1071,7 +1070,7 @@ void ShenandoahGenerationalHeap::complete_degenerated_cycle() { shenandoah_assert_heaplocked_or_safepoint(); if (is_concurrent_old_mark_in_progress()) { // This is still necessary for degenerated cycles because the degeneration point may occur - // after final mark of the young generation. See ShenandoahConcurrentGC::op_final_updaterefs for + // after final mark of the young generation. See ShenandoahConcurrentGC::op_final_update_refs for // a more detailed explanation. old_generation()->transfer_pointers_from_satb(); } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahGlobalGeneration.cpp b/src/hotspot/share/gc/shenandoah/shenandoahGlobalGeneration.cpp index 9b13c7c95af78..230fff162527b 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahGlobalGeneration.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahGlobalGeneration.cpp @@ -21,7 +21,6 @@ * questions. * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahAgeCensus.hpp" #include "gc/shenandoah/heuristics/shenandoahGlobalHeuristics.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp index d75a9234a63d2..4cc030b97366e 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2022, Red Hat, Inc. All rights reserved. * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "cds/archiveHeapWriter.hpp" #include "classfile/systemDictionary.hpp" @@ -102,6 +101,7 @@ #include "runtime/orderAccess.hpp" #include "runtime/safepointMechanism.hpp" #include "runtime/stackWatermarkSet.hpp" +#include "runtime/threads.hpp" #include "runtime/vmThread.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/events.hpp" @@ -145,7 +145,7 @@ class ShenandoahPretouchBitmapTask : public WorkerTask { while (r != nullptr) { size_t start = r->index() * ShenandoahHeapRegion::region_size_bytes() / MarkBitMap::heap_map_factor(); size_t end = (r->index() + 1) * ShenandoahHeapRegion::region_size_bytes() / MarkBitMap::heap_map_factor(); - assert (end <= _bitmap_size, "end is sane: " SIZE_FORMAT " < " SIZE_FORMAT, end, _bitmap_size); + assert (end <= _bitmap_size, "end is sane: %zu < %zu", end, _bitmap_size); if (r->is_committed()) { os::pretouch_memory(_bitmap_base + start, _bitmap_base + end, _page_size); @@ -186,7 +186,7 @@ jint ShenandoahHeap::initialize() { _num_regions = ShenandoahHeapRegion::region_count(); assert(_num_regions == (max_byte_size / reg_size_bytes), - "Regions should cover entire heap exactly: " SIZE_FORMAT " != " SIZE_FORMAT "/" SIZE_FORMAT, + "Regions should cover entire heap exactly: %zu != %zu/%zu", _num_regions, max_byte_size, reg_size_bytes); size_t num_committed_regions = init_byte_size / reg_size_bytes; @@ -276,7 +276,7 @@ jint ShenandoahHeap::initialize() { guarantee(bitmap_bytes_per_region != 0, "Bitmap bytes per region should not be zero"); guarantee(is_power_of_2(bitmap_bytes_per_region), - "Bitmap bytes per region should be power of two: " SIZE_FORMAT, bitmap_bytes_per_region); + "Bitmap bytes per region should be power of two: %zu", bitmap_bytes_per_region); if (bitmap_page_size > bitmap_bytes_per_region) { _bitmap_regions_per_slice = bitmap_page_size / bitmap_bytes_per_region; @@ -287,11 +287,11 @@ jint ShenandoahHeap::initialize() { } guarantee(_bitmap_regions_per_slice >= 1, - "Should have at least one region per slice: " SIZE_FORMAT, + "Should have at least one region per slice: %zu", _bitmap_regions_per_slice); guarantee(((_bitmap_bytes_per_slice) % bitmap_page_size) == 0, - "Bitmap slices should be page-granular: bps = " SIZE_FORMAT ", page size = " SIZE_FORMAT, + "Bitmap slices should be page-granular: bps = %zu, page size = %zu", _bitmap_bytes_per_slice, bitmap_page_size); ReservedSpace bitmap = reserve(_bitmap_size, bitmap_page_size); @@ -583,12 +583,12 @@ ShenandoahHeap::ShenandoahHeap(ShenandoahCollectorPolicy* policy) : void ShenandoahHeap::print_on(outputStream* st) const { st->print_cr("Shenandoah Heap"); - st->print_cr(" " SIZE_FORMAT "%s max, " SIZE_FORMAT "%s soft max, " SIZE_FORMAT "%s committed, " SIZE_FORMAT "%s used", + st->print_cr(" %zu%s max, %zu%s soft max, %zu%s committed, %zu%s used", byte_size_in_proper_unit(max_capacity()), proper_unit_for_byte_size(max_capacity()), byte_size_in_proper_unit(soft_max_capacity()), proper_unit_for_byte_size(soft_max_capacity()), byte_size_in_proper_unit(committed()), proper_unit_for_byte_size(committed()), byte_size_in_proper_unit(used()), proper_unit_for_byte_size(used())); - st->print_cr(" " SIZE_FORMAT " x " SIZE_FORMAT"%s regions", + st->print_cr(" %zu x %zu %s regions", num_regions(), byte_size_in_proper_unit(ShenandoahHeapRegion::region_size_bytes()), proper_unit_for_byte_size(ShenandoahHeapRegion::region_size_bytes())); @@ -644,7 +644,6 @@ class ShenandoahInitWorkerGCLABClosure : public ThreadClosure { public: void do_thread(Thread* thread) { assert(thread != nullptr, "Sanity"); - assert(thread->is_Worker_thread(), "Only worker thread expected"); ShenandoahThreadLocalData::initialize_gclab(thread); } }; @@ -663,6 +662,9 @@ void ShenandoahHeap::post_initialize() { // gclab can not be initialized early during VM startup, as it can not determinate its max_size. // Now, we will let WorkerThreads to initialize gclab when new worker is created. _workers->set_initialize_gclab(); + + // Note that the safepoint workers may require gclabs if the threads are used to create a heap dump + // during a concurrent evacuation phase. if (_safepoint_workers != nullptr) { _safepoint_workers->threads_do(&init_gclabs); _safepoint_workers->set_initialize_gclab(); @@ -786,14 +788,14 @@ size_t ShenandoahHeap::max_capacity() const { size_t ShenandoahHeap::soft_max_capacity() const { size_t v = Atomic::load(&_soft_max_size); assert(min_capacity() <= v && v <= max_capacity(), - "Should be in bounds: " SIZE_FORMAT " <= " SIZE_FORMAT " <= " SIZE_FORMAT, + "Should be in bounds: %zu <= %zu <= %zu", min_capacity(), v, max_capacity()); return v; } void ShenandoahHeap::set_soft_max_capacity(size_t v) { assert(min_capacity() <= v && v <= max_capacity(), - "Should be in bounds: " SIZE_FORMAT " <= " SIZE_FORMAT " <= " SIZE_FORMAT, + "Should be in bounds: %zu <= %zu <= %zu", min_capacity(), v, max_capacity()); Atomic::store(&_soft_max_size, v); } @@ -840,7 +842,7 @@ bool ShenandoahHeap::check_soft_max_changed() { new_soft_max = MAX2(min_capacity(), new_soft_max); new_soft_max = MIN2(max_capacity(), new_soft_max); if (new_soft_max != old_soft_max) { - log_info(gc)("Soft Max Heap Size: " SIZE_FORMAT "%s -> " SIZE_FORMAT "%s", + log_info(gc)("Soft Max Heap Size: %zu%s -> %zu%s", byte_size_in_proper_unit(old_soft_max), proper_unit_for_byte_size(old_soft_max), byte_size_in_proper_unit(new_soft_max), proper_unit_for_byte_size(new_soft_max) ); @@ -879,13 +881,13 @@ HeapWord* ShenandoahHeap::allocate_from_gclab_slow(Thread* thread, size_t size) // Record new heuristic value even if we take any shortcut. This captures // the case when moderately-sized objects always take a shortcut. At some point, // heuristics should catch up with them. - log_debug(gc, free)("Set new GCLAB size: " SIZE_FORMAT, new_size); + log_debug(gc, free)("Set new GCLAB size: %zu", new_size); ShenandoahThreadLocalData::set_gclab_size(thread, new_size); if (new_size < size) { // New size still does not fit the object. Fall back to shared allocation. // This avoids retiring perfectly good GCLABs, when we encounter a large object. - log_debug(gc, free)("New gclab size (" SIZE_FORMAT ") is too small for " SIZE_FORMAT, new_size, size); + log_debug(gc, free)("New gclab size (%zu) is too small for %zu", new_size, size); return nullptr; } @@ -994,8 +996,8 @@ HeapWord* ShenandoahHeap::allocate_memory(ShenandoahAllocRequest& req) { } if (log_develop_is_enabled(Debug, gc, alloc)) { ResourceMark rm; - log_debug(gc, alloc)("Thread: %s, Result: " PTR_FORMAT ", Request: %s, Size: " SIZE_FORMAT - ", Original: " SIZE_FORMAT ", Latest: " SIZE_FORMAT, + log_debug(gc, alloc)("Thread: %s, Result: " PTR_FORMAT ", Request: %s, Size: %zu" + ", Original: %zu, Latest: %zu", Thread::current()->name(), p2i(result), req.type_string(), req.size(), original_count, get_gc_no_progress_count()); } @@ -1024,7 +1026,7 @@ HeapWord* ShenandoahHeap::allocate_memory(ShenandoahAllocRequest& req) { size_t actual = req.actual_size(); assert (req.is_lab_alloc() || (requested == actual), - "Only LAB allocations are elastic: %s, requested = " SIZE_FORMAT ", actual = " SIZE_FORMAT, + "Only LAB allocations are elastic: %s, requested = %zu, actual = %zu", ShenandoahAllocRequest::alloc_type_to_string(req.type()), requested, actual); if (req.is_mutator_alloc()) { @@ -1176,7 +1178,7 @@ class ShenandoahEvacuationTask : public WorkerTask { ShenandoahConcurrentEvacuateRegionObjectClosure cl(_sh); ShenandoahHeapRegion* r; while ((r =_cs->claim_next()) != nullptr) { - assert(r->has_live(), "Region " SIZE_FORMAT " should have been reclaimed early", r->index()); + assert(r->has_live(), "Region %zu should have been reclaimed early", r->index()); _sh->marked_object_iterate(r, &cl); if (ShenandoahPacing) { @@ -1190,11 +1192,86 @@ class ShenandoahEvacuationTask : public WorkerTask { } }; +class ShenandoahRetireGCLABClosure : public ThreadClosure { +private: + bool const _resize; +public: + explicit ShenandoahRetireGCLABClosure(bool resize) : _resize(resize) {} + void do_thread(Thread* thread) override { + PLAB* gclab = ShenandoahThreadLocalData::gclab(thread); + assert(gclab != nullptr, "GCLAB should be initialized for %s", thread->name()); + gclab->retire(); + if (_resize && ShenandoahThreadLocalData::gclab_size(thread) > 0) { + ShenandoahThreadLocalData::set_gclab_size(thread, 0); + } + + if (ShenandoahHeap::heap()->mode()->is_generational()) { + PLAB* plab = ShenandoahThreadLocalData::plab(thread); + assert(plab != nullptr, "PLAB should be initialized for %s", thread->name()); + + // There are two reasons to retire all plabs between old-gen evacuation passes. + // 1. We need to make the plab memory parsable by remembered-set scanning. + // 2. We need to establish a trustworthy UpdateWaterMark value within each old-gen heap region + ShenandoahGenerationalHeap::heap()->retire_plab(plab, thread); + if (_resize && ShenandoahThreadLocalData::plab_size(thread) > 0) { + ShenandoahThreadLocalData::set_plab_size(thread, 0); + } + } + } +}; + +class ShenandoahGCStatePropagator : public ThreadClosure { +public: + explicit ShenandoahGCStatePropagator(char gc_state) : _gc_state(gc_state) {} + + void do_thread(Thread* thread) override { + ShenandoahThreadLocalData::set_gc_state(thread, _gc_state); + } +private: + char _gc_state; +}; + +class ShenandoahPrepareForUpdateRefs : public HandshakeClosure { +public: + explicit ShenandoahPrepareForUpdateRefs(char gc_state) : + HandshakeClosure("Shenandoah Prepare for Update Refs"), + _retire(ResizeTLAB), _propagator(gc_state) {} + + void do_thread(Thread* thread) override { + _propagator.do_thread(thread); + if (ShenandoahThreadLocalData::gclab(thread) != nullptr) { + _retire.do_thread(thread); + } + } +private: + ShenandoahRetireGCLABClosure _retire; + ShenandoahGCStatePropagator _propagator; +}; + void ShenandoahHeap::evacuate_collection_set(bool concurrent) { ShenandoahEvacuationTask task(this, _collection_set, concurrent); workers()->run_task(&task); } +void ShenandoahHeap::concurrent_prepare_for_update_refs() { + // It's possible that evacuation succeeded, but we could still be cancelled when we get here. + // A cancellation at this point means the degenerated cycle must resume from update-refs. + set_gc_state_concurrent(EVACUATION, false); + set_gc_state_concurrent(WEAK_ROOTS, false); + set_gc_state_concurrent(UPDATE_REFS, true); + + // This will propagate the gc state and retire gclabs and plabs for threads that require it. + ShenandoahPrepareForUpdateRefs prepare_for_update_refs(_gc_state.raw_value()); + + // The handshake won't touch worker threads (or control thread, or VM thread), so do those separately. + Threads::non_java_threads_do(&prepare_for_update_refs); + + // Now retire gclabs and plabs and propagate gc_state for mutator threads + Handshake::execute(&prepare_for_update_refs); + + _update_refs_iterator.reset(); +} + oop ShenandoahHeap::evacuate_object(oop p, Thread* thread) { assert(thread == Thread::current(), "Expected thread parameter to be current thread."); if (ShenandoahThreadLocalData::is_oom_during_evac(thread)) { @@ -1349,34 +1426,6 @@ class ShenandoahCheckCleanGCLABClosure : public ThreadClosure { } }; -class ShenandoahRetireGCLABClosure : public ThreadClosure { -private: - bool const _resize; -public: - ShenandoahRetireGCLABClosure(bool resize) : _resize(resize) {} - void do_thread(Thread* thread) { - PLAB* gclab = ShenandoahThreadLocalData::gclab(thread); - assert(gclab != nullptr, "GCLAB should be initialized for %s", thread->name()); - gclab->retire(); - if (_resize && ShenandoahThreadLocalData::gclab_size(thread) > 0) { - ShenandoahThreadLocalData::set_gclab_size(thread, 0); - } - - if (ShenandoahHeap::heap()->mode()->is_generational()) { - PLAB* plab = ShenandoahThreadLocalData::plab(thread); - assert(plab != nullptr, "PLAB should be initialized for %s", thread->name()); - - // There are two reasons to retire all plabs between old-gen evacuation passes. - // 1. We need to make the plab memory parsable by remembered-set scanning. - // 2. We need to establish a trustworthy UpdateWaterMark value within each old-gen heap region - ShenandoahGenerationalHeap::heap()->retire_plab(plab, thread); - if (_resize && ShenandoahThreadLocalData::plab_size(thread) > 0) { - ShenandoahThreadLocalData::set_plab_size(thread, 0); - } - } - } -}; - void ShenandoahHeap::labs_make_parsable() { assert(UseTLAB, "Only call with UseTLAB"); @@ -1389,6 +1438,10 @@ void ShenandoahHeap::labs_make_parsable() { } workers()->threads_do(&cl); + + if (safepoint_workers() != nullptr) { + safepoint_workers()->threads_do(&cl); + } } void ShenandoahHeap::tlabs_retire(bool resize) { @@ -1424,6 +1477,7 @@ void ShenandoahHeap::gclabs_retire(bool resize) { for (JavaThreadIteratorWithHandle jtiwh; JavaThread *t = jtiwh.next(); ) { cl.do_thread(t); } + workers()->threads_do(&cl); if (safepoint_workers() != nullptr) { @@ -1443,6 +1497,18 @@ size_t ShenandoahHeap::max_tlab_size() const { return ShenandoahHeapRegion::max_tlab_size_words(); } +void ShenandoahHeap::collect_as_vm_thread(GCCause::Cause cause) { + // These requests are ignored because we can't easily have Shenandoah jump into + // a synchronous (degenerated or full) cycle while it is in the middle of a concurrent + // cycle. We _could_ cancel the concurrent cycle and then try to run a cycle directly + // on the VM thread, but this would confuse the control thread mightily and doesn't + // seem worth the trouble. Instead, we will have the caller thread run (and wait for) a + // concurrent cycle in the prologue of the heap inspect/dump operation. This is how + // other concurrent collectors in the JVM handle this scenario as well. + assert(Thread::current()->is_VM_thread(), "Should be the VM thread"); + guarantee(cause == GCCause::_heap_dump || cause == GCCause::_heap_inspection, "Invalid cause"); +} + void ShenandoahHeap::collect(GCCause::Cause cause) { control_thread()->request_gc(cause); } @@ -1527,7 +1593,9 @@ void ShenandoahHeap::set_active_generation() { void ShenandoahHeap::on_cycle_start(GCCause::Cause cause, ShenandoahGeneration* generation) { shenandoah_policy()->record_collection_cause(cause); - assert(gc_cause() == GCCause::_no_gc, "Over-writing cause"); + const GCCause::Cause current = gc_cause(); + assert(current == GCCause::_no_gc, "Over-writing cause: %s, with: %s", + GCCause::to_string(current), GCCause::to_string(cause)); assert(_gc_generation == nullptr, "Over-writing _gc_generation"); set_gc_cause(cause); @@ -1933,23 +2001,25 @@ void ShenandoahHeap::prepare_update_heap_references(bool concurrent) { _update_refs_iterator.reset(); } -void ShenandoahHeap::propagate_gc_state_to_java_threads() { +void ShenandoahHeap::propagate_gc_state_to_all_threads() { assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Must be at Shenandoah safepoint"); if (_gc_state_changed) { + ShenandoahGCStatePropagator propagator(_gc_state.raw_value()); + Threads::threads_do(&propagator); _gc_state_changed = false; - char state = gc_state(); - for (JavaThreadIteratorWithHandle jtiwh; JavaThread *t = jtiwh.next(); ) { - ShenandoahThreadLocalData::set_gc_state(t, state); - } } } -void ShenandoahHeap::set_gc_state(uint mask, bool value) { +void ShenandoahHeap::set_gc_state_at_safepoint(uint mask, bool value) { assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Must be at Shenandoah safepoint"); _gc_state.set_cond(mask, value); _gc_state_changed = true; } +void ShenandoahHeap::set_gc_state_concurrent(uint mask, bool value) { + _gc_state.set_cond(mask, value); +} + void ShenandoahHeap::set_concurrent_young_mark_in_progress(bool in_progress) { uint mask; assert(!has_forwarded_objects(), "Young marking is not concurrent with evacuation"); @@ -1961,15 +2031,15 @@ void ShenandoahHeap::set_concurrent_young_mark_in_progress(bool in_progress) { } else { mask = MARKING | YOUNG_MARKING; } - set_gc_state(mask, in_progress); + set_gc_state_at_safepoint(mask, in_progress); manage_satb_barrier(in_progress); } void ShenandoahHeap::set_concurrent_old_mark_in_progress(bool in_progress) { #ifdef ASSERT - // has_forwarded_objects() iff UPDATEREFS or EVACUATION + // has_forwarded_objects() iff UPDATE_REFS or EVACUATION bool has_forwarded = has_forwarded_objects(); - bool updating_or_evacuating = _gc_state.is_set(UPDATEREFS | EVACUATION); + bool updating_or_evacuating = _gc_state.is_set(UPDATE_REFS | EVACUATION); bool evacuating = _gc_state.is_set(EVACUATION); assert ((has_forwarded == updating_or_evacuating) || (evacuating && !has_forwarded && collection_set()->is_empty()), "Updating or evacuating iff has forwarded objects, or if evacuation phase is promoting in place without forwarding"); @@ -1977,9 +2047,9 @@ void ShenandoahHeap::set_concurrent_old_mark_in_progress(bool in_progress) { if (!in_progress && is_concurrent_young_mark_in_progress()) { // If young-marking is in progress when we turn off OLD_MARKING, leave MARKING (and YOUNG_MARKING) on assert(_gc_state.is_set(MARKING), "concurrent_young_marking_in_progress implies MARKING"); - set_gc_state(OLD_MARKING, in_progress); + set_gc_state_at_safepoint(OLD_MARKING, in_progress); } else { - set_gc_state(MARKING | OLD_MARKING, in_progress); + set_gc_state_at_safepoint(MARKING | OLD_MARKING, in_progress); } manage_satb_barrier(in_progress); } @@ -2006,7 +2076,7 @@ void ShenandoahHeap::manage_satb_barrier(bool active) { void ShenandoahHeap::set_evacuation_in_progress(bool in_progress) { assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Only call this at safepoint"); - set_gc_state(EVACUATION, in_progress); + set_gc_state_at_safepoint(EVACUATION, in_progress); } void ShenandoahHeap::set_concurrent_strong_root_in_progress(bool in_progress) { @@ -2018,7 +2088,7 @@ void ShenandoahHeap::set_concurrent_strong_root_in_progress(bool in_progress) { } void ShenandoahHeap::set_concurrent_weak_root_in_progress(bool cond) { - set_gc_state(WEAK_ROOTS, cond); + set_gc_state_at_safepoint(WEAK_ROOTS, cond); } GCTracer* ShenandoahHeap::tracer() { @@ -2121,7 +2191,7 @@ void ShenandoahHeap::stw_unload_classes(bool full_gc) { DEBUG_ONLY(MetaspaceUtils::verify();) } -// Weak roots are either pre-evacuated (final mark) or updated (final updaterefs), +// Weak roots are either pre-evacuated (final mark) or updated (final update refs), // so they should not have forwarded oops. // However, we do need to "null" dead oops in the roots, if can not be done // in concurrent cycles. @@ -2165,7 +2235,7 @@ void ShenandoahHeap::parallel_cleaning(bool full_gc) { } void ShenandoahHeap::set_has_forwarded_objects(bool cond) { - set_gc_state(HAS_FORWARDED, cond); + set_gc_state_at_safepoint(HAS_FORWARDED, cond); } void ShenandoahHeap::set_unload_classes(bool uc) { @@ -2205,7 +2275,7 @@ void ShenandoahHeap::set_full_gc_move_in_progress(bool in_progress) { } void ShenandoahHeap::set_update_refs_in_progress(bool in_progress) { - set_gc_state(UPDATEREFS, in_progress); + set_gc_state_at_safepoint(UPDATE_REFS, in_progress); } void ShenandoahHeap::register_nmethod(nmethod* nm) { @@ -2223,7 +2293,7 @@ void ShenandoahHeap::pin_object(JavaThread* thr, oop o) { void ShenandoahHeap::unpin_object(JavaThread* thr, oop o) { ShenandoahHeapRegion* r = heap_region_containing(o); assert(r != nullptr, "Sanity"); - assert(r->pin_count() > 0, "Region " SIZE_FORMAT " should have non-zero pins", r->index()); + assert(r->pin_count() > 0, "Region %zu should have non-zero pins", r->index()); r->record_unpin(); } @@ -2255,7 +2325,7 @@ void ShenandoahHeap::assert_pinned_region_status() { shenandoah_assert_generations_reconciled(); if (gc_generation()->contains(r)) { assert((r->is_pinned() && r->pin_count() > 0) || (!r->is_pinned() && r->pin_count() == 0), - "Region " SIZE_FORMAT " pinning status is inconsistent", i); + "Region %zu pinning status is inconsistent", i); } } } @@ -2351,7 +2421,7 @@ class ShenandoahUpdateHeapRefsTask : public WorkerTask { if (r->is_active() && !r->is_cset()) { _heap->marked_object_oop_iterate(r, &cl, update_watermark); if (ShenandoahPacing) { - _heap->pacer()->report_updaterefs(pointer_delta(update_watermark, r->bottom())); + _heap->pacer()->report_update_refs(pointer_delta(update_watermark, r->bottom())); } } if (_heap->check_cancelled_gc_and_yield(CONCURRENT)) { @@ -2413,7 +2483,7 @@ void ShenandoahHeap::rebuild_free_set(bool concurrent) { assert((first_old_region > last_old_region) || ((last_old_region + 1 - first_old_region >= old_region_count) && get_region(first_old_region)->is_old() && get_region(last_old_region)->is_old()), - "sanity: old_region_count: " SIZE_FORMAT ", first_old_region: " SIZE_FORMAT ", last_old_region: " SIZE_FORMAT, + "sanity: old_region_count: %zu, first_old_region: %zu, last_old_region: %zu", old_region_count, first_old_region, last_old_region); if (mode()->is_generational()) { @@ -2610,6 +2680,14 @@ char ShenandoahHeap::gc_state() const { return _gc_state.raw_value(); } +bool ShenandoahHeap::is_gc_state(GCState state) const { + // If the global gc state has been changed, but hasn't yet been propagated to all threads, then + // the global gc state is the correct value. Once the gc state has been synchronized with all threads, + // _gc_state_changed will be toggled to false and we need to use the thread local state. + return _gc_state_changed ? _gc_state.is_set(state) : ShenandoahThreadLocalData::is_gc_state(state); +} + + ShenandoahLiveData* ShenandoahHeap::get_liveness_cache(uint worker_id) { #ifdef ASSERT assert(_liveness_cache != nullptr, "sanity"); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp index 5beced0544cf6..785e1742b0cdc 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp @@ -329,7 +329,7 @@ class ShenandoahHeap : public CollectedHeap { EVACUATION_BITPOS = 2, // Heap is under updating: needs no additional barriers. - UPDATEREFS_BITPOS = 3, + UPDATE_REFS_BITPOS = 3, // Heap is under weak-reference/roots processing: needs weak-LRB barriers. WEAK_ROOTS_BITPOS = 4, @@ -346,7 +346,7 @@ class ShenandoahHeap : public CollectedHeap { HAS_FORWARDED = 1 << HAS_FORWARDED_BITPOS, MARKING = 1 << MARKING_BITPOS, EVACUATION = 1 << EVACUATION_BITPOS, - UPDATEREFS = 1 << UPDATEREFS_BITPOS, + UPDATE_REFS = 1 << UPDATE_REFS_BITPOS, WEAK_ROOTS = 1 << WEAK_ROOTS_BITPOS, YOUNG_MARKING = 1 << YOUNG_MARKING_BITPOS, OLD_MARKING = 1 << OLD_MARKING_BITPOS @@ -363,18 +363,35 @@ class ShenandoahHeap : public CollectedHeap { size_t _gc_no_progress_count; - // This updates the singlular, global gc state. This must happen on a safepoint. - void set_gc_state(uint mask, bool value); + // This updates the singular, global gc state. This call must happen on a safepoint. + void set_gc_state_at_safepoint(uint mask, bool value); + + // This also updates the global gc state, but does not need to be called on a safepoint. + // Critically, this method will _not_ flag that the global gc state has changed and threads + // will continue to use their thread local copy. This is expected to be used in conjunction + // with a handshake operation to propagate the new gc state. + void set_gc_state_concurrent(uint mask, bool value); public: + // This returns the raw value of the singular, global gc state. char gc_state() const; - // This copies the global gc state into a thread local variable for java threads. - // It is primarily intended to support quick access at barriers. - void propagate_gc_state_to_java_threads(); + // Compares the given state against either the global gc state, or the thread local state. + // The global gc state may change on a safepoint and is the correct value to use until + // the global gc state has been propagated to all threads (after which, this method will + // compare against the thread local state). The thread local gc state may also be changed + // by a handshake operation, in which case, this function continues using the updated thread + // local value. + bool is_gc_state(GCState state) const; + + // This copies the global gc state into a thread local variable for all threads. + // The thread local gc state is primarily intended to support quick access at barriers. + // All threads are updated because in some cases the control thread or the vm thread may + // need to execute the load reference barrier. + void propagate_gc_state_to_all_threads(); // This is public to support assertions that the state hasn't been changed off of - // a safepoint and that any changes were propagated to java threads after the safepoint. + // a safepoint and that any changes were propagated to threads after the safepoint. bool has_gc_state_changed() const { return _gc_state_changed; } // Returns true if allocations have occurred in new regions or if regions have been @@ -394,9 +411,7 @@ class ShenandoahHeap : public CollectedHeap { void set_concurrent_strong_root_in_progress(bool cond); void set_concurrent_weak_root_in_progress(bool cond); - inline bool is_stable() const; inline bool is_idle() const; - inline bool is_concurrent_mark_in_progress() const; inline bool is_concurrent_young_mark_in_progress() const; inline bool is_concurrent_old_mark_in_progress() const; @@ -464,6 +479,10 @@ class ShenandoahHeap : public CollectedHeap { void do_class_unloading(); // Reference updating void prepare_update_heap_references(bool concurrent); + + // Retires LABs used for evacuation + void concurrent_prepare_for_update_refs(); + virtual void update_heap_references(bool concurrent); // Final update region states void update_heap_region_states(bool concurrent); @@ -615,6 +634,7 @@ class ShenandoahHeap : public CollectedHeap { MemRegion reserved_region() const { return _reserved; } bool is_in_reserved(const void* addr) const { return _reserved.contains(addr); } + void collect_as_vm_thread(GCCause::Cause cause) override; void collect(GCCause::Cause cause) override; void do_full_collection(bool clear_all_soft_refs) override; diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp index 6a38266489e03..461447cf9ba77 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp @@ -1,6 +1,7 @@ /* * Copyright (c) 2015, 2020, Red Hat, Inc. All rights reserved. * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -64,10 +65,6 @@ inline ShenandoahHeapRegion* ShenandoahRegionIterator::next() { return _heap->get_region(new_index - 1); } -inline bool ShenandoahHeap::has_forwarded_objects() const { - return _gc_state.is_set(HAS_FORWARDED); -} - inline WorkerThreads* ShenandoahHeap::workers() const { return _workers; } @@ -382,7 +379,7 @@ inline bool ShenandoahHeap::is_in_active_generation(oop obj) const { // Old regions are in old and global collections, not in young collections return !gen->is_young(); default: - assert(false, "Bad affiliation (%d) for region " SIZE_FORMAT, region_affiliation(index), index); + assert(false, "Bad affiliation (%d) for region %zu", region_affiliation(index), index); return false; } } @@ -450,28 +447,36 @@ inline bool ShenandoahHeap::in_collection_set_loc(void* p) const { return collection_set()->is_in_loc(p); } -inline bool ShenandoahHeap::is_stable() const { - return _gc_state.is_clear(); +inline bool ShenandoahHeap::is_idle() const { + return _gc_state_changed ? _gc_state.is_clear() : ShenandoahThreadLocalData::gc_state(Thread::current()) == 0; } -inline bool ShenandoahHeap::is_idle() const { - return _gc_state.is_unset(MARKING | EVACUATION | UPDATEREFS); +inline bool ShenandoahHeap::has_forwarded_objects() const { + return is_gc_state(HAS_FORWARDED); } inline bool ShenandoahHeap::is_concurrent_mark_in_progress() const { - return _gc_state.is_set(MARKING); + return is_gc_state(MARKING); } inline bool ShenandoahHeap::is_concurrent_young_mark_in_progress() const { - return _gc_state.is_set(YOUNG_MARKING); + return is_gc_state(YOUNG_MARKING); } inline bool ShenandoahHeap::is_concurrent_old_mark_in_progress() const { - return _gc_state.is_set(OLD_MARKING); + return is_gc_state(OLD_MARKING); } inline bool ShenandoahHeap::is_evacuation_in_progress() const { - return _gc_state.is_set(EVACUATION); + return is_gc_state(EVACUATION); +} + +inline bool ShenandoahHeap::is_update_refs_in_progress() const { + return is_gc_state(UPDATE_REFS); +} + +inline bool ShenandoahHeap::is_concurrent_weak_root_in_progress() const { + return is_gc_state(WEAK_ROOTS); } inline bool ShenandoahHeap::is_degenerated_gc_in_progress() const { @@ -486,10 +491,6 @@ inline bool ShenandoahHeap::is_full_gc_move_in_progress() const { return _full_gc_move_in_progress.is_set(); } -inline bool ShenandoahHeap::is_update_refs_in_progress() const { - return _gc_state.is_set(UPDATEREFS); -} - inline bool ShenandoahHeap::is_stw_gc_in_progress() const { return is_full_gc_in_progress() || is_degenerated_gc_in_progress(); } @@ -498,10 +499,6 @@ inline bool ShenandoahHeap::is_concurrent_strong_root_in_progress() const { return _concurrent_strong_root_in_progress.is_set(); } -inline bool ShenandoahHeap::is_concurrent_weak_root_in_progress() const { - return _gc_state.is_set(WEAK_ROOTS); -} - template inline void ShenandoahHeap::marked_object_iterate(ShenandoahHeapRegion* region, T* cl) { marked_object_iterate(region, cl, region->top()); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp index d46b76c937652..42237a0ab0600 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2020, Red Hat, Inc. All rights reserved. * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/cardTable.hpp" #include "gc/shared/space.hpp" #include "gc/shared/tlab_globals.hpp" @@ -242,7 +241,7 @@ void ShenandoahHeapRegion::make_humongous_cont_bypass(ShenandoahAffiliation affi void ShenandoahHeapRegion::make_pinned() { shenandoah_assert_heaplocked(); - assert(pin_count() > 0, "Should have pins: " SIZE_FORMAT, pin_count()); + assert(pin_count() > 0, "Should have pins: %zu", pin_count()); switch (state()) { case _regular: @@ -264,7 +263,7 @@ void ShenandoahHeapRegion::make_pinned() { void ShenandoahHeapRegion::make_unpinned() { shenandoah_assert_heaplocked(); - assert(pin_count() == 0, "Should not have pins: " SIZE_FORMAT, pin_count()); + assert(pin_count() == 0, "Should not have pins: %zu", pin_count()); switch (state()) { case _pinned: @@ -398,7 +397,7 @@ void ShenandoahHeapRegion::set_live_data(size_t s) { void ShenandoahHeapRegion::print_on(outputStream* st) const { st->print("|"); - st->print(SIZE_FORMAT_W(5), this->_index); + st->print("%5zu", this->_index); switch (state()) { case _empty_uncommitted: @@ -445,15 +444,15 @@ void ShenandoahHeapRegion::print_on(outputStream* st) const { p2i(ShenandoahHeap::heap()->marking_context()->top_at_mark_start(const_cast(this)))); st->print("|UWM " SHR_PTR_FORMAT, p2i(_update_watermark)); - st->print("|U " SIZE_FORMAT_W(5) "%1s", byte_size_in_proper_unit(used()), proper_unit_for_byte_size(used())); - st->print("|T " SIZE_FORMAT_W(5) "%1s", byte_size_in_proper_unit(get_tlab_allocs()), proper_unit_for_byte_size(get_tlab_allocs())); - st->print("|G " SIZE_FORMAT_W(5) "%1s", byte_size_in_proper_unit(get_gclab_allocs()), proper_unit_for_byte_size(get_gclab_allocs())); + st->print("|U %5zu%1s", byte_size_in_proper_unit(used()), proper_unit_for_byte_size(used())); + st->print("|T %5zu%1s", byte_size_in_proper_unit(get_tlab_allocs()), proper_unit_for_byte_size(get_tlab_allocs())); + st->print("|G %5zu%1s", byte_size_in_proper_unit(get_gclab_allocs()), proper_unit_for_byte_size(get_gclab_allocs())); if (ShenandoahHeap::heap()->mode()->is_generational()) { - st->print("|P " SIZE_FORMAT_W(5) "%1s", byte_size_in_proper_unit(get_plab_allocs()), proper_unit_for_byte_size(get_plab_allocs())); + st->print("|P %5zu%1s", byte_size_in_proper_unit(get_plab_allocs()), proper_unit_for_byte_size(get_plab_allocs())); } - st->print("|S " SIZE_FORMAT_W(5) "%1s", byte_size_in_proper_unit(get_shared_allocs()), proper_unit_for_byte_size(get_shared_allocs())); - st->print("|L " SIZE_FORMAT_W(5) "%1s", byte_size_in_proper_unit(get_live_data_bytes()), proper_unit_for_byte_size(get_live_data_bytes())); - st->print("|CP " SIZE_FORMAT_W(3), pin_count()); + st->print("|S %5zu%1s", byte_size_in_proper_unit(get_shared_allocs()), proper_unit_for_byte_size(get_shared_allocs())); + st->print("|L %5zu%1s", byte_size_in_proper_unit(get_live_data_bytes()), proper_unit_for_byte_size(get_live_data_bytes())); + st->print("|CP %3zu", pin_count()); st->cr(); #undef SHR_PTR_FORMAT @@ -675,33 +674,33 @@ size_t ShenandoahHeapRegion::setup_sizes(size_t max_heap_size) { size_t region_size; if (FLAG_IS_DEFAULT(ShenandoahRegionSize)) { if (ShenandoahMinRegionSize > max_heap_size / MIN_NUM_REGIONS) { - err_msg message("Max heap size (" SIZE_FORMAT "%s) is too low to afford the minimum number " - "of regions (" SIZE_FORMAT ") of minimum region size (" SIZE_FORMAT "%s).", + err_msg message("Max heap size (%zu%s) is too low to afford the minimum number " + "of regions (%zu) of minimum region size (%zu%s).", byte_size_in_proper_unit(max_heap_size), proper_unit_for_byte_size(max_heap_size), MIN_NUM_REGIONS, byte_size_in_proper_unit(ShenandoahMinRegionSize), proper_unit_for_byte_size(ShenandoahMinRegionSize)); vm_exit_during_initialization("Invalid -XX:ShenandoahMinRegionSize option", message); } if (ShenandoahMinRegionSize < MIN_REGION_SIZE) { - err_msg message("" SIZE_FORMAT "%s should not be lower than minimum region size (" SIZE_FORMAT "%s).", + err_msg message("%zu%s should not be lower than minimum region size (%zu%s).", byte_size_in_proper_unit(ShenandoahMinRegionSize), proper_unit_for_byte_size(ShenandoahMinRegionSize), byte_size_in_proper_unit(MIN_REGION_SIZE), proper_unit_for_byte_size(MIN_REGION_SIZE)); vm_exit_during_initialization("Invalid -XX:ShenandoahMinRegionSize option", message); } if (ShenandoahMinRegionSize < MinTLABSize) { - err_msg message("" SIZE_FORMAT "%s should not be lower than TLAB size size (" SIZE_FORMAT "%s).", + err_msg message("%zu%s should not be lower than TLAB size size (%zu%s).", byte_size_in_proper_unit(ShenandoahMinRegionSize), proper_unit_for_byte_size(ShenandoahMinRegionSize), byte_size_in_proper_unit(MinTLABSize), proper_unit_for_byte_size(MinTLABSize)); vm_exit_during_initialization("Invalid -XX:ShenandoahMinRegionSize option", message); } if (ShenandoahMaxRegionSize < MIN_REGION_SIZE) { - err_msg message("" SIZE_FORMAT "%s should not be lower than min region size (" SIZE_FORMAT "%s).", + err_msg message("%zu%s should not be lower than min region size (%zu%s).", byte_size_in_proper_unit(ShenandoahMaxRegionSize), proper_unit_for_byte_size(ShenandoahMaxRegionSize), byte_size_in_proper_unit(MIN_REGION_SIZE), proper_unit_for_byte_size(MIN_REGION_SIZE)); vm_exit_during_initialization("Invalid -XX:ShenandoahMaxRegionSize option", message); } if (ShenandoahMinRegionSize > ShenandoahMaxRegionSize) { - err_msg message("Minimum (" SIZE_FORMAT "%s) should be larger than maximum (" SIZE_FORMAT "%s).", + err_msg message("Minimum (%zu%s) should be larger than maximum (%zu%s).", byte_size_in_proper_unit(ShenandoahMinRegionSize), proper_unit_for_byte_size(ShenandoahMinRegionSize), byte_size_in_proper_unit(ShenandoahMaxRegionSize), proper_unit_for_byte_size(ShenandoahMaxRegionSize)); vm_exit_during_initialization("Invalid -XX:ShenandoahMinRegionSize or -XX:ShenandoahMaxRegionSize", message); @@ -717,21 +716,21 @@ size_t ShenandoahHeapRegion::setup_sizes(size_t max_heap_size) { } else { if (ShenandoahRegionSize > max_heap_size / MIN_NUM_REGIONS) { - err_msg message("Max heap size (" SIZE_FORMAT "%s) is too low to afford the minimum number " - "of regions (" SIZE_FORMAT ") of requested size (" SIZE_FORMAT "%s).", + err_msg message("Max heap size (%zu%s) is too low to afford the minimum number " + "of regions (%zu) of requested size (%zu%s).", byte_size_in_proper_unit(max_heap_size), proper_unit_for_byte_size(max_heap_size), MIN_NUM_REGIONS, byte_size_in_proper_unit(ShenandoahRegionSize), proper_unit_for_byte_size(ShenandoahRegionSize)); vm_exit_during_initialization("Invalid -XX:ShenandoahRegionSize option", message); } if (ShenandoahRegionSize < ShenandoahMinRegionSize) { - err_msg message("Heap region size (" SIZE_FORMAT "%s) should be larger than min region size (" SIZE_FORMAT "%s).", + err_msg message("Heap region size (%zu%s) should be larger than min region size (%zu%s).", byte_size_in_proper_unit(ShenandoahRegionSize), proper_unit_for_byte_size(ShenandoahRegionSize), byte_size_in_proper_unit(ShenandoahMinRegionSize), proper_unit_for_byte_size(ShenandoahMinRegionSize)); vm_exit_during_initialization("Invalid -XX:ShenandoahRegionSize option", message); } if (ShenandoahRegionSize > ShenandoahMaxRegionSize) { - err_msg message("Heap region size (" SIZE_FORMAT "%s) should be lower than max region size (" SIZE_FORMAT "%s).", + err_msg message("Heap region size (%zu%s) should be lower than max region size (%zu%s).", byte_size_in_proper_unit(ShenandoahRegionSize), proper_unit_for_byte_size(ShenandoahRegionSize), byte_size_in_proper_unit(ShenandoahMaxRegionSize), proper_unit_for_byte_size(ShenandoahMaxRegionSize)); vm_exit_during_initialization("Invalid -XX:ShenandoahRegionSize option", message); @@ -843,7 +842,7 @@ void ShenandoahHeapRegion::record_pin() { } void ShenandoahHeapRegion::record_unpin() { - assert(pin_count() > 0, "Region " SIZE_FORMAT " should have non-zero pins", index()); + assert(pin_count() > 0, "Region %zu should have non-zero pins", index()); Atomic::sub(&_critical_pins, (size_t)1); } @@ -857,7 +856,7 @@ void ShenandoahHeapRegion::set_affiliation(ShenandoahAffiliation new_affiliation ShenandoahAffiliation region_affiliation = heap->region_affiliation(this); { ShenandoahMarkingContext* const ctx = heap->complete_marking_context(); - log_debug(gc)("Setting affiliation of Region " SIZE_FORMAT " from %s to %s, top: " PTR_FORMAT ", TAMS: " PTR_FORMAT + log_debug(gc)("Setting affiliation of Region %zu from %s to %s, top: " PTR_FORMAT ", TAMS: " PTR_FORMAT ", watermark: " PTR_FORMAT ", top_bitmap: " PTR_FORMAT, index(), shenandoah_affiliation_name(region_affiliation), shenandoah_affiliation_name(new_affiliation), p2i(top()), p2i(ctx->top_at_mark_start(this)), p2i(_update_watermark), p2i(ctx->top_bitmap(this))); @@ -871,7 +870,7 @@ void ShenandoahHeapRegion::set_affiliation(ShenandoahAffiliation new_affiliation HeapWord* top_bitmap = ctx->top_bitmap(this); assert(ctx->is_bitmap_range_within_region_clear(top_bitmap, _end), - "Region " SIZE_FORMAT ", bitmap should be clear between top_bitmap: " PTR_FORMAT " and end: " PTR_FORMAT, idx, + "Region %zu, bitmap should be clear between top_bitmap: " PTR_FORMAT " and end: " PTR_FORMAT, idx, p2i(top_bitmap), p2i(_end)); } #endif diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.inline.hpp b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.inline.hpp index 382d9ba942ccd..7f29a8628aab5 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.inline.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.inline.hpp @@ -1,6 +1,7 @@ /* * Copyright (c) 2015, 2019, Red Hat, Inc. All rights reserved. * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,7 +37,7 @@ HeapWord* ShenandoahHeapRegion::allocate_aligned(size_t size, ShenandoahAllocRequest &req, size_t alignment_in_bytes) { shenandoah_assert_heaplocked_or_safepoint(); assert(req.is_lab_alloc(), "allocate_aligned() only applies to LAB allocations"); - assert(is_object_aligned(size), "alloc size breaks alignment: " SIZE_FORMAT, size); + assert(is_object_aligned(size), "alloc size breaks alignment: %zu", size); assert(is_old(), "aligned allocations are only taken from OLD regions to support PLABs"); assert(is_aligned(alignment_in_bytes, HeapWordSize), "Expect heap word alignment"); @@ -88,7 +89,7 @@ HeapWord* ShenandoahHeapRegion::allocate_aligned(size_t size, ShenandoahAllocReq HeapWord* ShenandoahHeapRegion::allocate(size_t size, const ShenandoahAllocRequest& req) { shenandoah_assert_heaplocked_or_safepoint(); - assert(is_object_aligned(size), "alloc size breaks alignment: " SIZE_FORMAT, size); + assert(is_object_aligned(size), "alloc size breaks alignment: %zu", size); HeapWord* obj = top(); if (pointer_delta(end(), obj) >= size) { @@ -160,7 +161,7 @@ inline bool ShenandoahHeapRegion::has_live() const { inline size_t ShenandoahHeapRegion::garbage() const { assert(used() >= get_live_data_bytes(), - "Live Data must be a subset of used() live: " SIZE_FORMAT " used: " SIZE_FORMAT, + "Live Data must be a subset of used() live: %zu used: %zu", get_live_data_bytes(), used()); size_t result = used() - get_live_data_bytes(); @@ -171,7 +172,7 @@ inline size_t ShenandoahHeapRegion::garbage_before_padded_for_promote() const { assert(get_top_before_promote() != nullptr, "top before promote should not equal null"); size_t used_before_promote = byte_size(bottom(), get_top_before_promote()); assert(used_before_promote >= get_live_data_bytes(), - "Live Data must be a subset of used before promotion live: " SIZE_FORMAT " used: " SIZE_FORMAT, + "Live Data must be a subset of used before promotion live: %zu used: %zu", get_live_data_bytes(), used_before_promote); size_t result = used_before_promote - get_live_data_bytes(); return result; diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegionClosures.cpp b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegionClosures.cpp index 3d3483a5b694f..3c6fe1a3df12d 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegionClosures.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegionClosures.cpp @@ -1,5 +1,6 @@ /* * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * 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 +23,6 @@ * */ -#include "precompiled.hpp" - #include "gc/shenandoah/shenandoahHeapRegionClosures.hpp" #include "gc/shenandoah/shenandoahMarkingContext.hpp" #include "gc/shenandoah/shenandoahSharedVariables.hpp" @@ -82,8 +81,8 @@ void ShenandoahFinalMarkUpdateRegionStateClosure::heap_region_do(ShenandoahHeapR // from-space-refs written from here on. r->set_update_watermark_at_safepoint(r->top()); } else { - assert(!r->has_live(), "Region " SIZE_FORMAT " should have no live data", r->index()); + assert(!r->has_live(), "Region %zu should have no live data", r->index()); assert(_ctx == nullptr || _ctx->top_at_mark_start(r) == r->top(), - "Region " SIZE_FORMAT " should have correct TAMS", r->index()); + "Region %zu should have correct TAMS", r->index()); } } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegionCounters.cpp b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegionCounters.cpp index 73250cecd6fe5..360c7d2d649a5 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegionCounters.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegionCounters.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) 2016, 2020, Red Hat, Inc. All rights reserved. * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * 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 +24,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahGeneration.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" @@ -91,7 +91,7 @@ void ShenandoahHeapRegionCounters::write_snapshot(PerfLongVariable** regions, ResourceMark rm; LogStream ls(lt); - ls.print_cr(JLONG_FORMAT " " JLONG_FORMAT " " SIZE_FORMAT " " SIZE_FORMAT " " SIZE_FORMAT, + ls.print_cr(JLONG_FORMAT " " JLONG_FORMAT " %zu %zu %zu", ts->get_value(), status->get_value(), num_regions, region_size, protocol_version); if (num_regions > 0) { ls.print(JLONG_FORMAT, regions[0]->get_value()); @@ -147,10 +147,10 @@ static int encode_phase(ShenandoahHeap* heap) { if (heap->is_update_refs_in_progress() || heap->is_full_gc_move_in_progress()) { return 3; } - if (heap->is_concurrent_mark_in_progress() || heap->is_full_gc_in_progress()) { + if (heap->is_concurrent_mark_in_progress() || heap->is_concurrent_weak_root_in_progress() || heap->is_full_gc_in_progress()) { return 1; } - assert(heap->is_idle(), "What is it doing?"); + assert(heap->is_idle(), "Unexpected gc_state: %d", heap->gc_state()); return 0; } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegionSet.cpp b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegionSet.cpp index d18bfb0d62598..46d54c70fe159 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegionSet.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegionSet.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2013, 2019, Red Hat, Inc. All rights reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahHeapRegionSet.inline.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "gc/shenandoah/shenandoahHeapRegion.hpp" @@ -81,7 +81,7 @@ ShenandoahHeapRegion* ShenandoahHeapRegionSetIterator::next() { } void ShenandoahHeapRegionSet::print_on(outputStream* out) const { - out->print_cr("Region Set : " SIZE_FORMAT "", count()); + out->print_cr("Region Set : %zu", count()); for (size_t index = 0; index < _heap->num_regions(); index++) { if (is_in(index)) { _heap->get_region(index)->print_on(out); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahInitLogger.cpp b/src/hotspot/share/gc/shenandoah/shenandoahInitLogger.cpp index baf95a5bdf7e4..b4ea327965b34 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahInitLogger.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahInitLogger.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) 2020, Red Hat, Inc. All rights reserved. * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * 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 +24,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "gc/shenandoah/shenandoahHeapRegion.hpp" #include "gc/shenandoah/shenandoahInitLogger.hpp" @@ -40,7 +40,7 @@ void ShenandoahInitLogger::print() { void ShenandoahInitLogger::print_heap() { GCInitLogger::print_heap(); - log_info(gc, init)("Heap Region Count: " SIZE_FORMAT, ShenandoahHeapRegion::region_count()); + log_info(gc, init)("Heap Region Count: %zu", ShenandoahHeapRegion::region_count()); log_info(gc, init)("Heap Region Size: " EXACTFMT, EXACTFMTARGS(ShenandoahHeapRegion::region_size_bytes())); log_info(gc, init)("TLAB Size Max: " EXACTFMT, EXACTFMTARGS(ShenandoahHeapRegion::max_tlab_size_bytes())); } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahJfrSupport.cpp b/src/hotspot/share/gc/shenandoah/shenandoahJfrSupport.cpp index cd555e12c6f4d..97307e85a9b04 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahJfrSupport.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahJfrSupport.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "gc/shenandoah/shenandoahHeapRegion.hpp" #include "gc/shenandoah/shenandoahJfrSupport.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahLock.cpp b/src/hotspot/share/gc/shenandoah/shenandoahLock.cpp index 63c6c9ea88624..be72127c6ec75 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahLock.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahLock.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "runtime/os.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahMark.cpp b/src/hotspot/share/gc/shenandoah/shenandoahMark.cpp index 686295c3e1b71..2a4149ee44dc4 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahMark.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahMark.cpp @@ -24,7 +24,6 @@ */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahBarrierSet.hpp" #include "gc/shenandoah/shenandoahClosures.inline.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahMark.inline.hpp b/src/hotspot/share/gc/shenandoah/shenandoahMark.inline.hpp index 0239f961c65f1..2dc0813e51354 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahMark.inline.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahMark.inline.hpp @@ -1,6 +1,7 @@ /* * Copyright (c) 2015, 2022, Red Hat, Inc. All rights reserved. * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -128,7 +129,7 @@ inline void ShenandoahMark::count_liveness(ShenandoahLiveData* live_data, oop ob if (!region->is_humongous_start()) { assert(!region->is_humongous(), "Cannot have continuations here"); - assert(region->is_affiliated(), "Do not count live data within Free Regular Region " SIZE_FORMAT, region_idx); + assert(region->is_affiliated(), "Do not count live data within Free Regular Region %zu", region_idx); ShenandoahLiveData cur = live_data[region_idx]; size_t new_val = size + cur; if (new_val >= SHENANDOAH_LIVEDATA_MAX) { @@ -143,11 +144,11 @@ inline void ShenandoahMark::count_liveness(ShenandoahLiveData* live_data, oop ob shenandoah_assert_in_correct_region(nullptr, obj); size_t num_regions = ShenandoahHeapRegion::required_regions(size * HeapWordSize); - assert(region->is_affiliated(), "Do not count live data within FREE Humongous Start Region " SIZE_FORMAT, region_idx); + assert(region->is_affiliated(), "Do not count live data within FREE Humongous Start Region %zu", region_idx); for (size_t i = region_idx; i < region_idx + num_regions; i++) { ShenandoahHeapRegion* chain_reg = heap->get_region(i); assert(chain_reg->is_humongous(), "Expecting a humongous region"); - assert(chain_reg->is_affiliated(), "Do not count live data within FREE Humongous Continuation Region " SIZE_FORMAT, i); + assert(chain_reg->is_affiliated(), "Do not count live data within FREE Humongous Continuation Region %zu", i); chain_reg->increase_live_data_gc_words(chain_reg->used() >> LogHeapWordSize); } } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahMarkBitMap.cpp b/src/hotspot/share/gc/shenandoah/shenandoahMarkBitMap.cpp index cd0f31ae14ffe..9986afc6f2019 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahMarkBitMap.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahMarkBitMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, Red Hat, Inc. and/or its affiliates. * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahMarkBitMap.inline.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "runtime/os.hpp" @@ -154,19 +153,19 @@ void ShenandoahMarkBitMap::check_mark(HeapWord* addr) const { void ShenandoahMarkBitMap::verify_index(idx_t bit) const { assert(bit < _size, - "BitMap index out of bounds: " SIZE_FORMAT " >= " SIZE_FORMAT, + "BitMap index out of bounds: %zu >= %zu", bit, _size); } void ShenandoahMarkBitMap::verify_limit(idx_t bit) const { assert(bit <= _size, - "BitMap limit out of bounds: " SIZE_FORMAT " > " SIZE_FORMAT, + "BitMap limit out of bounds: %zu > %zu", bit, _size); } void ShenandoahMarkBitMap::verify_range(idx_t beg, idx_t end) const { assert(beg <= end, - "BitMap range error: " SIZE_FORMAT " > " SIZE_FORMAT, beg, end); + "BitMap range error: %zu > %zu", beg, end); verify_limit(end); } #endif diff --git a/src/hotspot/share/gc/shenandoah/shenandoahMarkingContext.cpp b/src/hotspot/share/gc/shenandoah/shenandoahMarkingContext.cpp index ded9fbd97f5b1..4fa006e60fb61 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahMarkingContext.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahMarkingContext.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) 2018, 2021, Red Hat, Inc. All rights reserved. * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * 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 +24,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/markBitMap.inline.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "gc/shenandoah/shenandoahMarkingContext.hpp" @@ -56,7 +56,7 @@ bool ShenandoahMarkingContext::is_bitmap_range_within_region_clear(const HeapWor size_t start_idx = heap->heap_region_index_containing(start); #ifdef ASSERT size_t end_idx = heap->heap_region_index_containing(end - 1); - assert(start_idx == end_idx, "Expected range to be within same region (" SIZE_FORMAT ", " SIZE_FORMAT ")", start_idx, end_idx); + assert(start_idx == end_idx, "Expected range to be within same region (%zu, %zu)", start_idx, end_idx); #endif ShenandoahHeapRegion* r = heap->get_region(start_idx); if (!heap->is_bitmap_slice_committed(r)) { @@ -73,7 +73,7 @@ void ShenandoahMarkingContext::initialize_top_at_mark_start(ShenandoahHeapRegion _top_at_mark_starts_base[idx] = bottom; _top_bitmaps[idx] = bottom; - log_debug(gc)("SMC:initialize_top_at_mark_start for Region " SIZE_FORMAT ", TAMS: " PTR_FORMAT ", TopOfBitMap: " PTR_FORMAT, + log_debug(gc)("SMC:initialize_top_at_mark_start for Region %zu, TAMS: " PTR_FORMAT ", TopOfBitMap: " PTR_FORMAT, r->index(), p2i(bottom), p2i(r->end())); } @@ -85,7 +85,7 @@ void ShenandoahMarkingContext::clear_bitmap(ShenandoahHeapRegion* r) { HeapWord* bottom = r->bottom(); HeapWord* top_bitmap = _top_bitmaps[r->index()]; - log_debug(gc)("SMC:clear_bitmap for %s Region " SIZE_FORMAT ", top_bitmap: " PTR_FORMAT, + log_debug(gc)("SMC:clear_bitmap for %s Region %zu, top_bitmap: " PTR_FORMAT, r->affiliation_name(), r->index(), p2i(top_bitmap)); if (top_bitmap > bottom) { @@ -94,7 +94,7 @@ void ShenandoahMarkingContext::clear_bitmap(ShenandoahHeapRegion* r) { } assert(is_bitmap_range_within_region_clear(bottom, r->end()), - "Region " SIZE_FORMAT " should have no marks in bitmap", r->index()); + "Region %zu should have no marks in bitmap", r->index()); } bool ShenandoahMarkingContext::is_complete() { diff --git a/src/hotspot/share/gc/shenandoah/shenandoahMarkingContext.inline.hpp b/src/hotspot/share/gc/shenandoah/shenandoahMarkingContext.inline.hpp index 75a16e1554992..d9bddd5fbb6b9 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahMarkingContext.inline.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahMarkingContext.inline.hpp @@ -1,6 +1,7 @@ /* * Copyright (c) 2018, 2019, Red Hat, Inc. All rights reserved. * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * 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,16 +94,16 @@ inline void ShenandoahMarkingContext::capture_top_at_mark_start(ShenandoahHeapRe HeapWord* new_tams = r->top(); assert(new_tams >= old_tams, - "Region " SIZE_FORMAT", TAMS updates should be monotonic: " PTR_FORMAT " -> " PTR_FORMAT, + "Region %zu, TAMS updates should be monotonic: " PTR_FORMAT " -> " PTR_FORMAT, idx, p2i(old_tams), p2i(new_tams)); assert((new_tams == r->bottom()) || (old_tams == r->bottom()) || (new_tams >= _top_bitmaps[idx]), - "Region " SIZE_FORMAT", top_bitmaps updates should be monotonic: " PTR_FORMAT " -> " PTR_FORMAT, + "Region %zu, top_bitmaps updates should be monotonic: " PTR_FORMAT " -> " PTR_FORMAT, idx, p2i(_top_bitmaps[idx]), p2i(new_tams)); assert(old_tams == r->bottom() || is_bitmap_range_within_region_clear(old_tams, new_tams), - "Region " SIZE_FORMAT ", bitmap should be clear while adjusting TAMS: " PTR_FORMAT " -> " PTR_FORMAT, + "Region %zu, bitmap should be clear while adjusting TAMS: " PTR_FORMAT " -> " PTR_FORMAT, idx, p2i(old_tams), p2i(new_tams)); - log_debug(gc)("Capturing TAMS for %s Region " SIZE_FORMAT ", was: " PTR_FORMAT ", now: " PTR_FORMAT, + log_debug(gc)("Capturing TAMS for %s Region %zu, was: " PTR_FORMAT ", now: " PTR_FORMAT, r->affiliation_name(), idx, p2i(old_tams), p2i(new_tams)); _top_at_mark_starts_base[idx] = new_tams; @@ -119,7 +120,7 @@ inline HeapWord* ShenandoahMarkingContext::top_at_mark_start(const ShenandoahHea inline void ShenandoahMarkingContext::reset_top_bitmap(ShenandoahHeapRegion* r) { assert(is_bitmap_range_within_region_clear(r->bottom(), r->end()), - "Region " SIZE_FORMAT " should have no marks in bitmap", r->index()); + "Region %zu should have no marks in bitmap", r->index()); _top_bitmaps[r->index()] = r->bottom(); } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahMemoryPool.cpp b/src/hotspot/share/gc/shenandoah/shenandoahMemoryPool.cpp index 9350f44585fcf..e9aa69b5555c5 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahMemoryPool.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahMemoryPool.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) 2013, 2019, Red Hat, Inc. All rights reserved. * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * 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 +24,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahMemoryPool.hpp" #include "gc/shenandoah/shenandoahYoungGeneration.hpp" #include "gc/shenandoah/shenandoahOldGeneration.hpp" @@ -54,15 +54,15 @@ MemoryUsage ShenandoahMemoryPool::get_memory_usage() { size_t committed = _heap->committed(); // These asserts can never fail: max is stable, and all updates to other values never overflow max. - assert(initial <= max, "initial: " SIZE_FORMAT ", max: " SIZE_FORMAT, initial, max); - assert(used <= max, "used: " SIZE_FORMAT ", max: " SIZE_FORMAT, used, max); - assert(committed <= max, "committed: " SIZE_FORMAT ", max: " SIZE_FORMAT, committed, max); + assert(initial <= max, "initial: %zu, max: %zu", initial, max); + assert(used <= max, "used: %zu, max: %zu", used, max); + assert(committed <= max, "committed: %zu, max: %zu", committed, max); // Committed and used are updated concurrently and independently. They can momentarily break // the assert below, which would also fail in downstream code. To avoid that, adjust values // to make sense under the race. See JDK-8207200. committed = MAX2(used, committed); - assert(used <= committed, "used: " SIZE_FORMAT ", committed: " SIZE_FORMAT, used, committed); + assert(used <= committed, "used: %zu, committed: %zu", used, committed); return MemoryUsage(initial, used, committed, max); } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahMetrics.cpp b/src/hotspot/share/gc/shenandoah/shenandoahMetrics.cpp index 8b2412ff9ab05..201bcdc9e390b 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahMetrics.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahMetrics.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2013, 2019, Red Hat, Inc. All rights reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahMetrics.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "gc/shenandoah/shenandoahHeapRegion.hpp" @@ -48,7 +48,7 @@ bool ShenandoahMetricsSnapshot::is_good_progress() { size_t free_actual = _heap->free_set()->available(); size_t free_expected = _heap->max_capacity() / 100 * ShenandoahCriticalFreeThreshold; bool prog_free = free_actual >= free_expected; - log_info(gc, ergo)("%s progress for free space: " SIZE_FORMAT "%s, need " SIZE_FORMAT "%s", + log_info(gc, ergo)("%s progress for free space: %zu%s, need %zu%s", prog_free ? "Good" : "Bad", byte_size_in_proper_unit(free_actual), proper_unit_for_byte_size(free_actual), byte_size_in_proper_unit(free_expected), proper_unit_for_byte_size(free_expected)); @@ -60,7 +60,7 @@ bool ShenandoahMetricsSnapshot::is_good_progress() { size_t progress_actual = (_used_before > _used_after) ? _used_before - _used_after : 0; size_t progress_expected = ShenandoahHeapRegion::region_size_bytes(); bool prog_used = progress_actual >= progress_expected; - log_info(gc, ergo)("%s progress for used space: " SIZE_FORMAT "%s, need " SIZE_FORMAT "%s", + log_info(gc, ergo)("%s progress for used space: %zu%s, need %zu%s", prog_used ? "Good" : "Bad", byte_size_in_proper_unit(progress_actual), proper_unit_for_byte_size(progress_actual), byte_size_in_proper_unit(progress_expected), proper_unit_for_byte_size(progress_expected)); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahMmuTracker.cpp b/src/hotspot/share/gc/shenandoah/shenandoahMmuTracker.cpp index d9cec36e6c9c7..663864b1294ce 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahMmuTracker.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahMmuTracker.cpp @@ -1,5 +1,6 @@ /* * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * 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 +22,6 @@ * questions. * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahAsserts.hpp" #include "gc/shenandoah/shenandoahMmuTracker.hpp" @@ -48,7 +48,7 @@ class ThreadTimeAccumulator : public ThreadClosure { size_t total_time; ThreadTimeAccumulator() : total_time(0) {} void do_thread(Thread* thread) override { - assert(!thread->has_terminated(), "Cannot get cpu time for terminated thread: " UINTX_FORMAT, thread->osthread()->thread_id_for_printing()); + assert(!thread->has_terminated(), "Cannot get cpu time for terminated thread: %zu", thread->osthread()->thread_id_for_printing()); total_time += os::thread_cpu_time(thread); } }; diff --git a/src/hotspot/share/gc/shenandoah/shenandoahMonitoringSupport.cpp b/src/hotspot/share/gc/shenandoah/shenandoahMonitoringSupport.cpp index ffeab9b635102..77d586dd90bcd 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahMonitoringSupport.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahMonitoringSupport.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/collectorCounters.hpp" #include "gc/shared/generationCounters.hpp" #include "gc/shared/hSpaceCounters.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahNMethod.cpp b/src/hotspot/share/gc/shenandoah/shenandoahNMethod.cpp index 5ba241590882c..53dd3ae1b1ef8 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahNMethod.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahNMethod.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2019, 2022, Red Hat, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahClosures.inline.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahNumberSeq.cpp b/src/hotspot/share/gc/shenandoah/shenandoahNumberSeq.cpp index 3c7ba8e424300..be032a60db70a 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahNumberSeq.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahNumberSeq.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) 2018, 2019, Red Hat, Inc. All rights reserved. * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * 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 +24,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahNumberSeq.hpp" #include "runtime/atomic.hpp" @@ -208,12 +208,12 @@ void BinaryMagnitudeSeq::add(size_t val) { // Defensively saturate for product bits: if (mag < 0) { - assert (false, "bucket index (%d) underflow for value (" SIZE_FORMAT ")", mag, val); + assert (false, "bucket index (%d) underflow for value (%zu)", mag, val); mag = 0; } if (mag >= BitsPerSize_t) { - assert (false, "bucket index (%d) overflow for value (" SIZE_FORMAT ")", mag, val); + assert (false, "bucket index (%d) overflow for value (%zu)", mag, val); mag = BitsPerSize_t - 1; } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahOldGC.cpp b/src/hotspot/share/gc/shenandoah/shenandoahOldGC.cpp index a5d3302091c00..708d27db16525 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahOldGC.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahOldGC.cpp @@ -22,8 +22,6 @@ * */ -#include "precompiled.hpp" - #include "gc/shenandoah/heuristics/shenandoahYoungHeuristics.hpp" #include "gc/shenandoah/shenandoahClosures.inline.hpp" #include "gc/shenandoah/shenandoahFreeSet.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahOldGeneration.cpp b/src/hotspot/share/gc/shenandoah/shenandoahOldGeneration.cpp index 36007023d4600..388872172553b 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahOldGeneration.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahOldGeneration.cpp @@ -1,5 +1,6 @@ /* * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * 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,9 +23,6 @@ * */ - -#include "precompiled.hpp" - #include "gc/shared/strongRootsScope.hpp" #include "gc/shenandoah/heuristics/shenandoahOldHeuristics.hpp" #include "gc/shenandoah/shenandoahAsserts.hpp" @@ -108,7 +106,7 @@ class ShenandoahPurgeSATBTask : public WorkerTask { ~ShenandoahPurgeSATBTask() { if (_trashed_oops > 0) { - log_debug(gc)("Purged " SIZE_FORMAT " oops from old generation SATB buffers", _trashed_oops); + log_debug(gc)("Purged %zu oops from old generation SATB buffers", _trashed_oops); } } @@ -653,9 +651,9 @@ void ShenandoahOldGeneration::handle_failed_promotion(Thread* thread, size_t siz const size_t words_remaining = (plab == nullptr)? 0: plab->words_remaining(); const char* promote_enabled = ShenandoahThreadLocalData::allow_plab_promotions(thread)? "enabled": "disabled"; - log_info(gc, ergo)("Promotion failed, size " SIZE_FORMAT ", has plab? %s, PLAB remaining: " SIZE_FORMAT - ", plab promotions %s, promotion reserve: " SIZE_FORMAT ", promotion expended: " SIZE_FORMAT - ", old capacity: " SIZE_FORMAT ", old_used: " SIZE_FORMAT ", old unaffiliated regions: " SIZE_FORMAT, + log_info(gc, ergo)("Promotion failed, size %zu, has plab? %s, PLAB remaining: %zu" + ", plab promotions %s, promotion reserve: %zu, promotion expended: %zu" + ", old capacity: %zu, old_used: %zu, old unaffiliated regions: %zu", size * HeapWordSize, plab == nullptr? "no": "yes", words_remaining * HeapWordSize, promote_enabled, promotion_reserve, promotion_expended, max_capacity(), used(), free_unaffiliated_regions()); @@ -700,7 +698,7 @@ void ShenandoahOldGeneration::abandon_collection_candidates() { void ShenandoahOldGeneration::prepare_for_mixed_collections_after_global_gc() { assert(is_mark_complete(), "Expected old generation mark to be complete after global cycle."); _old_heuristics->prepare_for_old_collections(); - log_info(gc, ergo)("After choosing global collection set, mixed candidates: " UINT32_FORMAT ", coalescing candidates: " SIZE_FORMAT, + log_info(gc, ergo)("After choosing global collection set, mixed candidates: " UINT32_FORMAT ", coalescing candidates: %zu", _old_heuristics->unprocessed_old_collection_candidates(), _old_heuristics->coalesce_and_fill_candidates_count()); } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp b/src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp index e7d5a2e00c5b2..06b9d072aeb91 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2018, 2019, Red Hat, Inc. All rights reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahFreeSet.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" @@ -73,8 +73,8 @@ void ShenandoahPacer::setup_for_mark() { restart_with(non_taxable, tax); - log_info(gc, ergo)("Pacer for Mark. Expected Live: " SIZE_FORMAT "%s, Free: " SIZE_FORMAT "%s, " - "Non-Taxable: " SIZE_FORMAT "%s, Alloc Tax Rate: %.1fx", + log_info(gc, ergo)("Pacer for Mark. Expected Live: %zu%s, Free: %zu%s, " + "Non-Taxable: %zu%s, Alloc Tax Rate: %.1fx", byte_size_in_proper_unit(live), proper_unit_for_byte_size(live), byte_size_in_proper_unit(free), proper_unit_for_byte_size(free), byte_size_in_proper_unit(non_taxable), proper_unit_for_byte_size(non_taxable), @@ -98,15 +98,15 @@ void ShenandoahPacer::setup_for_evac() { restart_with(non_taxable, tax); - log_info(gc, ergo)("Pacer for Evacuation. Used CSet: " SIZE_FORMAT "%s, Free: " SIZE_FORMAT "%s, " - "Non-Taxable: " SIZE_FORMAT "%s, Alloc Tax Rate: %.1fx", + log_info(gc, ergo)("Pacer for Evacuation. Used CSet: %zu%s, Free: %zu%s, " + "Non-Taxable: %zu%s, Alloc Tax Rate: %.1fx", byte_size_in_proper_unit(used), proper_unit_for_byte_size(used), byte_size_in_proper_unit(free), proper_unit_for_byte_size(free), byte_size_in_proper_unit(non_taxable), proper_unit_for_byte_size(non_taxable), tax); } -void ShenandoahPacer::setup_for_updaterefs() { +void ShenandoahPacer::setup_for_update_refs() { assert(ShenandoahPacing, "Only be here when pacing is enabled"); size_t used = _heap->used(); @@ -123,8 +123,8 @@ void ShenandoahPacer::setup_for_updaterefs() { restart_with(non_taxable, tax); - log_info(gc, ergo)("Pacer for Update Refs. Used: " SIZE_FORMAT "%s, Free: " SIZE_FORMAT "%s, " - "Non-Taxable: " SIZE_FORMAT "%s, Alloc Tax Rate: %.1fx", + log_info(gc, ergo)("Pacer for Update Refs. Used: %zu%s, Free: %zu%s, " + "Non-Taxable: %zu%s, Alloc Tax Rate: %.1fx", byte_size_in_proper_unit(used), proper_unit_for_byte_size(used), byte_size_in_proper_unit(free), proper_unit_for_byte_size(free), byte_size_in_proper_unit(non_taxable), proper_unit_for_byte_size(non_taxable), @@ -148,7 +148,7 @@ void ShenandoahPacer::setup_for_idle() { restart_with(initial, tax); - log_info(gc, ergo)("Pacer for Idle. Initial: " SIZE_FORMAT "%s, Alloc Tax Rate: %.1fx", + log_info(gc, ergo)("Pacer for Idle. Initial: %zu%s, Alloc Tax Rate: %.1fx", byte_size_in_proper_unit(initial), proper_unit_for_byte_size(initial), tax); } @@ -164,7 +164,7 @@ void ShenandoahPacer::setup_for_reset() { size_t initial = _heap->max_capacity(); restart_with(initial, 1.0); - log_info(gc, ergo)("Pacer for Reset. Non-Taxable: " SIZE_FORMAT "%s", + log_info(gc, ergo)("Pacer for Reset. Non-Taxable: %zu%s", byte_size_in_proper_unit(initial), proper_unit_for_byte_size(initial)); } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahPacer.hpp b/src/hotspot/share/gc/shenandoah/shenandoahPacer.hpp index 44ad2700f8704..fd922d5572960 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahPacer.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahPacer.hpp @@ -97,13 +97,13 @@ class ShenandoahPacer : public CHeapObj { void setup_for_idle(); void setup_for_mark(); void setup_for_evac(); - void setup_for_updaterefs(); + void setup_for_update_refs(); void setup_for_reset(); inline void report_mark(size_t words); inline void report_evac(size_t words); - inline void report_updaterefs(size_t words); + inline void report_update_refs(size_t words); inline void report_alloc(size_t words); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahPacer.inline.hpp b/src/hotspot/share/gc/shenandoah/shenandoahPacer.inline.hpp index 38ce12437a38d..881b8a9590ac7 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahPacer.inline.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahPacer.inline.hpp @@ -38,7 +38,7 @@ inline void ShenandoahPacer::report_evac(size_t words) { report_internal(words); } -inline void ShenandoahPacer::report_updaterefs(size_t words) { +inline void ShenandoahPacer::report_update_refs(size_t words) { report_internal(words); } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahParallelCleaning.cpp b/src/hotspot/share/gc/shenandoah/shenandoahParallelCleaning.cpp index bc2c0b54b5ae5..99c739026cc7d 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahParallelCleaning.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahParallelCleaning.cpp @@ -23,7 +23,6 @@ */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahClosures.inline.hpp" #include "gc/shenandoah/shenandoahCodeRoots.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.cpp b/src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.cpp index f247308ec560d..b25edfd3cb700 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.cpp @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/workerDataArray.inline.hpp" #include "gc/shenandoah/shenandoahCollectorPolicy.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.hpp b/src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.hpp index 4c8cb8c20570d..7a8fed9f54837 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.hpp @@ -146,7 +146,7 @@ class outputStream; f(degen_gc_final_rebuild_freeset, " Rebuild Free Set") \ f(degen_gc_stw_evac, " Evacuation") \ f(degen_gc_init_update_refs_manage_gclabs, " Manage GCLABs") \ - f(degen_gc_updaterefs, " Update References") \ + f(degen_gc_update_refs, " Update References") \ f(degen_gc_final_update_refs_finish_work, " Finish Work") \ f(degen_gc_final_update_refs_update_region_states," Update Region States") \ f(degen_gc_final_update_refs_trash_cset, " Trash Collection Set") \ diff --git a/src/hotspot/share/gc/shenandoah/shenandoahReferenceProcessor.cpp b/src/hotspot/share/gc/shenandoah/shenandoahReferenceProcessor.cpp index 07d2fd3c4e342..04d38d97f61af 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahReferenceProcessor.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahReferenceProcessor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2021, Red Hat, Inc. and/or its affiliates. * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "classfile/javaClasses.hpp" #include "gc/shared/workerThread.hpp" #include "gc/shenandoah/shenandoahGeneration.hpp" @@ -673,10 +672,10 @@ void ShenandoahReferenceProcessor::collect_statistics() { discovered[REF_FINAL], discovered[REF_PHANTOM]); - log_info(gc,ref)("Encountered references: Soft: " SIZE_FORMAT ", Weak: " SIZE_FORMAT ", Final: " SIZE_FORMAT ", Phantom: " SIZE_FORMAT, + log_info(gc,ref)("Encountered references: Soft: %zu, Weak: %zu, Final: %zu, Phantom: %zu", encountered[REF_SOFT], encountered[REF_WEAK], encountered[REF_FINAL], encountered[REF_PHANTOM]); - log_info(gc,ref)("Discovered references: Soft: " SIZE_FORMAT ", Weak: " SIZE_FORMAT ", Final: " SIZE_FORMAT ", Phantom: " SIZE_FORMAT, + log_info(gc,ref)("Discovered references: Soft: %zu, Weak: %zu, Final: %zu, Phantom: %zu", discovered[REF_SOFT], discovered[REF_WEAK], discovered[REF_FINAL], discovered[REF_PHANTOM]); - log_info(gc,ref)("Enqueued references: Soft: " SIZE_FORMAT ", Weak: " SIZE_FORMAT ", Final: " SIZE_FORMAT ", Phantom: " SIZE_FORMAT, + log_info(gc,ref)("Enqueued references: Soft: %zu, Weak: %zu, Final: %zu, Phantom: %zu", enqueued[REF_SOFT], enqueued[REF_WEAK], enqueued[REF_FINAL], enqueued[REF_PHANTOM]); } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahRegulatorThread.cpp b/src/hotspot/share/gc/shenandoah/shenandoahRegulatorThread.cpp index f8e0e7125acdb..7ed2803f87714 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahRegulatorThread.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahRegulatorThread.cpp @@ -21,7 +21,6 @@ * questions. * */ -#include "precompiled.hpp" #include "gc/shenandoah/heuristics/shenandoahHeuristics.hpp" #include "gc/shenandoah/mode/shenandoahMode.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.cpp b/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.cpp index 804d643e753be..b3b5109f6b376 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderData.hpp" #include "code/nmethod.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahRootVerifier.cpp b/src/hotspot/share/gc/shenandoah/shenandoahRootVerifier.cpp index b9d7b34cc7c10..3fbf3e8d6d5f7 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahRootVerifier.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahRootVerifier.cpp @@ -24,7 +24,6 @@ */ -#include "precompiled.hpp" #include "classfile/classLoaderDataGraph.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahRuntime.cpp b/src/hotspot/share/gc/shenandoah/shenandoahRuntime.cpp index b217c641824c2..2984debd9f861 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahRuntime.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahRuntime.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahBarrierSet.inline.hpp" #include "gc/shenandoah/shenandoahBarrierSetClone.inline.hpp" #include "gc/shenandoah/shenandoahRuntime.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahSATBMarkQueueSet.cpp b/src/hotspot/share/gc/shenandoah/shenandoahSATBMarkQueueSet.cpp index ec00167f0e3b8..547ebb1a2296f 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahSATBMarkQueueSet.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahSATBMarkQueueSet.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "gc/shenandoah/shenandoahSATBMarkQueueSet.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahSTWMark.cpp b/src/hotspot/share/gc/shenandoah/shenandoahSTWMark.cpp index 1b565006f7417..c2bfea664fdcf 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahSTWMark.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahSTWMark.cpp @@ -24,7 +24,6 @@ */ -#include "precompiled.hpp" #include "gc/shared/strongRootsScope.hpp" #include "gc/shared/taskTerminator.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahScanRemembered.cpp b/src/hotspot/share/gc/shenandoah/shenandoahScanRemembered.cpp index 5f09801b92951..b9f52909cbe9f 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahScanRemembered.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahScanRemembered.cpp @@ -1,5 +1,6 @@ /* * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * 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,9 +23,6 @@ * */ - -#include "precompiled.hpp" - #include "gc/shenandoah/shenandoahClosures.inline.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "gc/shenandoah/shenandoahOldGeneration.hpp" @@ -686,7 +684,7 @@ void ShenandoahScanRememberedTask::do_work(uint worker_id) { while (_work_list->next(&assignment)) { ShenandoahHeapRegion* region = assignment._r; log_debug(gc)("ShenandoahScanRememberedTask::do_work(%u), processing slice of region " - SIZE_FORMAT " at offset " SIZE_FORMAT ", size: " SIZE_FORMAT, + "%zu at offset %zu, size: %zu", worker_id, region->index(), assignment._chunk_offset, assignment._chunk_size); if (region->is_old()) { size_t cluster_size = @@ -856,7 +854,7 @@ ShenandoahRegionChunkIterator::ShenandoahRegionChunkIterator(ShenandoahHeap* hea { #ifdef ASSERT size_t expected_chunk_size_words = _clusters_in_smallest_chunk * CardTable::card_size_in_words() * ShenandoahCardCluster::CardsPerCluster; - assert(smallest_chunk_size_words() == expected_chunk_size_words, "_smallest_chunk_size (" SIZE_FORMAT") is not valid because it does not equal (" SIZE_FORMAT ")", + assert(smallest_chunk_size_words() == expected_chunk_size_words, "_smallest_chunk_size (%zu) is not valid because it does not equal (%zu)", smallest_chunk_size_words(), expected_chunk_size_words); #endif assert(_num_groups <= _maximum_groups, @@ -897,13 +895,13 @@ ShenandoahRegionChunkIterator::ShenandoahRegionChunkIterator(ShenandoahHeap* hea } if (_group_entries[_num_groups-1] < _total_chunks) { assert((_total_chunks - _group_entries[_num_groups-1]) * _group_chunk_size[_num_groups-1] + previous_group_span == - heap->num_regions() * words_in_region, "Total region chunks (" SIZE_FORMAT - ") do not span total heap regions (" SIZE_FORMAT ")", _total_chunks, _heap->num_regions()); + heap->num_regions() * words_in_region, "Total region chunks (%zu" + ") do not span total heap regions (%zu)", _total_chunks, _heap->num_regions()); previous_group_span += (_total_chunks - _group_entries[_num_groups-1]) * _group_chunk_size[_num_groups-1]; _group_entries[_num_groups-1] = _total_chunks; } - assert(previous_group_span == heap->num_regions() * words_in_region, "Total region chunks (" SIZE_FORMAT - ") do not span total heap regions (" SIZE_FORMAT "): " SIZE_FORMAT " does not equal " SIZE_FORMAT, + assert(previous_group_span == heap->num_regions() * words_in_region, "Total region chunks (%zu" + ") do not span total heap regions (%zu): %zu does not equal %zu", _total_chunks, _heap->num_regions(), previous_group_span, heap->num_regions() * words_in_region); // Not necessary, but keeps things tidy diff --git a/src/hotspot/share/gc/shenandoah/shenandoahScanRemembered.inline.hpp b/src/hotspot/share/gc/shenandoah/shenandoahScanRemembered.inline.hpp index ec00adc4040b1..b0fc55631e067 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahScanRemembered.inline.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahScanRemembered.inline.hpp @@ -1,5 +1,6 @@ /* * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -69,8 +70,8 @@ void ShenandoahScanRemembered::process_clusters(size_t first_cluster, size_t cou const size_t whole_cards = (end_addr - start_addr + CardTable::card_size_in_words() - 1)/CardTable::card_size_in_words(); const size_t end_card_index = start_card_index + whole_cards - 1; - log_debug(gc, remset)("Worker %u: cluster = " SIZE_FORMAT " count = " SIZE_FORMAT " eor = " INTPTR_FORMAT - " start_addr = " INTPTR_FORMAT " end_addr = " INTPTR_FORMAT " cards = " SIZE_FORMAT, + log_debug(gc, remset)("Worker %u: cluster = %zu count = %zu eor = " INTPTR_FORMAT + " start_addr = " INTPTR_FORMAT " end_addr = " INTPTR_FORMAT " cards = %zu", worker_id, first_cluster, count, p2i(end_of_range), p2i(start_addr), p2i(end_addr), whole_cards); // use_write_table states whether we are using the card table that is being @@ -341,7 +342,7 @@ ShenandoahScanRemembered::process_region_slice(ShenandoahHeapRegion *region, siz } } - log_debug(gc)("Remembered set scan processing Region " SIZE_FORMAT ", from " PTR_FORMAT " to " PTR_FORMAT ", using %s table", + log_debug(gc)("Remembered set scan processing Region %zu, from " PTR_FORMAT " to " PTR_FORMAT ", using %s table", region->index(), p2i(start_of_range), p2i(end_of_range), use_write_table? "read/write (updating)": "read (marking)"); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahSimpleBitMap.cpp b/src/hotspot/share/gc/shenandoah/shenandoahSimpleBitMap.cpp index 127e6324fb01e..3f4bbafb755e3 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahSimpleBitMap.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahSimpleBitMap.cpp @@ -1,5 +1,6 @@ /* * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahSimpleBitMap.inline.hpp" ShenandoahSimpleBitMap::ShenandoahSimpleBitMap(size_t num_bits) : @@ -95,7 +95,7 @@ size_t ShenandoahSimpleBitMap::count_trailing_ones(idx_t last_idx) const { bool ShenandoahSimpleBitMap::is_forward_consecutive_ones(idx_t start_idx, idx_t count) const { while (count > 0) { - assert((start_idx >= 0) && (start_idx < _num_bits), "precondition: start_idx: " SSIZE_FORMAT ", count: " SSIZE_FORMAT, + assert((start_idx >= 0) && (start_idx < _num_bits), "precondition: start_idx: %zd, count: %zd", start_idx, count); assert(start_idx + count <= (idx_t) _num_bits, "precondition"); size_t array_idx = start_idx >> LogBitsPerWord; diff --git a/src/hotspot/share/gc/shenandoah/shenandoahStackWatermark.cpp b/src/hotspot/share/gc/shenandoah/shenandoahStackWatermark.cpp index df05604762268..73449bdae54d1 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahStackWatermark.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahStackWatermark.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2021, Red Hat, Inc. All rights reserved. - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahAsserts.hpp" #include "gc/shenandoah/shenandoahClosures.inline.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahTaskqueue.cpp b/src/hotspot/share/gc/shenandoah/shenandoahTaskqueue.cpp index eb185c197bd5d..637bbfcb898a6 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahTaskqueue.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahTaskqueue.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "gc/shenandoah/shenandoahTaskqueue.inline.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahThreadLocalData.cpp b/src/hotspot/share/gc/shenandoah/shenandoahThreadLocalData.cpp index 3901e0c7b7f1a..afeba3dbbf7db 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahThreadLocalData.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahThreadLocalData.cpp @@ -23,8 +23,6 @@ * */ -#include "precompiled.hpp" - #include "gc/shenandoah/mode/shenandoahMode.hpp" #include "gc/shenandoah/shenandoahEvacTracker.hpp" #include "gc/shenandoah/shenandoahGenerationalHeap.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahThreadLocalData.hpp b/src/hotspot/share/gc/shenandoah/shenandoahThreadLocalData.hpp index c226b1ad2545e..9e1777dd82c4f 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahThreadLocalData.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahThreadLocalData.hpp @@ -111,12 +111,18 @@ class ShenandoahThreadLocalData { } static char gc_state(Thread* thread) { - assert(thread->is_Java_thread(), "GC state is only synchronized to java threads"); return data(thread)->_gc_state; } + static bool is_gc_state(Thread* thread, ShenandoahHeap::GCState state) { + return (gc_state(thread) & state) != 0; + } + + static bool is_gc_state(ShenandoahHeap::GCState state) { + return is_gc_state(Thread::current(), state); + } + static void initialize_gclab(Thread* thread) { - assert (thread->is_Java_thread() || thread->is_Worker_thread(), "Only Java and GC worker threads are allowed to get GCLABs"); assert(data(thread)->_gclab == nullptr, "Only initialize once"); data(thread)->_gclab = new PLAB(PLAB::min_size()); data(thread)->_gclab_size = 0; diff --git a/src/hotspot/share/gc/shenandoah/shenandoahTrace.cpp b/src/hotspot/share/gc/shenandoah/shenandoahTrace.cpp index 0e6453c9b358c..f1afcca34934a 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahTrace.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahTrace.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahEvacInfo.hpp" #include "gc/shenandoah/shenandoahTrace.hpp" #include "jfr/jfrEvents.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahUncommitThread.cpp b/src/hotspot/share/gc/shenandoah/shenandoahUncommitThread.cpp index 85bb3349d5c97..5f9bc7c9b91c5 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahUncommitThread.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahUncommitThread.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "gc/shenandoah/shenandoahHeapRegion.hpp" #include "gc/shenandoah/shenandoahUncommitThread.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahUnload.cpp b/src/hotspot/share/gc/shenandoah/shenandoahUnload.cpp index f33b76bcd4e1c..24fb56b80377c 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahUnload.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahUnload.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2019, 2021, Red Hat, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderDataGraph.hpp" #include "classfile/systemDictionary.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahUtils.cpp b/src/hotspot/share/gc/shenandoah/shenandoahUtils.cpp index 518cb325efbc1..ecca550d5532c 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahUtils.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahUtils.cpp @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "jfr/jfrEvents.hpp" #include "gc/shared/gcCause.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahVMOperations.cpp b/src/hotspot/share/gc/shenandoah/shenandoahVMOperations.cpp index da32601eed7f0..30a677fc12684 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahVMOperations.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahVMOperations.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahConcurrentGC.hpp" #include "gc/shenandoah/shenandoahDegeneratedGC.hpp" @@ -82,47 +81,47 @@ void VM_ShenandoahInitMark::doit() { ShenandoahGCPauseMark mark(_gc_id, "Init Mark", SvcGCMarker::CONCURRENT); set_active_generation(); _gc->entry_init_mark(); - ShenandoahHeap::heap()->propagate_gc_state_to_java_threads(); + ShenandoahHeap::heap()->propagate_gc_state_to_all_threads(); } void VM_ShenandoahFinalMarkStartEvac::doit() { ShenandoahGCPauseMark mark(_gc_id, "Final Mark", SvcGCMarker::CONCURRENT); set_active_generation(); _gc->entry_final_mark(); - ShenandoahHeap::heap()->propagate_gc_state_to_java_threads(); + ShenandoahHeap::heap()->propagate_gc_state_to_all_threads(); } void VM_ShenandoahFullGC::doit() { ShenandoahGCPauseMark mark(_gc_id, "Full GC", SvcGCMarker::FULL); set_active_generation(); _full_gc->entry_full(_gc_cause); - ShenandoahHeap::heap()->propagate_gc_state_to_java_threads(); + ShenandoahHeap::heap()->propagate_gc_state_to_all_threads(); } void VM_ShenandoahDegeneratedGC::doit() { ShenandoahGCPauseMark mark(_gc_id, "Degenerated GC", SvcGCMarker::CONCURRENT); set_active_generation(); _gc->entry_degenerated(); - ShenandoahHeap::heap()->propagate_gc_state_to_java_threads(); + ShenandoahHeap::heap()->propagate_gc_state_to_all_threads(); } void VM_ShenandoahInitUpdateRefs::doit() { ShenandoahGCPauseMark mark(_gc_id, "Init Update Refs", SvcGCMarker::CONCURRENT); set_active_generation(); - _gc->entry_init_updaterefs(); - ShenandoahHeap::heap()->propagate_gc_state_to_java_threads(); + _gc->entry_init_update_refs(); + ShenandoahHeap::heap()->propagate_gc_state_to_all_threads(); } void VM_ShenandoahFinalUpdateRefs::doit() { ShenandoahGCPauseMark mark(_gc_id, "Final Update Refs", SvcGCMarker::CONCURRENT); set_active_generation(); - _gc->entry_final_updaterefs(); - ShenandoahHeap::heap()->propagate_gc_state_to_java_threads(); + _gc->entry_final_update_refs(); + ShenandoahHeap::heap()->propagate_gc_state_to_all_threads(); } void VM_ShenandoahFinalRoots::doit() { ShenandoahGCPauseMark mark(_gc_id, "Final Roots", SvcGCMarker::CONCURRENT); set_active_generation(); _gc->entry_final_roots(); - ShenandoahHeap::heap()->propagate_gc_state_to_java_threads(); + ShenandoahHeap::heap()->propagate_gc_state_to_all_threads(); } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp b/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp index bde8638140b52..db752395c1bfd 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) 2017, 2021, Red Hat, Inc. All rights reserved. * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * 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 +24,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/tlab_globals.hpp" #include "gc/shenandoah/shenandoahAsserts.hpp" #include "gc/shenandoah/shenandoahForwarding.inline.hpp" @@ -383,7 +383,7 @@ class ShenandoahCalculateRegionStatsClosure : public ShenandoahHeapRegionClosure _trashed_regions++; } _regions++; - log_debug(gc)("ShenandoahCalculateRegionStatsClosure: adding " SIZE_FORMAT " for %s Region " SIZE_FORMAT ", yielding: " SIZE_FORMAT, + log_debug(gc)("ShenandoahCalculateRegionStatsClosure: adding %zu for %s Region %zu, yielding: %zu", r->used(), (r->is_humongous() ? "humongous" : "regular"), r->index(), _used); } @@ -422,7 +422,7 @@ class ShenandoahGenerationStatsClosure : public ShenandoahHeapRegionClosure { } static void log_usage(ShenandoahGeneration* generation, ShenandoahCalculateRegionStatsClosure& stats) { - log_debug(gc)("Safepoint verification: %s verified usage: " SIZE_FORMAT "%s, recorded usage: " SIZE_FORMAT "%s", + log_debug(gc)("Safepoint verification: %s verified usage: %zu%s, recorded usage: %zu%s", generation->name(), byte_size_in_proper_unit(generation->used()), proper_unit_for_byte_size(generation->used()), byte_size_in_proper_unit(stats.used()), proper_unit_for_byte_size(stats.used())); @@ -443,12 +443,12 @@ class ShenandoahGenerationStatsClosure : public ShenandoahHeapRegionClosure { label, generation->name(), PROPERFMTARGS(generation_used), PROPERFMTARGS(stats.used())); guarantee(stats.regions() == generation_used_regions, - "%s: generation (%s) used regions (" SIZE_FORMAT ") must equal regions that are in use (" SIZE_FORMAT ")", + "%s: generation (%s) used regions (%zu) must equal regions that are in use (%zu)", label, generation->name(), generation->used_regions(), stats.regions()); size_t generation_capacity = generation->max_capacity(); guarantee(stats.non_trashed_span() <= generation_capacity, - "%s: generation (%s) size spanned by regions (" SIZE_FORMAT ") * region size (" PROPERFMT + "%s: generation (%s) size spanned by regions (%zu) * region size (" PROPERFMT ") must not exceed current capacity (" PROPERFMT ")", label, generation->name(), stats.regions(), PROPERFMTARGS(ShenandoahHeapRegion::region_size_bytes()), PROPERFMTARGS(generation_capacity)); @@ -796,12 +796,12 @@ void ShenandoahVerifier::verify_at_safepoint(const char* label, guarantee(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "only when nothing else happens"); guarantee(ShenandoahVerify, "only when enabled, and bitmap is initialized in ShenandoahHeap::initialize"); - ShenandoahHeap::heap()->propagate_gc_state_to_java_threads(); + ShenandoahHeap::heap()->propagate_gc_state_to_all_threads(); // Avoid side-effect of changing workers' active thread count, but bypass concurrent/parallel protocol check ShenandoahPushWorkerScope verify_worker_scope(_heap->workers(), _heap->max_workers(), false /*bypass check*/); - log_info(gc,start)("Verify %s, Level " INTX_FORMAT, label, ShenandoahVerifyLevel); + log_info(gc,start)("Verify %s, Level %zd", label, ShenandoahVerifyLevel); // GC state checks { @@ -817,7 +817,7 @@ void ShenandoahVerifier::verify_at_safepoint(const char* label, break; case _verify_gcstate_updating: enabled = true; - expected = ShenandoahHeap::HAS_FORWARDED | ShenandoahHeap::UPDATEREFS; + expected = ShenandoahHeap::HAS_FORWARDED | ShenandoahHeap::UPDATE_REFS; break; case _verify_gcstate_stable: enabled = true; @@ -871,14 +871,14 @@ void ShenandoahVerifier::verify_at_safepoint(const char* label, } if (sizeness != _verify_size_disable) { guarantee(cl.used() == heap_used, - "%s: heap used size must be consistent: heap-used = " SIZE_FORMAT "%s, regions-used = " SIZE_FORMAT "%s", + "%s: heap used size must be consistent: heap-used = %zu%s, regions-used = %zu%s", label, byte_size_in_proper_unit(heap_used), proper_unit_for_byte_size(heap_used), byte_size_in_proper_unit(cl.used()), proper_unit_for_byte_size(cl.used())); } size_t heap_committed = _heap->committed(); guarantee(cl.committed() == heap_committed, - "%s: heap committed size must be consistent: heap-committed = " SIZE_FORMAT "%s, regions-committed = " SIZE_FORMAT "%s", + "%s: heap committed size must be consistent: heap-committed = %zu%s, regions-committed = %zu%s", label, byte_size_in_proper_unit(heap_committed), proper_unit_for_byte_size(heap_committed), byte_size_in_proper_unit(cl.committed()), proper_unit_for_byte_size(cl.committed())); @@ -1025,7 +1025,7 @@ void ShenandoahVerifier::verify_at_safepoint(const char* label, if (reg_live != verf_live) { stringStream ss; r->print_on(&ss); - fatal("%s: Live data should match: region-live = " SIZE_FORMAT ", verifier-live = " UINT32_FORMAT "\n%s", + fatal("%s: Live data should match: region-live = %zu, verifier-live = " UINT32_FORMAT "\n%s", label, reg_live, verf_live, ss.freeze()); } } @@ -1034,7 +1034,7 @@ void ShenandoahVerifier::verify_at_safepoint(const char* label, log_debug(gc)("Safepoint verification finished accumulation of liveness data"); - log_info(gc)("Verify %s, Level " INTX_FORMAT " (" SIZE_FORMAT " reachable, " SIZE_FORMAT " marked)", + log_info(gc)("Verify %s, Level %zd (%zu reachable, %zu marked)", label, ShenandoahVerifyLevel, count_reachable, count_marked); FREE_C_HEAP_ARRAY(ShenandoahLivenessData, ld); @@ -1113,7 +1113,7 @@ void ShenandoahVerifier::verify_before_evacuation() { ); } -void ShenandoahVerifier::verify_before_updaterefs() { +void ShenandoahVerifier::verify_before_update_refs() { verify_at_safepoint( "Before Updating References", _verify_remembered_before_updating_references, // verify read-write remembered set @@ -1128,7 +1128,7 @@ void ShenandoahVerifier::verify_before_updaterefs() { } // We have not yet cleanup (reclaimed) the collection set -void ShenandoahVerifier::verify_after_updaterefs() { +void ShenandoahVerifier::verify_after_update_refs() { verify_at_safepoint( "After Updating References", _verify_remembered_disable, // do not verify remembered set diff --git a/src/hotspot/share/gc/shenandoah/shenandoahVerifier.hpp b/src/hotspot/share/gc/shenandoah/shenandoahVerifier.hpp index e49b7b43376bc..a6076ed176bc8 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahVerifier.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahVerifier.hpp @@ -214,8 +214,8 @@ class ShenandoahVerifier : public CHeapObj { void verify_after_concmark(); void verify_after_concmark_with_promotions(); void verify_before_evacuation(); - void verify_before_updaterefs(); - void verify_after_updaterefs(); + void verify_before_update_refs(); + void verify_after_update_refs(); void verify_before_fullgc(); void verify_after_fullgc(); void verify_after_degenerated(); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahWorkGroup.cpp b/src/hotspot/share/gc/shenandoah/shenandoahWorkGroup.cpp index 4a49d28ea861b..d6c47339f28a9 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahWorkGroup.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahWorkGroup.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2017, 2021, Red Hat, Inc. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "gc/shenandoah/shenandoahThreadLocalData.hpp" @@ -73,7 +73,6 @@ ShenandoahPushWorkerScope::~ShenandoahPushWorkerScope() { } void ShenandoahWorkerThreads::on_create_worker(WorkerThread* worker) { - ShenandoahThreadLocalData::create(worker); if (_initialize_gclab) { ShenandoahThreadLocalData::initialize_gclab(worker); } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahWorkerPolicy.cpp b/src/hotspot/share/gc/shenandoah/shenandoahWorkerPolicy.cpp index 30651f0ccf1a4..87095e87406f3 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahWorkerPolicy.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahWorkerPolicy.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/gc_globals.hpp" #include "gc/shenandoah/shenandoahWorkerPolicy.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahYoungGeneration.cpp b/src/hotspot/share/gc/shenandoah/shenandoahYoungGeneration.cpp index 59c33a015c24f..8663515d019d0 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahYoungGeneration.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahYoungGeneration.cpp @@ -21,7 +21,6 @@ * questions. * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahAgeCensus.hpp" #include "gc/shenandoah/shenandoahFreeSet.hpp" diff --git a/src/hotspot/share/gc/z/c1/zBarrierSetC1.cpp b/src/hotspot/share/gc/z/c1/zBarrierSetC1.cpp index 9c16714b26e3f..87bfc1f9c66c9 100644 --- a/src/hotspot/share/gc/z/c1/zBarrierSetC1.cpp +++ b/src/hotspot/share/gc/z/c1/zBarrierSetC1.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "c1/c1_FrameMap.hpp" #include "c1/c1_LIR.hpp" #include "c1/c1_LIRAssembler.hpp" diff --git a/src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp b/src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp index 3f9c09f1c8c07..538e87a8f1930 100644 --- a/src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp +++ b/src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "classfile/javaClasses.hpp" #include "gc/z/c2/zBarrierSetC2.hpp" diff --git a/src/hotspot/share/gc/z/vmStructs_z.cpp b/src/hotspot/share/gc/z/vmStructs_z.cpp index 2ae826663d222..f77253202ba0b 100644 --- a/src/hotspot/share/gc/z/vmStructs_z.cpp +++ b/src/hotspot/share/gc/z/vmStructs_z.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/vmStructs_z.hpp" #include "gc/z/zAddress.hpp" diff --git a/src/hotspot/share/gc/z/zAbort.cpp b/src/hotspot/share/gc/z/zAbort.cpp index 938e77b7d8007..7e4f23c1c7a8a 100644 --- a/src/hotspot/share/gc/z/zAbort.cpp +++ b/src/hotspot/share/gc/z/zAbort.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zAbort.hpp" #include "runtime/atomic.hpp" diff --git a/src/hotspot/share/gc/z/zAddress.cpp b/src/hotspot/share/gc/z/zAddress.cpp index 1cd33e44a05d1..59489f62372c4 100644 --- a/src/hotspot/share/gc/z/zAddress.cpp +++ b/src/hotspot/share/gc/z/zAddress.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/gc_globals.hpp" #include "gc/z/zAddress.inline.hpp" @@ -106,7 +105,7 @@ void ZGlobalsPointers::initialize() { // Check max supported heap size if (MaxHeapSize > ZAddressOffsetMax) { vm_exit_during_initialization( - err_msg("Java heap too large (max supported heap size is " SIZE_FORMAT "G)", + err_msg("Java heap too large (max supported heap size is %zuG)", ZAddressOffsetMax / G)); } diff --git a/src/hotspot/share/gc/z/zAddressSpaceLimit.cpp b/src/hotspot/share/gc/z/zAddressSpaceLimit.cpp index 41ae19566b980..c737644472c6e 100644 --- a/src/hotspot/share/gc/z/zAddressSpaceLimit.cpp +++ b/src/hotspot/share/gc/z/zAddressSpaceLimit.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/gc_globals.hpp" #include "gc/z/zAddressSpaceLimit.hpp" #include "gc/z/zGlobals.hpp" diff --git a/src/hotspot/share/gc/z/zAllocator.cpp b/src/hotspot/share/gc/z/zAllocator.cpp index f75a67fd2117c..87e1f6f76f941 100644 --- a/src/hotspot/share/gc/z/zAllocator.cpp +++ b/src/hotspot/share/gc/z/zAllocator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zAllocator.hpp" #include "gc/z/zObjectAllocator.hpp" diff --git a/src/hotspot/share/gc/z/zArguments.cpp b/src/hotspot/share/gc/z/zArguments.cpp index 331ca9f7c9423..7c082252133cd 100644 --- a/src/hotspot/share/gc/z/zArguments.cpp +++ b/src/hotspot/share/gc/z/zArguments.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zAddressSpaceLimit.hpp" #include "gc/z/zArguments.hpp" #include "gc/z/zCollectedHeap.hpp" @@ -142,10 +141,6 @@ void ZArguments::initialize() { FLAG_SET_ERGO_IF_DEFAULT(ZCollectionIntervalMajor, ZCollectionInterval); } - if (FLAG_IS_DEFAULT(ZFragmentationLimit)) { - FLAG_SET_DEFAULT(ZFragmentationLimit, 5.0); - } - // Set medium page size here because MaxTenuringThreshold may use it. ZHeuristics::set_medium_page_size(); @@ -180,7 +175,7 @@ void ZArguments::initialize() { // Large page size must match granule size if (!FLAG_IS_DEFAULT(LargePageSizeInBytes) && LargePageSizeInBytes != ZGranuleSize) { vm_exit_during_initialization(err_msg("Incompatible -XX:LargePageSizeInBytes, only " - SIZE_FORMAT "M large pages are supported by ZGC", + "%zuM large pages are supported by ZGC", ZGranuleSize / M)); } diff --git a/src/hotspot/share/gc/z/zBarrier.cpp b/src/hotspot/share/gc/z/zBarrier.cpp index 7d7f1284bdfdc..2b3f3f25fa64e 100644 --- a/src/hotspot/share/gc/z/zBarrier.cpp +++ b/src/hotspot/share/gc/z/zBarrier.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "classfile/javaClasses.hpp" #include "gc/z/zAddress.inline.hpp" #include "gc/z/zBarrier.inline.hpp" diff --git a/src/hotspot/share/gc/z/zBarrierSet.cpp b/src/hotspot/share/gc/z/zBarrierSet.cpp index 4ce591a507a67..f88a593b1c307 100644 --- a/src/hotspot/share/gc/z/zBarrierSet.cpp +++ b/src/hotspot/share/gc/z/zBarrierSet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zBarrierSet.hpp" #include "gc/z/zBarrierSetAssembler.hpp" #include "gc/z/zBarrierSetNMethod.hpp" diff --git a/src/hotspot/share/gc/z/zBarrierSetAssembler.cpp b/src/hotspot/share/gc/z/zBarrierSetAssembler.cpp index e68142f0778ba..b46810c7c00a2 100644 --- a/src/hotspot/share/gc/z/zBarrierSetAssembler.cpp +++ b/src/hotspot/share/gc/z/zBarrierSetAssembler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zBarrierSetAssembler.hpp" #include "gc/z/zThreadLocalData.hpp" #include "runtime/javaThread.hpp" diff --git a/src/hotspot/share/gc/z/zBarrierSetNMethod.cpp b/src/hotspot/share/gc/z/zBarrierSetNMethod.cpp index 33894f166a3e9..cdb1701875679 100644 --- a/src/hotspot/share/gc/z/zBarrierSetNMethod.cpp +++ b/src/hotspot/share/gc/z/zBarrierSetNMethod.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "code/nmethod.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/z/zAddress.hpp" diff --git a/src/hotspot/share/gc/z/zBarrierSetRuntime.cpp b/src/hotspot/share/gc/z/zBarrierSetRuntime.cpp index 935238c4e4f54..78376149d9082 100644 --- a/src/hotspot/share/gc/z/zBarrierSetRuntime.cpp +++ b/src/hotspot/share/gc/z/zBarrierSetRuntime.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zBarrier.inline.hpp" #include "gc/z/zBarrierSetRuntime.hpp" #include "oops/access.hpp" diff --git a/src/hotspot/share/gc/z/zBarrierSetStackChunk.cpp b/src/hotspot/share/gc/z/zBarrierSetStackChunk.cpp index e33b86ef22b85..22b766ecd1a2d 100644 --- a/src/hotspot/share/gc/z/zBarrierSetStackChunk.cpp +++ b/src/hotspot/share/gc/z/zBarrierSetStackChunk.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/z/zBarrierSetStackChunk.hpp" #include "gc/z/zContinuation.hpp" #include "utilities/debug.hpp" diff --git a/src/hotspot/share/gc/z/zBreakpoint.cpp b/src/hotspot/share/gc/z/zBreakpoint.cpp index f9db1d54c8cc9..00e91c2c28aab 100644 --- a/src/hotspot/share/gc/z/zBreakpoint.cpp +++ b/src/hotspot/share/gc/z/zBreakpoint.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/concurrentGCBreakpoints.hpp" #include "gc/z/zBreakpoint.hpp" #include "runtime/mutexLocker.hpp" diff --git a/src/hotspot/share/gc/z/zCPU.cpp b/src/hotspot/share/gc/z/zCPU.cpp index f6aaa96476f75..8ba8ea9986365 100644 --- a/src/hotspot/share/gc/z/zCPU.cpp +++ b/src/hotspot/share/gc/z/zCPU.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/gcLogPrecious.hpp" #include "gc/z/zCPU.inline.hpp" #include "memory/padded.inline.hpp" diff --git a/src/hotspot/share/gc/z/zCollectedHeap.cpp b/src/hotspot/share/gc/z/zCollectedHeap.cpp index 8afefd5a7cc1c..c43090f9699fc 100644 --- a/src/hotspot/share/gc/z/zCollectedHeap.cpp +++ b/src/hotspot/share/gc/z/zCollectedHeap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "classfile/classLoaderData.hpp" #include "gc/shared/gcHeapSummary.hpp" #include "gc/shared/gcLogPrecious.hpp" @@ -363,12 +362,12 @@ void ZCollectedHeap::print_on_error(outputStream* st) const { st->print_cr("ZGC Globals:"); st->print_cr(" Young Collection: %s/%u", ZGeneration::young()->phase_to_string(), ZGeneration::young()->seqnum()); st->print_cr(" Old Collection: %s/%u", ZGeneration::old()->phase_to_string(), ZGeneration::old()->seqnum()); - st->print_cr(" Offset Max: " SIZE_FORMAT "%s (" PTR_FORMAT ")", + st->print_cr(" Offset Max: %zu%s (" PTR_FORMAT ")", byte_size_in_exact_unit(ZAddressOffsetMax), exact_unit_for_byte_size(ZAddressOffsetMax), ZAddressOffsetMax); - st->print_cr(" Page Size Small: " SIZE_FORMAT "M", ZPageSizeSmall / M); - st->print_cr(" Page Size Medium: " SIZE_FORMAT "M", ZPageSizeMedium / M); + st->print_cr(" Page Size Small: %zuM", ZPageSizeSmall / M); + st->print_cr(" Page Size Medium: %zuM", ZPageSizeMedium / M); st->cr(); st->print_cr("ZGC Metadata Bits:"); st->print_cr(" LoadGood: " PTR_FORMAT, ZPointerLoadGoodMask); diff --git a/src/hotspot/share/gc/z/zContinuation.cpp b/src/hotspot/share/gc/z/zContinuation.cpp index 3a4390b472bbd..6c02f64528c28 100644 --- a/src/hotspot/share/gc/z/zContinuation.cpp +++ b/src/hotspot/share/gc/z/zContinuation.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zAddress.inline.hpp" #include "gc/z/zBarrier.inline.hpp" #include "gc/z/zContinuation.inline.hpp" diff --git a/src/hotspot/share/gc/z/zDirector.cpp b/src/hotspot/share/gc/z/zDirector.cpp index 48e426f068aa6..f1256eecd19bf 100644 --- a/src/hotspot/share/gc/z/zDirector.cpp +++ b/src/hotspot/share/gc/z/zDirector.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/gc_globals.hpp" #include "gc/z/zCollectedHeap.hpp" #include "gc/z/zDirector.hpp" @@ -194,7 +193,7 @@ static ZDriverRequest rule_minor_allocation_rate_dynamic(const ZDirectorStats& s const double time_until_gc = time_until_oom - actual_gc_duration; log_debug(gc, director)("Rule Minor: Allocation Rate (Dynamic GC Workers), " - "MaxAllocRate: %.1fMB/s (+/-%.1f%%), Free: " SIZE_FORMAT "MB, GCCPUTime: %.3f, " + "MaxAllocRate: %.1fMB/s (+/-%.1f%%), Free: %zuMB, GCCPUTime: %.3f, " "GCDuration: %.3fs, TimeUntilOOM: %.3fs, TimeUntilGC: %.3fs, GCWorkers: %u", alloc_rate / M, alloc_rate_sd_percent * 100, @@ -288,7 +287,7 @@ static bool rule_minor_allocation_rate_static(const ZDirectorStats& stats) { // time and end up starting the GC too late in the next interval. const double time_until_gc = time_until_oom - gc_duration; - log_debug(gc, director)("Rule Minor: Allocation Rate (Static GC Workers), MaxAllocRate: %.1fMB/s, Free: " SIZE_FORMAT "MB, GCDuration: %.3fs, TimeUntilGC: %.3fs", + log_debug(gc, director)("Rule Minor: Allocation Rate (Static GC Workers), MaxAllocRate: %.1fMB/s, Free: %zuMB, GCDuration: %.3fs, TimeUntilGC: %.3fs", max_alloc_rate / M, free / M, gc_duration, time_until_gc); return time_until_gc <= 0; @@ -386,7 +385,7 @@ static bool rule_minor_high_usage(const ZDirectorStats& stats) { const double free_percent = percent_of(free, soft_max_capacity); auto print_function = [&](size_t free, double free_percent) { - log_debug(gc, director)("Rule Minor: High Usage, Free: " SIZE_FORMAT "MB(%.1f%%)", + log_debug(gc, director)("Rule Minor: High Usage, Free: %zuMB(%.1f%%)", free / M, free_percent); }; @@ -430,7 +429,7 @@ static bool rule_major_warmup(const ZDirectorStats& stats) { const double used_threshold_percent = (stats._old_stats._cycle._nwarmup_cycles + 1) * 0.1; const size_t used_threshold = (size_t)(soft_max_capacity * used_threshold_percent); - log_debug(gc, director)("Rule Major: Warmup %.0f%%, Used: " SIZE_FORMAT "MB, UsedThreshold: " SIZE_FORMAT "MB", + log_debug(gc, director)("Rule Major: Warmup %.0f%%, Used: %zuMB, UsedThreshold: %zuMB", used_threshold_percent * 100, used / M, used_threshold / M); return used >= used_threshold; @@ -593,7 +592,7 @@ static bool rule_major_proactive(const ZDirectorStats& stats) { const double time_since_last_gc_threshold = 5 * 60; // 5 minutes if (used < used_threshold && time_since_last_gc < time_since_last_gc_threshold) { // Don't even consider doing a proactive GC - log_debug(gc, director)("Rule Major: Proactive, UsedUntilEnabled: " SIZE_FORMAT "MB, TimeUntilEnabled: %.3fs", + log_debug(gc, director)("Rule Major: Proactive, UsedUntilEnabled: %zuMB, TimeUntilEnabled: %.3fs", (used_threshold - used) / M, time_since_last_gc_threshold - time_since_last_gc); return false; diff --git a/src/hotspot/share/gc/z/zDriver.cpp b/src/hotspot/share/gc/z/zDriver.cpp index c91de172fee46..e8f7af179cb4c 100644 --- a/src/hotspot/share/gc/z/zDriver.cpp +++ b/src/hotspot/share/gc/z/zDriver.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/gc_globals.hpp" #include "gc/shared/gcCause.hpp" #include "gc/shared/gcId.hpp" diff --git a/src/hotspot/share/gc/z/zDriverPort.cpp b/src/hotspot/share/gc/z/zDriverPort.cpp index 28c8fbc732cd6..02732dd149024 100644 --- a/src/hotspot/share/gc/z/zDriverPort.cpp +++ b/src/hotspot/share/gc/z/zDriverPort.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zDriverPort.hpp" #include "gc/z/zFuture.inline.hpp" #include "gc/z/zList.inline.hpp" diff --git a/src/hotspot/share/gc/z/zErrno.cpp b/src/hotspot/share/gc/z/zErrno.cpp index a3847181c2c84..fc9b1706ce9ee 100644 --- a/src/hotspot/share/gc/z/zErrno.cpp +++ b/src/hotspot/share/gc/z/zErrno.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zErrno.hpp" #include "runtime/os.hpp" diff --git a/src/hotspot/share/gc/z/zForwarding.cpp b/src/hotspot/share/gc/z/zForwarding.cpp index 622f271a6d309..df0e986d2c596 100644 --- a/src/hotspot/share/gc/z/zForwarding.cpp +++ b/src/hotspot/share/gc/z/zForwarding.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/gcLogPrecious.hpp" #include "gc/z/zAddress.inline.hpp" #include "gc/z/zCollectedHeap.hpp" diff --git a/src/hotspot/share/gc/z/zForwardingAllocator.cpp b/src/hotspot/share/gc/z/zForwardingAllocator.cpp index 617745dc08d02..0b4e6c7b08c54 100644 --- a/src/hotspot/share/gc/z/zForwardingAllocator.cpp +++ b/src/hotspot/share/gc/z/zForwardingAllocator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zForwardingAllocator.hpp" #include "memory/allocation.inline.hpp" diff --git a/src/hotspot/share/gc/z/zGCIdPrinter.cpp b/src/hotspot/share/gc/z/zGCIdPrinter.cpp index 80ca72e4f48de..25141264f2cd3 100644 --- a/src/hotspot/share/gc/z/zGCIdPrinter.cpp +++ b/src/hotspot/share/gc/z/zGCIdPrinter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zGCIdPrinter.hpp" #include "include/jvm.h" diff --git a/src/hotspot/share/gc/z/zGeneration.cpp b/src/hotspot/share/gc/z/zGeneration.cpp index 655f47ba49cd8..9a2535d527f6f 100644 --- a/src/hotspot/share/gc/z/zGeneration.cpp +++ b/src/hotspot/share/gc/z/zGeneration.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "classfile/classLoaderDataGraph.hpp" #include "code/nmethod.hpp" #include "gc/shared/classUnloadingContext.hpp" @@ -361,7 +360,7 @@ void ZGeneration::log_phase_switch(Phase from, Phase to) { index += 1; } - assert(index < ARRAY_SIZE(str), "OOB: " SIZE_FORMAT " < " SIZE_FORMAT, index, ARRAY_SIZE(str)); + assert(index < ARRAY_SIZE(str), "OOB: %zu < %zu", index, ARRAY_SIZE(str)); Events::log_zgc_phase_switch("%-21s %4u", str[index], seqnum()); } @@ -796,8 +795,8 @@ uint ZGenerationYoung::compute_tenuring_threshold(ZRelocationSetSelectorStats st // if the GC is finding it hard to keep up with the allocation rate. const double tenuring_threshold_raw = young_life_decay_factor * young_log_residency; - log_trace(gc, reloc)("Young Allocated: " SIZE_FORMAT "M", young_allocated / M); - log_trace(gc, reloc)("Young Garbage: " SIZE_FORMAT "M", young_garbage / M); + log_trace(gc, reloc)("Young Allocated: %zuM", young_allocated / M); + log_trace(gc, reloc)("Young Garbage: %zuM", young_garbage / M); log_debug(gc, reloc)("Allocated To Garbage: %.1f", allocated_garbage_ratio); log_trace(gc, reloc)("Young Log: %.1f", young_log); log_trace(gc, reloc)("Young Residency Reciprocal: %.1f", young_residency_reciprocal); diff --git a/src/hotspot/share/gc/z/zGlobals.cpp b/src/hotspot/share/gc/z/zGlobals.cpp index 460ed4f09fe5d..2cb9a70eb7e10 100644 --- a/src/hotspot/share/gc/z/zGlobals.cpp +++ b/src/hotspot/share/gc/z/zGlobals.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zGlobals.hpp" size_t ZPageSizeMediumShift; diff --git a/src/hotspot/share/gc/z/zHeap.cpp b/src/hotspot/share/gc/z/zHeap.cpp index d29a5d15795f4..7169b915cb5ee 100644 --- a/src/hotspot/share/gc/z/zHeap.cpp +++ b/src/hotspot/share/gc/z/zHeap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "classfile/classLoaderDataGraph.hpp" #include "gc/shared/gc_globals.hpp" #include "gc/shared/gcLogPrecious.hpp" @@ -75,7 +74,7 @@ ZHeap::ZHeap() // Prime cache if (!_page_allocator.prime_cache(_old.workers(), InitialHeapSize)) { - ZInitialize::error("Failed to allocate initial Java heap (" SIZE_FORMAT "M)", InitialHeapSize / M); + ZInitialize::error("Failed to allocate initial Java heap (%zuM)", InitialHeapSize / M); return; } @@ -238,7 +237,7 @@ void ZHeap::undo_alloc_page(ZPage* page) { assert(page->is_allocating(), "Invalid page state"); ZStatInc(ZCounterUndoPageAllocation); - log_trace(gc)("Undo page allocation, thread: " PTR_FORMAT " (%s), page: " PTR_FORMAT ", size: " SIZE_FORMAT, + log_trace(gc)("Undo page allocation, thread: " PTR_FORMAT " (%s), page: " PTR_FORMAT ", size: %zu", p2i(Thread::current()), ZUtils::thread_name(), p2i(page), page->size()); free_page(page, false /* allow_defragment */); @@ -320,7 +319,7 @@ ZServiceabilityCounters* ZHeap::serviceability_counters() { } void ZHeap::print_on(outputStream* st) const { - st->print_cr(" ZHeap used " SIZE_FORMAT "M, capacity " SIZE_FORMAT "M, max capacity " SIZE_FORMAT "M", + st->print_cr(" ZHeap used %zuM, capacity %zuM, max capacity %zuM", used() / M, capacity() / M, max_capacity() / M); diff --git a/src/hotspot/share/gc/z/zHeapIterator.cpp b/src/hotspot/share/gc/z/zHeapIterator.cpp index e149a976add92..63bede6143ba1 100644 --- a/src/hotspot/share/gc/z/zHeapIterator.cpp +++ b/src/hotspot/share/gc/z/zHeapIterator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "classfile/classLoaderData.hpp" #include "classfile/classLoaderDataGraph.hpp" #include "gc/shared/barrierSet.hpp" diff --git a/src/hotspot/share/gc/z/zHeuristics.cpp b/src/hotspot/share/gc/z/zHeuristics.cpp index ebf979af79518..d13cdef3bb57c 100644 --- a/src/hotspot/share/gc/z/zHeuristics.cpp +++ b/src/hotspot/share/gc/z/zHeuristics.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/gc_globals.hpp" #include "gc/shared/gcLogPrecious.hpp" #include "gc/z/zCPU.inline.hpp" diff --git a/src/hotspot/share/gc/z/zIndexDistributor.inline.hpp b/src/hotspot/share/gc/z/zIndexDistributor.inline.hpp index 26afdef9d052d..c582be8fcee8f 100644 --- a/src/hotspot/share/gc/z/zIndexDistributor.inline.hpp +++ b/src/hotspot/share/gc/z/zIndexDistributor.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -274,7 +274,7 @@ class ZIndexDistributorClaimTree : public CHeapObj { assert((levels_size(ClaimLevels - 1) << _last_level_segment_size_shift) == count, "Incorrectly setup"); #if 0 - tty->print_cr("ZIndexDistributorClaimTree count: %d byte size: " SIZE_FORMAT, count, claim_variables_size() + os::vm_page_size()); + tty->print_cr("ZIndexDistributorClaimTree count: %d byte size: %zu", count, claim_variables_size() + os::vm_page_size()); #endif memset(_malloced, 0, claim_variables_size() + os::vm_page_size()); diff --git a/src/hotspot/share/gc/z/zInitialize.cpp b/src/hotspot/share/gc/z/zInitialize.cpp index e37fc550bfe2a..a8d6a32a7d5ee 100644 --- a/src/hotspot/share/gc/z/zInitialize.cpp +++ b/src/hotspot/share/gc/z/zInitialize.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/gcLogPrecious.hpp" #include "gc/z/zAddress.hpp" #include "gc/z/zBarrierSet.hpp" diff --git a/src/hotspot/share/gc/z/zJNICritical.cpp b/src/hotspot/share/gc/z/zJNICritical.cpp index d096367e12f79..608b8f2249313 100644 --- a/src/hotspot/share/gc/z/zJNICritical.cpp +++ b/src/hotspot/share/gc/z/zJNICritical.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zJNICritical.hpp" #include "gc/z/zLock.inline.hpp" #include "gc/z/zStat.hpp" diff --git a/src/hotspot/share/gc/z/zLargePages.cpp b/src/hotspot/share/gc/z/zLargePages.cpp index a65bf3b10ebad..56c94a75713cd 100644 --- a/src/hotspot/share/gc/z/zLargePages.cpp +++ b/src/hotspot/share/gc/z/zLargePages.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/gcLogPrecious.hpp" #include "gc/z/zLargePages.hpp" #include "runtime/os.hpp" diff --git a/src/hotspot/share/gc/z/zLiveMap.cpp b/src/hotspot/share/gc/z/zLiveMap.cpp index 715ebc6291724..cc7271f99a7dc 100644 --- a/src/hotspot/share/gc/z/zLiveMap.cpp +++ b/src/hotspot/share/gc/z/zLiveMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zGeneration.inline.hpp" #include "gc/z/zHeap.inline.hpp" #include "gc/z/zLiveMap.inline.hpp" @@ -103,7 +102,7 @@ void ZLiveMap::reset_segment(BitMap::idx_t segment) { ZStatInc(ZCounterMarkSegmentResetContention); contention = true; - log_trace(gc)("Mark segment reset contention, thread: " PTR_FORMAT " (%s), map: " PTR_FORMAT ", segment: " SIZE_FORMAT, + log_trace(gc)("Mark segment reset contention, thread: " PTR_FORMAT " (%s), map: " PTR_FORMAT ", segment: %zu", p2i(Thread::current()), ZUtils::thread_name(), p2i(this), segment); } } diff --git a/src/hotspot/share/gc/z/zMark.cpp b/src/hotspot/share/gc/z/zMark.cpp index d33b86c83e57c..554cef8cec5fe 100644 --- a/src/hotspot/share/gc/z/zMark.cpp +++ b/src/hotspot/share/gc/z/zMark.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "classfile/classLoaderData.hpp" #include "classfile/classLoaderDataGraph.hpp" #include "classfile/javaClasses.inline.hpp" @@ -135,7 +134,7 @@ void ZMark::start() { for (uint worker_id = 0; worker_id < _nworkers; worker_id++) { const ZMarkStripe* const stripe = _stripes.stripe_for_worker(_nworkers, worker_id); const size_t stripe_id = _stripes.stripe_id(stripe); - log.print(" Worker %u(%u) -> Stripe " SIZE_FORMAT "(" SIZE_FORMAT ")", + log.print(" Worker %u(%u) -> Stripe %zu(%zu)", worker_id, _nworkers, stripe_id, nstripes); } } @@ -194,7 +193,7 @@ void ZMark::push_partial_array(zpointer* addr, size_t length, bool finalizable) const uintptr_t offset = encode_partial_array_offset(addr); const ZMarkStackEntry entry(offset, length, finalizable); - log_develop_trace(gc, marking)("Array push partial: " PTR_FORMAT " (" SIZE_FORMAT "), stripe: " SIZE_FORMAT, + log_develop_trace(gc, marking)("Array push partial: " PTR_FORMAT " (%zu), stripe: %zu", p2i(addr), length, _stripes.stripe_id(stripe)); stacks->push(&_allocator, &_stripes, stripe, &_terminate, entry, false /* publish */); @@ -213,7 +212,7 @@ static void mark_barrier_on_oop_array(volatile zpointer* p, size_t length, bool void ZMark::follow_array_elements_small(zpointer* addr, size_t length, bool finalizable) { assert(length <= ZMarkPartialArrayMinLength, "Too large, should be split"); - log_develop_trace(gc, marking)("Array follow small: " PTR_FORMAT " (" SIZE_FORMAT ")", p2i(addr), length); + log_develop_trace(gc, marking)("Array follow small: " PTR_FORMAT " (%zu)", p2i(addr), length); mark_barrier_on_oop_array(addr, length, finalizable, _generation->is_young()); } @@ -232,8 +231,8 @@ void ZMark::follow_array_elements_large(zpointer* addr, size_t length, bool fina const size_t middle_length = align_down(end - middle_start, ZMarkPartialArrayMinLength); zpointer* const middle_end = middle_start + middle_length; - log_develop_trace(gc, marking)("Array follow large: " PTR_FORMAT "-" PTR_FORMAT" (" SIZE_FORMAT "), " - "middle: " PTR_FORMAT "-" PTR_FORMAT " (" SIZE_FORMAT ")", + log_develop_trace(gc, marking)("Array follow large: " PTR_FORMAT "-" PTR_FORMAT" (%zu), " + "middle: " PTR_FORMAT "-" PTR_FORMAT " (%zu)", p2i(start), p2i(end), length, p2i(middle_start), p2i(middle_end), middle_length); // Push unaligned trailing part diff --git a/src/hotspot/share/gc/z/zMarkCache.cpp b/src/hotspot/share/gc/z/zMarkCache.cpp index 0eecfbfaa6773..c920bb897b0c1 100644 --- a/src/hotspot/share/gc/z/zMarkCache.cpp +++ b/src/hotspot/share/gc/z/zMarkCache.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zMarkCache.inline.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/powerOfTwo.hpp" diff --git a/src/hotspot/share/gc/z/zMarkStack.cpp b/src/hotspot/share/gc/z/zMarkStack.cpp index c4938af0a5f6d..00a534d236ff2 100644 --- a/src/hotspot/share/gc/z/zMarkStack.cpp +++ b/src/hotspot/share/gc/z/zMarkStack.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zMarkStack.inline.hpp" #include "gc/z/zMarkStackAllocator.hpp" #include "gc/z/zMarkTerminate.inline.hpp" @@ -54,7 +53,7 @@ void ZMarkStripeSet::set_nstripes(size_t nstripes) { // if they see the old or new values. Atomic::store(&_nstripes_mask, nstripes - 1); - log_debug(gc, marking)("Using " SIZE_FORMAT " mark stripes", nstripes); + log_debug(gc, marking)("Using %zu mark stripes", nstripes); } size_t ZMarkStripeSet::nstripes() const { diff --git a/src/hotspot/share/gc/z/zMarkStackAllocator.cpp b/src/hotspot/share/gc/z/zMarkStackAllocator.cpp index 2bc37a0483a36..02a903985e71c 100644 --- a/src/hotspot/share/gc/z/zMarkStackAllocator.cpp +++ b/src/hotspot/share/gc/z/zMarkStackAllocator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/gc_globals.hpp" #include "gc/z/zInitialize.hpp" #include "gc/z/zLock.inline.hpp" @@ -79,11 +78,11 @@ size_t ZMarkStackSpace::expand_space() { // Expansion limit reached. This is a fatal error since we // currently can't recover from running out of mark stack space. fatal("Mark stack space exhausted. Use -XX:ZMarkStackSpaceLimit= to increase the " - "maximum number of bytes allocated for mark stacks. Current limit is " SIZE_FORMAT "M.", + "maximum number of bytes allocated for mark stacks. Current limit is %zuM.", ZMarkStackSpaceLimit / M); } - log_debug(gc, marking)("Expanding mark stack space: " SIZE_FORMAT "M->" SIZE_FORMAT "M", + log_debug(gc, marking)("Expanding mark stack space: %zuM->%zuM", old_size / M, new_size / M); // Expand @@ -100,7 +99,7 @@ size_t ZMarkStackSpace::shrink_space() { if (shrink_size > 0) { // Shrink - log_debug(gc, marking)("Shrinking mark stack space: " SIZE_FORMAT "M->" SIZE_FORMAT "M", + log_debug(gc, marking)("Shrinking mark stack space: %zuM->%zuM", old_size / M, new_size / M); const uintptr_t shrink_start = _end - shrink_size; diff --git a/src/hotspot/share/gc/z/zMemory.cpp b/src/hotspot/share/gc/z/zMemory.cpp index 7bc6b7379c599..14578c2db8a26 100644 --- a/src/hotspot/share/gc/z/zMemory.cpp +++ b/src/hotspot/share/gc/z/zMemory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zList.inline.hpp" #include "gc/z/zLock.inline.hpp" #include "gc/z/zMemory.inline.hpp" diff --git a/src/hotspot/share/gc/z/zMetronome.cpp b/src/hotspot/share/gc/z/zMetronome.cpp index 876b1f6922799..d719017ddc45a 100644 --- a/src/hotspot/share/gc/z/zMetronome.cpp +++ b/src/hotspot/share/gc/z/zMetronome.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zMetronome.hpp" #include "runtime/mutexLocker.hpp" #include "runtime/timer.hpp" diff --git a/src/hotspot/share/gc/z/zNMT.cpp b/src/hotspot/share/gc/z/zNMT.cpp index b23452eb15647..07ea8df13252f 100644 --- a/src/hotspot/share/gc/z/zNMT.cpp +++ b/src/hotspot/share/gc/z/zNMT.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zAddress.inline.hpp" #include "gc/z/zGlobals.hpp" #include "gc/z/zNMT.hpp" diff --git a/src/hotspot/share/gc/z/zNMethod.cpp b/src/hotspot/share/gc/z/zNMethod.cpp index 7c5b1e06edbb0..26f2ab96946db 100644 --- a/src/hotspot/share/gc/z/zNMethod.cpp +++ b/src/hotspot/share/gc/z/zNMethod.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "code/codeCache.hpp" #include "code/relocInfo.hpp" #include "code/nmethod.hpp" diff --git a/src/hotspot/share/gc/z/zNMethodData.cpp b/src/hotspot/share/gc/z/zNMethodData.cpp index 467553bd7a6b4..deb56340a8f07 100644 --- a/src/hotspot/share/gc/z/zNMethodData.cpp +++ b/src/hotspot/share/gc/z/zNMethodData.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zLock.inline.hpp" #include "gc/z/zNMethodData.hpp" #include "utilities/debug.hpp" diff --git a/src/hotspot/share/gc/z/zNMethodTable.cpp b/src/hotspot/share/gc/z/zNMethodTable.cpp index 9714bee4bd88f..0aec0d5a9c7f4 100644 --- a/src/hotspot/share/gc/z/zNMethodTable.cpp +++ b/src/hotspot/share/gc/z/zNMethodTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "code/relocInfo.hpp" #include "code/nmethod.hpp" #include "gc/shared/barrierSet.hpp" @@ -110,9 +109,9 @@ void ZNMethodTable::rebuild(size_t new_size) { assert(is_power_of_2(new_size), "Invalid size"); log_debug(gc, nmethod)("Rebuilding NMethod Table: " - SIZE_FORMAT "->" SIZE_FORMAT " entries, " - SIZE_FORMAT "(%.0f%%->%.0f%%) registered, " - SIZE_FORMAT "(%.0f%%->%.0f%%) unregistered", + "%zu->%zu entries, " + "%zu(%.0f%%->%.0f%%) registered, " + "%zu(%.0f%%->%.0f%%) unregistered", _size, new_size, _nregistered, percent_of(_nregistered, _size), percent_of(_nregistered, new_size), _nunregistered, percent_of(_nunregistered, _size), 0.0); diff --git a/src/hotspot/share/gc/z/zNMethodTableIteration.cpp b/src/hotspot/share/gc/z/zNMethodTableIteration.cpp index d6eb728f9614d..f34f520875237 100644 --- a/src/hotspot/share/gc/z/zNMethodTableIteration.cpp +++ b/src/hotspot/share/gc/z/zNMethodTableIteration.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zNMethodTableEntry.hpp" #include "gc/z/zNMethodTableIteration.hpp" #include "memory/iterator.hpp" diff --git a/src/hotspot/share/gc/z/zNUMA.cpp b/src/hotspot/share/gc/z/zNUMA.cpp index 2ee790ede30c3..2c37b25f87bb9 100644 --- a/src/hotspot/share/gc/z/zNUMA.cpp +++ b/src/hotspot/share/gc/z/zNUMA.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/gcLogPrecious.hpp" #include "gc/z/zNUMA.hpp" diff --git a/src/hotspot/share/gc/z/zObjArrayAllocator.cpp b/src/hotspot/share/gc/z/zObjArrayAllocator.cpp index c63b989dc4eb0..a4484ba10237b 100644 --- a/src/hotspot/share/gc/z/zObjArrayAllocator.cpp +++ b/src/hotspot/share/gc/z/zObjArrayAllocator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zThreadLocalData.hpp" #include "gc/z/zObjArrayAllocator.hpp" #include "gc/z/zUtils.inline.hpp" diff --git a/src/hotspot/share/gc/z/zObjectAllocator.cpp b/src/hotspot/share/gc/z/zObjectAllocator.cpp index c088e20244ae0..81a92aa6cc646 100644 --- a/src/hotspot/share/gc/z/zObjectAllocator.cpp +++ b/src/hotspot/share/gc/z/zObjectAllocator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zGlobals.hpp" #include "gc/z/zHeap.inline.hpp" #include "gc/z/zHeuristics.hpp" diff --git a/src/hotspot/share/gc/z/zPage.cpp b/src/hotspot/share/gc/z/zPage.cpp index ff56768e9ad99..5264076c8a9bf 100644 --- a/src/hotspot/share/gc/z/zPage.cpp +++ b/src/hotspot/share/gc/z/zPage.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/gc_globals.hpp" #include "gc/z/zGeneration.inline.hpp" #include "gc/z/zList.inline.hpp" diff --git a/src/hotspot/share/gc/z/zPageAllocator.cpp b/src/hotspot/share/gc/z/zPageAllocator.cpp index ecd9f3e34b9b9..7913aa68fbe1b 100644 --- a/src/hotspot/share/gc/z/zPageAllocator.cpp +++ b/src/hotspot/share/gc/z/zPageAllocator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/gcLogPrecious.hpp" #include "gc/shared/suspendibleThreadSet.hpp" #include "gc/z/zArray.inline.hpp" @@ -207,12 +206,12 @@ ZPageAllocator::ZPageAllocator(size_t min_capacity, return; } - log_info_p(gc, init)("Min Capacity: " SIZE_FORMAT "M", min_capacity / M); - log_info_p(gc, init)("Initial Capacity: " SIZE_FORMAT "M", initial_capacity / M); - log_info_p(gc, init)("Max Capacity: " SIZE_FORMAT "M", max_capacity / M); - log_info_p(gc, init)("Soft Max Capacity: " SIZE_FORMAT "M", soft_max_capacity / M); + log_info_p(gc, init)("Min Capacity: %zuM", min_capacity / M); + log_info_p(gc, init)("Initial Capacity: %zuM", initial_capacity / M); + log_info_p(gc, init)("Max Capacity: %zuM", max_capacity / M); + log_info_p(gc, init)("Soft Max Capacity: %zuM", soft_max_capacity / M); if (ZPageSizeMedium > 0) { - log_info_p(gc, init)("Medium Page Size: " SIZE_FORMAT "M", ZPageSizeMedium / M); + log_info_p(gc, init)("Medium Page Size: %zuM", ZPageSizeMedium / M); } else { log_info_p(gc, init)("Medium Page Size: N/A"); } @@ -377,7 +376,7 @@ void ZPageAllocator::decrease_capacity(size_t size, bool set_max_capacity) { if (set_max_capacity) { // Adjust current max capacity to avoid further attempts to increase capacity log_error_p(gc)("Forced to lower max Java heap size from " - SIZE_FORMAT "M(%.0f%%) to " SIZE_FORMAT "M(%.0f%%)", + "%zuM(%.0f%%) to %zuM(%.0f%%)", _current_max_capacity / M, percent_of(_current_max_capacity, _max_capacity), _capacity / M, percent_of(_capacity, _max_capacity)); @@ -650,7 +649,7 @@ ZPage* ZPageAllocator::alloc_page_create(ZPageAllocation* allocation) { // Update statistics ZStatInc(ZCounterPageCacheFlush, flushed); - log_debug(gc, heap)("Page Cache Flushed: " SIZE_FORMAT "M", flushed / M); + log_debug(gc, heap)("Page Cache Flushed: %zuM", flushed / M); } // Allocate any remaining physical memory. Capacity and used has diff --git a/src/hotspot/share/gc/z/zPageCache.cpp b/src/hotspot/share/gc/z/zPageCache.cpp index 163bb395560de..b689a274de06c 100644 --- a/src/hotspot/share/gc/z/zPageCache.cpp +++ b/src/hotspot/share/gc/z/zPageCache.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zGlobals.hpp" #include "gc/z/zList.inline.hpp" #include "gc/z/zNUMA.hpp" diff --git a/src/hotspot/share/gc/z/zPageTable.cpp b/src/hotspot/share/gc/z/zPageTable.cpp index 459d26e9df3f4..9a4bbc85d0450 100644 --- a/src/hotspot/share/gc/z/zPageTable.cpp +++ b/src/hotspot/share/gc/z/zPageTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zAddress.hpp" #include "gc/z/zGranuleMap.inline.hpp" #include "gc/z/zPage.inline.hpp" diff --git a/src/hotspot/share/gc/z/zPhysicalMemory.cpp b/src/hotspot/share/gc/z/zPhysicalMemory.cpp index a04fce2d9a9d8..541e60051c312 100644 --- a/src/hotspot/share/gc/z/zPhysicalMemory.cpp +++ b/src/hotspot/share/gc/z/zPhysicalMemory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/gcLogPrecious.hpp" #include "gc/z/zAddress.inline.hpp" #include "gc/z/zArray.inline.hpp" @@ -277,7 +276,7 @@ void ZPhysicalMemoryManager::try_enable_uncommit(size_t min_capacity, size_t max } log_info_p(gc, init)("Uncommit: Enabled"); - log_info_p(gc, init)("Uncommit Delay: " UINTX_FORMAT "s", ZUncommitDelay); + log_info_p(gc, init)("Uncommit Delay: %zus", ZUncommitDelay); } void ZPhysicalMemoryManager::alloc(ZPhysicalMemory& pmem, size_t size) { diff --git a/src/hotspot/share/gc/z/zReferenceProcessor.cpp b/src/hotspot/share/gc/z/zReferenceProcessor.cpp index 797bd96353687..1af4deaec0339 100644 --- a/src/hotspot/share/gc/z/zReferenceProcessor.cpp +++ b/src/hotspot/share/gc/z/zReferenceProcessor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "classfile/javaClasses.inline.hpp" #include "gc/shared/referencePolicy.hpp" #include "gc/shared/referenceProcessorStats.hpp" diff --git a/src/hotspot/share/gc/z/zRelocate.cpp b/src/hotspot/share/gc/z/zRelocate.cpp index 7f69c0752bc5a..805044f9deb88 100644 --- a/src/hotspot/share/gc/z/zRelocate.cpp +++ b/src/hotspot/share/gc/z/zRelocate.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/gc_globals.hpp" #include "gc/shared/suspendibleThreadSet.hpp" #include "gc/z/zAbort.inline.hpp" diff --git a/src/hotspot/share/gc/z/zRelocationSet.cpp b/src/hotspot/share/gc/z/zRelocationSet.cpp index 5c82f55bbbfe7..8cc7bceb8e849 100644 --- a/src/hotspot/share/gc/z/zRelocationSet.cpp +++ b/src/hotspot/share/gc/z/zRelocationSet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zArray.inline.hpp" #include "gc/z/zCollectedHeap.hpp" #include "gc/z/zForwarding.inline.hpp" diff --git a/src/hotspot/share/gc/z/zRelocationSetSelector.cpp b/src/hotspot/share/gc/z/zRelocationSetSelector.cpp index ec904b914fb0b..03835689ec594 100644 --- a/src/hotspot/share/gc/z/zRelocationSetSelector.cpp +++ b/src/hotspot/share/gc/z/zRelocationSetSelector.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/gc_globals.hpp" #include "gc/z/zArray.inline.hpp" #include "gc/z/zForwarding.inline.hpp" @@ -153,7 +152,7 @@ void ZRelocationSetSelectorGroup::select_inner() { } log_trace(gc, reloc)("Candidate Relocation Set (%s Pages): %d->%d, " - "%.1f%% relative defragmentation, " SIZE_FORMAT " forwarding entries, %s, live %d", + "%.1f%% relative defragmentation, %zu forwarding entries, %s, live %d", _name, from, to, diff_reclaimable, from_forwarding_entries, (selected_from == from) ? "Selected" : "Rejected", int(page_live_bytes * 100 / page->size())); @@ -175,7 +174,7 @@ void ZRelocationSetSelectorGroup::select_inner() { _stats[i]._npages_selected = npages_selected[i]; } - log_debug(gc, reloc)("Relocation Set (%s Pages): %d->%d, %d skipped, " SIZE_FORMAT " forwarding entries", + log_debug(gc, reloc)("Relocation Set (%s Pages): %d->%d, %d skipped, %zu forwarding entries", _name, selected_from, selected_to, npages - selected_from, selected_forwarding_entries); } diff --git a/src/hotspot/share/gc/z/zRemembered.cpp b/src/hotspot/share/gc/z/zRemembered.cpp index 18657c44c5c4f..4cfc349acc47e 100644 --- a/src/hotspot/share/gc/z/zRemembered.cpp +++ b/src/hotspot/share/gc/z/zRemembered.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zAddress.inline.hpp" #include "gc/z/zForwarding.inline.hpp" #include "gc/z/zGeneration.inline.hpp" diff --git a/src/hotspot/share/gc/z/zRememberedSet.cpp b/src/hotspot/share/gc/z/zRememberedSet.cpp index f605401648dfb..f833c5b233616 100644 --- a/src/hotspot/share/gc/z/zRememberedSet.cpp +++ b/src/hotspot/share/gc/z/zRememberedSet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zAddress.inline.hpp" #include "gc/z/zBitMap.inline.hpp" #include "gc/z/zHeap.inline.hpp" @@ -206,5 +205,5 @@ bool ZRememberedSetContainingInLiveIterator::next(ZRememberedSetContaining* cont } void ZRememberedSetContainingInLiveIterator::print_statistics() const { - _page->log_msg(" (remembered iter count: " SIZE_FORMAT " skipped: " SIZE_FORMAT ")", _count, _count_skipped); + _page->log_msg(" (remembered iter count: %zu skipped: %zu)", _count, _count_skipped); } diff --git a/src/hotspot/share/gc/z/zResurrection.cpp b/src/hotspot/share/gc/z/zResurrection.cpp index 2e7b4c7b4b98e..4e9aa0448da3f 100644 --- a/src/hotspot/share/gc/z/zResurrection.cpp +++ b/src/hotspot/share/gc/z/zResurrection.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zResurrection.hpp" #include "runtime/atomic.hpp" #include "runtime/safepoint.hpp" diff --git a/src/hotspot/share/gc/z/zRootsIterator.cpp b/src/hotspot/share/gc/z/zRootsIterator.cpp index 086d90781dd63..d5c413f593881 100644 --- a/src/hotspot/share/gc/z/zRootsIterator.cpp +++ b/src/hotspot/share/gc/z/zRootsIterator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "classfile/classLoaderDataGraph.hpp" #include "gc/shared/oopStorageSetParState.inline.hpp" #include "gc/z/zNMethod.hpp" diff --git a/src/hotspot/share/gc/z/zRuntimeWorkers.cpp b/src/hotspot/share/gc/z/zRuntimeWorkers.cpp index 488df66edc61c..f19e5cd54697a 100644 --- a/src/hotspot/share/gc/z/zRuntimeWorkers.cpp +++ b/src/hotspot/share/gc/z/zRuntimeWorkers.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/gcLogPrecious.hpp" #include "gc/shared/gc_globals.hpp" #include "gc/z/zRuntimeWorkers.hpp" diff --git a/src/hotspot/share/gc/z/zServiceability.cpp b/src/hotspot/share/gc/z/zServiceability.cpp index 50fc172f55c02..f2a7ad2dc1aa9 100644 --- a/src/hotspot/share/gc/z/zServiceability.cpp +++ b/src/hotspot/share/gc/z/zServiceability.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/generationCounters.hpp" #include "gc/shared/hSpaceCounters.hpp" #include "gc/z/zCollectedHeap.hpp" diff --git a/src/hotspot/share/gc/z/zStackWatermark.cpp b/src/hotspot/share/gc/z/zStackWatermark.cpp index a4962416f811f..4a50dea0cec01 100644 --- a/src/hotspot/share/gc/z/zStackWatermark.cpp +++ b/src/hotspot/share/gc/z/zStackWatermark.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zAddress.hpp" #include "gc/z/zBarrier.inline.hpp" #include "gc/z/zGeneration.inline.hpp" diff --git a/src/hotspot/share/gc/z/zStat.cpp b/src/hotspot/share/gc/z/zStat.cpp index 96cfa7d3a3718..3fe60f48e8950 100644 --- a/src/hotspot/share/gc/z/zStat.cpp +++ b/src/hotspot/share/gc/z/zStat.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/gc_globals.hpp" #include "gc/z/zAbort.inline.hpp" #include "gc/z/zCollectedHeap.hpp" @@ -48,12 +47,12 @@ #include -#define ZSIZE_FMT SIZE_FORMAT "M(%.0f%%)" +#define ZSIZE_FMT "%zuM(%.0f%%)" #define ZSIZE_ARGS_WITH_MAX(size, max) ((size) / M), (percent_of(size, max)) #define ZSIZE_ARGS(size) ZSIZE_ARGS_WITH_MAX(size, ZStatHeap::max_capacity()) #define ZTABLE_ARGS_NA "%9s", "-" -#define ZTABLE_ARGS(size) SIZE_FORMAT_W(8) "M (%.0f%%)", \ +#define ZTABLE_ARGS(size) "%8zuM (%.0f%%)", \ ((size) / M), (percent_of(size, ZStatHeap::max_capacity())) // @@ -1448,18 +1447,18 @@ void ZStatMark::at_mark_free(size_t mark_stack_usage) { void ZStatMark::print() { log_info(gc, marking)("Mark: " - SIZE_FORMAT " stripe(s), " - SIZE_FORMAT " proactive flush(es), " - SIZE_FORMAT " terminate flush(es), " - SIZE_FORMAT " completion(s), " - SIZE_FORMAT " continuation(s) ", + "%zu stripe(s), " + "%zu proactive flush(es), " + "%zu terminate flush(es), " + "%zu completion(s), " + "%zu continuation(s) ", _nstripes, _nproactiveflush, _nterminateflush, _ntrycomplete, _ncontinue); - log_info(gc, marking)("Mark Stack Usage: " SIZE_FORMAT "M", _mark_stack_usage / M); + log_info(gc, marking)("Mark Stack Usage: %zuM", _mark_stack_usage / M); } // @@ -1544,7 +1543,7 @@ void ZStatRelocation::print_page_summary() { } print_summary("Large", large_summary, 0 /* in_place_count */); - lt.print("Forwarding Usage: " SIZE_FORMAT "M", _forwarding_usage / M); + lt.print("Forwarding Usage: %zuM", _forwarding_usage / M); } void ZStatRelocation::print_age_table() { @@ -1610,13 +1609,13 @@ void ZStatRelocation::print_age_table() { lt.print("%s", create_age_table() .left(ZTABLE_ARGS(total[i] - live[i])) - .left(SIZE_FORMAT_W(7) " / " SIZE_FORMAT, + .left("%7zu / %zu", _selector_stats.small(age).npages_candidates(), _selector_stats.small(age).npages_selected()) - .left(SIZE_FORMAT_W(7) " / " SIZE_FORMAT, + .left("%7zu / %zu", _selector_stats.medium(age).npages_candidates(), _selector_stats.medium(age).npages_selected()) - .left(SIZE_FORMAT_W(7) " / " SIZE_FORMAT, + .left("%7zu / %zu", _selector_stats.large(age).npages_candidates(), _selector_stats.large(age).npages_selected()) .end()); @@ -1627,7 +1626,7 @@ void ZStatRelocation::print_age_table() { // Stat nmethods // void ZStatNMethods::print() { - log_info(gc, nmethod)("NMethods: " SIZE_FORMAT " registered, " SIZE_FORMAT " unregistered", + log_info(gc, nmethod)("NMethods: %zu registered, %zu unregistered", ZNMethodTable::registered_nmethods(), ZNMethodTable::unregistered_nmethods()); } @@ -1638,8 +1637,8 @@ void ZStatNMethods::print() { void ZStatMetaspace::print() { const MetaspaceCombinedStats stats = MetaspaceUtils::get_combined_statistics(); log_info(gc, metaspace)("Metaspace: " - SIZE_FORMAT "M used, " - SIZE_FORMAT "M committed, " SIZE_FORMAT "M reserved", + "%zuM used, " + "%zuM committed, %zuM reserved", stats.used() / M, stats.committed() / M, stats.reserved() / M); diff --git a/src/hotspot/share/gc/z/zStoreBarrierBuffer.cpp b/src/hotspot/share/gc/z/zStoreBarrierBuffer.cpp index 78106aad729b7..a4895ca11cc26 100644 --- a/src/hotspot/share/gc/z/zStoreBarrierBuffer.cpp +++ b/src/hotspot/share/gc/z/zStoreBarrierBuffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/gc_globals.hpp" #include "gc/z/zAddress.inline.hpp" #include "gc/z/zBarrier.inline.hpp" diff --git a/src/hotspot/share/gc/z/zTask.cpp b/src/hotspot/share/gc/z/zTask.cpp index 3125b67c29a95..208a20c1914a6 100644 --- a/src/hotspot/share/gc/z/zTask.cpp +++ b/src/hotspot/share/gc/z/zTask.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zTask.hpp" ZTask::Task::Task(ZTask* task, const char* name) diff --git a/src/hotspot/share/gc/z/zThread.cpp b/src/hotspot/share/gc/z/zThread.cpp index 3203da6430f35..0e5860a3951bd 100644 --- a/src/hotspot/share/gc/z/zThread.cpp +++ b/src/hotspot/share/gc/z/zThread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zThread.hpp" #include "runtime/mutexLocker.hpp" diff --git a/src/hotspot/share/gc/z/zThreadLocalAllocBuffer.cpp b/src/hotspot/share/gc/z/zThreadLocalAllocBuffer.cpp index 530db62f258df..f0261f51d3c98 100644 --- a/src/hotspot/share/gc/z/zThreadLocalAllocBuffer.cpp +++ b/src/hotspot/share/gc/z/zThreadLocalAllocBuffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/tlab_globals.hpp" #include "gc/z/zAddress.inline.hpp" #include "gc/z/zStackWatermark.hpp" diff --git a/src/hotspot/share/gc/z/zTracer.cpp b/src/hotspot/share/gc/z/zTracer.cpp index 7c7fff5624ccc..6ab16f6c88693 100644 --- a/src/hotspot/share/gc/z/zTracer.cpp +++ b/src/hotspot/share/gc/z/zTracer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/gcId.hpp" #include "gc/z/zGeneration.inline.hpp" #include "gc/z/zGlobals.hpp" diff --git a/src/hotspot/share/gc/z/zUncoloredRoot.cpp b/src/hotspot/share/gc/z/zUncoloredRoot.cpp index 505e10628d7f8..03b9862f2a379 100644 --- a/src/hotspot/share/gc/z/zUncoloredRoot.cpp +++ b/src/hotspot/share/gc/z/zUncoloredRoot.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zUncoloredRoot.inline.hpp" void ZUncoloredRootClosure::do_oop(oop* p) { diff --git a/src/hotspot/share/gc/z/zUncommitter.cpp b/src/hotspot/share/gc/z/zUncommitter.cpp index a6a455d4a08b4..50731592108c6 100644 --- a/src/hotspot/share/gc/z/zUncommitter.cpp +++ b/src/hotspot/share/gc/z/zUncommitter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/gc_globals.hpp" #include "gc/z/zHeap.inline.hpp" #include "gc/z/zLock.inline.hpp" @@ -80,7 +79,7 @@ void ZUncommitter::run_thread() { if (uncommitted > 0) { // Update statistics ZStatInc(ZCounterUncommit, uncommitted); - log_info(gc, heap)("Uncommitted: " SIZE_FORMAT "M(%.0f%%)", + log_info(gc, heap)("Uncommitted: %zuM(%.0f%%)", uncommitted / M, percent_of(uncommitted, ZHeap::heap()->max_capacity())); // Send event diff --git a/src/hotspot/share/gc/z/zUnload.cpp b/src/hotspot/share/gc/z/zUnload.cpp index 03827a6929dd3..3dc7ecd3edc41 100644 --- a/src/hotspot/share/gc/z/zUnload.cpp +++ b/src/hotspot/share/gc/z/zUnload.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "classfile/classLoaderDataGraph.hpp" #include "classfile/systemDictionary.hpp" #include "code/codeBehaviours.hpp" diff --git a/src/hotspot/share/gc/z/zUnmapper.cpp b/src/hotspot/share/gc/z/zUnmapper.cpp index b6ef40b6b059f..edd31805c49eb 100644 --- a/src/hotspot/share/gc/z/zUnmapper.cpp +++ b/src/hotspot/share/gc/z/zUnmapper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/gc_globals.hpp" #include "gc/shared/gcLogPrecious.hpp" #include "gc/z/zList.inline.hpp" @@ -70,11 +69,11 @@ bool ZUnmapper::try_enqueue(ZPage* page) { _warned_sync_unmapping = true; log_warning_p(gc)("WARNING: Encountered synchronous unmapping because asynchronous unmapping could not keep up"); } - log_debug(gc, unmap)("Synchronous unmapping " SIZE_FORMAT "M page", page->size() / M); + log_debug(gc, unmap)("Synchronous unmapping %zuM page", page->size() / M); return false; } - log_trace(gc, unmap)("Asynchronous unmapping " SIZE_FORMAT "M page (" SIZE_FORMAT "M / " SIZE_FORMAT "M enqueued)", + log_trace(gc, unmap)("Asynchronous unmapping %zuM page (%zuM / %zuM enqueued)", page->size() / M, _enqueued_bytes / M, queue_capacity() / M); _queue.insert_last(page); diff --git a/src/hotspot/share/gc/z/zUtils.cpp b/src/hotspot/share/gc/z/zUtils.cpp index 7997242f39124..73d9c42d5fb16 100644 --- a/src/hotspot/share/gc/z/zUtils.cpp +++ b/src/hotspot/share/gc/z/zUtils.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/z/zUtils.hpp" #include "runtime/nonJavaThread.hpp" diff --git a/src/hotspot/share/gc/z/zVerify.cpp b/src/hotspot/share/gc/z/zVerify.cpp index 03b50e110e4c4..8e2022d781a4c 100644 --- a/src/hotspot/share/gc/z/zVerify.cpp +++ b/src/hotspot/share/gc/z/zVerify.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "classfile/classLoaderData.hpp" #include "gc/shared/gc_globals.hpp" #include "gc/shared/isGCActiveMark.hpp" @@ -515,7 +514,7 @@ static ZStoreBarrierBufferTable* z_verify_store_barrier_buffer_table = nullptr; #define BAD_REMSET_ARG(p, ptr, addr) \ "Missing remembered set at " PTR_FORMAT " pointing at " PTR_FORMAT \ - " (" PTR_FORMAT " + " INTX_FORMAT ")" \ + " (" PTR_FORMAT " + %zd)" \ , p2i(p), untype(ptr), untype(addr), p2i(p) - untype(addr) class ZVerifyRemsetBeforeOopClosure : public BasicOopIterateClosure { diff --git a/src/hotspot/share/gc/z/zVirtualMemory.cpp b/src/hotspot/share/gc/z/zVirtualMemory.cpp index f645eef740840..ccc30626a3fd0 100644 --- a/src/hotspot/share/gc/z/zVirtualMemory.cpp +++ b/src/hotspot/share/gc/z/zVirtualMemory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/gc_globals.hpp" #include "gc/shared/gcLogPrecious.hpp" #include "gc/z/zAddress.inline.hpp" @@ -138,7 +137,7 @@ size_t ZVirtualMemoryManager::reserve_discontiguous(size_t size) { } bool ZVirtualMemoryManager::reserve_contiguous(zoffset start, size_t size) { - assert(is_aligned(size, ZGranuleSize), "Must be granule aligned " SIZE_FORMAT_X, size); + assert(is_aligned(size, ZGranuleSize), "Must be granule aligned 0x%zx", size); // Reserve address views const zaddress_unsafe addr = ZOffset::address_unsafe(start); @@ -201,7 +200,7 @@ bool ZVirtualMemoryManager::reserve(size_t max_capacity) { (contiguous ? "Contiguous" : "Discontiguous"), (limit == ZAddressOffsetMax ? "Unrestricted" : "Restricted"), (reserved == size ? "Complete" : "Degraded")); - log_info_p(gc, init)("Address Space Size: " SIZE_FORMAT "M", reserved / M); + log_info_p(gc, init)("Address Space Size: %zuM", reserved / M); // Record reserved _reserved = reserved; diff --git a/src/hotspot/share/gc/z/zWeakRootsProcessor.cpp b/src/hotspot/share/gc/z/zWeakRootsProcessor.cpp index c40aae19a5fbc..7373f451cea3b 100644 --- a/src/hotspot/share/gc/z/zWeakRootsProcessor.cpp +++ b/src/hotspot/share/gc/z/zWeakRootsProcessor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/suspendibleThreadSet.hpp" #include "gc/z/zAddress.inline.hpp" #include "gc/z/zBarrier.inline.hpp" diff --git a/src/hotspot/share/gc/z/zWorkers.cpp b/src/hotspot/share/gc/z/zWorkers.cpp index 7db603c73bae5..1e7144a0c261e 100644 --- a/src/hotspot/share/gc/z/zWorkers.cpp +++ b/src/hotspot/share/gc/z/zWorkers.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "gc/shared/gc_globals.hpp" #include "gc/shared/gcLogPrecious.hpp" #include "gc/z/zHeap.inline.hpp" diff --git a/src/hotspot/share/include/cds.h b/src/hotspot/share/include/cds.h index eb8010d625fdc..16d9d74e3982f 100644 --- a/src/hotspot/share/include/cds.h +++ b/src/hotspot/share/include/cds.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 +70,7 @@ typedef struct CDSFileMapRegion { // (The base address is the bottom of the BM region). size_t _ptrmap_size_in_bits; char* _mapped_base; // Actually mapped address (null if this region is not mapped). + bool _in_reserved_space; // Is this region in a ReservedSpace } CDSFileMapRegion; // This portion of the archive file header must remain unchanged for diff --git a/src/hotspot/share/include/jvm.h b/src/hotspot/share/include/jvm.h index 474d5baa487bd..c2a1a3f53f6ca 100644 --- a/src/hotspot/share/include/jvm.h +++ b/src/hotspot/share/include/jvm.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,9 +29,9 @@ #include #include "jni.h" -#include "jvm_md.h" #include "jvm_constants.h" #include "jvm_io.h" +#include "jvm_md.h" #ifdef __cplusplus extern "C" { diff --git a/src/hotspot/share/interpreter/abstractInterpreter.cpp b/src/hotspot/share/interpreter/abstractInterpreter.cpp index 616ba29c62b33..18cd9babf0592 100644 --- a/src/hotspot/share/interpreter/abstractInterpreter.cpp +++ b/src/hotspot/share/interpreter/abstractInterpreter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "asm/macroAssembler.inline.hpp" #include "cds/metaspaceShared.hpp" diff --git a/src/hotspot/share/interpreter/bootstrapInfo.cpp b/src/hotspot/share/interpreter/bootstrapInfo.cpp index 44ef81666031f..c8553615d0c64 100644 --- a/src/hotspot/share/interpreter/bootstrapInfo.cpp +++ b/src/hotspot/share/interpreter/bootstrapInfo.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/javaClasses.inline.hpp" #include "classfile/resolutionErrors.hpp" #include "classfile/systemDictionary.hpp" diff --git a/src/hotspot/share/interpreter/bytecode.cpp b/src/hotspot/share/interpreter/bytecode.cpp index a1d125ed162a5..37feb834a5d1f 100644 --- a/src/hotspot/share/interpreter/bytecode.cpp +++ b/src/hotspot/share/interpreter/bytecode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "interpreter/bytecode.inline.hpp" #include "interpreter/linkResolver.hpp" #include "oops/constantPool.hpp" diff --git a/src/hotspot/share/interpreter/bytecodeHistogram.cpp b/src/hotspot/share/interpreter/bytecodeHistogram.cpp index 9b023f1a66272..e416aa40e7b7f 100644 --- a/src/hotspot/share/interpreter/bytecodeHistogram.cpp +++ b/src/hotspot/share/interpreter/bytecodeHistogram.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "interpreter/bytecodeHistogram.hpp" #include "memory/resourceArea.hpp" #include "runtime/os.hpp" diff --git a/src/hotspot/share/interpreter/bytecodeStream.cpp b/src/hotspot/share/interpreter/bytecodeStream.cpp index 418795a856bf0..7454c74982822 100644 --- a/src/hotspot/share/interpreter/bytecodeStream.cpp +++ b/src/hotspot/share/interpreter/bytecodeStream.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "interpreter/bytecodeStream.hpp" #include "interpreter/bytecodes.hpp" #include "runtime/handles.inline.hpp" diff --git a/src/hotspot/share/interpreter/bytecodeTracer.cpp b/src/hotspot/share/interpreter/bytecodeTracer.cpp index cdb53b62f8c40..f576ad2f07f15 100644 --- a/src/hotspot/share/interpreter/bytecodeTracer.cpp +++ b/src/hotspot/share/interpreter/bytecodeTracer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classPrinter.hpp" #include "classfile/javaClasses.inline.hpp" #include "interpreter/bytecodeHistogram.hpp" @@ -105,7 +104,7 @@ class BytecodePrinter { // the incoming method. We could lose a line of trace output. // This is acceptable in a debug-only feature. st->cr(); - st->print("[" UINTX_FORMAT "] ", Thread::current()->osthread()->thread_id_for_printing()); + st->print("[%zu] ", Thread::current()->osthread()->thread_id_for_printing()); method->print_name(st); st->cr(); _current_method = method(); @@ -128,7 +127,7 @@ class BytecodePrinter { code == Bytecodes::_return_register_finalizer || (code >= Bytecodes::_ireturn && code <= Bytecodes::_return)) { int bci = (int)(bcp - method->code_base()); - st->print("[" UINTX_FORMAT "] ", Thread::current()->osthread()->thread_id_for_printing()); + st->print("[%zu] ", Thread::current()->osthread()->thread_id_for_printing()); if (Verbose) { st->print("%8d %4d " INTPTR_FORMAT " " INTPTR_FORMAT " %s", BytecodeCounter::counter_value(), bci, tos, tos2, Bytecodes::name(code)); diff --git a/src/hotspot/share/interpreter/bytecodeUtils.cpp b/src/hotspot/share/interpreter/bytecodeUtils.cpp index 9c76a6c571b09..eb4557d6ba09d 100644 --- a/src/hotspot/share/interpreter/bytecodeUtils.cpp +++ b/src/hotspot/share/interpreter/bytecodeUtils.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2019 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "classfile/vmClasses.hpp" #include "classfile/vmSymbols.hpp" #include "gc/shared/gcLocker.hpp" diff --git a/src/hotspot/share/interpreter/bytecodes.cpp b/src/hotspot/share/interpreter/bytecodes.cpp index c1304df6d3413..1526b3c330e9a 100644 --- a/src/hotspot/share/interpreter/bytecodes.cpp +++ b/src/hotspot/share/interpreter/bytecodes.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "interpreter/bytecodes.hpp" #include "memory/resourceArea.hpp" #include "oops/method.hpp" diff --git a/src/hotspot/share/interpreter/interpreter.cpp b/src/hotspot/share/interpreter/interpreter.cpp index cba26f5aa6a6d..6272deea34939 100644 --- a/src/hotspot/share/interpreter/interpreter.cpp +++ b/src/hotspot/share/interpreter/interpreter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "asm/macroAssembler.inline.hpp" #include "compiler/disassembler.hpp" diff --git a/src/hotspot/share/interpreter/interpreter.hpp b/src/hotspot/share/interpreter/interpreter.hpp index 85f9be5b3db04..800429913fd95 100644 --- a/src/hotspot/share/interpreter/interpreter.hpp +++ b/src/hotspot/share/interpreter/interpreter.hpp @@ -44,7 +44,6 @@ class InterpreterMacroAssembler; class InterpreterCodelet: public Stub { friend class VMStructs; - friend class CodeCacheDumper; // possible extension [do not remove] private: NOT_PRODUCT(AsmRemarks _asm_remarks;) // Comments for annotating assembler output. NOT_PRODUCT(DbgStrings _dbg_strings;) // Debug strings used in generated code. diff --git a/src/hotspot/share/interpreter/interpreterRuntime.cpp b/src/hotspot/share/interpreter/interpreterRuntime.cpp index 9d953d9db54fd..2377c74868499 100644 --- a/src/hotspot/share/interpreter/interpreterRuntime.cpp +++ b/src/hotspot/share/interpreter/interpreterRuntime.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/javaClasses.inline.hpp" #include "classfile/symbolTable.hpp" #include "classfile/vmClasses.hpp" @@ -1431,38 +1430,6 @@ void SignatureHandlerLibrary::add(const methodHandle& method) { #endif // ASSERT } -void SignatureHandlerLibrary::add(uint64_t fingerprint, address handler) { - int handler_index = -1; - // use customized signature handler - MutexLocker mu(SignatureHandlerLibrary_lock); - // make sure data structure is initialized - initialize(); - fingerprint = InterpreterRuntime::normalize_fast_native_fingerprint(fingerprint); - handler_index = _fingerprints->find(fingerprint); - // create handler if necessary - if (handler_index < 0) { - if (PrintSignatureHandlers && (handler != Interpreter::slow_signature_handler())) { - tty->cr(); - tty->print_cr("argument handler #%d at " PTR_FORMAT " for fingerprint " UINT64_FORMAT, - _handlers->length(), - p2i(handler), - fingerprint); - } - _fingerprints->append(fingerprint); - _handlers->append(handler); - } else { - if (PrintSignatureHandlers) { - tty->cr(); - tty->print_cr("duplicate argument handler #%d for fingerprint " UINT64_FORMAT "(old: " PTR_FORMAT ", new : " PTR_FORMAT ")", - _handlers->length(), - fingerprint, - p2i(_handlers->at(handler_index)), - p2i(handler)); - } - } -} - - BufferBlob* SignatureHandlerLibrary::_handler_blob = nullptr; address SignatureHandlerLibrary::_handler = nullptr; GrowableArray* SignatureHandlerLibrary::_fingerprints = nullptr; diff --git a/src/hotspot/share/interpreter/interpreterRuntime.hpp b/src/hotspot/share/interpreter/interpreterRuntime.hpp index 3635433f43432..3cc7a938a6aa0 100644 --- a/src/hotspot/share/interpreter/interpreterRuntime.hpp +++ b/src/hotspot/share/interpreter/interpreterRuntime.hpp @@ -192,7 +192,6 @@ class SignatureHandlerLibrary: public AllStatic { public: static void add(const methodHandle& method); - static void add(uint64_t fingerprint, address handler); }; #endif // SHARE_INTERPRETER_INTERPRETERRUNTIME_HPP diff --git a/src/hotspot/share/interpreter/invocationCounter.cpp b/src/hotspot/share/interpreter/invocationCounter.cpp index 6793ff039e060..7133d8beb62ed 100644 --- a/src/hotspot/share/interpreter/invocationCounter.cpp +++ b/src/hotspot/share/interpreter/invocationCounter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "compiler/compiler_globals.hpp" #include "interpreter/invocationCounter.hpp" @@ -61,7 +60,7 @@ void InvocationCounter::reset() { void InvocationCounter::print() { uint counter = raw_counter(); - tty->print_cr("invocation count: up = %d, limit = " INTX_FORMAT ", carry = %s", + tty->print_cr("invocation count: up = %d, limit = %zd, carry = %s", extract_count(counter), limit(), extract_carry(counter) ? "true" : "false"); } diff --git a/src/hotspot/share/interpreter/linkResolver.cpp b/src/hotspot/share/interpreter/linkResolver.cpp index ca8a85c8bba5f..b26c643d15fce 100644 --- a/src/hotspot/share/interpreter/linkResolver.cpp +++ b/src/hotspot/share/interpreter/linkResolver.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/archiveUtils.hpp" #include "classfile/classLoader.hpp" #include "classfile/defaultMethods.hpp" @@ -583,7 +582,7 @@ void LinkResolver::check_method_accessability(Klass* ref_klass, resolved_klass->is_array_klass()) { // We need to change "protected" to "public". assert(flags.is_protected(), "clone not protected?"); - jint new_flags = flags.as_int(); + u2 new_flags = flags.as_method_flags(); new_flags = new_flags & (~JVM_ACC_PROTECTED); new_flags = new_flags | JVM_ACC_PUBLIC; flags.set_flags(new_flags); diff --git a/src/hotspot/share/interpreter/oopMapCache.cpp b/src/hotspot/share/interpreter/oopMapCache.cpp index 3406c85df7fe0..62ce860594b9b 100644 --- a/src/hotspot/share/interpreter/oopMapCache.cpp +++ b/src/hotspot/share/interpreter/oopMapCache.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "interpreter/bytecodeStream.hpp" #include "interpreter/oopMapCache.hpp" #include "logging/log.hpp" diff --git a/src/hotspot/share/interpreter/rewriter.cpp b/src/hotspot/share/interpreter/rewriter.cpp index afc8df4b9a0a2..d64954b50bdd4 100644 --- a/src/hotspot/share/interpreter/rewriter.cpp +++ b/src/hotspot/share/interpreter/rewriter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/cdsConfig.hpp" #include "cds/metaspaceShared.hpp" #include "classfile/vmClasses.hpp" diff --git a/src/hotspot/share/interpreter/templateInterpreter.cpp b/src/hotspot/share/interpreter/templateInterpreter.cpp index dc3e4b67b33fd..0dd82addbfead 100644 --- a/src/hotspot/share/interpreter/templateInterpreter.cpp +++ b/src/hotspot/share/interpreter/templateInterpreter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/interpreterRuntime.hpp" #include "interpreter/interp_masm.hpp" diff --git a/src/hotspot/share/interpreter/templateInterpreter.hpp b/src/hotspot/share/interpreter/templateInterpreter.hpp index 224d9b973edf7..8f118bb6ec828 100644 --- a/src/hotspot/share/interpreter/templateInterpreter.hpp +++ b/src/hotspot/share/interpreter/templateInterpreter.hpp @@ -88,7 +88,6 @@ class TemplateInterpreter: public AbstractInterpreter { friend class InterpreterMacroAssembler; friend class TemplateInterpreterGenerator; friend class TemplateTable; - friend class CodeCacheExtensions; // friend class Interpreter; public: diff --git a/src/hotspot/share/interpreter/templateInterpreterGenerator.cpp b/src/hotspot/share/interpreter/templateInterpreterGenerator.cpp index 91c302888431e..e9f1e568a19bf 100644 --- a/src/hotspot/share/interpreter/templateInterpreterGenerator.cpp +++ b/src/hotspot/share/interpreter/templateInterpreterGenerator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "compiler/disassembler.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/interpreterRuntime.hpp" @@ -244,7 +243,6 @@ void TemplateInterpreterGenerator::generate_all() { set_entry_points_for_all_bytes(); // installation of code in other places in the runtime - // (ExcutableCodeManager calls not needed to copy the entries) set_safepoints_for_all_bytes(); { CodeletMark cm(_masm, "deoptimization entry points"); diff --git a/src/hotspot/share/interpreter/templateTable.cpp b/src/hotspot/share/interpreter/templateTable.cpp index 28e42ca1e02ae..55dd0bb8e0f15 100644 --- a/src/hotspot/share/interpreter/templateTable.cpp +++ b/src/hotspot/share/interpreter/templateTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/barrierSet.hpp" #include "interpreter/interp_masm.hpp" #include "interpreter/templateTable.hpp" diff --git a/src/hotspot/share/interpreter/zero/bytecodeInterpreter.cpp b/src/hotspot/share/interpreter/zero/bytecodeInterpreter.cpp index 3f3632c0eea5d..43b618dcc1e13 100644 --- a/src/hotspot/share/interpreter/zero/bytecodeInterpreter.cpp +++ b/src/hotspot/share/interpreter/zero/bytecodeInterpreter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -// no precompiled headers #include "cds/cdsConfig.hpp" #include "classfile/javaClasses.hpp" #include "classfile/vmSymbols.hpp" diff --git a/src/hotspot/share/interpreter/zero/zeroInterpreterGenerator.cpp b/src/hotspot/share/interpreter/zero/zeroInterpreterGenerator.cpp index 27ea1b9706719..faa36fc1ab1f5 100644 --- a/src/hotspot/share/interpreter/zero/zeroInterpreterGenerator.cpp +++ b/src/hotspot/share/interpreter/zero/zeroInterpreterGenerator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/interpreterRuntime.hpp" diff --git a/src/hotspot/share/jfr/dcmd/jfrDcmds.cpp b/src/hotspot/share/jfr/dcmd/jfrDcmds.cpp index 56e006ab25cf3..e7ba0e8f7ca7e 100644 --- a/src/hotspot/share/jfr/dcmd/jfrDcmds.cpp +++ b/src/hotspot/share/jfr/dcmd/jfrDcmds.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/javaClasses.inline.hpp" #include "classfile/vmSymbols.hpp" #include "jfr/jfr.hpp" diff --git a/src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp b/src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp index c2a4016478735..8c3b895345f5a 100644 --- a/src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp +++ b/src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classFileParser.hpp" #include "classfile/classFileStream.hpp" #include "classfile/classLoadInfo.hpp" @@ -1322,7 +1321,7 @@ static u1* schema_extend_event_subklass_bytes(const InstanceKlass* ik, const jint new_buffer_size = extra_stream_bytes + orig_stream_size; u1* const new_buffer = NEW_RESOURCE_ARRAY_IN_THREAD_RETURN_NULL(THREAD, u1, new_buffer_size); if (new_buffer == nullptr) { - log_error(jfr, system) ("Thread local allocation (native) for " SIZE_FORMAT + log_error(jfr, system) ("Thread local allocation (native) for %zu" " bytes failed in JfrEventClassTransformer::on_klass_creation", static_cast(new_buffer_size)); return nullptr; } @@ -1563,7 +1562,7 @@ static void cache_class_file_data(InstanceKlass* new_ik, const ClassFileStream* JvmtiCachedClassFileData* p = (JvmtiCachedClassFileData*)NEW_C_HEAP_ARRAY_RETURN_NULL(u1, offset_of(JvmtiCachedClassFileData, data) + stream_len, mtInternal); if (p == nullptr) { - log_error(jfr, system)("Allocation using C_HEAP_ARRAY for " SIZE_FORMAT " bytes failed in JfrEventClassTransformer::cache_class_file_data", + log_error(jfr, system)("Allocation using C_HEAP_ARRAY for %zu bytes failed in JfrEventClassTransformer::cache_class_file_data", static_cast(offset_of(JvmtiCachedClassFileData, data) + stream_len)); return; } diff --git a/src/hotspot/share/jfr/instrumentation/jfrJvmtiAgent.cpp b/src/hotspot/share/jfr/instrumentation/jfrJvmtiAgent.cpp index f8f975528cb47..31dd55f702d2d 100644 --- a/src/hotspot/share/jfr/instrumentation/jfrJvmtiAgent.cpp +++ b/src/hotspot/share/jfr/instrumentation/jfrJvmtiAgent.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/instrumentation/jfrJvmtiAgent.hpp" #include "jfr/jni/jfrJavaSupport.hpp" #include "jfr/jni/jfrUpcalls.hpp" @@ -103,7 +102,7 @@ static jclass* create_classes_array(jint classes_count, TRAPS) { if (nullptr == classes) { char error_buffer[ERROR_MSG_BUFFER_SIZE]; jio_snprintf(error_buffer, ERROR_MSG_BUFFER_SIZE, - "Thread local allocation (native) of " SIZE_FORMAT " bytes failed " + "Thread local allocation (native) of %zu bytes failed " "in retransform classes", sizeof(jclass) * classes_count); log_error(jfr, system)("%s", error_buffer); JfrJavaSupport::throw_out_of_memory_error(error_buffer, CHECK_NULL); diff --git a/src/hotspot/share/jfr/jfr.cpp b/src/hotspot/share/jfr/jfr.cpp index 1ba374ef24af9..08e2b9f66757a 100644 --- a/src/hotspot/share/jfr/jfr.cpp +++ b/src/hotspot/share/jfr/jfr.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/jfr.hpp" #include "jfr/jni/jfrJavaSupport.hpp" #include "jfr/leakprofiler/leakProfiler.hpp" diff --git a/src/hotspot/share/jfr/jfr.hpp b/src/hotspot/share/jfr/jfr.hpp index 4b34784558ef3..df19ebc5808d0 100644 --- a/src/hotspot/share/jfr/jfr.hpp +++ b/src/hotspot/share/jfr/jfr.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * 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,8 +27,8 @@ #include "jni.h" #include "memory/allStatic.hpp" -#include "utilities/exceptions.hpp" #include "oops/oopsHierarchy.hpp" +#include "utilities/exceptions.hpp" #include "utilities/globalDefinitions.hpp" class CallInfo; diff --git a/src/hotspot/share/jfr/jni/jfrJavaCall.cpp b/src/hotspot/share/jfr/jni/jfrJavaCall.cpp index 9eaf506db7309..9c0bcb415b4e0 100644 --- a/src/hotspot/share/jfr/jni/jfrJavaCall.cpp +++ b/src/hotspot/share/jfr/jni/jfrJavaCall.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/symbolTable.hpp" #include "classfile/systemDictionary.hpp" #include "jfr/jni/jfrJavaCall.hpp" diff --git a/src/hotspot/share/jfr/jni/jfrJavaSupport.cpp b/src/hotspot/share/jfr/jni/jfrJavaSupport.cpp index 777c4ced8a33d..25badd191a5ea 100644 --- a/src/hotspot/share/jfr/jni/jfrJavaSupport.cpp +++ b/src/hotspot/share/jfr/jni/jfrJavaSupport.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/javaClasses.inline.hpp" #include "classfile/modules.hpp" #include "classfile/symbolTable.hpp" diff --git a/src/hotspot/share/jfr/jni/jfrJniMethod.cpp b/src/hotspot/share/jfr/jni/jfrJniMethod.cpp index 143248ef714ec..e0e6979a4e6a3 100644 --- a/src/hotspot/share/jfr/jni/jfrJniMethod.cpp +++ b/src/hotspot/share/jfr/jni/jfrJniMethod.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/jfr.hpp" #include "jfr/jfrEvents.hpp" #include "jfr/periodic/sampling/jfrThreadSampler.hpp" diff --git a/src/hotspot/share/jfr/jni/jfrJniMethodRegistration.cpp b/src/hotspot/share/jfr/jni/jfrJniMethodRegistration.cpp index 4702cbe467b6f..d131d070de5d5 100644 --- a/src/hotspot/share/jfr/jni/jfrJniMethodRegistration.cpp +++ b/src/hotspot/share/jfr/jni/jfrJniMethodRegistration.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/jni/jfrJniMethod.hpp" #include "jfr/jni/jfrJniMethodRegistration.hpp" #include "logging/log.hpp" diff --git a/src/hotspot/share/jfr/jni/jfrUpcalls.cpp b/src/hotspot/share/jfr/jni/jfrUpcalls.cpp index 1915c127b4faf..718e62a9ce816 100644 --- a/src/hotspot/share/jfr/jni/jfrUpcalls.cpp +++ b/src/hotspot/share/jfr/jni/jfrUpcalls.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/javaClasses.hpp" #include "classfile/symbolTable.hpp" #include "classfile/systemDictionary.hpp" @@ -107,7 +106,7 @@ static const size_t ERROR_MSG_BUFFER_SIZE = 256; static void log_error_and_throw_oom(jint new_bytes_length, TRAPS) { char error_buffer[ERROR_MSG_BUFFER_SIZE]; jio_snprintf(error_buffer, ERROR_MSG_BUFFER_SIZE, - "Thread local allocation (native) for " SIZE_FORMAT " bytes failed in JfrUpcalls", (size_t)new_bytes_length); + "Thread local allocation (native) for %zu bytes failed in JfrUpcalls", (size_t)new_bytes_length); log_error(jfr, system)("%s", error_buffer); JfrJavaSupport::throw_out_of_memory_error(error_buffer, CHECK); } diff --git a/src/hotspot/share/jfr/leakprofiler/chains/bfsClosure.cpp b/src/hotspot/share/jfr/leakprofiler/chains/bfsClosure.cpp index ea96a4ccd7aea..45fd4a7dc57dd 100644 --- a/src/hotspot/share/jfr/leakprofiler/chains/bfsClosure.cpp +++ b/src/hotspot/share/jfr/leakprofiler/chains/bfsClosure.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. * */ -#include "precompiled.hpp" #include "jfr/leakprofiler/chains/bfsClosure.hpp" #include "jfr/leakprofiler/chains/dfsClosure.hpp" #include "jfr/leakprofiler/chains/edge.hpp" @@ -55,7 +54,7 @@ static void log_frontier_level_summary(size_t level, size_t edge_size) { const size_t nof_edges_in_frontier = high_idx - low_idx; log_trace(jfr, system)( - "BFS front: " SIZE_FORMAT " edges: " SIZE_FORMAT " size: " SIZE_FORMAT " [KB]", + "BFS front: %zu edges: %zu size: %zu [KB]", level, nof_edges_in_frontier, (nof_edges_in_frontier * edge_size) / K @@ -85,14 +84,14 @@ void BFSClosure::log_dfs_fallback() const { // additional information about DFS fallover log_trace(jfr, system)( - "BFS front: " SIZE_FORMAT " filled edge queue at edge: " SIZE_FORMAT, + "BFS front: %zu filled edge queue at edge: %zu", _current_frontier_level, _dfs_fallback_idx ); const size_t nof_dfs_completed_edges = _edge_queue->bottom() - _dfs_fallback_idx; log_trace(jfr, system)( - "DFS to complete " SIZE_FORMAT " edges size: " SIZE_FORMAT " [KB]", + "DFS to complete %zu edges size: %zu [KB]", nof_dfs_completed_edges, (nof_dfs_completed_edges * edge_size) / K ); diff --git a/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.cpp b/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.cpp index 4ba2e3329f818..83eee96091e00 100644 --- a/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.cpp +++ b/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/leakprofiler/chains/dfsClosure.hpp" #include "jfr/leakprofiler/chains/edge.hpp" #include "jfr/leakprofiler/chains/edgeStore.hpp" diff --git a/src/hotspot/share/jfr/leakprofiler/chains/edge.cpp b/src/hotspot/share/jfr/leakprofiler/chains/edge.cpp index d66c1c0f87024..9be7cf7596ddb 100644 --- a/src/hotspot/share/jfr/leakprofiler/chains/edge.cpp +++ b/src/hotspot/share/jfr/leakprofiler/chains/edge.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. * */ -#include "precompiled.hpp" #include "classfile/javaClasses.inline.hpp" #include "jfr/leakprofiler/chains/edge.hpp" #include "jfr/leakprofiler/utilities/unifiedOopRef.inline.hpp" diff --git a/src/hotspot/share/jfr/leakprofiler/chains/edgeQueue.cpp b/src/hotspot/share/jfr/leakprofiler/chains/edgeQueue.cpp index 75ca304b84789..2f9a57b6dc3bb 100644 --- a/src/hotspot/share/jfr/leakprofiler/chains/edgeQueue.cpp +++ b/src/hotspot/share/jfr/leakprofiler/chains/edgeQueue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/leakprofiler/chains/edgeQueue.hpp" #include "jfr/leakprofiler/utilities/unifiedOopRef.inline.hpp" #include "jfr/recorder/storage/jfrVirtualMemory.hpp" diff --git a/src/hotspot/share/jfr/leakprofiler/chains/edgeStore.cpp b/src/hotspot/share/jfr/leakprofiler/chains/edgeStore.cpp index c08cc543f2f96..9aef92c41826a 100644 --- a/src/hotspot/share/jfr/leakprofiler/chains/edgeStore.cpp +++ b/src/hotspot/share/jfr/leakprofiler/chains/edgeStore.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/leakprofiler/chains/edgeStore.hpp" #include "jfr/leakprofiler/chains/edgeUtils.hpp" #include "jfr/leakprofiler/sampling/objectSample.hpp" diff --git a/src/hotspot/share/jfr/leakprofiler/chains/edgeUtils.cpp b/src/hotspot/share/jfr/leakprofiler/chains/edgeUtils.cpp index edb87c7fc8e41..6a38553403d71 100644 --- a/src/hotspot/share/jfr/leakprofiler/chains/edgeUtils.cpp +++ b/src/hotspot/share/jfr/leakprofiler/chains/edgeUtils.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/javaClasses.inline.hpp" #include "jfr/leakprofiler/chains/edge.hpp" #include "jfr/leakprofiler/chains/edgeStore.hpp" @@ -72,7 +71,7 @@ const Symbol* EdgeUtils::field_name(const Edge& edge, jshort* modifiers) { JavaFieldStream jfs(ik); while (!jfs.done()) { if (offset == jfs.offset()) { - *modifiers = jfs.access_flags().as_short(); + *modifiers = jfs.access_flags().as_field_flags(); return jfs.name(); } jfs.next(); diff --git a/src/hotspot/share/jfr/leakprofiler/chains/pathToGcRootsOperation.cpp b/src/hotspot/share/jfr/leakprofiler/chains/pathToGcRootsOperation.cpp index b6fd556a03e7b..ca7650d68763c 100644 --- a/src/hotspot/share/jfr/leakprofiler/chains/pathToGcRootsOperation.cpp +++ b/src/hotspot/share/jfr/leakprofiler/chains/pathToGcRootsOperation.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/collectedHeap.hpp" #include "gc/shared/gc_globals.hpp" #include "jfr/leakprofiler/leakProfiler.hpp" @@ -70,9 +69,9 @@ static size_t edge_queue_memory_commit_size(size_t memory_reservation_bytes) { } static void log_edge_queue_summary(const EdgeQueue& edge_queue) { - log_trace(jfr, system)("EdgeQueue reserved size total: " SIZE_FORMAT " [KB]", edge_queue.reserved_size() / K); - log_trace(jfr, system)("EdgeQueue edges total: " SIZE_FORMAT, edge_queue.top()); - log_trace(jfr, system)("EdgeQueue liveset total: " SIZE_FORMAT " [KB]", edge_queue.live_set() / K); + log_trace(jfr, system)("EdgeQueue reserved size total: %zu [KB]", edge_queue.reserved_size() / K); + log_trace(jfr, system)("EdgeQueue edges total: %zu", edge_queue.top()); + log_trace(jfr, system)("EdgeQueue liveset total: %zu [KB]", edge_queue.live_set() / K); if (edge_queue.reserved_size() > 0) { log_trace(jfr, system)("EdgeQueue commit reserve ratio: %f\n", ((double)edge_queue.live_set() / (double)edge_queue.reserved_size())); diff --git a/src/hotspot/share/jfr/leakprofiler/chains/rootSetClosure.cpp b/src/hotspot/share/jfr/leakprofiler/chains/rootSetClosure.cpp index b14bbb77d2a72..04ba9477fabdd 100644 --- a/src/hotspot/share/jfr/leakprofiler/chains/rootSetClosure.cpp +++ b/src/hotspot/share/jfr/leakprofiler/chains/rootSetClosure.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderDataGraph.hpp" #include "classfile/stringTable.hpp" #include "gc/shared/oopStorage.inline.hpp" diff --git a/src/hotspot/share/jfr/leakprofiler/checkpoint/eventEmitter.cpp b/src/hotspot/share/jfr/leakprofiler/checkpoint/eventEmitter.cpp index 8b28c4f797404..ffb583bc5f3e1 100644 --- a/src/hotspot/share/jfr/leakprofiler/checkpoint/eventEmitter.cpp +++ b/src/hotspot/share/jfr/leakprofiler/checkpoint/eventEmitter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021, Datadog, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "jfr/jfrEvents.hpp" #include "jfr/leakprofiler/chains/edgeStore.hpp" #include "jfr/leakprofiler/chains/pathToGcRootsOperation.hpp" diff --git a/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.cpp b/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.cpp index b7f9b733c0fd0..112469b9888a6 100644 --- a/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.cpp +++ b/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/jfrEvents.hpp" #include "jfr/jni/jfrJavaSupport.hpp" #include "jfr/leakprofiler/chains/edgeStore.hpp" diff --git a/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleDescription.cpp b/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleDescription.cpp index eb898318c9709..519e81a69e230 100644 --- a/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleDescription.cpp +++ b/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleDescription.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/javaClasses.inline.hpp" #include "classfile/symbolTable.hpp" #include "classfile/vmClasses.hpp" diff --git a/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleWriter.cpp b/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleWriter.cpp index 87851c71cdb75..ff1f9efd01787 100644 --- a/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleWriter.cpp +++ b/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleWriter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfrfiles/jfrTypes.hpp" #include "jfr/leakprofiler/chains/edge.hpp" #include "jfr/leakprofiler/chains/edgeStore.hpp" diff --git a/src/hotspot/share/jfr/leakprofiler/checkpoint/rootResolver.cpp b/src/hotspot/share/jfr/leakprofiler/checkpoint/rootResolver.cpp index 57b29a09d016f..d1ae48e4a75c9 100644 --- a/src/hotspot/share/jfr/leakprofiler/checkpoint/rootResolver.cpp +++ b/src/hotspot/share/jfr/leakprofiler/checkpoint/rootResolver.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderDataGraph.hpp" #include "classfile/stringTable.hpp" #include "gc/shared/oopStorage.inline.hpp" diff --git a/src/hotspot/share/jfr/leakprofiler/leakProfiler.cpp b/src/hotspot/share/jfr/leakprofiler/leakProfiler.cpp index 7ae0ef8b48463..a5b4babb2b197 100644 --- a/src/hotspot/share/jfr/leakprofiler/leakProfiler.cpp +++ b/src/hotspot/share/jfr/leakprofiler/leakProfiler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/leakprofiler/leakProfiler.hpp" #include "jfr/leakprofiler/startOperation.hpp" #include "jfr/leakprofiler/stopOperation.hpp" diff --git a/src/hotspot/share/jfr/leakprofiler/sampling/objectSample.cpp b/src/hotspot/share/jfr/leakprofiler/sampling/objectSample.cpp index 21d3338f51528..61cf8b7acf7ef 100644 --- a/src/hotspot/share/jfr/leakprofiler/sampling/objectSample.cpp +++ b/src/hotspot/share/jfr/leakprofiler/sampling/objectSample.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. * */ -#include "precompiled.hpp" #include "jfr/leakprofiler/sampling/objectSample.hpp" #include "jfr/leakprofiler/sampling/objectSampler.hpp" #include "jfr/recorder/checkpoint/types/traceid/jfrTraceId.inline.hpp" diff --git a/src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.cpp b/src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.cpp index a004bad34cde1..86b8712698bdc 100644 --- a/src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.cpp +++ b/src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/collectedHeap.hpp" #include "gc/shared/oopStorage.hpp" #include "gc/shared/oopStorageSet.hpp" diff --git a/src/hotspot/share/jfr/leakprofiler/sampling/sampleList.cpp b/src/hotspot/share/jfr/leakprofiler/sampling/sampleList.cpp index 28cddeee70e85..4ff95f1775675 100644 --- a/src/hotspot/share/jfr/leakprofiler/sampling/sampleList.cpp +++ b/src/hotspot/share/jfr/leakprofiler/sampling/sampleList.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/leakprofiler/sampling/objectSample.hpp" #include "jfr/leakprofiler/sampling/sampleList.hpp" #include "oops/oop.inline.hpp" diff --git a/src/hotspot/share/jfr/leakprofiler/sampling/samplePriorityQueue.cpp b/src/hotspot/share/jfr/leakprofiler/sampling/samplePriorityQueue.cpp index caa77d2bbb9fd..644cd25ec8a26 100644 --- a/src/hotspot/share/jfr/leakprofiler/sampling/samplePriorityQueue.cpp +++ b/src/hotspot/share/jfr/leakprofiler/sampling/samplePriorityQueue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/leakprofiler/sampling/objectSample.hpp" #include "jfr/leakprofiler/sampling/samplePriorityQueue.hpp" #include "memory/allocation.inline.hpp" diff --git a/src/hotspot/share/jfr/leakprofiler/utilities/granularTimer.cpp b/src/hotspot/share/jfr/leakprofiler/utilities/granularTimer.cpp index 0ce0068d73ff5..5aa8dd9cc95a8 100644 --- a/src/hotspot/share/jfr/leakprofiler/utilities/granularTimer.cpp +++ b/src/hotspot/share/jfr/leakprofiler/utilities/granularTimer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/leakprofiler/utilities/granularTimer.hpp" long GranularTimer::_granularity = 0; diff --git a/src/hotspot/share/jfr/leakprofiler/utilities/rootType.cpp b/src/hotspot/share/jfr/leakprofiler/utilities/rootType.cpp index f066cd5df31f2..9b06caae555b4 100644 --- a/src/hotspot/share/jfr/leakprofiler/utilities/rootType.cpp +++ b/src/hotspot/share/jfr/leakprofiler/utilities/rootType.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/oopStorage.hpp" #include "gc/shared/oopStorageSet.hpp" #include "jfr/leakprofiler/utilities/rootType.hpp" diff --git a/src/hotspot/share/jfr/metadata/metadata.xml b/src/hotspot/share/jfr/metadata/metadata.xml index 3b5e24ca9a256..1b85cb1350cbd 100644 --- a/src/hotspot/share/jfr/metadata/metadata.xml +++ b/src/hotspot/share/jfr/metadata/metadata.xml @@ -46,10 +46,10 @@ $ jfr print dump.jfr Programmatic access: - try (var rf = new RecordingFile(Path.of("dump.jfr)) { + try (var rf = new RecordingFile(Path.of("dump.jfr"))) { while (rf.hasMoreEvents()) { RecordedEvent e = rf.readEvent(); - System.out.println(e.getName() + " " + e.getDuration())); + System.out.println(e.getName() + " " + e.getDuration()); } }; !--> diff --git a/src/hotspot/share/jfr/periodic/jfrCompilerQueueUtilization.cpp b/src/hotspot/share/jfr/periodic/jfrCompilerQueueUtilization.cpp index 1ba31876cb91a..a9bafa99b34b5 100644 --- a/src/hotspot/share/jfr/periodic/jfrCompilerQueueUtilization.cpp +++ b/src/hotspot/share/jfr/periodic/jfrCompilerQueueUtilization.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "compiler/compileBroker.hpp" #include "jfr/jfrEvents.hpp" #include "jfr/periodic/jfrCompilerQueueUtilization.hpp" @@ -88,4 +87,4 @@ void JfrCompilerQueueUtilization::send_events() { last_sample_instant = cur_time; } -} \ No newline at end of file +} diff --git a/src/hotspot/share/jfr/periodic/jfrFinalizerStatisticsEvent.cpp b/src/hotspot/share/jfr/periodic/jfrFinalizerStatisticsEvent.cpp index 908dae2227739..ec734a505e01a 100644 --- a/src/hotspot/share/jfr/periodic/jfrFinalizerStatisticsEvent.cpp +++ b/src/hotspot/share/jfr/periodic/jfrFinalizerStatisticsEvent.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "utilities/macros.hpp" #if INCLUDE_MANAGEMENT #include "classfile/classLoaderDataGraph.hpp" diff --git a/src/hotspot/share/jfr/periodic/jfrModuleEvent.cpp b/src/hotspot/share/jfr/periodic/jfrModuleEvent.cpp index d9b628593a423..ed0fb23f2d7b1 100644 --- a/src/hotspot/share/jfr/periodic/jfrModuleEvent.cpp +++ b/src/hotspot/share/jfr/periodic/jfrModuleEvent.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderData.inline.hpp" #include "classfile/classLoaderDataGraph.hpp" #include "classfile/moduleEntry.hpp" diff --git a/src/hotspot/share/jfr/periodic/jfrNativeMemoryEvent.cpp b/src/hotspot/share/jfr/periodic/jfrNativeMemoryEvent.cpp index 6c0584f50ff31..875db3773005f 100644 --- a/src/hotspot/share/jfr/periodic/jfrNativeMemoryEvent.cpp +++ b/src/hotspot/share/jfr/periodic/jfrNativeMemoryEvent.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/jfrEvents.hpp" #include "jfr/periodic/jfrNativeMemoryEvent.hpp" #include "nmt/memTracker.hpp" diff --git a/src/hotspot/share/jfr/periodic/jfrNetworkUtilization.cpp b/src/hotspot/share/jfr/periodic/jfrNetworkUtilization.cpp index 9d57cddb44808..c18248e105662 100644 --- a/src/hotspot/share/jfr/periodic/jfrNetworkUtilization.cpp +++ b/src/hotspot/share/jfr/periodic/jfrNetworkUtilization.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "logging/log.hpp" #include "jfr/jfrEvents.hpp" #include "jfr/metadata/jfrSerializer.hpp" diff --git a/src/hotspot/share/jfr/periodic/jfrOSInterface.cpp b/src/hotspot/share/jfr/periodic/jfrOSInterface.cpp index 9d9ec751fa642..2d4b99d59abdf 100644 --- a/src/hotspot/share/jfr/periodic/jfrOSInterface.cpp +++ b/src/hotspot/share/jfr/periodic/jfrOSInterface.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/jfrEvents.hpp" #include "jfr/periodic/jfrNetworkUtilization.hpp" #include "jfr/periodic/jfrOSInterface.hpp" diff --git a/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp b/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp index d9aae89b99341..f22098bb52e18 100644 --- a/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp +++ b/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderDataGraph.hpp" #include "classfile/classLoaderStats.hpp" #include "classfile/javaClasses.hpp" diff --git a/src/hotspot/share/jfr/periodic/jfrThreadCPULoadEvent.cpp b/src/hotspot/share/jfr/periodic/jfrThreadCPULoadEvent.cpp index ff1d7ad280ac3..1863b1af800be 100644 --- a/src/hotspot/share/jfr/periodic/jfrThreadCPULoadEvent.cpp +++ b/src/hotspot/share/jfr/periodic/jfrThreadCPULoadEvent.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "logging/log.hpp" #include "jfr/jfrEvents.hpp" #include "jfr/periodic/jfrThreadCPULoadEvent.hpp" diff --git a/src/hotspot/share/jfr/periodic/jfrThreadDumpEvent.cpp b/src/hotspot/share/jfr/periodic/jfrThreadDumpEvent.cpp index 1b296fc4555b3..69bf10d5fd54d 100644 --- a/src/hotspot/share/jfr/periodic/jfrThreadDumpEvent.cpp +++ b/src/hotspot/share/jfr/periodic/jfrThreadDumpEvent.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/dcmd/jfrDcmds.hpp" #include "jfr/jfrEvents.hpp" #include "jfr/periodic/jfrThreadDumpEvent.hpp" diff --git a/src/hotspot/share/jfr/periodic/sampling/jfrCallTrace.cpp b/src/hotspot/share/jfr/periodic/sampling/jfrCallTrace.cpp index 5d12af6d9370e..72cad299f8b5e 100644 --- a/src/hotspot/share/jfr/periodic/sampling/jfrCallTrace.cpp +++ b/src/hotspot/share/jfr/periodic/sampling/jfrCallTrace.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "code/debugInfoRec.hpp" #include "code/nmethod.hpp" #include "code/pcDesc.hpp" diff --git a/src/hotspot/share/jfr/periodic/sampling/jfrThreadSampler.cpp b/src/hotspot/share/jfr/periodic/sampling/jfrThreadSampler.cpp index 5cef25c54cb51..29f4c88881b23 100644 --- a/src/hotspot/share/jfr/periodic/sampling/jfrThreadSampler.cpp +++ b/src/hotspot/share/jfr/periodic/sampling/jfrThreadSampler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/javaThreadStatus.hpp" #include "jfr/jfrEvents.hpp" #include "jfr/recorder/jfrRecorder.hpp" diff --git a/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp b/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp index a2e887e71a32a..26b5116a59944 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/javaClasses.inline.hpp" #include "jfr/jni/jfrJavaSupport.hpp" #include "jfr/leakprofiler/checkpoint/objectSampleCheckpoint.hpp" diff --git a/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointWriter.cpp b/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointWriter.cpp index 02829c40a712c..04a517ff46340 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointWriter.cpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointWriter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/recorder/checkpoint/jfrCheckpointManager.hpp" #include "jfr/recorder/checkpoint/jfrCheckpointWriter.hpp" #include "jfr/utilities/jfrBlob.hpp" diff --git a/src/hotspot/share/jfr/recorder/checkpoint/jfrMetadataEvent.cpp b/src/hotspot/share/jfr/recorder/checkpoint/jfrMetadataEvent.cpp index 08f7d2ae87d8f..bf27fa5903172 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/jfrMetadataEvent.cpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/jfrMetadataEvent.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/jni/jfrJavaSupport.hpp" #include "jfr/jni/jfrUpcalls.hpp" #include "jfr/recorder/checkpoint/jfrMetadataEvent.hpp" diff --git a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrThreadGroup.cpp b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrThreadGroup.cpp index f16542d13ac39..a4817cbc87d0d 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrThreadGroup.cpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrThreadGroup.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/recorder/checkpoint/jfrCheckpointWriter.hpp" #include "jfr/recorder/checkpoint/types/jfrThreadGroup.hpp" #include "jfr/utilities/jfrTypes.hpp" diff --git a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrThreadState.cpp b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrThreadState.cpp index f6bf3e685b6e7..cdd7adebe4fd2 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrThreadState.cpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrThreadState.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/javaClasses.inline.hpp" #include "jfr/recorder/checkpoint/types/jfrThreadState.hpp" #include "jfr/recorder/checkpoint/jfrCheckpointWriter.hpp" diff --git a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrType.cpp b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrType.cpp index 4b054a86ba143..01cad49e1835e 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrType.cpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrType.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/javaClasses.inline.hpp" #include "code/codeBlob.hpp" #include "code/codeCache.hpp" diff --git a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeManager.cpp b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeManager.cpp index 20c1100994722..334bdc40cb33b 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeManager.cpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" #include "jfr/metadata/jfrSerializer.hpp" diff --git a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp index a53eaa474f3f0..8128674dc1e58 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderDataGraph.hpp" #include "classfile/javaClasses.inline.hpp" #include "classfile/moduleEntry.hpp" @@ -227,9 +226,9 @@ static traceid method_id(KlassPtr klass, MethodPtr method) { } template -static s4 get_flags(const T* ptr) { +static u2 get_flags(const T* ptr) { assert(ptr != nullptr, "invariant"); - return ptr->access_flags().get_flags(); + return ptr->access_flags().as_unsigned_short(); } // Same as JVM_GetClassModifiers @@ -968,7 +967,7 @@ static int write_method(JfrCheckpointWriter* writer, MethodPtr method, bool leak writer->write(artifact_id(klass)); writer->write(mark_symbol(method->name(), leakp)); writer->write(mark_symbol(method->signature(), leakp)); - writer->write(static_cast(get_flags(method))); + writer->write(get_flags(method)); writer->write(get_visibility(method)); return 1; } diff --git a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSetUtils.cpp b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSetUtils.cpp index 3db940156a800..5e70fdcb941d6 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSetUtils.cpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSetUtils.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/recorder/checkpoint/types/jfrTypeSetUtils.hpp" #include "jfr/utilities/jfrPredicate.hpp" #include "jfr/utilities/jfrRelation.hpp" diff --git a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceId.cpp b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceId.cpp index d2973f748729a..7006d6c865a55 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceId.cpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceId.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderData.inline.hpp" #include "classfile/javaClasses.inline.hpp" #include "classfile/symbolTable.hpp" diff --git a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdEpoch.cpp b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdEpoch.cpp index 328c3a7c9e1a4..743923d674cdf 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdEpoch.cpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdEpoch.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/recorder/checkpoint/types/traceid/jfrTraceIdEpoch.hpp" #include "jfr/support/jfrThreadId.inline.hpp" #include "runtime/safepoint.hpp" diff --git a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdKlassQueue.cpp b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdKlassQueue.cpp index 30f2afd880c43..e821b52870771 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdKlassQueue.cpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdKlassQueue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/recorder/checkpoint/types/traceid/jfrTraceId.inline.hpp" #include "jfr/recorder/checkpoint/types/traceid/jfrTraceIdEpoch.hpp" #include "jfr/recorder/checkpoint/types/traceid/jfrTraceIdKlassQueue.hpp" diff --git a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdLoadBarrier.cpp b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdLoadBarrier.cpp index db0faafdc99a7..8f600431333d9 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdLoadBarrier.cpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdLoadBarrier.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/recorder/checkpoint/types/traceid/jfrTraceIdLoadBarrier.inline.hpp" #include "jfr/recorder/checkpoint/types/traceid/jfrTraceIdKlassQueue.hpp" #include "jfr/recorder/service/jfrOptionSet.hpp" diff --git a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdMacros.hpp b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdMacros.hpp index f53eecad2cf9e..b487b5e667001 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdMacros.hpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdMacros.hpp @@ -97,7 +97,7 @@ #define METHOD_USED_THIS_EPOCH(kls) (TRACE_ID_PREDICATE(kls, (THIS_EPOCH_METHOD_BIT))) #define METHOD_NOT_USED_THIS_EPOCH(kls) (!(METHOD_USED_THIS_EPOCH(kls))) #define METHOD_USED_PREVIOUS_EPOCH(kls) (TRACE_ID_PREDICATE(kls, (PREVIOUS_EPOCH_METHOD_BIT))) -#define METHOD_USED_ANY_EPOCH(kls) (TRACE_ID_PREDICATE(kls, (EPOCH_1_METHOD_BIT) | EPOCH_0_METHOD_BIT))) +#define METHOD_USED_ANY_EPOCH(kls) (TRACE_ID_PREDICATE(kls, (EPOCH_1_METHOD_BIT | EPOCH_0_METHOD_BIT))) #define METHOD_AND_CLASS_USED_THIS_EPOCH(kls) (TRACE_ID_PREDICATE(kls, (THIS_EPOCH_METHOD_AND_CLASS_BITS))) #define METHOD_AND_CLASS_USED_PREVIOUS_EPOCH(kls) (TRACE_ID_PREDICATE(kls, (PREVIOUS_EPOCH_METHOD_AND_CLASS_BITS))) #define METHOD_AND_CLASS_USED_ANY_EPOCH(kls) (METHOD_USED_ANY_EPOCH(kls) && USED_ANY_EPOCH(kls)) diff --git a/src/hotspot/share/jfr/recorder/jfrEventSetting.cpp b/src/hotspot/share/jfr/recorder/jfrEventSetting.cpp index 175ee30496576..13bb328d2f465 100644 --- a/src/hotspot/share/jfr/recorder/jfrEventSetting.cpp +++ b/src/hotspot/share/jfr/recorder/jfrEventSetting.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/recorder/jfrEventSetting.inline.hpp" JfrNativeSettings JfrEventSetting::_jvm_event_settings; diff --git a/src/hotspot/share/jfr/recorder/jfrRecorder.cpp b/src/hotspot/share/jfr/recorder/jfrRecorder.cpp index af6543e2a75ba..d6fea53fcc910 100644 --- a/src/hotspot/share/jfr/recorder/jfrRecorder.cpp +++ b/src/hotspot/share/jfr/recorder/jfrRecorder.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/cdsConfig.hpp" #include "classfile/javaClasses.hpp" #include "jfr/dcmd/jfrDcmds.hpp" diff --git a/src/hotspot/share/jfr/recorder/repository/jfrChunk.cpp b/src/hotspot/share/jfr/recorder/repository/jfrChunk.cpp index a35b046e56c92..f697f19b4885d 100644 --- a/src/hotspot/share/jfr/recorder/repository/jfrChunk.cpp +++ b/src/hotspot/share/jfr/recorder/repository/jfrChunk.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/recorder/repository/jfrChunk.hpp" #include "jfr/recorder/service/jfrOptionSet.hpp" #include "jfr/utilities/jfrTime.hpp" diff --git a/src/hotspot/share/jfr/recorder/repository/jfrChunkRotation.cpp b/src/hotspot/share/jfr/recorder/repository/jfrChunkRotation.cpp index 2940126374117..930f5be0b039b 100644 --- a/src/hotspot/share/jfr/recorder/repository/jfrChunkRotation.cpp +++ b/src/hotspot/share/jfr/recorder/repository/jfrChunkRotation.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/jni/jfrJavaSupport.hpp" #include "jfr/recorder/repository/jfrChunkRotation.hpp" #include "jfr/recorder/repository/jfrChunkWriter.hpp" diff --git a/src/hotspot/share/jfr/recorder/repository/jfrChunkWriter.cpp b/src/hotspot/share/jfr/recorder/repository/jfrChunkWriter.cpp index 4b08ea6b1354e..99fbc0e69bfad 100644 --- a/src/hotspot/share/jfr/recorder/repository/jfrChunkWriter.cpp +++ b/src/hotspot/share/jfr/recorder/repository/jfrChunkWriter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/recorder/repository/jfrChunk.hpp" #include "jfr/recorder/repository/jfrChunkWriter.hpp" #include "jfr/utilities/jfrTime.hpp" diff --git a/src/hotspot/share/jfr/recorder/repository/jfrEmergencyDump.cpp b/src/hotspot/share/jfr/recorder/repository/jfrEmergencyDump.cpp index eaee79497bb4d..b49ce4556c7c2 100644 --- a/src/hotspot/share/jfr/recorder/repository/jfrEmergencyDump.cpp +++ b/src/hotspot/share/jfr/recorder/repository/jfrEmergencyDump.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/jfrEvents.hpp" #include "jfr/jni/jfrJavaSupport.hpp" #include "jfr/leakprofiler/leakProfiler.hpp" diff --git a/src/hotspot/share/jfr/recorder/repository/jfrRepository.cpp b/src/hotspot/share/jfr/recorder/repository/jfrRepository.cpp index 3bd1157ac359f..9f6071874d8d9 100644 --- a/src/hotspot/share/jfr/recorder/repository/jfrRepository.cpp +++ b/src/hotspot/share/jfr/recorder/repository/jfrRepository.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/jfr.hpp" #include "jfr/jni/jfrJavaSupport.hpp" #include "jfr/recorder/jfrRecorder.hpp" diff --git a/src/hotspot/share/jfr/recorder/service/jfrEvent.cpp b/src/hotspot/share/jfr/recorder/service/jfrEvent.cpp index aceeabcedf473..7462aa2fce1be 100644 --- a/src/hotspot/share/jfr/recorder/service/jfrEvent.cpp +++ b/src/hotspot/share/jfr/recorder/service/jfrEvent.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/recorder/service/jfrEvent.hpp" #include "utilities/bitMap.inline.hpp" #include "utilities/macros.hpp" diff --git a/src/hotspot/share/jfr/recorder/service/jfrEventThrottler.cpp b/src/hotspot/share/jfr/recorder/service/jfrEventThrottler.cpp index af0697b5e28ca..6b8b5f0cc8c7b 100644 --- a/src/hotspot/share/jfr/recorder/service/jfrEventThrottler.cpp +++ b/src/hotspot/share/jfr/recorder/service/jfrEventThrottler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, Datadog, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "jfr/recorder/service/jfrEventThrottler.hpp" #include "jfr/utilities/jfrSpinlockHelper.hpp" #include "logging/log.hpp" diff --git a/src/hotspot/share/jfr/recorder/service/jfrMemorySizer.cpp b/src/hotspot/share/jfr/recorder/service/jfrMemorySizer.cpp index af17659e2ec36..a2e2a9d3cf0e3 100644 --- a/src/hotspot/share/jfr/recorder/service/jfrMemorySizer.cpp +++ b/src/hotspot/share/jfr/recorder/service/jfrMemorySizer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/recorder/service/jfrMemorySizer.hpp" #include "logging/log.hpp" #include "runtime/os.hpp" diff --git a/src/hotspot/share/jfr/recorder/service/jfrOptionSet.cpp b/src/hotspot/share/jfr/recorder/service/jfrOptionSet.cpp index 4982e24e8987d..b212ee4ccba48 100644 --- a/src/hotspot/share/jfr/recorder/service/jfrOptionSet.cpp +++ b/src/hotspot/share/jfr/recorder/service/jfrOptionSet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/cdsConfig.hpp" #include "classfile/javaClasses.hpp" #include "jfr/dcmd/jfrDcmds.hpp" diff --git a/src/hotspot/share/jfr/recorder/service/jfrPostBox.cpp b/src/hotspot/share/jfr/recorder/service/jfrPostBox.cpp index cf487d48f5450..b1bddfff466a2 100644 --- a/src/hotspot/share/jfr/recorder/service/jfrPostBox.cpp +++ b/src/hotspot/share/jfr/recorder/service/jfrPostBox.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/recorder/service/jfrPostBox.hpp" #include "jfr/utilities/jfrTryLock.hpp" #include "runtime/atomic.hpp" diff --git a/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp b/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp index 9f24bddcd3cd7..31b2311af6ce8 100644 --- a/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp +++ b/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfrfiles/jfrEventClasses.hpp" #include "jfr/jni/jfrJavaSupport.hpp" #include "jfr/leakprofiler/leakProfiler.hpp" diff --git a/src/hotspot/share/jfr/recorder/service/jfrRecorderThread.cpp b/src/hotspot/share/jfr/recorder/service/jfrRecorderThread.cpp index e1cb8e889d33e..de0a77a0c8209 100644 --- a/src/hotspot/share/jfr/recorder/service/jfrRecorderThread.cpp +++ b/src/hotspot/share/jfr/recorder/service/jfrRecorderThread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmClasses.hpp" #include "classfile/vmSymbols.hpp" diff --git a/src/hotspot/share/jfr/recorder/service/jfrRecorderThreadLoop.cpp b/src/hotspot/share/jfr/recorder/service/jfrRecorderThreadLoop.cpp index 9742ae986de4f..d549ea55dee5a 100644 --- a/src/hotspot/share/jfr/recorder/service/jfrRecorderThreadLoop.cpp +++ b/src/hotspot/share/jfr/recorder/service/jfrRecorderThreadLoop.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/jni/jfrJavaSupport.hpp" #include "jfr/recorder/jfrRecorder.hpp" #include "jfr/recorder/service/jfrPostBox.hpp" diff --git a/src/hotspot/share/jfr/recorder/stacktrace/jfrStackFilter.cpp b/src/hotspot/share/jfr/recorder/stacktrace/jfrStackFilter.cpp index bf10c531c637a..1eb057b564ec1 100644 --- a/src/hotspot/share/jfr/recorder/stacktrace/jfrStackFilter.cpp +++ b/src/hotspot/share/jfr/recorder/stacktrace/jfrStackFilter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/recorder/stacktrace/jfrStackFilter.hpp" #include "oops/method.hpp" #include "oops/symbol.hpp" diff --git a/src/hotspot/share/jfr/recorder/stacktrace/jfrStackFilterRegistry.cpp b/src/hotspot/share/jfr/recorder/stacktrace/jfrStackFilterRegistry.cpp index 481dcbdc840c6..de20cd3637570 100644 --- a/src/hotspot/share/jfr/recorder/stacktrace/jfrStackFilterRegistry.cpp +++ b/src/hotspot/share/jfr/recorder/stacktrace/jfrStackFilterRegistry.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ */ -#include "precompiled.hpp" #include "jfr/jni/jfrJavaSupport.hpp" #include "jfr/recorder/stacktrace/jfrStackFilter.hpp" #include "jfr/recorder/stacktrace/jfrStackFilterRegistry.hpp" diff --git a/src/hotspot/share/jfr/recorder/stacktrace/jfrStackTrace.cpp b/src/hotspot/share/jfr/recorder/stacktrace/jfrStackTrace.cpp index 29cd6a17b1314..cbe686fa910ca 100644 --- a/src/hotspot/share/jfr/recorder/stacktrace/jfrStackTrace.cpp +++ b/src/hotspot/share/jfr/recorder/stacktrace/jfrStackTrace.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/recorder/checkpoint/jfrCheckpointWriter.hpp" #include "jfr/recorder/checkpoint/types/traceid/jfrTraceId.inline.hpp" #include "jfr/recorder/repository/jfrChunkWriter.hpp" diff --git a/src/hotspot/share/jfr/recorder/stacktrace/jfrStackTraceRepository.cpp b/src/hotspot/share/jfr/recorder/stacktrace/jfrStackTraceRepository.cpp index 0cb8561ad9f92..a30c0d8f2624d 100644 --- a/src/hotspot/share/jfr/recorder/stacktrace/jfrStackTraceRepository.cpp +++ b/src/hotspot/share/jfr/recorder/stacktrace/jfrStackTraceRepository.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/metadata/jfrSerializer.hpp" #include "jfr/recorder/checkpoint/jfrCheckpointWriter.hpp" #include "jfr/recorder/repository/jfrChunkWriter.hpp" diff --git a/src/hotspot/share/jfr/recorder/storage/jfrBuffer.cpp b/src/hotspot/share/jfr/recorder/storage/jfrBuffer.cpp index edbf5ef6981d8..5c734e5c3690b 100644 --- a/src/hotspot/share/jfr/recorder/storage/jfrBuffer.cpp +++ b/src/hotspot/share/jfr/recorder/storage/jfrBuffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/recorder/storage/jfrBuffer.hpp" #include "runtime/javaThread.hpp" diff --git a/src/hotspot/share/jfr/recorder/storage/jfrEpochStorage.inline.hpp b/src/hotspot/share/jfr/recorder/storage/jfrEpochStorage.inline.hpp index ae52f20436d9b..230d5dd1a985b 100644 --- a/src/hotspot/share/jfr/recorder/storage/jfrEpochStorage.inline.hpp +++ b/src/hotspot/share/jfr/recorder/storage/jfrEpochStorage.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,7 +52,7 @@ template class RetrievalPolicy, bool Eag inline NodeType* JfrEpochStorageHost::acquire(size_t size, Thread* thread) { BufferPtr buffer = mspace_acquire_to_live_list(size, _mspace, thread); if (buffer == nullptr) { - log_warning(jfr)("Unable to allocate " SIZE_FORMAT " bytes of %s.", _mspace->min_element_size(), "epoch storage"); + log_warning(jfr)("Unable to allocate %zu bytes of %s.", _mspace->min_element_size(), "epoch storage"); return nullptr; } assert(buffer->acquired_by_self(), "invariant"); diff --git a/src/hotspot/share/jfr/recorder/storage/jfrMemorySpace.inline.hpp b/src/hotspot/share/jfr/recorder/storage/jfrMemorySpace.inline.hpp index 8812d0a8ffd80..18ed2272cfad7 100644 --- a/src/hotspot/share/jfr/recorder/storage/jfrMemorySpace.inline.hpp +++ b/src/hotspot/share/jfr/recorder/storage/jfrMemorySpace.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -203,7 +203,7 @@ inline bool JfrMemorySpace< Client, RetrievalPolicy, FreeListType, FullListType, // allocations are even multiples of the mspace min size static inline size_t align_allocation_size(size_t requested_size, size_t min_element_size) { if (requested_size > static_cast(min_intx)) { - assert(false, "requested size: " SIZE_FORMAT " is too large", requested_size); + assert(false, "requested size: %zu is too large", requested_size); return 0; } u8 alloc_size_bytes = min_element_size; diff --git a/src/hotspot/share/jfr/recorder/storage/jfrReferenceCountedStorage.cpp b/src/hotspot/share/jfr/recorder/storage/jfrReferenceCountedStorage.cpp index ac652905c5b83..d28b7212571d9 100644 --- a/src/hotspot/share/jfr/recorder/storage/jfrReferenceCountedStorage.cpp +++ b/src/hotspot/share/jfr/recorder/storage/jfrReferenceCountedStorage.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/leakprofiler/sampling/objectSampler.hpp" #include "jfr/recorder/checkpoint/jfrCheckpointWriter.hpp" #include "jfr/recorder/storage/jfrReferenceCountedStorage.hpp" diff --git a/src/hotspot/share/jfr/recorder/storage/jfrStorage.cpp b/src/hotspot/share/jfr/recorder/storage/jfrStorage.cpp index 8b920d163b0da..a7a21f65944bc 100644 --- a/src/hotspot/share/jfr/recorder/storage/jfrStorage.cpp +++ b/src/hotspot/share/jfr/recorder/storage/jfrStorage.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/jfrEvents.hpp" #include "jfr/jni/jfrJavaSupport.hpp" #include "jfr/recorder/jfrRecorder.hpp" @@ -137,7 +136,7 @@ JfrStorageControl& JfrStorage::control() { } static void log_allocation_failure(const char* msg, size_t size) { - log_warning(jfr)("Unable to allocate " SIZE_FORMAT " bytes of %s.", size, msg); + log_warning(jfr)("Unable to allocate %zu bytes of %s.", size, msg); } BufferPtr JfrStorage::acquire_thread_local(Thread* thread, size_t size /* 0 */) { @@ -327,8 +326,8 @@ static void log_discard(size_t pre_full_count, size_t post_full_count, size_t am if (log_is_enabled(Debug, jfr, system)) { const size_t number_of_discards = pre_full_count - post_full_count; if (number_of_discards > 0) { - log_debug(jfr, system)("Cleared " SIZE_FORMAT " full buffer(s) of " SIZE_FORMAT" bytes.", number_of_discards, amount); - log_debug(jfr, system)("Current number of full buffers " SIZE_FORMAT "", number_of_discards); + log_debug(jfr, system)("Cleared %zu full buffer(s) of %zu bytes.", number_of_discards, amount); + log_debug(jfr, system)("Current number of full buffers %zu", number_of_discards); } } } @@ -566,7 +565,7 @@ static size_t process_full(Processor& processor, JfrFullList* list, JfrStorageCo static void log(size_t count, size_t amount, bool clear = false) { if (log_is_enabled(Debug, jfr, system)) { if (count > 0) { - log_debug(jfr, system)("%s " SIZE_FORMAT " full buffer(s) of " SIZE_FORMAT" B of data%s", + log_debug(jfr, system)("%s %zu full buffer(s) of %zu B of data%s", clear ? "Discarded" : "Wrote", count, amount, clear ? "." : " to chunk."); } } diff --git a/src/hotspot/share/jfr/recorder/storage/jfrStorageControl.cpp b/src/hotspot/share/jfr/recorder/storage/jfrStorageControl.cpp index 7691d8bb99324..52a747fdad1bb 100644 --- a/src/hotspot/share/jfr/recorder/storage/jfrStorageControl.cpp +++ b/src/hotspot/share/jfr/recorder/storage/jfrStorageControl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/recorder/storage/jfrStorageControl.hpp" #include "runtime/atomic.hpp" diff --git a/src/hotspot/share/jfr/recorder/storage/jfrVirtualMemory.cpp b/src/hotspot/share/jfr/recorder/storage/jfrVirtualMemory.cpp index 6130de655bdff..c91da0075210d 100644 --- a/src/hotspot/share/jfr/recorder/storage/jfrVirtualMemory.cpp +++ b/src/hotspot/share/jfr/recorder/storage/jfrVirtualMemory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/recorder/storage/jfrVirtualMemory.hpp" #include "memory/memoryReserver.hpp" #include "memory/virtualspace.hpp" diff --git a/src/hotspot/share/jfr/recorder/stringpool/jfrStringPool.cpp b/src/hotspot/share/jfr/recorder/stringpool/jfrStringPool.cpp index 217b6dbddc3c4..a9e39094f7906 100644 --- a/src/hotspot/share/jfr/recorder/stringpool/jfrStringPool.cpp +++ b/src/hotspot/share/jfr/recorder/stringpool/jfrStringPool.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/javaClasses.inline.hpp" #include "classfile/symbolTable.hpp" #include "classfile/systemDictionary.hpp" diff --git a/src/hotspot/share/jfr/recorder/stringpool/jfrStringPoolBuffer.cpp b/src/hotspot/share/jfr/recorder/stringpool/jfrStringPoolBuffer.cpp index f130431bcf066..f5f15be2899b2 100644 --- a/src/hotspot/share/jfr/recorder/stringpool/jfrStringPoolBuffer.cpp +++ b/src/hotspot/share/jfr/recorder/stringpool/jfrStringPoolBuffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/recorder/stringpool/jfrStringPoolBuffer.hpp" JfrStringPoolBuffer::JfrStringPoolBuffer() : JfrBuffer(), _string_count_pos(0), _string_count_top(0) {} diff --git a/src/hotspot/share/jfr/recorder/stringpool/jfrStringPoolWriter.cpp b/src/hotspot/share/jfr/recorder/stringpool/jfrStringPoolWriter.cpp index 8cbe37f1403a8..5ef64e67f0922 100644 --- a/src/hotspot/share/jfr/recorder/stringpool/jfrStringPoolWriter.cpp +++ b/src/hotspot/share/jfr/recorder/stringpool/jfrStringPoolWriter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/recorder/stringpool/jfrStringPool.hpp" #include "jfr/recorder/stringpool/jfrStringPoolWriter.hpp" #include "jfr/writers/jfrEventWriterHost.inline.hpp" diff --git a/src/hotspot/share/jfr/support/jfrAdaptiveSampler.cpp b/src/hotspot/share/jfr/support/jfrAdaptiveSampler.cpp index 9ef85ecbbe9fb..aa351a81ff3c3 100644 --- a/src/hotspot/share/jfr/support/jfrAdaptiveSampler.cpp +++ b/src/hotspot/share/jfr/support/jfrAdaptiveSampler.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, Datadog, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "jfr/support/jfrAdaptiveSampler.hpp" #include "jfr/utilities/jfrRandom.inline.hpp" #include "jfr/utilities/jfrSpinlockHelper.hpp" diff --git a/src/hotspot/share/jfr/support/jfrAllocationTracer.cpp b/src/hotspot/share/jfr/support/jfrAllocationTracer.cpp index 8d56be89c13c2..a1245d7bafe3a 100644 --- a/src/hotspot/share/jfr/support/jfrAllocationTracer.cpp +++ b/src/hotspot/share/jfr/support/jfrAllocationTracer.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/leakprofiler/leakProfiler.hpp" #include "jfr/support/jfrAllocationTracer.hpp" #include "jfr/support/jfrObjectAllocationSample.hpp" diff --git a/src/hotspot/share/jfr/support/jfrDeprecationEventWriter.cpp b/src/hotspot/share/jfr/support/jfrDeprecationEventWriter.cpp index 4aa61bdddff7f..49b5e20e49a8b 100644 --- a/src/hotspot/share/jfr/support/jfrDeprecationEventWriter.cpp +++ b/src/hotspot/share/jfr/support/jfrDeprecationEventWriter.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfrfiles/jfrEventIds.hpp" #include "jfr/recorder/checkpoint/jfrCheckpointWriter.hpp" #include "jfr/recorder/jfrEventSetting.inline.hpp" diff --git a/src/hotspot/share/jfr/support/jfrDeprecationManager.cpp b/src/hotspot/share/jfr/support/jfrDeprecationManager.cpp index 79bcb37e5c0e1..ef1f25c84b308 100644 --- a/src/hotspot/share/jfr/support/jfrDeprecationManager.cpp +++ b/src/hotspot/share/jfr/support/jfrDeprecationManager.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/moduleEntry.hpp" #include "interpreter/bytecodes.hpp" #include "jfrfiles/jfrEventIds.hpp" diff --git a/src/hotspot/share/jfr/support/jfrFlush.cpp b/src/hotspot/share/jfr/support/jfrFlush.cpp index 42e4f5f45818a..0179cde3d4acb 100644 --- a/src/hotspot/share/jfr/support/jfrFlush.cpp +++ b/src/hotspot/share/jfr/support/jfrFlush.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/recorder/jfrEventSetting.inline.hpp" #include "jfr/recorder/storage/jfrStorage.hpp" #include "jfr/recorder/stacktrace/jfrStackTraceRepository.hpp" diff --git a/src/hotspot/share/jfr/support/jfrIntrinsics.cpp b/src/hotspot/share/jfr/support/jfrIntrinsics.cpp index 63d0e686021f2..306e223ee2ebd 100644 --- a/src/hotspot/share/jfr/support/jfrIntrinsics.cpp +++ b/src/hotspot/share/jfr/support/jfrIntrinsics.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/jni/jfrJavaSupport.hpp" #include "jfr/recorder/checkpoint/types/traceid/jfrTraceIdEpoch.hpp" #include "jfr/recorder/checkpoint/types/traceid/jfrTraceIdLoadBarrier.inline.hpp" diff --git a/src/hotspot/share/jfr/support/jfrIntrinsics.hpp b/src/hotspot/share/jfr/support/jfrIntrinsics.hpp index 77affc69926f0..31a81e7d7b544 100644 --- a/src/hotspot/share/jfr/support/jfrIntrinsics.hpp +++ b/src/hotspot/share/jfr/support/jfrIntrinsics.hpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,7 +49,7 @@ class JfrIntrinsicSupport : AllStatic { #define JFR_TEMPLATES(template) \ template(jdk_jfr_internal_management_HiddenWait, "jdk/jfr/internal/management/HiddenWait") \ template(jdk_jfr_internal_JVM, "jdk/jfr/internal/JVM") \ - template(jdk_jfr_internal_event_EventWriterFactory, "jdk/jfr/internal/event/EventWriterFactory") \ + template(jdk_jfr_internal_event_EventWriter, "jdk/jfr/internal/event/EventWriter") \ template(jdk_jfr_internal_event_EventConfiguration_signature, "Ljdk/jfr/internal/event/EventConfiguration;") \ template(getEventWriter_signature, "()Ljdk/jfr/internal/event/EventWriter;") \ template(eventConfiguration_name, "eventConfiguration") \ diff --git a/src/hotspot/share/jfr/support/jfrJdkJfrEvent.cpp b/src/hotspot/share/jfr/support/jfrJdkJfrEvent.cpp index b8dc7a6b3b5d9..ff1f4cdd39845 100644 --- a/src/hotspot/share/jfr/support/jfrJdkJfrEvent.cpp +++ b/src/hotspot/share/jfr/support/jfrJdkJfrEvent.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/javaClasses.inline.hpp" #include "classfile/symbolTable.hpp" #include "classfile/systemDictionary.hpp" diff --git a/src/hotspot/share/jfr/support/jfrKlassUnloading.cpp b/src/hotspot/share/jfr/support/jfrKlassUnloading.cpp index e0f26a800ba52..31eb83e16674a 100644 --- a/src/hotspot/share/jfr/support/jfrKlassUnloading.cpp +++ b/src/hotspot/share/jfr/support/jfrKlassUnloading.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/jfrEvents.hpp" #include "jfr/periodic/jfrFinalizerStatisticsEvent.hpp" #include "jfr/recorder/checkpoint/types/traceid/jfrTraceId.inline.hpp" diff --git a/src/hotspot/share/jfr/support/jfrMethodData.cpp b/src/hotspot/share/jfr/support/jfrMethodData.cpp index af5d19c262ccb..633019106547b 100644 --- a/src/hotspot/share/jfr/support/jfrMethodData.cpp +++ b/src/hotspot/share/jfr/support/jfrMethodData.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/support/jfrMethodData.hpp" #include "memory/resourceArea.hpp" #include "oops/method.inline.hpp" diff --git a/src/hotspot/share/jfr/support/jfrMethodLookup.cpp b/src/hotspot/share/jfr/support/jfrMethodLookup.cpp index f83fc95d2700b..69cf6ebe0f645 100644 --- a/src/hotspot/share/jfr/support/jfrMethodLookup.cpp +++ b/src/hotspot/share/jfr/support/jfrMethodLookup.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/recorder/checkpoint/types/traceid/jfrTraceIdBits.inline.hpp" #include "jfr/recorder/checkpoint/types/traceid/jfrTraceIdEpoch.hpp" #include "jfr/recorder/checkpoint/types/traceid/jfrTraceIdMacros.hpp" diff --git a/src/hotspot/share/jfr/support/jfrNativeLibraryLoadEvent.cpp b/src/hotspot/share/jfr/support/jfrNativeLibraryLoadEvent.cpp index 5e80e31a9987a..2958c1130747d 100644 --- a/src/hotspot/share/jfr/support/jfrNativeLibraryLoadEvent.cpp +++ b/src/hotspot/share/jfr/support/jfrNativeLibraryLoadEvent.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/jfrEvents.hpp" #include "jfr/support/jfrNativeLibraryLoadEvent.hpp" #include "jfr/utilities/jfrTime.hpp" diff --git a/src/hotspot/share/jfr/support/jfrObjectAllocationSample.cpp b/src/hotspot/share/jfr/support/jfrObjectAllocationSample.cpp index 55ea5225e2450..6a99271a80e14 100644 --- a/src/hotspot/share/jfr/support/jfrObjectAllocationSample.cpp +++ b/src/hotspot/share/jfr/support/jfrObjectAllocationSample.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/threadLocalAllocBuffer.inline.hpp" #include "gc/shared/tlab_globals.hpp" #include "jfr/jfrEvents.hpp" diff --git a/src/hotspot/share/jfr/support/jfrResolution.cpp b/src/hotspot/share/jfr/support/jfrResolution.cpp index 486067c485a72..4027de2fb3d7e 100644 --- a/src/hotspot/share/jfr/support/jfrResolution.cpp +++ b/src/hotspot/share/jfr/support/jfrResolution.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciKlass.hpp" #include "ci/ciMethod.hpp" #include "classfile/vmSymbols.hpp" @@ -182,7 +181,7 @@ static inline const Method* ljf_sender_method(JavaThread* jt) { return ljf.method(); } -static const char* const link_error_msg = "illegal access linking method 'jdk.jfr.internal.event.EventWriterFactory.getEventWriter(long)'"; +static const char* const link_error_msg = "illegal access linking method 'jdk.jfr.internal.event.EventWriter.getEventWriter()'"; void JfrResolution::on_runtime_resolution(const CallInfo & info, TRAPS) { assert(info.selected_method() != nullptr, "invariant"); @@ -199,12 +198,12 @@ void JfrResolution::on_runtime_resolution(const CallInfo & info, TRAPS) { if (method->name() != event_writer_method_name) { return; } - static const Symbol* const event_writer_factory_klass_name = vmSymbols::jdk_jfr_internal_event_EventWriterFactory(); - assert(event_writer_factory_klass_name != nullptr, "invariant"); - if (info.resolved_klass()->name() != event_writer_factory_klass_name) { + static const Symbol* const event_writer_klass_name = vmSymbols::jdk_jfr_internal_event_EventWriter(); + assert(event_writer_klass_name != nullptr, "invariant"); + if (info.resolved_klass()->name() != event_writer_klass_name) { return; } - // Attempting to link against jdk.jfr.internal.event.EventWriterFactory.getEventWriter(). + // Attempting to link against jdk.jfr.internal.event.EventWriter.getEventWriter(). // The sender, i.e. the method attempting to link, is in the ljf (if one exists). const Method* const sender = ljf_sender_method(THREAD); if (sender == nullptr) { @@ -228,9 +227,9 @@ void JfrResolution::on_runtime_resolution(const CallInfo & info, TRAPS) { } static inline bool is_compiler_linking_event_writer(const Symbol* holder, const Symbol* name) { - static const Symbol* const event_writer_factory_klass_name = vmSymbols::jdk_jfr_internal_event_EventWriterFactory(); - assert(event_writer_factory_klass_name != nullptr, "invariant"); - if (holder != event_writer_factory_klass_name) { + static const Symbol* const event_writer_klass_name = vmSymbols::jdk_jfr_internal_event_EventWriter(); + assert(event_writer_klass_name != nullptr, "invariant"); + if (holder != event_writer_klass_name) { return false; } static const Symbol* const event_writer_method_name = vmSymbols::getEventWriter_name(); diff --git a/src/hotspot/share/jfr/support/jfrStackTraceMark.cpp b/src/hotspot/share/jfr/support/jfrStackTraceMark.cpp index d1fa55e6dde6f..ef7cb88514789 100644 --- a/src/hotspot/share/jfr/support/jfrStackTraceMark.cpp +++ b/src/hotspot/share/jfr/support/jfrStackTraceMark.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/recorder/jfrEventSetting.inline.hpp" #include "jfr/recorder/stacktrace/jfrStackTraceRepository.hpp" #include "jfr/support/jfrStackTraceMark.hpp" diff --git a/src/hotspot/share/jfr/support/jfrSymbolTable.cpp b/src/hotspot/share/jfr/support/jfrSymbolTable.cpp index e3c34e46a1a4a..3fc639ffb5cf3 100644 --- a/src/hotspot/share/jfr/support/jfrSymbolTable.cpp +++ b/src/hotspot/share/jfr/support/jfrSymbolTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderData.hpp" #include "classfile/javaClasses.hpp" #include "jfr/support/jfrSymbolTable.hpp" diff --git a/src/hotspot/share/jfr/support/jfrThreadLocal.cpp b/src/hotspot/share/jfr/support/jfrThreadLocal.cpp index 9fc6be3d4c844..e1f72606c50a2 100644 --- a/src/hotspot/share/jfr/support/jfrThreadLocal.cpp +++ b/src/hotspot/share/jfr/support/jfrThreadLocal.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/jfrEvents.hpp" #include "jfr/jni/jfrJavaSupport.hpp" #include "jfr/leakprofiler/checkpoint/objectSampleCheckpoint.hpp" diff --git a/src/hotspot/share/jfr/utilities/jfrAllocation.cpp b/src/hotspot/share/jfr/utilities/jfrAllocation.cpp index c94765bbc8fe7..f97838c786957 100644 --- a/src/hotspot/share/jfr/utilities/jfrAllocation.cpp +++ b/src/hotspot/share/jfr/utilities/jfrAllocation.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/recorder/jfrRecorder.hpp" #include "jfr/utilities/jfrAllocation.hpp" #include "logging/log.hpp" @@ -53,7 +52,7 @@ static void add(size_t alloc_size) { if (!JfrRecorder::is_created()) { const jlong total_allocated = atomic_add_jlong((jlong)alloc_size, &_allocated_bytes); const jlong current_live_set = atomic_add_jlong((jlong)alloc_size, &_live_set_bytes); - log_trace(jfr, system)("Allocation: [" SIZE_FORMAT "] bytes", alloc_size); + log_trace(jfr, system)("Allocation: [%zu] bytes", alloc_size); log_trace(jfr, system)("Total alloc [" JLONG_FORMAT "] bytes", total_allocated); log_trace(jfr, system)("Liveset: [" JLONG_FORMAT "] bytes", current_live_set); } @@ -63,7 +62,7 @@ static void subtract(size_t dealloc_size) { if (!JfrRecorder::is_created()) { const jlong total_deallocated = atomic_add_jlong((jlong)dealloc_size, &_deallocated_bytes); const jlong current_live_set = atomic_add_jlong(((jlong)dealloc_size * -1), &_live_set_bytes); - log_trace(jfr, system)("Deallocation: [" SIZE_FORMAT "] bytes", dealloc_size); + log_trace(jfr, system)("Deallocation: [%zu] bytes", dealloc_size); log_trace(jfr, system)("Total dealloc [" JLONG_FORMAT "] bytes", total_deallocated); log_trace(jfr, system)("Liveset: [" JLONG_FORMAT "] bytes", current_live_set); } @@ -77,7 +76,7 @@ static void hook_memory_deallocation(size_t dealloc_size) { static void hook_memory_allocation(const char* allocation, size_t alloc_size) { if (nullptr == allocation) { if (!JfrRecorder::is_created()) { - log_warning(jfr, system)("Memory allocation failed for size [" SIZE_FORMAT "] bytes", alloc_size); + log_warning(jfr, system)("Memory allocation failed for size [%zu] bytes", alloc_size); return; } else { // after critical startup, fail as by default diff --git a/src/hotspot/share/jfr/utilities/jfrBlob.cpp b/src/hotspot/share/jfr/utilities/jfrBlob.cpp index f326ff69d4795..108c473bf363b 100644 --- a/src/hotspot/share/jfr/utilities/jfrBlob.cpp +++ b/src/hotspot/share/jfr/utilities/jfrBlob.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/utilities/jfrBlob.hpp" JfrBlob::JfrBlob(const u1* checkpoint, size_t size) : diff --git a/src/hotspot/share/jfr/utilities/jfrJavaLog.cpp b/src/hotspot/share/jfr/utilities/jfrJavaLog.cpp index 44b97488f5cb8..2f46853b042ee 100644 --- a/src/hotspot/share/jfr/utilities/jfrJavaLog.cpp +++ b/src/hotspot/share/jfr/utilities/jfrJavaLog.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/jni/jfrJavaSupport.hpp" #include "jfr/utilities/jfrJavaLog.hpp" #include "jfr/utilities/jfrLogTagSets.hpp" diff --git a/src/hotspot/share/jfr/utilities/jfrThreadIterator.cpp b/src/hotspot/share/jfr/utilities/jfrThreadIterator.cpp index 30de22c5f58a9..2425f7c43ecde 100644 --- a/src/hotspot/share/jfr/utilities/jfrThreadIterator.cpp +++ b/src/hotspot/share/jfr/utilities/jfrThreadIterator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/support/jfrThreadLocal.hpp" #include "jfr/utilities/jfrThreadIterator.hpp" #include "runtime/javaThread.inline.hpp" diff --git a/src/hotspot/share/jfr/utilities/jfrTime.cpp b/src/hotspot/share/jfr/utilities/jfrTime.cpp index 363550a78e4c6..75c3bc5cd28ba 100644 --- a/src/hotspot/share/jfr/utilities/jfrTime.cpp +++ b/src/hotspot/share/jfr/utilities/jfrTime.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/utilities/jfrTime.hpp" #include "runtime/os.inline.hpp" #if defined(X86) && !defined(ZERO) diff --git a/src/hotspot/share/jfr/utilities/jfrTimeConverter.cpp b/src/hotspot/share/jfr/utilities/jfrTimeConverter.cpp index 4a6ab84400a6b..2ea0fd383d6e7 100644 --- a/src/hotspot/share/jfr/utilities/jfrTimeConverter.cpp +++ b/src/hotspot/share/jfr/utilities/jfrTimeConverter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jfr/utilities/jfrTimeConverter.hpp" #include "jfr/utilities/jfrTime.hpp" #include "runtime/os.inline.hpp" diff --git a/src/hotspot/share/jfr/writers/jfrJavaEventWriter.cpp b/src/hotspot/share/jfr/writers/jfrJavaEventWriter.cpp index d9610bcc97005..7f2d931623b5b 100644 --- a/src/hotspot/share/jfr/writers/jfrJavaEventWriter.cpp +++ b/src/hotspot/share/jfr/writers/jfrJavaEventWriter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * */ -#include "precompiled.hpp" -#include "jni.h" #include "classfile/symbolTable.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" @@ -32,6 +30,7 @@ #include "jfr/support/jfrThreadLocal.hpp" #include "jfr/utilities/jfrTypes.hpp" #include "jfr/writers/jfrJavaEventWriter.hpp" +#include "jni.h" #include "memory/iterator.hpp" #include "oops/instanceKlass.hpp" #include "oops/oop.inline.hpp" diff --git a/src/hotspot/share/jfr/writers/jfrJavaEventWriter.hpp b/src/hotspot/share/jfr/writers/jfrJavaEventWriter.hpp index b93d6ad8cacc0..92a9a7a693e50 100644 --- a/src/hotspot/share/jfr/writers/jfrJavaEventWriter.hpp +++ b/src/hotspot/share/jfr/writers/jfrJavaEventWriter.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * 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 @@ #ifndef SHARE_JFR_WRITERS_JFRJAVAEVENTWRITER_HPP #define SHARE_JFR_WRITERS_JFRJAVAEVENTWRITER_HPP -#include "jni.h" #include "jfr/utilities/jfrTypes.hpp" +#include "jni.h" #include "memory/allStatic.hpp" #include "utilities/exceptions.hpp" diff --git a/src/hotspot/share/jfr/writers/jfrWriterHost.hpp b/src/hotspot/share/jfr/writers/jfrWriterHost.hpp index 2d28e84fd298e..2d07c8239ceaf 100644 --- a/src/hotspot/share/jfr/writers/jfrWriterHost.hpp +++ b/src/hotspot/share/jfr/writers/jfrWriterHost.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * 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,9 +25,9 @@ #ifndef SHARE_JFR_WRITERS_JFRWRITERHOST_HPP #define SHARE_JFR_WRITERS_JFRWRITERHOST_HPP +#include "jfr/utilities/jfrTime.hpp" #include "jni.h" #include "utilities/globalDefinitions.hpp" -#include "jfr/utilities/jfrTime.hpp" class ClassLoaderData; class Klass; diff --git a/src/hotspot/share/jvmci/jvmci.cpp b/src/hotspot/share/jvmci/jvmci.cpp index 9442c241e1637..609617b4a2073 100644 --- a/src/hotspot/share/jvmci/jvmci.cpp +++ b/src/hotspot/share/jvmci/jvmci.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "classfile/systemDictionary.hpp" #include "compiler/abstractCompiler.hpp" #include "compiler/compileTask.hpp" @@ -380,7 +379,7 @@ void JVMCI::fatal_log(const char* buf, size_t count) { _fatal_log_fd = log_fd; } else if (_first_error_tid != current_thread_id) { // This is not the first thread reporting a libjvmci error - tty->print_cr("[thread " INTX_FORMAT " also had an error in the JVMCI native library]", + tty->print_cr("[thread %zd also had an error in the JVMCI native library]", current_thread_id); // Fatal error reporting is single threaded so just block this thread. diff --git a/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp b/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp index dc3eecd57917e..5127e29712e27 100644 --- a/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp +++ b/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "classfile/javaClasses.inline.hpp" #include "code/compiledIC.hpp" #include "compiler/compileBroker.hpp" diff --git a/src/hotspot/share/jvmci/jvmciCompiler.cpp b/src/hotspot/share/jvmci/jvmciCompiler.cpp index 04cdb4b4b4fda..f3f68a00b4f40 100644 --- a/src/hotspot/share/jvmci/jvmciCompiler.cpp +++ b/src/hotspot/share/jvmci/jvmciCompiler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "classfile/vmClasses.hpp" #include "compiler/compileBroker.hpp" #include "compiler/compilerDefinitions.inline.hpp" diff --git a/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp b/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp index 9052e6228945b..9bbf4fccae16c 100644 --- a/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp +++ b/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "classfile/classLoaderData.inline.hpp" #include "classfile/javaClasses.inline.hpp" #include "classfile/stringTable.hpp" @@ -1000,7 +999,7 @@ C2V_VMENTRY_NULL(jobject, resolveFieldInPool, (JNIEnv* env, jobject, ARGUMENT_PA if (info.is_null() || JVMCIENV->get_length(info) != 4) { JVMCI_ERROR_NULL("info must not be null and have a length of 4"); } - JVMCIENV->put_int_at(info, 0, fd.access_flags().as_int()); + JVMCIENV->put_int_at(info, 0, fd.access_flags().as_field_flags()); JVMCIENV->put_int_at(info, 1, fd.offset()); JVMCIENV->put_int_at(info, 2, fd.index()); JVMCIENV->put_int_at(info, 3, fd.field_flags().as_uint()); diff --git a/src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp b/src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp index faa23a8417866..a2f6f7f6d5213 100644 --- a/src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp +++ b/src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -// no precompiled headers #ifdef COMPILER1 #include "c1/c1_Compiler.hpp" #endif diff --git a/src/hotspot/share/jvmci/jvmciEnv.cpp b/src/hotspot/share/jvmci/jvmciEnv.cpp index 712745e2a021c..78f5bca476957 100644 --- a/src/hotspot/share/jvmci/jvmciEnv.cpp +++ b/src/hotspot/share/jvmci/jvmciEnv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/stringTable.hpp" #include "classfile/symbolTable.hpp" #include "classfile/systemDictionary.hpp" @@ -1592,7 +1591,7 @@ JVMCIObject JVMCIEnv::new_FieldInfo(FieldInfo* fieldinfo, JVMCI_TRAPS) { HotSpotJVMCI::FieldInfo::set_nameIndex(JVMCIENV, obj_h(), (jint)fieldinfo->name_index()); HotSpotJVMCI::FieldInfo::set_signatureIndex(JVMCIENV, obj_h(), (jint)fieldinfo->signature_index()); HotSpotJVMCI::FieldInfo::set_offset(JVMCIENV, obj_h(), (jint)fieldinfo->offset()); - HotSpotJVMCI::FieldInfo::set_classfileFlags(JVMCIENV, obj_h(), (jint)fieldinfo->access_flags().as_int()); + HotSpotJVMCI::FieldInfo::set_classfileFlags(JVMCIENV, obj_h(), (jint)fieldinfo->access_flags().as_field_flags()); HotSpotJVMCI::FieldInfo::set_internalFlags(JVMCIENV, obj_h(), (jint)fieldinfo->field_flags().as_uint()); HotSpotJVMCI::FieldInfo::set_initializerIndex(JVMCIENV, obj_h(), (jint)fieldinfo->initializer_index()); return wrap(obj_h()); @@ -1603,7 +1602,7 @@ JVMCIObject JVMCIEnv::new_FieldInfo(FieldInfo* fieldinfo, JVMCI_TRAPS) { (jint)fieldinfo->name_index(), (jint)fieldinfo->signature_index(), (jint)fieldinfo->offset(), - (jint)fieldinfo->access_flags().as_int(), + (jint)fieldinfo->access_flags().as_field_flags(), (jint)fieldinfo->field_flags().as_uint(), (jint)fieldinfo->initializer_index()); diff --git a/src/hotspot/share/jvmci/jvmciJavaClasses.cpp b/src/hotspot/share/jvmci/jvmciJavaClasses.cpp index aa32e0e3eca02..b8d3d4e3b7ebf 100644 --- a/src/hotspot/share/jvmci/jvmciJavaClasses.cpp +++ b/src/hotspot/share/jvmci/jvmciJavaClasses.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "classfile/symbolTable.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmClasses.hpp" diff --git a/src/hotspot/share/jvmci/jvmciRuntime.cpp b/src/hotspot/share/jvmci/jvmciRuntime.cpp index ac972e97b1b6f..9a2a1de23a536 100644 --- a/src/hotspot/share/jvmci/jvmciRuntime.cpp +++ b/src/hotspot/share/jvmci/jvmciRuntime.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "classfile/javaClasses.inline.hpp" #include "classfile/symbolTable.hpp" #include "classfile/systemDictionary.hpp" @@ -1008,7 +1007,7 @@ static void _fatal() { } } intx current_thread_id = os::current_thread_id(); - fatal("thread " INTX_FORMAT ": Fatal error in JVMCI shared library", current_thread_id); + fatal("thread %zd: Fatal error in JVMCI shared library", current_thread_id); } JVMCIRuntime::JVMCIRuntime(JVMCIRuntime* next, int id, bool for_compile_broker) : diff --git a/src/hotspot/share/jvmci/jvmci_globals.cpp b/src/hotspot/share/jvmci/jvmci_globals.cpp index 2ae38044df0ff..dfc7e6b597046 100644 --- a/src/hotspot/share/jvmci/jvmci_globals.cpp +++ b/src/hotspot/share/jvmci/jvmci_globals.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "compiler/compilerDefinitions.hpp" #include "gc/shared/gcConfig.hpp" #include "jvm.h" diff --git a/src/hotspot/share/jvmci/metadataHandles.cpp b/src/hotspot/share/jvmci/metadataHandles.cpp index 8bfea49fd0d86..3df7ebe573ae9 100644 --- a/src/hotspot/share/jvmci/metadataHandles.cpp +++ b/src/hotspot/share/jvmci/metadataHandles.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "classfile/classLoaderData.hpp" #include "jvmci/metadataHandles.hpp" #include "runtime/atomic.hpp" diff --git a/src/hotspot/share/jvmci/vmStructs_jvmci.cpp b/src/hotspot/share/jvmci/vmStructs_jvmci.cpp index ba47e5599578f..96d369678f792 100644 --- a/src/hotspot/share/jvmci/vmStructs_jvmci.cpp +++ b/src/hotspot/share/jvmci/vmStructs_jvmci.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "code/codeCache.hpp" #include "code/compiledIC.hpp" #include "compiler/compileBroker.hpp" @@ -273,7 +272,7 @@ nonstatic_field(Klass, _name, Symbol*) \ volatile_nonstatic_field(Klass, _next_sibling, Klass*) \ nonstatic_field(Klass, _java_mirror, OopHandle) \ - nonstatic_field(Klass, _modifier_flags, jint) \ + nonstatic_field(Klass, _modifier_flags, u2) \ nonstatic_field(Klass, _access_flags, AccessFlags) \ nonstatic_field(Klass, _class_loader_data, ClassLoaderData*) \ nonstatic_field(Klass, _secondary_supers_bitmap, uintx) \ @@ -488,7 +487,6 @@ declare_constant(InvocationEntryBci) \ declare_constant(JVMCINMethodData::SPECULATION_LENGTH_BITS) \ \ - declare_constant(JVM_ACC_WRITTEN_FLAGS) \ declare_constant(FieldInfo::FieldFlags::_ff_injected) \ declare_constant(FieldInfo::FieldFlags::_ff_stable) \ declare_preprocessor_constant("JVM_ACC_VARARGS", JVM_ACC_VARARGS) \ diff --git a/src/hotspot/share/libadt/dict.cpp b/src/hotspot/share/libadt/dict.cpp index 0343125018e6c..e31df74807380 100644 --- a/src/hotspot/share/libadt/dict.cpp +++ b/src/hotspot/share/libadt/dict.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "libadt/dict.hpp" #include "utilities/powerOfTwo.hpp" diff --git a/src/hotspot/share/libadt/vectset.cpp b/src/hotspot/share/libadt/vectset.cpp index feb3ab10c65f2..a4224b0adb152 100644 --- a/src/hotspot/share/libadt/vectset.cpp +++ b/src/hotspot/share/libadt/vectset.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "libadt/vectset.hpp" #include "memory/arena.hpp" #include "memory/resourceArea.hpp" diff --git a/src/hotspot/share/logging/logAsyncWriter.cpp b/src/hotspot/share/logging/logAsyncWriter.cpp index 3d987d04b8d42..8360a4af91dbd 100644 --- a/src/hotspot/share/logging/logAsyncWriter.cpp +++ b/src/hotspot/share/logging/logAsyncWriter.cpp @@ -1,6 +1,6 @@ /* * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * questions. * */ -#include "precompiled.hpp" #include "logging/logAsyncWriter.hpp" #include "logging/logConfiguration.hpp" #include "logging/logFileOutput.hpp" @@ -108,7 +107,7 @@ AsyncLogWriter::AsyncLogWriter() size_t size = AsyncLogBufferSize / 2; _buffer = new Buffer(size); _buffer_staging = new Buffer(size); - log_info(logging)("AsyncLogBuffer estimates memory use: " SIZE_FORMAT " bytes", size * 2); + log_info(logging)("AsyncLogBuffer estimates memory use: %zu bytes", size * 2); if (os::create_thread(this, os::asynclog_thread)) { _initialized = true; } else { diff --git a/src/hotspot/share/logging/logAsyncWriter.hpp b/src/hotspot/share/logging/logAsyncWriter.hpp index 97bae2a581745..4d18e61211063 100644 --- a/src/hotspot/share/logging/logAsyncWriter.hpp +++ b/src/hotspot/share/logging/logAsyncWriter.hpp @@ -1,6 +1,6 @@ /* * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -176,7 +176,7 @@ class AsyncLogWriter : public NonJavaThread { void run() override; void pre_run() override { NonJavaThread::pre_run(); - log_debug(logging, thread)("starting AsyncLog Thread tid = " INTX_FORMAT, os::current_thread_id()); + log_debug(logging, thread)("starting AsyncLog Thread tid = %zd", os::current_thread_id()); } const char* type_name() const override { return "AsyncLogWriter"; } void print_on(outputStream* st) const override { diff --git a/src/hotspot/share/logging/logConfiguration.cpp b/src/hotspot/share/logging/logConfiguration.cpp index dfddfff2f05c0..5f8a045c356fa 100644 --- a/src/hotspot/share/logging/logConfiguration.cpp +++ b/src/hotspot/share/logging/logConfiguration.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. * */ -#include "precompiled.hpp" #include "jvm.h" #include "logging/log.hpp" #include "logging/logAsyncWriter.hpp" @@ -214,8 +213,8 @@ size_t LogConfiguration::add_output(LogOutput* output) { void LogConfiguration::delete_output(size_t idx) { assert(idx > 1 && idx < _n_outputs, - "idx must be in range 1 < idx < _n_outputs, but idx = " SIZE_FORMAT - " and _n_outputs = " SIZE_FORMAT, idx, _n_outputs); + "idx must be in range 1 < idx < _n_outputs, but idx = %zu" + " and _n_outputs = %zu", idx, _n_outputs); LogOutput* output = _outputs[idx]; // Swap places with the last output and shrink the array _outputs[idx] = _outputs[--_n_outputs]; @@ -240,7 +239,7 @@ void LogConfiguration::delete_output(size_t idx) { // void LogConfiguration::configure_output(size_t idx, const LogSelectionList& selections, const LogDecorators& decorators) { assert(ConfigurationLock::current_thread_has_lock(), "Must hold configuration lock to call this function."); - assert(idx < _n_outputs, "Invalid index, idx = " SIZE_FORMAT " and _n_outputs = " SIZE_FORMAT, idx, _n_outputs); + assert(idx < _n_outputs, "Invalid index, idx = %zu and _n_outputs = %zu", idx, _n_outputs); LogOutput* output = _outputs[idx]; output->_reconfigured = true; @@ -351,7 +350,7 @@ void LogConfiguration::configure_stdout(LogLevelType level, int exact_match, ... } } assert(i < LogTag::MaxTags || static_cast(va_arg(ap, int)) == LogTag::__NO_TAG, - "Too many tags specified! Can only have up to " SIZE_FORMAT " tags in a tag set.", LogTag::MaxTags); + "Too many tags specified! Can only have up to %zu tags in a tag set.", LogTag::MaxTags); va_end(ap); LogSelection selection(tags, !exact_match, level); @@ -500,7 +499,7 @@ bool LogConfiguration::parse_log_arguments(const char* outputstr, size_t idx; bool added = false; if (outputstr[0] == '#') { // Output specified using index - int ret = sscanf(outputstr + 1, SIZE_FORMAT, &idx); + int ret = sscanf(outputstr + 1, "%zu", &idx); if (ret != 1 || idx >= _n_outputs) { errstream->print_cr("Invalid output index '%s'", outputstr); return false; @@ -566,7 +565,7 @@ void LogConfiguration::describe_available(outputStream* out) { void LogConfiguration::describe_current_configuration(outputStream* out) { out->print_cr("Log output configuration:"); for (size_t i = 0; i < _n_outputs; i++) { - out->print(" #" SIZE_FORMAT ": ", i); + out->print(" #%zu: ", i); _outputs[i]->describe(out); if (_outputs[i]->is_reconfigured()) { out->print(" (reconfigured)"); diff --git a/src/hotspot/share/logging/logDecorations.cpp b/src/hotspot/share/logging/logDecorations.cpp index 058bd7ab2aad0..e08c6c9cb137d 100644 --- a/src/hotspot/share/logging/logDecorations.cpp +++ b/src/hotspot/share/logging/logDecorations.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. * */ -#include "precompiled.hpp" #include "jvm.h" #include "logging/logConfiguration.hpp" #include "logging/logDecorations.hpp" @@ -127,7 +126,7 @@ void LogDecorations::print_pid_decoration(outputStream* st) const { } void LogDecorations::print_tid_decoration(outputStream* st) const { - st->print(INTX_FORMAT, _tid); + st->print("%zd", _tid); } void LogDecorations::print_level_decoration(outputStream* st) const { diff --git a/src/hotspot/share/logging/logDecorators.cpp b/src/hotspot/share/logging/logDecorators.cpp index 6c06bd4571627..0b1470f1a2ed3 100644 --- a/src/hotspot/share/logging/logDecorators.cpp +++ b/src/hotspot/share/logging/logDecorators.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. * */ -#include "precompiled.hpp" #include "logging/logDecorators.hpp" #include "runtime/os.hpp" @@ -100,7 +99,9 @@ bool LogDecorators::parse(const char* decorator_args, outputStream* errstream) { break; } tmp_decorators |= mask(d); - token = comma_pos + 1; + if (comma_pos != nullptr) { + token = comma_pos + 1; + } } while (comma_pos != nullptr); os::free(args_copy); if (result) { diff --git a/src/hotspot/share/logging/logDiagnosticCommand.cpp b/src/hotspot/share/logging/logDiagnosticCommand.cpp index dfd45d611884a..adf596afc9405 100644 --- a/src/hotspot/share/logging/logDiagnosticCommand.cpp +++ b/src/hotspot/share/logging/logDiagnosticCommand.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. * */ -#include "precompiled.hpp" #include "logging/logConfiguration.hpp" #include "logging/logDiagnosticCommand.hpp" #include "memory/resourceArea.hpp" diff --git a/src/hotspot/share/logging/logFileOutput.cpp b/src/hotspot/share/logging/logFileOutput.cpp index 783be86586147..568708a59611e 100644 --- a/src/hotspot/share/logging/logFileOutput.cpp +++ b/src/hotspot/share/logging/logFileOutput.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. * */ -#include "precompiled.hpp" #include "jvm.h" #include "logging/log.hpp" #include "logging/logAsyncWriter.hpp" @@ -185,7 +184,7 @@ bool LogFileOutput::set_option(const char* key, const char* value, outputStream* success = Arguments::atojulong(value, &longval); if (!success || (longval > SIZE_MAX)) { errstream->print_cr("Invalid option: %s must be in range [0, " - SIZE_FORMAT "]", FileSizeOptionKey, (size_t)SIZE_MAX); + "%zu]", FileSizeOptionKey, (size_t)SIZE_MAX); success = false; } else { _rotate_size = static_cast(longval); @@ -215,7 +214,7 @@ bool LogFileOutput::initialize(const char* options, outputStream* errstream) { } log_trace(logging)("Initializing logging to file '%s' (filecount: %u" - ", filesize: " SIZE_FORMAT " KiB).", + ", filesize: %zu KiB).", _file_name, _file_count, _rotate_size / K); if (_file_count > 0 && file_exist) { @@ -461,7 +460,7 @@ char* LogFileOutput::make_file_name(const char* file_name, void LogFileOutput::describe(outputStream *out) { LogFileStreamOutput::describe(out); - out->print(",filecount=%u,filesize=" SIZE_FORMAT "%s,async=%s", _file_count, + out->print(",filecount=%u,filesize=%zu%s,async=%s", _file_count, byte_size_in_proper_unit(_rotate_size), proper_unit_for_byte_size(_rotate_size), LogConfiguration::is_async_mode() ? "true" : "false"); diff --git a/src/hotspot/share/logging/logFileStreamOutput.cpp b/src/hotspot/share/logging/logFileStreamOutput.cpp index dc34a9b8b1449..f8bbb28472ceb 100644 --- a/src/hotspot/share/logging/logFileStreamOutput.cpp +++ b/src/hotspot/share/logging/logFileStreamOutput.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. * */ -#include "precompiled.hpp" #include "jvm.h" #include "logging/logAsyncWriter.hpp" #include "logging/logDecorations.hpp" diff --git a/src/hotspot/share/logging/logLevel.cpp b/src/hotspot/share/logging/logLevel.cpp index 2b9ef795163c6..9efe07b05e9e6 100644 --- a/src/hotspot/share/logging/logLevel.cpp +++ b/src/hotspot/share/logging/logLevel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. * */ -#include "precompiled.hpp" #include "logging/logLevel.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/stringUtils.hpp" diff --git a/src/hotspot/share/logging/logMessageBuffer.cpp b/src/hotspot/share/logging/logMessageBuffer.cpp index 268cc191418cb..8f308b1f01506 100644 --- a/src/hotspot/share/logging/logMessageBuffer.cpp +++ b/src/hotspot/share/logging/logMessageBuffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. * */ -#include "precompiled.hpp" #include "logging/logMessageBuffer.hpp" #include "memory/allocation.inline.hpp" #include "runtime/javaThread.hpp" diff --git a/src/hotspot/share/logging/logOutput.cpp b/src/hotspot/share/logging/logOutput.cpp index 17d0e8b555d60..e3c68b49b1305 100644 --- a/src/hotspot/share/logging/logOutput.cpp +++ b/src/hotspot/share/logging/logOutput.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. * */ -#include "precompiled.hpp" #include "jvm.h" #include "logging/log.hpp" #include "logging/logFileStreamOutput.hpp" @@ -354,7 +353,9 @@ bool LogOutput::parse_options(const char* options, outputStream* errstream) { } break; } - pos = comma_pos + 1; + if (comma_pos != nullptr) { + pos = comma_pos + 1; + } } while (comma_pos != nullptr); os::free(opts); diff --git a/src/hotspot/share/logging/logOutputList.cpp b/src/hotspot/share/logging/logOutputList.cpp index 6367577b1b001..fab06860a4807 100644 --- a/src/hotspot/share/logging/logOutputList.cpp +++ b/src/hotspot/share/logging/logOutputList.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. * */ -#include "precompiled.hpp" #include "logging/logLevel.hpp" #include "logging/logOutputList.hpp" #include "memory/allocation.inline.hpp" diff --git a/src/hotspot/share/logging/logSelection.cpp b/src/hotspot/share/logging/logSelection.cpp index 99ecc9f87f272..476fdebc9c540 100644 --- a/src/hotspot/share/logging/logSelection.cpp +++ b/src/hotspot/share/logging/logSelection.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. * */ -#include "precompiled.hpp" #include "jvm_io.h" #include "logging/log.hpp" #include "logging/logSelection.hpp" @@ -145,13 +144,15 @@ static LogSelection parse_internal(char *str, outputStream* errstream) { } if (ntags == LogTag::MaxTags) { if (errstream != nullptr) { - errstream->print_cr("Too many tags in log selection '%s' (can only have up to " SIZE_FORMAT " tags).", + errstream->print_cr("Too many tags in log selection '%s' (can only have up to %zu tags).", str, LogTag::MaxTags); } return LogSelection::Invalid; } tags[ntags++] = tag; - cur_tag = plus_pos + 1; + if (plus_pos != nullptr) { + cur_tag = plus_pos + 1; + } } while (plus_pos != nullptr); for (size_t i = 0; i < ntags; i++) { diff --git a/src/hotspot/share/logging/logSelectionList.cpp b/src/hotspot/share/logging/logSelectionList.cpp index ac63f20512c2a..f8c2d9e7cfb69 100644 --- a/src/hotspot/share/logging/logSelectionList.cpp +++ b/src/hotspot/share/logging/logSelectionList.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "logging/logSelectionList.hpp" #include "logging/logTagSet.hpp" #include "runtime/os.hpp" @@ -69,10 +68,10 @@ bool LogSelectionList::parse(const char* str, outputStream* errstream) { } char* copy = os::strdup_check_oom(str, mtLogging); // Split string on commas - for (char *comma_pos = copy, *cur = copy; success && comma_pos != nullptr; cur = comma_pos + 1) { + for (char *comma_pos = copy, *cur = copy; success; cur = comma_pos + 1) { if (_nselections == MaxSelections) { if (errstream != nullptr) { - errstream->print_cr("Can not have more than " SIZE_FORMAT " log selections in a single configuration.", + errstream->print_cr("Can not have more than %zu log selections in a single configuration.", MaxSelections); } success = false; @@ -90,6 +89,10 @@ bool LogSelectionList::parse(const char* str, outputStream* errstream) { break; } _selections[_nselections++] = selection; + + if (comma_pos == nullptr) { + break; + } } os::free(copy); diff --git a/src/hotspot/share/logging/logStream.cpp b/src/hotspot/share/logging/logStream.cpp index efbd806733d01..813b0aceb4a52 100644 --- a/src/hotspot/share/logging/logStream.cpp +++ b/src/hotspot/share/logging/logStream.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "logging/logStream.hpp" #include "runtime/os.hpp" #include "utilities/align.hpp" diff --git a/src/hotspot/share/logging/logTag.cpp b/src/hotspot/share/logging/logTag.cpp index a4cd535cf7afe..d2aeeebfc7996 100644 --- a/src/hotspot/share/logging/logTag.cpp +++ b/src/hotspot/share/logging/logTag.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. * */ -#include "precompiled.hpp" #include "logging/logTag.hpp" #include "utilities/stringUtils.hpp" #include "utilities/globalDefinitions.hpp" diff --git a/src/hotspot/share/logging/logTagSet.cpp b/src/hotspot/share/logging/logTagSet.cpp index 04da1a1e28d16..3cb04a033c60d 100644 --- a/src/hotspot/share/logging/logTagSet.cpp +++ b/src/hotspot/share/logging/logTagSet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. * */ -#include "precompiled.hpp" #include "jvm.h" #include "logging/logDecorations.hpp" #include "logging/logFileStreamOutput.hpp" diff --git a/src/hotspot/share/logging/logTagSetDescriptions.cpp b/src/hotspot/share/logging/logTagSetDescriptions.cpp index cc0501771619f..f8edfb9a4c55a 100644 --- a/src/hotspot/share/logging/logTagSetDescriptions.cpp +++ b/src/hotspot/share/logging/logTagSetDescriptions.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. * */ -#include "precompiled.hpp" #include "logging/logTag.hpp" #include "logging/logTagSet.hpp" #include "logging/logTagSetDescriptions.hpp" diff --git a/src/hotspot/share/memory/allocation.cpp b/src/hotspot/share/memory/allocation.cpp index 096ee6964210e..13280006fe692 100644 --- a/src/hotspot/share/memory/allocation.cpp +++ b/src/hotspot/share/memory/allocation.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "memory/allocation.hpp" #include "memory/allocation.inline.hpp" #include "memory/arena.hpp" diff --git a/src/hotspot/share/memory/arena.cpp b/src/hotspot/share/memory/arena.cpp index 51d7cda9c61ec..055c6405590b5 100644 --- a/src/hotspot/share/memory/arena.cpp +++ b/src/hotspot/share/memory/arena.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2019, 2023 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "compiler/compilationMemoryStatistic.hpp" #include "memory/allocation.hpp" #include "memory/allocation.inline.hpp" @@ -142,8 +141,7 @@ Chunk* ChunkPool::allocate_chunk(size_t length, AllocFailType alloc_failmode) { // - the payload size (length) must be aligned to 64-bit, which takes care of 64-bit // aligning (D) - assert(is_aligned(length, ARENA_AMALLOC_ALIGNMENT), "chunk payload length misaligned: " - SIZE_FORMAT ".", length); + assert(is_aligned(length, ARENA_AMALLOC_ALIGNMENT), "chunk payload length misaligned: %zu.", length); // Try to reuse a freed chunk from the pool ChunkPool* pool = ChunkPool::get_pool_for_size(length); Chunk* chunk = nullptr; diff --git a/src/hotspot/share/memory/classLoaderMetaspace.cpp b/src/hotspot/share/memory/classLoaderMetaspace.cpp index 4bcbb862a5a4e..efa6adc7a7bf5 100644 --- a/src/hotspot/share/memory/classLoaderMetaspace.cpp +++ b/src/hotspot/share/memory/classLoaderMetaspace.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "logging/log.hpp" #include "memory/classLoaderMetaspace.hpp" #include "memory/metaspace.hpp" @@ -148,8 +147,8 @@ MetaWord* ClassLoaderMetaspace::expand_and_allocate(size_t word_size, Metaspace: Metaspace::tracer()->report_gc_threshold(before, after, MetaspaceGCThresholdUpdater::ExpandAndAllocate); // Keeping both for now until I am sure the old variant (gc + metaspace) is not needed anymore - log_trace(gc, metaspace)("Increase capacity to GC from " SIZE_FORMAT " to " SIZE_FORMAT, before, after); - UL2(info, "GC threshold increased: " SIZE_FORMAT "->" SIZE_FORMAT ".", before, after); + log_trace(gc, metaspace)("Increase capacity to GC from %zu to %zu", before, after); + UL2(info, "GC threshold increased: %zu->%zu.", before, after); } return res; diff --git a/src/hotspot/share/memory/guardedMemory.cpp b/src/hotspot/share/memory/guardedMemory.cpp index 12ffde3cc1b94..4165ccdb62080 100644 --- a/src/hotspot/share/memory/guardedMemory.cpp +++ b/src/hotspot/share/memory/guardedMemory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. * */ -#include "precompiled.hpp" #include "memory/guardedMemory.hpp" #include "nmt/memTag.hpp" #include "runtime/os.hpp" @@ -59,7 +58,7 @@ void GuardedMemory::print_on(outputStream* st) const { return; } st->print_cr("GuardedMemory(" PTR_FORMAT ") base_addr=" PTR_FORMAT - " tag=" PTR_FORMAT " user_size=" SIZE_FORMAT " user_data=" PTR_FORMAT, + " tag=" PTR_FORMAT " user_size=%zu user_data=" PTR_FORMAT, p2i(this), p2i(_base_addr), p2i(get_tag()), get_user_size(), p2i(get_user_ptr())); Guard* guard = get_head_guard(); diff --git a/src/hotspot/share/memory/heap.cpp b/src/hotspot/share/memory/heap.cpp index 1f0db3f08b54f..bcb9d2e6114b9 100644 --- a/src/hotspot/share/memory/heap.cpp +++ b/src/hotspot/share/memory/heap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "memory/heap.hpp" #include "memory/memoryReserver.hpp" #include "oops/oop.inline.hpp" diff --git a/src/hotspot/share/memory/heapInspection.cpp b/src/hotspot/share/memory/heapInspection.cpp index bf9deb530f03a..867ccc6106d8e 100644 --- a/src/hotspot/share/memory/heapInspection.cpp +++ b/src/hotspot/share/memory/heapInspection.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderData.inline.hpp" #include "classfile/classLoaderDataGraph.hpp" #include "classfile/moduleEntry.hpp" @@ -592,7 +591,7 @@ void HeapInspection::heap_inspection(outputStream* st, WorkerThreads* workers) { // populate table with object allocation info uintx missed_count = populate_table(&cit, nullptr, workers); if (missed_count != 0) { - log_info(gc, classhisto)("WARNING: Ran out of C-heap; undercounted " UINTX_FORMAT + log_info(gc, classhisto)("WARNING: Ran out of C-heap; undercounted %zu" " total instances in data below", missed_count); } diff --git a/src/hotspot/share/memory/iterator.cpp b/src/hotspot/share/memory/iterator.cpp index d2d478cb51851..9569822e03f6f 100644 --- a/src/hotspot/share/memory/iterator.cpp +++ b/src/hotspot/share/memory/iterator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderDataGraph.hpp" #include "code/nmethod.hpp" #include "gc/shared/barrierSetNMethod.hpp" diff --git a/src/hotspot/share/memory/memRegion.cpp b/src/hotspot/share/memory/memRegion.cpp index d6565b0032442..4391e25aec33b 100644 --- a/src/hotspot/share/memory/memRegion.cpp +++ b/src/hotspot/share/memory/memRegion.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "memory/allocation.hpp" #include "memory/allocation.inline.hpp" #include "memory/memRegion.hpp" diff --git a/src/hotspot/share/memory/memoryReserver.cpp b/src/hotspot/share/memory/memoryReserver.cpp index d68736c7f2ab3..dad88ae97e53b 100644 --- a/src/hotspot/share/memory/memoryReserver.cpp +++ b/src/hotspot/share/memory/memoryReserver.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "jvm.h" #include "logging/log.hpp" #include "memory/memoryReserver.hpp" @@ -68,7 +67,7 @@ static void log_on_large_pages_failure(char* req_addr, size_t bytes) { // JVM style warning that we did not succeed in using large pages. char msg[128]; jio_snprintf(msg, sizeof(msg), "Failed to reserve and commit memory using large pages. " - "req_addr: " PTR_FORMAT " bytes: " SIZE_FORMAT, + "req_addr: " PTR_FORMAT " bytes: %zu", req_addr, bytes); warning("%s", msg); } @@ -89,7 +88,7 @@ static char* reserve_memory_inner(char* requested_address, // important. If the reservation fails, return null. if (requested_address != nullptr) { assert(is_aligned(requested_address, alignment), - "Requested address " PTR_FORMAT " must be aligned to " SIZE_FORMAT, + "Requested address " PTR_FORMAT " must be aligned to %zu", p2i(requested_address), alignment); return os::attempt_reserve_memory_at(requested_address, size, exec, mem_tag); } @@ -131,8 +130,7 @@ ReservedSpace MemoryReserver::reserve_memory_special(char* requested_address, size_t alignment, size_t page_size, bool exec) { - log_trace(pagesize)("Attempt special mapping: size: " SIZE_FORMAT "%s, " - "alignment: " SIZE_FORMAT "%s", + log_trace(pagesize)("Attempt special mapping: size: %zu%s, alignment: %zu%s", byte_size_in_exact_unit(size), exact_unit_for_byte_size(size), byte_size_in_exact_unit(alignment), exact_unit_for_byte_size(alignment)); @@ -141,7 +139,7 @@ ReservedSpace MemoryReserver::reserve_memory_special(char* requested_address, if (base != nullptr) { assert(is_aligned(base, alignment), "reserve_memory_special() returned an unaligned address, " - "base: " PTR_FORMAT " alignment: " SIZE_FORMAT_X, + "base: " PTR_FORMAT " alignment: 0x%zx", p2i(base), alignment); return ReservedSpace(base, size, alignment, page_size, exec, true /* special */); @@ -255,7 +253,7 @@ static char* map_memory_to_file(char* requested_address, // important. If the reservation fails, return null. if (requested_address != nullptr) { assert(is_aligned(requested_address, alignment), - "Requested address " PTR_FORMAT " must be aligned to " SIZE_FORMAT, + "Requested address " PTR_FORMAT " must be aligned to %zu", p2i(requested_address), alignment); return os::attempt_map_memory_to_file_at(requested_address, size, fd, mem_tag); } @@ -401,7 +399,7 @@ ReservedSpace HeapReserver::Instance::try_reserve_memory(size_t size, char* requested_address) { // Try to reserve the memory for the heap. log_trace(gc, heap, coops)("Trying to allocate at address " PTR_FORMAT - " heap of size " SIZE_FORMAT_X, + " heap of size 0x%zx", p2i(requested_address), size); @@ -426,19 +424,17 @@ ReservedSpace HeapReserver::Instance::try_reserve_range(char *highest_start, size_t size, size_t alignment, size_t page_size) { - const size_t attach_range = highest_start - lowest_start; - // Cap num_attempts at possible number. - // At least one is possible even for 0 sized attach range. - const uint64_t num_attempts_possible = (attach_range / attach_point_alignment) + 1; - const uint64_t num_attempts_to_try = MIN2((uint64_t)HeapSearchSteps, num_attempts_possible); - - const size_t stepsize = (attach_range == 0) ? // Only one try. - (size_t) highest_start : align_up(attach_range / num_attempts_to_try, attach_point_alignment); - - // Try attach points from top to bottom. - for (char* attach_point = highest_start; - attach_point >= lowest_start && attach_point <= highest_start; // Avoid wrap around. - attach_point -= stepsize) { + assert(is_aligned(highest_start, attach_point_alignment), "precondition"); + assert(is_aligned(lowest_start, attach_point_alignment), "precondition"); + + const size_t attach_range = pointer_delta(highest_start, lowest_start, sizeof(char)); + const size_t num_attempts_possible = (attach_range / attach_point_alignment) + 1; + const size_t num_attempts_to_try = MIN2((size_t)HeapSearchSteps, num_attempts_possible); + const size_t num_intervals = num_attempts_to_try - 1; + const size_t stepsize = num_intervals == 0 ? 0 : align_down(attach_range / num_intervals, attach_point_alignment); + + for (size_t i = 0; i < num_attempts_to_try; ++i) { + char* const attach_point = highest_start - stepsize * i; ReservedSpace reserved = try_reserve_memory(size, alignment, page_size, attach_point); if (reserved.is_reserved()) { @@ -516,7 +512,7 @@ static ReservedSpace establish_noaccess_prefix(const ReservedSpace& reserved, si fatal("cannot protect protection page"); } log_debug(gc, heap, coops)("Protected page at the reserved heap base: " - PTR_FORMAT " / " INTX_FORMAT " bytes", + PTR_FORMAT " / %zd bytes", p2i(reserved.base()), noaccess_prefix); assert(CompressedOops::use_implicit_null_checks() == true, "not initialized?"); @@ -639,7 +635,7 @@ ReservedHeapSpace HeapReserver::Instance::reserve_compressed_oops_heap(const siz // Last, desperate try without any placement. if (!reserved.is_reserved()) { - log_trace(gc, heap, coops)("Trying to allocate at address null heap of size " SIZE_FORMAT_X, size + noaccess_prefix); + log_trace(gc, heap, coops)("Trying to allocate at address null heap of size 0x%zx", size + noaccess_prefix); assert(alignment >= os::vm_page_size(), "Unexpected"); reserved = reserve_memory(size + noaccess_prefix, alignment, page_size); } diff --git a/src/hotspot/share/memory/metaspace.cpp b/src/hotspot/share/memory/metaspace.cpp index ccfda8257d319..c1fc0bf669bbd 100644 --- a/src/hotspot/share/memory/metaspace.cpp +++ b/src/hotspot/share/memory/metaspace.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2021 SAP SE. All rights reserved. * Copyright (c) 2023, 2024, Red Hat, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "cds/cdsConfig.hpp" #include "cds/metaspaceShared.hpp" #include "classfile/classLoaderData.hpp" @@ -217,18 +216,18 @@ void MetaspaceUtils::print_on(outputStream* out) { // Used from all GCs. It first prints out totals, then, separately, the class space portion. MetaspaceCombinedStats stats = get_combined_statistics(); out->print_cr(" Metaspace " - "used " SIZE_FORMAT "K, " - "committed " SIZE_FORMAT "K, " - "reserved " SIZE_FORMAT "K", + "used %zuK, " + "committed %zuK, " + "reserved %zuK", stats.used()/K, stats.committed()/K, stats.reserved()/K); if (Metaspace::using_class_space()) { out->print_cr(" class space " - "used " SIZE_FORMAT "K, " - "committed " SIZE_FORMAT "K, " - "reserved " SIZE_FORMAT "K", + "used %zuK, " + "committed %zuK, " + "reserved %zuK", stats.class_space_stats().used()/K, stats.class_space_stats().committed()/K, stats.class_space_stats().reserved()/K); @@ -386,7 +385,7 @@ bool MetaspaceGC::can_expand(size_t word_size, bool is_class) { if (is_class && Metaspace::using_class_space()) { size_t class_committed = MetaspaceUtils::committed_bytes(Metaspace::ClassType); if (class_committed + word_size * BytesPerWord > CompressedClassSpaceSize) { - log_trace(gc, metaspace, freelist)("Cannot expand %s metaspace by " SIZE_FORMAT " words (CompressedClassSpaceSize = " SIZE_FORMAT " words)", + log_trace(gc, metaspace, freelist)("Cannot expand %s metaspace by %zu words (CompressedClassSpaceSize = %zu words)", (is_class ? "class" : "non-class"), word_size, CompressedClassSpaceSize / sizeof(MetaWord)); return false; } @@ -395,7 +394,7 @@ bool MetaspaceGC::can_expand(size_t word_size, bool is_class) { // Check if the user has imposed a limit on the metaspace memory. size_t committed_bytes = MetaspaceUtils::committed_bytes(); if (committed_bytes + word_size * BytesPerWord > MaxMetaspaceSize) { - log_trace(gc, metaspace, freelist)("Cannot expand %s metaspace by " SIZE_FORMAT " words (MaxMetaspaceSize = " SIZE_FORMAT " words)", + log_trace(gc, metaspace, freelist)("Cannot expand %s metaspace by %zu words (MaxMetaspaceSize = %zu words)", (is_class ? "class" : "non-class"), word_size, MaxMetaspaceSize / sizeof(MetaWord)); return false; } @@ -413,8 +412,8 @@ size_t MetaspaceGC::allowed_expansion() { size_t left_until_GC = capacity_until_gc > committed_bytes ? capacity_until_gc - committed_bytes : 0; size_t left_to_commit = MIN2(left_until_GC, left_until_max); - log_trace(gc, metaspace, freelist)("allowed expansion words: " SIZE_FORMAT - " (left_until_max: " SIZE_FORMAT ", left_until_GC: " SIZE_FORMAT ".", + log_trace(gc, metaspace, freelist)("allowed expansion words: %zu" + " (left_until_max: %zu, left_until_GC: %zu.", left_to_commit / BytesPerWord, left_until_max / BytesPerWord, left_until_GC / BytesPerWord); return left_to_commit / BytesPerWord; @@ -478,7 +477,7 @@ void MetaspaceGC::compute_new_size() { // No expansion, now see if we want to shrink // We would never want to shrink more than this assert(capacity_until_GC >= minimum_desired_capacity, - SIZE_FORMAT " >= " SIZE_FORMAT, + "%zu >= %zu", capacity_until_GC, minimum_desired_capacity); size_t max_shrink_bytes = capacity_until_GC - minimum_desired_capacity; @@ -512,7 +511,7 @@ void MetaspaceGC::compute_new_size() { shrink_bytes = align_down(shrink_bytes, Metaspace::commit_alignment()); assert(shrink_bytes <= max_shrink_bytes, - "invalid shrink size " SIZE_FORMAT " not <= " SIZE_FORMAT, + "invalid shrink size %zu not <= %zu", shrink_bytes, max_shrink_bytes); if (current_shrink_factor == 0) { _shrink_factor = 10; @@ -554,7 +553,7 @@ void Metaspace::print_compressed_class_space(outputStream* st) { MetaWord* base = VirtualSpaceList::vslist_class()->base_of_first_node(); size_t size = VirtualSpaceList::vslist_class()->word_size_of_first_node(); MetaWord* top = base + size; - st->print("Compressed class space mapped at: " PTR_FORMAT "-" PTR_FORMAT ", reserved size: " SIZE_FORMAT, + st->print("Compressed class space mapped at: " PTR_FORMAT "-" PTR_FORMAT ", reserved size: %zu", p2i(base), p2i(top), (top - base) * BytesPerWord); st->cr(); } @@ -563,10 +562,10 @@ void Metaspace::print_compressed_class_space(outputStream* st) { // Given a prereserved space, use that to set up the compressed class space list. void Metaspace::initialize_class_space(ReservedSpace rs) { assert(rs.size() >= CompressedClassSpaceSize, - SIZE_FORMAT " != " SIZE_FORMAT, rs.size(), CompressedClassSpaceSize); + "%zu != %zu", rs.size(), CompressedClassSpaceSize); assert(using_class_space(), "Must be using class space"); - assert(rs.size() == CompressedClassSpaceSize, SIZE_FORMAT " != " SIZE_FORMAT, + assert(rs.size() == CompressedClassSpaceSize, "%zu != %zu", rs.size(), CompressedClassSpaceSize); assert(is_aligned(rs.base(), Metaspace::reserve_alignment()) && is_aligned(rs.size(), Metaspace::reserve_alignment()), @@ -692,7 +691,7 @@ void Metaspace::ergo_initialize() { // Lets just live with that, its not a big deal. if (adjusted_ccs_size != CompressedClassSpaceSize) { FLAG_SET_ERGO(CompressedClassSpaceSize, adjusted_ccs_size); - log_info(metaspace)("Setting CompressedClassSpaceSize to " SIZE_FORMAT ".", + log_info(metaspace)("Setting CompressedClassSpaceSize to %zu.", CompressedClassSpaceSize); } } @@ -761,7 +760,7 @@ void Metaspace::global_initialize() { if (!is_aligned(base, Metaspace::reserve_alignment())) { vm_exit_during_initialization( err_msg("CompressedClassSpaceBaseAddress=" PTR_FORMAT " invalid " - "(must be aligned to " SIZE_FORMAT_X ").", + "(must be aligned to 0x%zx).", CompressedClassSpaceBaseAddress, Metaspace::reserve_alignment())); } @@ -793,7 +792,7 @@ void Metaspace::global_initialize() { // ...failing that, give up. if (!rs.is_reserved()) { vm_exit_during_initialization( - err_msg("Could not allocate compressed class space: " SIZE_FORMAT " bytes", + err_msg("Could not allocate compressed class space: %zu bytes", CompressedClassSpaceSize)); } @@ -859,7 +858,7 @@ size_t Metaspace::max_allocation_word_size() { MetaWord* Metaspace::allocate(ClassLoaderData* loader_data, size_t word_size, MetaspaceObj::Type type, bool use_class_space) { assert(word_size <= Metaspace::max_allocation_word_size(), - "allocation size too large (" SIZE_FORMAT ")", word_size); + "allocation size too large (%zu)", word_size); assert(loader_data != nullptr, "Should never pass around a null loader_data. " "ClassLoaderData::the_null_class_loader_data() should have been used."); @@ -935,7 +934,7 @@ void Metaspace::report_metadata_oome(ClassLoaderData* loader_data, size_t word_s { LogMessage(gc, metaspace, freelist, oom) log; if (log.is_info()) { - log.info("Metaspace (%s) allocation failed for size " SIZE_FORMAT, + log.info("Metaspace (%s) allocation failed for size %zu", is_class_space_allocation(mdtype) ? "class" : "data", word_size); ResourceMark rm; if (log.is_debug()) { diff --git a/src/hotspot/share/memory/metaspace/binList.hpp b/src/hotspot/share/memory/metaspace/binList.hpp index 9442ea3cd5200..18e1b2c7fb86d 100644 --- a/src/hotspot/share/memory/metaspace/binList.hpp +++ b/src/hotspot/share/memory/metaspace/binList.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020 SAP SE. All rights reserved. * Copyright (c) 2023 Red Hat, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -78,7 +78,7 @@ class BinListImpl { Block(Block* next) : _next(next) {} }; -#define BLOCK_FORMAT "Block @" PTR_FORMAT ": size: " SIZE_FORMAT ", next: " PTR_FORMAT +#define BLOCK_FORMAT "Block @" PTR_FORMAT ": size: %zu, next: " PTR_FORMAT #define BLOCK_FORMAT_ARGS(b, sz) p2i(b), (sz), p2i((b)->_next) // Block size must be exactly one word size. @@ -161,7 +161,7 @@ class BinListImpl { // Block may be larger. MetaBlock remove_block(size_t word_size) { assert(word_size >= MinWordSize && - word_size <= MaxWordSize, "bad block size " SIZE_FORMAT ".", word_size); + word_size <= MaxWordSize, "bad block size %zu.", word_size); MetaBlock result; int index = index_for_word_size(word_size); index = index_for_next_non_empty_list(index); diff --git a/src/hotspot/share/memory/metaspace/blockTree.cpp b/src/hotspot/share/memory/metaspace/blockTree.cpp index 85e7750883667..33237494b50b0 100644 --- a/src/hotspot/share/memory/metaspace/blockTree.cpp +++ b/src/hotspot/share/memory/metaspace/blockTree.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2022 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "memory/metaspace/chunklevel.hpp" #include "memory/metaspace/blockTree.hpp" #include "memory/resourceArea.hpp" @@ -44,7 +43,7 @@ const size_t BlockTree::MinWordSize; ", left " PTR_FORMAT \ ", right " PTR_FORMAT \ ", next " PTR_FORMAT \ - ", size " SIZE_FORMAT + ", size %zu" #define NODE_FORMAT_ARGS(n) \ p2i(n), \ diff --git a/src/hotspot/share/memory/metaspace/blockTree.hpp b/src/hotspot/share/memory/metaspace/blockTree.hpp index 8bcdd30919ae9..a01f60b166f14 100644 --- a/src/hotspot/share/memory/metaspace/blockTree.hpp +++ b/src/hotspot/share/memory/metaspace/blockTree.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -348,7 +348,7 @@ class BlockTree: public CHeapObj { void add_block(MetaBlock block) { DEBUG_ONLY(zap_block(block);) const size_t word_size = block.word_size(); - assert(word_size >= MinWordSize, "invalid block size " SIZE_FORMAT, word_size); + assert(word_size >= MinWordSize, "invalid block size %zu", word_size); Node* n = new(block.base()) Node(word_size); if (_root == nullptr) { _root = n; @@ -361,7 +361,7 @@ class BlockTree: public CHeapObj { // Given a word_size, search and return the smallest block that is equal or // larger than that size. MetaBlock remove_block(size_t word_size) { - assert(word_size >= MinWordSize, "invalid block size " SIZE_FORMAT, word_size); + assert(word_size >= MinWordSize, "invalid block size %zu", word_size); MetaBlock result; Node* n = find_closest_fit(word_size); diff --git a/src/hotspot/share/memory/metaspace/chunkHeaderPool.cpp b/src/hotspot/share/memory/metaspace/chunkHeaderPool.cpp index 050dd74276358..ac63d0d022593 100644 --- a/src/hotspot/share/memory/metaspace/chunkHeaderPool.cpp +++ b/src/hotspot/share/memory/metaspace/chunkHeaderPool.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "memory/metaspace/chunkHeaderPool.hpp" #include "runtime/os.hpp" #include "utilities/debug.hpp" diff --git a/src/hotspot/share/memory/metaspace/chunkManager.cpp b/src/hotspot/share/memory/metaspace/chunkManager.cpp index 7b51198bc79a3..2c787046ce8d9 100644 --- a/src/hotspot/share/memory/metaspace/chunkManager.cpp +++ b/src/hotspot/share/memory/metaspace/chunkManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2023 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "logging/log.hpp" #include "logging/logStream.hpp" #include "memory/metaspace/chunkManager.hpp" @@ -141,7 +140,7 @@ Metachunk* ChunkManager::get_chunk_locked(chunklevel_t preferred_level, chunklev DEBUG_ONLY(chunklevel::check_valid_level(preferred_level);) UL2(debug, "requested chunk: pref_level: " CHKLVL_FORMAT - ", max_level: " CHKLVL_FORMAT ", min committed size: " SIZE_FORMAT ".", + ", max_level: " CHKLVL_FORMAT ", min committed size: %zu.", preferred_level, max_level, min_committed_words); // First, optimistically look for a chunk which is already committed far enough to hold min_word_size. @@ -212,7 +211,7 @@ Metachunk* ChunkManager::get_chunk_locked(chunklevel_t preferred_level, chunklev const size_t to_commit = min_committed_words; if (c->committed_words() < to_commit) { if (c->ensure_committed_locked(to_commit) == false) { - UL2(info, "failed to commit " SIZE_FORMAT " words on chunk " METACHUNK_FORMAT ".", + UL2(info, "failed to commit %zu words on chunk " METACHUNK_FORMAT ".", to_commit, METACHUNK_FORMAT_ARGS(c)); return_chunk_locked(c); c = nullptr; @@ -434,7 +433,7 @@ void ChunkManager::print_on(outputStream* st) const { void ChunkManager::print_on_locked(outputStream* st) const { assert_lock_strong(Metaspace_lock); - st->print_cr("cm %s: %d chunks, total word size: " SIZE_FORMAT ".", _name, + st->print_cr("cm %s: %d chunks, total word size: %zu.", _name, total_num_chunks(), total_word_size()); _chunks.print_on(st); } diff --git a/src/hotspot/share/memory/metaspace/chunklevel.cpp b/src/hotspot/share/memory/metaspace/chunklevel.cpp index c8bb19373d600..371ba0e68cd14 100644 --- a/src/hotspot/share/memory/metaspace/chunklevel.cpp +++ b/src/hotspot/share/memory/metaspace/chunklevel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "memory/metaspace/chunklevel.hpp" #include "utilities/debug.hpp" #include "utilities/globalDefinitions.hpp" @@ -36,7 +35,7 @@ using namespace chunklevel; chunklevel_t chunklevel::level_fitting_word_size(size_t word_size) { assert(MAX_CHUNK_WORD_SIZE >= word_size, - SIZE_FORMAT " - too large allocation size.", word_size * BytesPerWord); + "%zu - too large allocation size.", word_size * BytesPerWord); if (word_size <= MIN_CHUNK_WORD_SIZE) { return HIGHEST_CHUNK_LEVEL; } diff --git a/src/hotspot/share/memory/metaspace/commitLimiter.cpp b/src/hotspot/share/memory/metaspace/commitLimiter.cpp index 8887804b030d1..97bf9faa9c659 100644 --- a/src/hotspot/share/memory/metaspace/commitLimiter.cpp +++ b/src/hotspot/share/memory/metaspace/commitLimiter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "memory/metaspace.hpp" #include "memory/metaspace/commitLimiter.hpp" #include "memory/metaspaceUtils.hpp" diff --git a/src/hotspot/share/memory/metaspace/commitMask.cpp b/src/hotspot/share/memory/metaspace/commitMask.cpp index a1bc985210bf1..b6227f16b8ad3 100644 --- a/src/hotspot/share/memory/metaspace/commitMask.cpp +++ b/src/hotspot/share/memory/metaspace/commitMask.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "memory/metaspace/commitMask.hpp" #include "memory/metaspace/metaspaceCommon.hpp" #include "memory/metaspace/metaspaceSettings.hpp" @@ -61,7 +60,7 @@ void CommitMask::check_pointer(const MetaWord* p) const { void CommitMask::check_pointer_aligned(const MetaWord* p) const { check_pointer(p); assert(is_aligned(p, _words_per_bit * BytesPerWord), - "Pointer " PTR_FORMAT " should be aligned to commit granule size " SIZE_FORMAT ".", + "Pointer " PTR_FORMAT " should be aligned to commit granule size %zu.", p2i(p), _words_per_bit * BytesPerWord); } // Given a range, check if it points into the range this bitmap covers, @@ -69,7 +68,7 @@ void CommitMask::check_pointer_aligned(const MetaWord* p) const { void CommitMask::check_range(const MetaWord* start, size_t word_size) const { check_pointer_aligned(start); assert(is_aligned(word_size, _words_per_bit), - "Range " SIZE_FORMAT " should be aligned to commit granule size " SIZE_FORMAT ".", + "Range %zu should be aligned to commit granule size %zu.", word_size, _words_per_bit); check_pointer(start + word_size - 1); } diff --git a/src/hotspot/share/memory/metaspace/freeBlocks.cpp b/src/hotspot/share/memory/metaspace/freeBlocks.cpp index ab65387043a7e..93f68d89ecd4d 100644 --- a/src/hotspot/share/memory/metaspace/freeBlocks.cpp +++ b/src/hotspot/share/memory/metaspace/freeBlocks.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "memory/metaspace/freeBlocks.hpp" #include "utilities/debug.hpp" #include "utilities/globalDefinitions.hpp" diff --git a/src/hotspot/share/memory/metaspace/freeChunkList.cpp b/src/hotspot/share/memory/metaspace/freeChunkList.cpp index 65eace074f933..3640f9d354d90 100644 --- a/src/hotspot/share/memory/metaspace/freeChunkList.cpp +++ b/src/hotspot/share/memory/metaspace/freeChunkList.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2022 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "memory/metaspace/freeChunkList.hpp" #include "utilities/debug.hpp" #include "utilities/globalDefinitions.hpp" @@ -155,7 +154,7 @@ void FreeChunkListVector::print_on(outputStream* st) const { list_for_level(l)->print_on(st); st->cr(); } - st->print_cr("total chunks: %d, total word size: " SIZE_FORMAT ".", + st->print_cr("total chunks: %d, total word size: %zu.", num_chunks(), word_size()); } diff --git a/src/hotspot/share/memory/metaspace/internalStats.cpp b/src/hotspot/share/memory/metaspace/internalStats.cpp index d7b0e4495051e..0f386eb33a5c1 100644 --- a/src/hotspot/share/memory/metaspace/internalStats.cpp +++ b/src/hotspot/share/memory/metaspace/internalStats.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "memory/metaspace/internalStats.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/ostream.hpp" @@ -41,7 +40,7 @@ void InternalStats::print_on(outputStream* st) { #define xstr(s) str(s) #define str(s) #s -#define PRINT_COUNTER(name) st->print_cr("%s: " UINTX_FORMAT ".", xstr(name), _##name); +#define PRINT_COUNTER(name) st->print_cr("%s: %zu.", xstr(name), _##name); ALL_MY_COUNTERS(PRINT_COUNTER, PRINT_COUNTER) #undef PRINT_COUNTER diff --git a/src/hotspot/share/memory/metaspace/metablock.hpp b/src/hotspot/share/memory/metaspace/metablock.hpp index 96e27ff8702e8..4b2dfdfe6803e 100644 --- a/src/hotspot/share/memory/metaspace/metablock.hpp +++ b/src/hotspot/share/memory/metaspace/metablock.hpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2023 Red Hat, Inc. All rights reserved. - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -68,7 +68,7 @@ class MetaBlock { void print_on(outputStream* st) const; }; -#define METABLOCKFORMAT "block (@" PTR_FORMAT " word size " SIZE_FORMAT ")" +#define METABLOCKFORMAT "block (@" PTR_FORMAT " word size %zu)" #define METABLOCKFORMATARGS(__block__) p2i((__block__).base()), (__block__).word_size() } // namespace metaspace diff --git a/src/hotspot/share/memory/metaspace/metachunk.cpp b/src/hotspot/share/memory/metaspace/metachunk.cpp index 0bf7e98f13022..df3718d7bfa54 100644 --- a/src/hotspot/share/memory/metaspace/metachunk.cpp +++ b/src/hotspot/share/memory/metaspace/metachunk.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2021 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "logging/log.hpp" #include "memory/metaspace/metachunk.hpp" #include "memory/metaspace/metaspaceCommon.hpp" @@ -102,7 +101,7 @@ bool Metachunk::commit_up_to(size_t new_committed_words) { assert(commit_to <= word_size(), "Sanity"); if (commit_to > commit_from) { log_debug(metaspace)("Chunk " METACHUNK_FORMAT ": attempting to move commit line to " - SIZE_FORMAT " words.", METACHUNK_FORMAT_ARGS(this), commit_to); + "%zu words.", METACHUNK_FORMAT_ARGS(this), commit_to); if (!_vsnode->ensure_range_is_committed(base() + commit_from, commit_to - commit_from)) { DEBUG_ONLY(verify();) return false; @@ -271,10 +270,10 @@ void Metachunk::verify() const { assert(base() != nullptr, "No base ptr"); assert(committed_words() >= used_words(), - "mismatch: committed: " SIZE_FORMAT ", used: " SIZE_FORMAT ".", + "mismatch: committed: %zu, used: %zu.", committed_words(), used_words()); assert(word_size() >= committed_words(), - "mismatch: word_size: " SIZE_FORMAT ", committed: " SIZE_FORMAT ".", + "mismatch: word_size: %zu, committed: %zu.", word_size(), committed_words()); // Test base pointer @@ -304,8 +303,8 @@ void Metachunk::verify() const { void Metachunk::print_on(outputStream* st) const { // Note: must also work with invalid/random data. (e.g. do not call word_size()) st->print("Chunk @" PTR_FORMAT ", state %c, base " PTR_FORMAT ", " - "level " CHKLVL_FORMAT " (" SIZE_FORMAT " words), " - "used " SIZE_FORMAT " words, committed " SIZE_FORMAT " words.", + "level " CHKLVL_FORMAT " (%zu words), " + "used %zu words, committed %zu words.", p2i(this), get_state_char(), p2i(base()), level(), (chunklevel::is_valid_level(level()) ? chunklevel::word_size_for_level(level()) : SIZE_MAX), used_words(), committed_words()); diff --git a/src/hotspot/share/memory/metaspace/metachunk.hpp b/src/hotspot/share/memory/metaspace/metachunk.hpp index efd849c6e5a36..c025343231b1c 100644 --- a/src/hotspot/share/memory/metaspace/metachunk.hpp +++ b/src/hotspot/share/memory/metaspace/metachunk.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -362,7 +362,7 @@ class Metachunk { #define METACHUNK_FORMAT "@" PTR_FORMAT ", %c, base " PTR_FORMAT ", level " CHKLVL_FORMAT #define METACHUNK_FORMAT_ARGS(chunk) p2i(chunk), chunk->get_state_char(), p2i(chunk->base()), chunk->level() -#define METACHUNK_FULL_FORMAT "@" PTR_FORMAT ", %c, base " PTR_FORMAT ", level " CHKLVL_FORMAT " (" SIZE_FORMAT "), used: " SIZE_FORMAT ", committed: " SIZE_FORMAT ", committed-free: " SIZE_FORMAT +#define METACHUNK_FULL_FORMAT "@" PTR_FORMAT ", %c, base " PTR_FORMAT ", level " CHKLVL_FORMAT " (%zu), used: %zu, committed: %zu, committed-free: %zu" #define METACHUNK_FULL_FORMAT_ARGS(chunk) p2i(chunk), chunk->get_state_char(), p2i(chunk->base()), chunk->level(), chunk->word_size(), chunk->used_words(), chunk->committed_words(), chunk->free_below_committed_words() } // namespace metaspace diff --git a/src/hotspot/share/memory/metaspace/metachunkList.cpp b/src/hotspot/share/memory/metaspace/metachunkList.cpp index e691f9e359425..d8a956060683a 100644 --- a/src/hotspot/share/memory/metaspace/metachunkList.cpp +++ b/src/hotspot/share/memory/metaspace/metachunkList.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "memory/metaspace/metachunkList.hpp" #include "memory/metaspace/metaspaceCommon.hpp" #include "utilities/debug.hpp" diff --git a/src/hotspot/share/memory/metaspace/metaspaceArena.cpp b/src/hotspot/share/memory/metaspace/metaspaceArena.cpp index 33f1bfc46a31d..709bbfd90a119 100644 --- a/src/hotspot/share/memory/metaspace/metaspaceArena.cpp +++ b/src/hotspot/share/memory/metaspace/metaspaceArena.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2023 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "logging/log.hpp" #include "logging/logStream.hpp" #include "memory/metaspace/chunkManager.hpp" @@ -84,7 +83,7 @@ MetaBlock MetaspaceArena::salvage_chunk(Metachunk* c) { Metachunk* MetaspaceArena::allocate_new_chunk(size_t requested_word_size) { // Should this ever happen, we need to increase the maximum possible chunk size. guarantee(requested_word_size <= chunklevel::MAX_CHUNK_WORD_SIZE, - "Requested size too large (" SIZE_FORMAT ") - max allowed size per allocation is " SIZE_FORMAT ".", + "Requested size too large (%zu) - max allowed size per allocation is %zu.", requested_word_size, chunklevel::MAX_CHUNK_WORD_SIZE); const chunklevel_t max_level = chunklevel::level_fitting_word_size(requested_word_size); @@ -150,7 +149,7 @@ MetaspaceArena::~MetaspaceArena() { c = c2; } - UL2(debug, "returned %d chunks, total capacity " SIZE_FORMAT " words.", + UL2(debug, "returned %d chunks, total capacity %zu words.", return_counter.count(), return_counter.total_size()); _total_used_words_counter->decrement_by(return_counter.total_size()); @@ -216,7 +215,7 @@ bool MetaspaceArena::attempt_enlarge_current_chunk(size_t requested_word_size) { // 4) Attempt to get a new chunk and allocate from that chunk. // At any point, if we hit a commit limit, we return null. MetaBlock MetaspaceArena::allocate(size_t requested_word_size, MetaBlock& wastage) { - UL2(trace, "requested " SIZE_FORMAT " words.", requested_word_size); + UL2(trace, "requested %zu words.", requested_word_size); const size_t aligned_word_size = get_raw_word_size_for_requested_word_size(requested_word_size); @@ -234,7 +233,7 @@ MetaBlock MetaspaceArena::allocate(size_t requested_word_size, MetaBlock& wastag wastage = result.split_off_tail(result.word_size() - aligned_word_size); // Stats, logging DEBUG_ONLY(InternalStats::inc_num_allocs_from_deallocated_blocks();) - UL2(trace, "returning " METABLOCKFORMAT " with wastage " METABLOCKFORMAT " - taken from fbl (now: %d, " SIZE_FORMAT ").", + UL2(trace, "returning " METABLOCKFORMAT " with wastage " METABLOCKFORMAT " - taken from fbl (now: %d, %zu).", METABLOCKFORMATARGS(result), METABLOCKFORMATARGS(wastage), _fbl->count(), _fbl->total_size()); // Note: free blocks in freeblock dictionary still count as "used" as far as statistics go; // therefore we don't need to adjust any usage counters (see epilogue of allocate_inner()). @@ -314,7 +313,7 @@ MetaBlock MetaspaceArena::allocate_inner(size_t word_size, MetaBlock& wastage) { // chunk. if (!current_chunk_too_small) { if (!current_chunk()->ensure_committed_additional(word_size_plus_alignment)) { - UL2(info, "commit failure (requested size: " SIZE_FORMAT ")", word_size_plus_alignment); + UL2(info, "commit failure (requested size: %zu)", word_size_plus_alignment); commit_failure = true; } } @@ -339,7 +338,7 @@ MetaBlock MetaspaceArena::allocate_inner(size_t word_size, MetaBlock& wastage) { Metachunk* new_chunk = allocate_new_chunk(word_size); if (new_chunk != nullptr) { - UL2(debug, "allocated new chunk " METACHUNK_FORMAT " for requested word size " SIZE_FORMAT ".", + UL2(debug, "allocated new chunk " METACHUNK_FORMAT " for requested word size %zu.", METACHUNK_FORMAT_ARGS(new_chunk), word_size); assert(new_chunk->free_below_committed_words() >= word_size, "Sanity"); @@ -359,7 +358,7 @@ MetaBlock MetaspaceArena::allocate_inner(size_t word_size, MetaBlock& wastage) { assert(p != nullptr, "Allocation from chunk failed."); result = MetaBlock(p, word_size); } else { - UL2(info, "failed to allocate new chunk for requested word size " SIZE_FORMAT ".", word_size); + UL2(info, "failed to allocate new chunk for requested word size %zu.", word_size); } } @@ -407,7 +406,7 @@ void MetaspaceArena::deallocate(MetaBlock block) { #else add_allocation_to_fbl(block); #endif - UL2(trace, "added to fbl: " METABLOCKFORMAT ", (now: %d, " SIZE_FORMAT ").", + UL2(trace, "added to fbl: " METABLOCKFORMAT ", (now: %d, %zu).", METABLOCKFORMATARGS(block), _fbl->count(), _fbl->total_size()); SOMETIMES(verify();) } @@ -482,7 +481,7 @@ bool MetaspaceArena::contains(MetaBlock bl) const { #endif // ASSERT void MetaspaceArena::print_on(outputStream* st) const { - st->print_cr("sm %s: %d chunks, total word size: " SIZE_FORMAT ", committed word size: " SIZE_FORMAT, _name, + st->print_cr("sm %s: %d chunks, total word size: %zu, committed word size: %zu", _name, _chunks.count(), _chunks.calc_word_size(), _chunks.calc_committed_word_size()); _chunks.print_on(st); st->cr(); diff --git a/src/hotspot/share/memory/metaspace/metaspaceArenaGrowthPolicy.cpp b/src/hotspot/share/memory/metaspace/metaspaceArenaGrowthPolicy.cpp index 0698c1509cf38..b16f2d216103c 100644 --- a/src/hotspot/share/memory/metaspace/metaspaceArenaGrowthPolicy.cpp +++ b/src/hotspot/share/memory/metaspace/metaspaceArenaGrowthPolicy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "memory/metaspace/metaspaceArenaGrowthPolicy.hpp" #include "utilities/globalDefinitions.hpp" diff --git a/src/hotspot/share/memory/metaspace/metaspaceCommon.cpp b/src/hotspot/share/memory/metaspace/metaspaceCommon.cpp index aec656201fe81..947b4843436fe 100644 --- a/src/hotspot/share/memory/metaspace/metaspaceCommon.cpp +++ b/src/hotspot/share/memory/metaspace/metaspaceCommon.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "memory/metaspace/freeBlocks.hpp" #include "memory/metaspace/metaspaceCommon.hpp" #include "memory/metaspace/metaspaceSettings.hpp" @@ -98,9 +97,9 @@ void print_human_readable_size(outputStream* st, size_t byte_size, size_t scale, if (width == -1) { if (scale == 1) { - st->print(SIZE_FORMAT " bytes", byte_size); + st->print("%zu bytes", byte_size); } else if (scale == BytesPerWord) { - st->print(SIZE_FORMAT " words", byte_size / BytesPerWord); + st->print("%zu words", byte_size / BytesPerWord); } else { const char* display_unit = display_unit_for_scale(scale); float display_value = (float) byte_size / (float)scale; @@ -162,9 +161,9 @@ const char* classes_plural(uintx num) { } void print_number_of_classes(outputStream* out, uintx classes, uintx classes_shared) { - out->print(UINTX_FORMAT " %s", classes, classes_plural(classes)); + out->print("%zu %s", classes, classes_plural(classes)); if (classes_shared > 0) { - out->print(" (" UINTX_FORMAT " shared)", classes_shared); + out->print(" (%zu shared)", classes_shared); } } diff --git a/src/hotspot/share/memory/metaspace/metaspaceCommon.hpp b/src/hotspot/share/memory/metaspace/metaspaceCommon.hpp index d296ffd6cd7f0..e9f51d05aa5cb 100644 --- a/src/hotspot/share/memory/metaspace/metaspaceCommon.hpp +++ b/src/hotspot/share/memory/metaspace/metaspaceCommon.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -80,8 +80,8 @@ void print_percentage(outputStream* st, size_t total, size_t part); #ifdef ASSERT #define assert_is_aligned(value, alignment) \ assert(is_aligned((value), (alignment)), \ - SIZE_FORMAT_X " is not aligned to " \ - SIZE_FORMAT_X, (size_t)(uintptr_t)value, (size_t)(alignment)) + "0x%zx is not aligned to 0x%zx", \ + (size_t)(uintptr_t)value, (size_t)(alignment)) #define assert_is_aligned_metaspace_pointer(p) \ assert_is_aligned((p), metaspace::AllocationAlignmentByteSize) #else diff --git a/src/hotspot/share/memory/metaspace/metaspaceContext.cpp b/src/hotspot/share/memory/metaspace/metaspaceContext.cpp index b43f4cd3b15b2..b38e32e23f63a 100644 --- a/src/hotspot/share/memory/metaspace/metaspaceContext.cpp +++ b/src/hotspot/share/memory/metaspace/metaspaceContext.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "memory/metaspace/chunkManager.hpp" #include "memory/metaspace/commitLimiter.hpp" #include "memory/metaspace/metaspaceContext.hpp" diff --git a/src/hotspot/share/memory/metaspace/metaspaceDCmd.cpp b/src/hotspot/share/memory/metaspace/metaspaceDCmd.cpp index 32fee96ad7d09..0ab83b44a7627 100644 --- a/src/hotspot/share/memory/metaspace/metaspaceDCmd.cpp +++ b/src/hotspot/share/memory/metaspace/metaspaceDCmd.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2022 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "memory/metaspace.hpp" #include "memory/metaspace/metaspaceDCmd.hpp" #include "memory/metaspace/metaspaceReporter.hpp" diff --git a/src/hotspot/share/memory/metaspace/metaspaceReporter.cpp b/src/hotspot/share/memory/metaspace/metaspaceReporter.cpp index cbd2400444ff0..3cff2a50d033f 100644 --- a/src/hotspot/share/memory/metaspace/metaspaceReporter.cpp +++ b/src/hotspot/share/memory/metaspace/metaspaceReporter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "cds/cdsConfig.hpp" #include "classfile/classLoaderData.hpp" #include "classfile/classLoaderDataGraph.hpp" @@ -218,7 +217,7 @@ void MetaspaceReporter::print_report(outputStream* out, size_t scale, int flags) { uintx num_loaders = cl._num_loaders_by_spacetype[space_type]; uintx num_classes = cl._num_classes_by_spacetype[space_type]; - out->print("%s - " UINTX_FORMAT " %s", + out->print("%s - %zu %s", describe_spacetype((Metaspace::MetaspaceType)space_type), num_loaders, loaders_plural(num_loaders)); if (num_classes > 0) { @@ -239,7 +238,7 @@ void MetaspaceReporter::print_report(outputStream* out, size_t scale, int flags) out->cr(); { uintx num_loaders = cl._num_loaders; - out->print("Total Usage - " UINTX_FORMAT " %s, ", + out->print("Total Usage - %zu %s, ", num_loaders, loaders_plural(num_loaders)); print_number_of_classes(out, cl._num_classes, cl._num_classes_shared); out->print(":"); @@ -360,7 +359,7 @@ void MetaspaceReporter::print_report(outputStream* out, size_t scale, int flags) cl._stats_total._arena_stats_class._free_blocks_word_size; out->print("Deallocated from chunks in use: "); print_scaled_words_and_percentage(out, free_blocks_cap_words, committed_words, scale, 6); - out->print(" (" UINTX_FORMAT " blocks)", free_blocks_num); + out->print(" (%zu blocks)", free_blocks_num); out->cr(); // Print total waste. diff --git a/src/hotspot/share/memory/metaspace/metaspaceSettings.cpp b/src/hotspot/share/memory/metaspace/metaspaceSettings.cpp index b812341a2da34..23d38e0d77544 100644 --- a/src/hotspot/share/memory/metaspace/metaspaceSettings.cpp +++ b/src/hotspot/share/memory/metaspace/metaspaceSettings.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2023 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "logging/log.hpp" #include "logging/logStream.hpp" #include "memory/metaspace/metaspaceSettings.hpp" @@ -49,9 +48,9 @@ void Settings::ergo_initialize() { } void Settings::print_on(outputStream* st) { - st->print_cr(" - commit_granule_bytes: " SIZE_FORMAT ".", commit_granule_bytes()); - st->print_cr(" - commit_granule_words: " SIZE_FORMAT ".", commit_granule_words()); - st->print_cr(" - virtual_space_node_default_size: " SIZE_FORMAT ".", virtual_space_node_default_word_size()); + st->print_cr(" - commit_granule_bytes: %zu.", commit_granule_bytes()); + st->print_cr(" - commit_granule_words: %zu.", commit_granule_words()); + st->print_cr(" - virtual_space_node_default_size: %zu.", virtual_space_node_default_word_size()); st->print_cr(" - enlarge_chunks_in_place: %d.", (int)enlarge_chunks_in_place()); } diff --git a/src/hotspot/share/memory/metaspace/metaspaceStatistics.cpp b/src/hotspot/share/memory/metaspace/metaspaceStatistics.cpp index 32329831e7cc5..d4cf551d05428 100644 --- a/src/hotspot/share/memory/metaspace/metaspaceStatistics.cpp +++ b/src/hotspot/share/memory/metaspace/metaspaceStatistics.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "memory/metaspace/metaspaceCommon.hpp" #include "memory/metaspace/metaspaceStatistics.hpp" #include "utilities/debug.hpp" @@ -128,7 +127,7 @@ void InUseChunkStats::print_on(outputStream* st, size_t scale) const { void InUseChunkStats::verify() const { assert(_word_size >= _committed_words && _committed_words == _used_words + _free_words + _waste_words, - "Sanity: cap " SIZE_FORMAT ", committed " SIZE_FORMAT ", used " SIZE_FORMAT ", free " SIZE_FORMAT ", waste " SIZE_FORMAT ".", + "Sanity: cap %zu, committed %zu, used %zu, free %zu, waste %zu.", _word_size, _committed_words, _used_words, _free_words, _waste_words); } #endif @@ -174,13 +173,13 @@ void ArenaStats::print_on(outputStream* st, size_t scale, bool detailed) const } if (_free_blocks_num > 0) { st->cr_indent(); - st->print("deallocated: " UINTX_FORMAT " blocks with ", _free_blocks_num); + st->print("deallocated: %zu blocks with ", _free_blocks_num); print_scaled_words(st, _free_blocks_word_size, scale); } } else { totals().print_on(st, scale); st->print(", "); - st->print("deallocated: " UINTX_FORMAT " blocks with ", _free_blocks_num); + st->print("deallocated: %zu blocks with ", _free_blocks_num); print_scaled_words(st, _free_blocks_word_size, scale); } } diff --git a/src/hotspot/share/memory/metaspace/printCLDMetaspaceInfoClosure.cpp b/src/hotspot/share/memory/metaspace/printCLDMetaspaceInfoClosure.cpp index 100a009ca8738..8dc16cd177746 100644 --- a/src/hotspot/share/memory/metaspace/printCLDMetaspaceInfoClosure.cpp +++ b/src/hotspot/share/memory/metaspace/printCLDMetaspaceInfoClosure.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderData.inline.hpp" #include "classfile/javaClasses.hpp" #include "memory/classLoaderMetaspace.hpp" @@ -106,7 +105,7 @@ void PrintCLDMetaspaceInfoClosure::do_cld(ClassLoaderData* cld) { // Optionally, print if (_do_print) { - _out->print(UINTX_FORMAT_W(4) ": ", _num_loaders); + _out->print("%4zu: ", _num_loaders); // Print "CLD for [,] instance of " // or "CLD for , loaded by [,] instance of " diff --git a/src/hotspot/share/memory/metaspace/printMetaspaceInfoKlassClosure.cpp b/src/hotspot/share/memory/metaspace/printMetaspaceInfoKlassClosure.cpp index ce975d673f1bc..d91ee55ef9738 100644 --- a/src/hotspot/share/memory/metaspace/printMetaspaceInfoKlassClosure.cpp +++ b/src/hotspot/share/memory/metaspace/printMetaspaceInfoKlassClosure.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, SAP and/or its affiliates. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -22,7 +22,6 @@ * questions. * */ -#include "precompiled.hpp" #include "memory/metaspace/printMetaspaceInfoKlassClosure.hpp" #include "memory/resourceArea.hpp" #include "oops/klass.hpp" @@ -38,7 +37,7 @@ PrintMetaspaceInfoKlassClosure::PrintMetaspaceInfoKlassClosure(outputStream* out void PrintMetaspaceInfoKlassClosure::do_klass(Klass* k) { _cnt++; _out->cr_indent(); - _out->print(UINTX_FORMAT_W(4) ": ", _cnt); + _out->print("%4zu: ", _cnt); // Print a 's' for shared classes _out->put(k->is_shared() ? 's': ' '); diff --git a/src/hotspot/share/memory/metaspace/rootChunkArea.cpp b/src/hotspot/share/memory/metaspace/rootChunkArea.cpp index 24377ec25ad12..a178e12278819 100644 --- a/src/hotspot/share/memory/metaspace/rootChunkArea.cpp +++ b/src/hotspot/share/memory/metaspace/rootChunkArea.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2022 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "logging/log.hpp" #include "memory/allocation.hpp" #include "memory/metaspace/chunkHeaderPool.hpp" diff --git a/src/hotspot/share/memory/metaspace/runningCounters.cpp b/src/hotspot/share/memory/metaspace/runningCounters.cpp index 75fc4b9792c81..db497cf33872a 100644 --- a/src/hotspot/share/memory/metaspace/runningCounters.cpp +++ b/src/hotspot/share/memory/metaspace/runningCounters.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "memory/metaspace/chunkManager.hpp" #include "memory/metaspace/metaspaceContext.hpp" #include "memory/metaspace/runningCounters.hpp" diff --git a/src/hotspot/share/memory/metaspace/testHelpers.cpp b/src/hotspot/share/memory/metaspace/testHelpers.cpp index fdf7bb1ba6084..76fa1e36c4523 100644 --- a/src/hotspot/share/memory/metaspace/testHelpers.cpp +++ b/src/hotspot/share/memory/metaspace/testHelpers.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2021 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "memory/memoryReserver.hpp" #include "memory/metaspace/chunkManager.hpp" #include "memory/metaspace/metaspaceArena.hpp" @@ -78,8 +77,8 @@ MetaspaceTestContext::MetaspaceTestContext(const char* name, size_t commit_limit _commit_limiter(commit_limit == 0 ? max_uintx : commit_limit), // commit_limit == 0 -> no limit _rs() { - assert(is_aligned(reserve_limit, Metaspace::reserve_alignment_words()), "reserve_limit (" SIZE_FORMAT ") " - "not aligned to metaspace reserve alignment (" SIZE_FORMAT ")", + assert(is_aligned(reserve_limit, Metaspace::reserve_alignment_words()), "reserve_limit (%zu) " + "not aligned to metaspace reserve alignment (%zu)", reserve_limit, Metaspace::reserve_alignment_words()); if (reserve_limit > 0) { // have reserve limit -> non-expandable context diff --git a/src/hotspot/share/memory/metaspace/virtualSpaceList.cpp b/src/hotspot/share/memory/metaspace/virtualSpaceList.cpp index 32ceeb45c4fb5..64a17fcbfa9de 100644 --- a/src/hotspot/share/memory/metaspace/virtualSpaceList.cpp +++ b/src/hotspot/share/memory/metaspace/virtualSpaceList.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2021 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "logging/log.hpp" #include "memory/metaspace.hpp" #include "memory/metaspace/chunkManager.hpp" @@ -150,7 +149,7 @@ void VirtualSpaceList::print_on(outputStream* st) const { vsn = vsn->next(); n++; } - st->print_cr("- total %d nodes, " SIZE_FORMAT " reserved words, " SIZE_FORMAT " committed words.", + st->print_cr("- total %d nodes, %zu reserved words, %zu committed words.", n, reserved_words(), committed_words()); } diff --git a/src/hotspot/share/memory/metaspace/virtualSpaceNode.cpp b/src/hotspot/share/memory/metaspace/virtualSpaceNode.cpp index 77b943609bccd..500649dc92665 100644 --- a/src/hotspot/share/memory/metaspace/virtualSpaceNode.cpp +++ b/src/hotspot/share/memory/metaspace/virtualSpaceNode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2021 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/gc_globals.hpp" #include "logging/log.hpp" #include "memory/memoryReserver.hpp" @@ -65,7 +64,7 @@ static void check_pointer_is_aligned_to_commit_granule(const MetaWord* p) { } static void check_word_size_is_aligned_to_commit_granule(size_t word_size) { assert(is_aligned(word_size, Settings::commit_granule_words()), - "Not aligned to commit granule size: " SIZE_FORMAT ".", word_size); + "Not aligned to commit granule size: %zu.", word_size); } #endif @@ -95,7 +94,7 @@ bool VirtualSpaceNode::commit_range(MetaWord* p, size_t word_size) { // were we to commit the given address range completely. const size_t commit_increase_words = word_size - committed_words_in_range; - UL2(debug, "committing range " PTR_FORMAT ".." PTR_FORMAT "(" SIZE_FORMAT " words)", + UL2(debug, "committing range " PTR_FORMAT ".." PTR_FORMAT "(%zu words)", p2i(p), p2i(p + word_size), word_size); if (commit_increase_words == 0) { @@ -118,7 +117,7 @@ bool VirtualSpaceNode::commit_range(MetaWord* p, size_t word_size) { os::pretouch_memory(p, p + word_size); } - UL2(debug, "... committed " SIZE_FORMAT " additional words.", commit_increase_words); + UL2(debug, "... committed %zu additional words.", commit_increase_words); // ... tell commit limiter... _commit_limiter->increase_committed(commit_increase_words); @@ -180,7 +179,7 @@ void VirtualSpaceNode::uncommit_range(MetaWord* p, size_t word_size) { const size_t committed_words_in_range = _commit_mask.get_committed_size_in_range(p, word_size); DEBUG_ONLY(check_word_size_is_aligned_to_commit_granule(committed_words_in_range);) - UL2(debug, "uncommitting range " PTR_FORMAT ".." PTR_FORMAT "(" SIZE_FORMAT " words)", + UL2(debug, "uncommitting range " PTR_FORMAT ".." PTR_FORMAT "(%zu words)", p2i(p), p2i(p + word_size), word_size); if (committed_words_in_range == 0) { @@ -194,7 +193,7 @@ void VirtualSpaceNode::uncommit_range(MetaWord* p, size_t word_size) { fatal("Failed to uncommit metaspace."); } - UL2(debug, "... uncommitted " SIZE_FORMAT " words.", committed_words_in_range); + UL2(debug, "... uncommitted %zu words.", committed_words_in_range); // ... tell commit limiter... _commit_limiter->decrease_committed(committed_words_in_range); @@ -231,7 +230,7 @@ VirtualSpaceNode::VirtualSpaceNode(ReservedSpace rs, bool owns_rs, CommitLimiter _total_reserved_words_counter(reserve_counter), _total_committed_words_counter(commit_counter) { - UL2(debug, "born (word_size " SIZE_FORMAT ").", _word_size); + UL2(debug, "born (word_size %zu).", _word_size); // Update reserved counter in vslist _total_reserved_words_counter->increment_by(_word_size); diff --git a/src/hotspot/share/memory/metaspaceClosure.cpp b/src/hotspot/share/memory/metaspaceClosure.cpp index 50262f5f469cf..46e80ec3a1f5e 100644 --- a/src/hotspot/share/memory/metaspaceClosure.cpp +++ b/src/hotspot/share/memory/metaspaceClosure.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "memory/metaspaceClosure.hpp" void MetaspaceClosure::push_impl(MetaspaceClosure::Ref* ref) { diff --git a/src/hotspot/share/memory/metaspaceCounters.cpp b/src/hotspot/share/memory/metaspaceCounters.cpp index 818172b968458..b57373516f9a5 100644 --- a/src/hotspot/share/memory/metaspaceCounters.cpp +++ b/src/hotspot/share/memory/metaspaceCounters.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "memory/metaspace.hpp" #include "memory/metaspaceCounters.hpp" #include "memory/metaspaceStats.hpp" diff --git a/src/hotspot/share/memory/metaspaceCriticalAllocation.cpp b/src/hotspot/share/memory/metaspaceCriticalAllocation.cpp index a25c4c68f1023..b5eff08e740e7 100644 --- a/src/hotspot/share/memory/metaspaceCriticalAllocation.cpp +++ b/src/hotspot/share/memory/metaspaceCriticalAllocation.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderData.hpp" #include "gc/shared/collectedHeap.hpp" #include "logging/log.hpp" diff --git a/src/hotspot/share/memory/metaspaceTracer.cpp b/src/hotspot/share/memory/metaspaceTracer.cpp index 5899a2140fe29..05dc01c280b0e 100644 --- a/src/hotspot/share/memory/metaspaceTracer.cpp +++ b/src/hotspot/share/memory/metaspaceTracer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderData.hpp" #include "jfr/jfrEvents.hpp" #include "memory/metaspaceTracer.hpp" diff --git a/src/hotspot/share/memory/oopFactory.cpp b/src/hotspot/share/memory/oopFactory.cpp index 440b93a2a4688..83140aa44f5b2 100644 --- a/src/hotspot/share/memory/oopFactory.cpp +++ b/src/hotspot/share/memory/oopFactory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/javaClasses.hpp" #include "classfile/symbolTable.hpp" #include "classfile/vmSymbols.hpp" diff --git a/src/hotspot/share/memory/reservedSpace.cpp b/src/hotspot/share/memory/reservedSpace.cpp index 90bc00843d1fc..712eceac772ab 100644 --- a/src/hotspot/share/memory/reservedSpace.cpp +++ b/src/hotspot/share/memory/reservedSpace.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "memory/reservedSpace.hpp" #include "runtime/os.hpp" #include "utilities/align.hpp" diff --git a/src/hotspot/share/memory/resourceArea.cpp b/src/hotspot/share/memory/resourceArea.cpp index d5a7513ba19d2..7b0de1fd71708 100644 --- a/src/hotspot/share/memory/resourceArea.cpp +++ b/src/hotspot/share/memory/resourceArea.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.inline.hpp" #include "nmt/memTracker.hpp" diff --git a/src/hotspot/share/memory/resourceArea.hpp b/src/hotspot/share/memory/resourceArea.hpp index b9a1904b5078c..29dea9ad2f466 100644 --- a/src/hotspot/share/memory/resourceArea.hpp +++ b/src/hotspot/share/memory/resourceArea.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -107,7 +107,7 @@ class ResourceArea: public Arena { // Reset size before deleting chunks. Otherwise, the total // size could exceed the total chunk size. assert(size_in_bytes() > state._size_in_bytes, - "size: " SIZE_FORMAT ", saved size: " SIZE_FORMAT, + "size: %zu, saved size: %zu", size_in_bytes(), state._size_in_bytes); set_size_in_bytes(state._size_in_bytes); Chunk::next_chop(state._chunk); diff --git a/src/hotspot/share/memory/universe.cpp b/src/hotspot/share/memory/universe.cpp index d8a3ff820dbe9..42d93ebb9ba43 100644 --- a/src/hotspot/share/memory/universe.cpp +++ b/src/hotspot/share/memory/universe.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/archiveHeapLoader.hpp" #include "cds/cdsConfig.hpp" #include "cds/dynamicArchive.hpp" @@ -371,7 +370,7 @@ void Universe::serialize(SerializeClosure* f) { void Universe::check_alignment(uintx size, uintx alignment, const char* name) { if (size < alignment || size % alignment != 0) { vm_exit_during_initialization( - err_msg("Size of %s (" UINTX_FORMAT " bytes) must be aligned to " UINTX_FORMAT " bytes", name, size, alignment)); + err_msg("Size of %s (%zu bytes) must be aligned to %zu bytes", name, size, alignment)); } } @@ -940,7 +939,7 @@ void Universe::initialize_tlab() { ReservedHeapSpace Universe::reserve_heap(size_t heap_size, size_t alignment) { assert(alignment <= Arguments::conservative_max_heap_alignment(), - "actual alignment " SIZE_FORMAT " must be within maximum heap alignment " SIZE_FORMAT, + "actual alignment %zu must be within maximum heap alignment %zu", alignment, Arguments::conservative_max_heap_alignment()); size_t total_reserved = align_up(heap_size, alignment); @@ -985,7 +984,7 @@ ReservedHeapSpace Universe::reserve_heap(size_t heap_size, size_t alignment) { } vm_exit_during_initialization( - err_msg("Could not reserve enough space for " SIZE_FORMAT "KB object heap", + err_msg("Could not reserve enough space for %zuKB object heap", total_reserved/K)); // satisfy compiler diff --git a/src/hotspot/share/memory/virtualspace.cpp b/src/hotspot/share/memory/virtualspace.cpp index 73f74e0b9efcd..42b46294693e5 100644 --- a/src/hotspot/share/memory/virtualspace.cpp +++ b/src/hotspot/share/memory/virtualspace.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/gc_globals.hpp" #include "memory/reservedSpace.hpp" #include "memory/virtualspace.hpp" @@ -203,7 +202,7 @@ static bool commit_expanded(char* start, size_t size, size_t alignment, bool pre debug_only(warning( "INFO: os::commit_memory(" PTR_FORMAT ", " PTR_FORMAT - " size=" SIZE_FORMAT ", executable=%d) failed", + " size=%zu, executable=%d) failed", p2i(start), p2i(start + size), size, executable);) return false; @@ -426,8 +425,8 @@ void VirtualSpace::print_on(outputStream* out) const { out->print ("Virtual space:"); if (special()) out->print(" (pinned in memory)"); out->cr(); - out->print_cr(" - committed: " SIZE_FORMAT, committed_size()); - out->print_cr(" - reserved: " SIZE_FORMAT, reserved_size()); + out->print_cr(" - committed: %zu", committed_size()); + out->print_cr(" - reserved: %zu", reserved_size()); out->print_cr(" - [low, high]: [" PTR_FORMAT ", " PTR_FORMAT "]", p2i(low()), p2i(high())); out->print_cr(" - [low_b, high_b]: [" PTR_FORMAT ", " PTR_FORMAT "]", p2i(low_boundary()), p2i(high_boundary())); } diff --git a/src/hotspot/share/nmt/mallocHeader.cpp b/src/hotspot/share/nmt/mallocHeader.cpp index defe2fc045d41..2b59a2b66480f 100644 --- a/src/hotspot/share/nmt/mallocHeader.cpp +++ b/src/hotspot/share/nmt/mallocHeader.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021, 2022 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -22,7 +22,6 @@ * questions. * */ -#include "precompiled.hpp" #include "nmt/mallocHeader.inline.hpp" #include "nmt/mallocSiteTable.hpp" diff --git a/src/hotspot/share/nmt/mallocHeader.hpp b/src/hotspot/share/nmt/mallocHeader.hpp index 6711c2b993e6f..8472b5f8ce888 100644 --- a/src/hotspot/share/nmt/mallocHeader.hpp +++ b/src/hotspot/share/nmt/mallocHeader.hpp @@ -36,7 +36,7 @@ class outputStream; /* * Malloc tracking header. * - * If NMT is active (state >= minimal), we need to track allocations. A simple and cheap way to + * If NMT is active (state >= summary), we need to track allocations. A simple and cheap way to * do this is by using malloc headers. * * The user allocation is preceded by a header and is immediately followed by a (possibly unaligned) diff --git a/src/hotspot/share/nmt/mallocLimit.cpp b/src/hotspot/share/nmt/mallocLimit.cpp index 5e16a406821ea..ed479725cf9e7 100644 --- a/src/hotspot/share/nmt/mallocLimit.cpp +++ b/src/hotspot/share/nmt/mallocLimit.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2023 SAP SE. All rights reserved. - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * */ -#include "precompiled.hpp" #include "nmt/mallocLimit.hpp" #include "nmt/memTag.hpp" #include "nmt/nmtCommon.hpp" @@ -230,4 +229,3 @@ void MallocLimitHandler::print_on(outputStream* st) { st->print_cr("MallocLimit: unset"); } } - diff --git a/src/hotspot/share/nmt/mallocSiteTable.cpp b/src/hotspot/share/nmt/mallocSiteTable.cpp index 9411f76c491ac..b017e139e24fd 100644 --- a/src/hotspot/share/nmt/mallocSiteTable.cpp +++ b/src/hotspot/share/nmt/mallocSiteTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. * */ -#include "precompiled.hpp" #include "memory/allocation.inline.hpp" #include "nmt/mallocSiteTable.hpp" diff --git a/src/hotspot/share/nmt/mallocTracker.cpp b/src/hotspot/share/nmt/mallocTracker.cpp index 6829db90b4bc1..3c3236d2cbcce 100644 --- a/src/hotspot/share/nmt/mallocTracker.cpp +++ b/src/hotspot/share/nmt/mallocTracker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021, 2023 SAP SE. All rights reserved. * Copyright (c) 2023, 2024, Red Hat, Inc. and/or its affiliates. * @@ -25,7 +25,6 @@ * */ -#include "precompiled.hpp" #include "jvm_io.h" #include "logging/log.hpp" #include "logging/logStream.hpp" @@ -231,6 +230,10 @@ bool MallocTracker::print_pointer_information(const void* p, outputStream* st) { address addr = (address)p; + if (p2u(addr) < MAX2(os::vm_min_address(), (size_t)16 * M)) { + return false; // bail out + } + // Carefully feel your way upwards and try to find a malloc header. Then check if // we are within the block. // We give preference to found live blocks; but if no live block had been found, @@ -239,13 +242,12 @@ bool MallocTracker::print_pointer_information(const void* p, outputStream* st) { const MallocHeader* likely_live_block = nullptr; { const size_t smallest_possible_alignment = sizeof(void*); - const uint8_t* here = align_down(addr, smallest_possible_alignment); - const uint8_t* const end = here - (0x1000 + sizeof(MallocHeader)); // stop searching after 4k + uintptr_t here = (uintptr_t)align_down(addr, smallest_possible_alignment); + uintptr_t end = MAX2(smallest_possible_alignment, here - (0x1000 + sizeof(MallocHeader))); // stop searching after 4k for (; here >= end; here -= smallest_possible_alignment) { // JDK-8306561: cast to a MallocHeader needs to guarantee it can reside in readable memory - if (!os::is_readable_range(here, here + sizeof(MallocHeader))) { - // Probably OOB, give up - break; + if (!os::is_readable_range((void*)here, (void*)(here + sizeof(MallocHeader)))) { + break; // Probably OOB, give up } const MallocHeader* const candidate = (const MallocHeader*)here; if (!candidate->looks_valid()) { @@ -292,7 +294,7 @@ bool MallocTracker::print_pointer_information(const void* p, outputStream* st) { } else { where = "just outside of"; } - st->print_cr(PTR_FORMAT " %s %s malloced block starting at " PTR_FORMAT ", size " SIZE_FORMAT ", tag %s", + st->print_cr(PTR_FORMAT " %s %s malloced block starting at " PTR_FORMAT ", size %zu, tag %s", p2i(p), where, (block->is_dead() ? "dead" : "live"), p2i(block + 1), // lets print the payload start, not the header diff --git a/src/hotspot/share/nmt/memBaseline.cpp b/src/hotspot/share/nmt/memBaseline.cpp index 6f82b2de9f106..6b18dad21bd66 100644 --- a/src/hotspot/share/nmt/memBaseline.cpp +++ b/src/hotspot/share/nmt/memBaseline.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. * */ -#include "precompiled.hpp" #include "classfile/classLoaderDataGraph.inline.hpp" #include "memory/allocation.hpp" @@ -141,7 +140,7 @@ void MemBaseline::baseline_summary() { MallocMemorySummary::snapshot(&_malloc_memory_snapshot); VirtualMemorySummary::snapshot(&_virtual_memory_snapshot); { - MemoryFileTracker::Instance::Locker lock; + MemTracker::NmtVirtualMemoryLocker nvml; MemoryFileTracker::Instance::summary_snapshot(&_virtual_memory_snapshot); } diff --git a/src/hotspot/share/nmt/memMapPrinter.cpp b/src/hotspot/share/nmt/memMapPrinter.cpp index 8f1a4569e222b..db67321fb1d45 100644 --- a/src/hotspot/share/nmt/memMapPrinter.cpp +++ b/src/hotspot/share/nmt/memMapPrinter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, 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. * @@ -23,8 +23,6 @@ * */ -#include "precompiled.hpp" - #if defined(LINUX) || defined(_WIN64) || defined(__APPLE__) #include "gc/shared/collectedHeap.hpp" @@ -173,7 +171,7 @@ static bool vma_touches_thread_stack(const void* from, const void* to, const Thr // kernel. That can happen, e.g., for non-java threads that don't have guard pages. // Therefore we go for the simplest way here and check for intersection between VMA and thread stack. // Note it is possible to encounter a brand new thread that has not yet initialized its stack fields. - return range_intersects(from, to, (const void*)t->stack_end(), (const void*)t->stack_base_or_null()); + return t->stack_base_or_null() != nullptr && range_intersects(from, to, (const void*)t->stack_end(), (const void*)t->stack_base()); } struct GCThreadClosure : public ThreadClosure { @@ -195,7 +193,7 @@ static void print_thread_details(uintx thread_id, const char* name, outputStream // avoid commas and spaces in output to ease post-processing via awk char tmp[64]; stringStream ss(tmp, sizeof(tmp)); - ss.print(":" UINTX_FORMAT "-%s", (uintx)thread_id, name); + ss.print(":%zu-%s", (uintx)thread_id, name); for (int i = 0; tmp[i] != '\0'; i++) { if (!isalnum(tmp[i])) { tmp[i] = '-'; diff --git a/src/hotspot/share/nmt/memReporter.cpp b/src/hotspot/share/nmt/memReporter.cpp index 6ce6206ebcc2a..38c1ab5a6674d 100644 --- a/src/hotspot/share/nmt/memReporter.cpp +++ b/src/hotspot/share/nmt/memReporter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * 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,13 +21,13 @@ * questions. * */ -#include "precompiled.hpp" #include "cds/filemap.hpp" #include "memory/metaspace.hpp" #include "memory/metaspaceUtils.hpp" #include "nmt/mallocTracker.hpp" #include "nmt/memTag.hpp" #include "nmt/memReporter.hpp" +#include "nmt/memTracker.hpp" #include "nmt/memoryFileTracker.hpp" #include "nmt/threadStackTracker.hpp" #include "nmt/virtualMemoryTracker.hpp" @@ -42,8 +42,8 @@ // Diff two counters, express them as signed, with range checks static ssize_t counter_diff(size_t c1, size_t c2) { - assert(c1 <= SSIZE_MAX, "counter out of range: " SIZE_FORMAT ".", c1); - assert(c2 <= SSIZE_MAX, "counter out of range: " SIZE_FORMAT ".", c2); + assert(c1 <= SSIZE_MAX, "counter out of range: %zu.", c1); + assert(c2 <= SSIZE_MAX, "counter out of range: %zu.", c2); if (c1 > SSIZE_MAX || c2 > SSIZE_MAX) { return 0; } @@ -63,10 +63,10 @@ size_t MemReporterBase::committed_total(const MallocMemory* malloc, const Virtua void MemReporterBase::print_total(size_t reserved, size_t committed, size_t peak) const { const char* scale = current_scale(); - output()->print("reserved=" SIZE_FORMAT "%s, committed=" SIZE_FORMAT "%s", + output()->print("reserved=%zu%s, committed=%zu%s", amount_in_current_scale(reserved), scale, amount_in_current_scale(committed), scale); if (peak != 0) { - output()->print(", peak=" SIZE_FORMAT "%s", amount_in_current_scale(peak), scale); + output()->print(", peak=%zu%s", amount_in_current_scale(peak), scale); } } @@ -79,16 +79,16 @@ void MemReporterBase::print_malloc(const MemoryCounter* c, MemTag mem_tag) const const size_t count = c->count(); if (mem_tag != mtNone) { - out->print("(%s" SIZE_FORMAT "%s type=%s", alloc_type, + out->print("(%s%zu%s type=%s", alloc_type, amount_in_current_scale(amount), scale, NMTUtil::tag_to_name(mem_tag)); } else { - out->print("(%s" SIZE_FORMAT "%s", alloc_type, + out->print("(%s%zu%s", alloc_type, amount_in_current_scale(amount), scale); } // blends out mtChunk count number if (count > 0) { - out->print(" #" SIZE_FORMAT "", count); + out->print(" #%zu", count); } out->print(")"); @@ -98,7 +98,7 @@ void MemReporterBase::print_malloc(const MemoryCounter* c, MemTag mem_tag) const out->print_raw(" (at peak)"); } else if (pk_amount > amount) { size_t pk_count = c->peak_count(); - out->print(" (peak=" SIZE_FORMAT "%s #" SIZE_FORMAT ")", + out->print(" (peak=%zu%s #%zu)", amount_in_current_scale(pk_amount), scale, pk_count); } } @@ -106,12 +106,12 @@ void MemReporterBase::print_malloc(const MemoryCounter* c, MemTag mem_tag) const void MemReporterBase::print_virtual_memory(size_t reserved, size_t committed, size_t peak) const { outputStream* out = output(); const char* scale = current_scale(); - out->print("(mmap: reserved=" SIZE_FORMAT "%s, committed=" SIZE_FORMAT "%s, ", + out->print("(mmap: reserved=%zu%s, committed=%zu%s, ", amount_in_current_scale(reserved), scale, amount_in_current_scale(committed), scale); if (peak == committed) { out->print_raw("at peak)"); } else { - out->print("peak=" SIZE_FORMAT "%s)", amount_in_current_scale(peak), scale); + out->print("peak=%zu%s)", amount_in_current_scale(peak), scale); } } @@ -122,7 +122,7 @@ void MemReporterBase::print_arena(const MemoryCounter* c) const { const size_t amount = c->size(); const size_t count = c->count(); - out->print("(arena=" SIZE_FORMAT "%s #" SIZE_FORMAT ")", + out->print("(arena=%zu%s #%zu)", amount_in_current_scale(amount), scale, count); size_t pk_amount = c->peak_size(); @@ -130,14 +130,14 @@ void MemReporterBase::print_arena(const MemoryCounter* c) const { out->print_raw(" (at peak)"); } else if (pk_amount > amount) { size_t pk_count = c->peak_count(); - out->print(" (peak=" SIZE_FORMAT "%s #" SIZE_FORMAT ")", + out->print(" (peak=%zu%s #%zu)", amount_in_current_scale(pk_amount), scale, pk_count); } } void MemReporterBase::print_virtual_memory_region(const char* type, address base, size_t size) const { const char* scale = current_scale(); - output()->print("[" PTR_FORMAT " - " PTR_FORMAT "] %s " SIZE_FORMAT "%s", + output()->print("[" PTR_FORMAT " - " PTR_FORMAT "] %s %zu%s", p2i(base), p2i(base + size), type, amount_in_current_scale(size), scale); } @@ -165,7 +165,7 @@ void MemSummaryReporter::report() { print_total(total_reserved_amount, total_committed_amount); out->cr(); INDENT_BY(7, - out->print_cr("malloc: " SIZE_FORMAT "%s #" SIZE_FORMAT ", peak=" SIZE_FORMAT "%s #" SIZE_FORMAT, + out->print_cr("malloc: %zu%s #%zu, peak=%zu%s #%zu", amount_in_current_scale(total_malloced_bytes), current_scale(), _malloc_snapshot->total_count(), amount_in_current_scale(_malloc_snapshot->total_peak()), @@ -224,7 +224,7 @@ void MemSummaryReporter::report_summary_of_type(MemTag mem_tag, #if INCLUDE_CDS if (mem_tag == mtClassShared) { size_t read_only_bytes = FileMapInfo::readonly_total(); - output()->print(", readonly=" SIZE_FORMAT "%s", + output()->print(", readonly=%zu%s", amount_in_current_scale(read_only_bytes), scale); } #endif @@ -234,14 +234,14 @@ void MemSummaryReporter::report_summary_of_type(MemTag mem_tag, if (mem_tag == mtClass) { // report class count - out->print_cr("(classes #" SIZE_FORMAT ")", (_instance_class_count + _array_class_count)); - out->print_cr("( instance classes #" SIZE_FORMAT ", array classes #" SIZE_FORMAT ")", + out->print_cr("(classes #%zu)", (_instance_class_count + _array_class_count)); + out->print_cr("( instance classes #%zu, array classes #%zu)", _instance_class_count, _array_class_count); } else if (mem_tag == mtThread) { const VirtualMemory* thread_stack_usage = _vm_snapshot->by_type(mtThreadStack); // report thread count - out->print_cr("(threads #" SIZE_FORMAT ")", ThreadStackTracker::thread_count()); + out->print_cr("(threads #%zu)", ThreadStackTracker::thread_count()); out->print("(stack: "); print_total(thread_stack_usage->reserved(), thread_stack_usage->committed(), thread_stack_usage->peak_size()); out->print_cr(")"); @@ -265,7 +265,7 @@ void MemSummaryReporter::report_summary_of_type(MemTag mem_tag, if (mem_tag == mtNMT && amount_in_current_scale(_malloc_snapshot->malloc_overhead()) > 0) { - out->print_cr("(tracking overhead=" SIZE_FORMAT "%s)", + out->print_cr("(tracking overhead=%zu%s)", amount_in_current_scale(_malloc_snapshot->malloc_overhead()), scale); } else if (mem_tag == mtClass) { // Metadata information @@ -301,8 +301,8 @@ void MemSummaryReporter::report_metadata(Metaspace::MetadataType type) const { out->print("( "); print_total(stats.reserved(), stats.committed()); out->print_cr(")"); - out->print_cr("( used=" SIZE_FORMAT "%s)", amount_in_current_scale(stats.used()), scale); - out->print_cr("( waste=" SIZE_FORMAT "%s =%2.2f%%)", amount_in_current_scale(waste), + out->print_cr("( used=%zu%s)", amount_in_current_scale(stats.used()), scale); + out->print_cr("( waste=%zu%s =%2.2f%%)", amount_in_current_scale(waste), scale, waste_percentage); } @@ -465,7 +465,7 @@ void MemDetailReporter::report_virtual_memory_region(const ReservedMemoryRegion* void MemDetailReporter::report_memory_file_allocations() { stringStream st; { - MemoryFileTracker::Instance::Locker lock; + MemTracker::NmtVirtualMemoryLocker nvml; MemoryFileTracker::Instance::print_all_reports_on(&st, scale()); } output()->print_raw(st.freeze()); @@ -540,7 +540,7 @@ void MemSummaryDiffReporter::print_malloc_diff(size_t current_amount, size_t cur outputStream* out = output(); const char* alloc_tag = (mem_tag == mtThread) ? "" : "malloc="; - out->print("%s" SIZE_FORMAT "%s", alloc_tag, amount_in_current_scale(current_amount), scale); + out->print("%s%zu%s", alloc_tag, amount_in_current_scale(current_amount), scale); // Report type only if it is valid and not under "thread" category if (mem_tag != mtNone && mem_tag != mtThread) { out->print(" type=%s", NMTUtil::tag_to_name(mem_tag)); @@ -551,10 +551,10 @@ void MemSummaryDiffReporter::print_malloc_diff(size_t current_amount, size_t cur out->print(" " INT64_PLUS_FORMAT "%s", amount_diff, scale); } if (current_count > 0) { - out->print(" #" SIZE_FORMAT "", current_count); + out->print(" #%zu", current_count); const ssize_t delta_count = counter_diff(current_count, early_count); if (delta_count != 0) { - out->print(" " SSIZE_PLUS_FORMAT, delta_count); + out->print(" %+zd", delta_count); } } } @@ -563,16 +563,16 @@ void MemSummaryDiffReporter::print_arena_diff(size_t current_amount, size_t curr size_t early_amount, size_t early_count) const { const char* scale = current_scale(); outputStream* out = output(); - out->print("arena=" SIZE_FORMAT "%s", amount_in_current_scale(current_amount), scale); + out->print("arena=%zu%s", amount_in_current_scale(current_amount), scale); int64_t amount_diff = diff_in_current_scale(current_amount, early_amount); if (amount_diff != 0) { out->print(" " INT64_PLUS_FORMAT "%s", amount_diff, scale); } - out->print(" #" SIZE_FORMAT "", current_count); + out->print(" #%zu", current_count); const ssize_t delta_count = counter_diff(current_count, early_count); if (delta_count != 0) { - out->print(" " SSIZE_PLUS_FORMAT, delta_count); + out->print(" %+zd", delta_count); } } @@ -580,13 +580,13 @@ void MemSummaryDiffReporter::print_virtual_memory_diff(size_t current_reserved, size_t early_reserved, size_t early_committed) const { const char* scale = current_scale(); outputStream* out = output(); - out->print("reserved=" SIZE_FORMAT "%s", amount_in_current_scale(current_reserved), scale); + out->print("reserved=%zu%s", amount_in_current_scale(current_reserved), scale); int64_t reserved_diff = diff_in_current_scale(current_reserved, early_reserved); if (reserved_diff != 0) { out->print(" " INT64_PLUS_FORMAT "%s", reserved_diff, scale); } - out->print(", committed=" SIZE_FORMAT "%s", amount_in_current_scale(current_committed), scale); + out->print(", committed=%zu%s", amount_in_current_scale(current_committed), scale); int64_t committed_diff = diff_in_current_scale(current_committed, early_committed); if (committed_diff != 0) { out->print(" " INT64_PLUS_FORMAT "%s", committed_diff, scale); @@ -646,34 +646,34 @@ void MemSummaryDiffReporter::diff_summary_of_type(MemTag mem_tag, // detail lines if (mem_tag == mtClass) { // report class count - out->print("(classes #" SIZE_FORMAT, _current_baseline.class_count()); + out->print("(classes #%zu", _current_baseline.class_count()); const ssize_t class_count_diff = counter_diff(_current_baseline.class_count(), _early_baseline.class_count()); if (class_count_diff != 0) { - out->print(" " SSIZE_PLUS_FORMAT, class_count_diff); + out->print(" %+zd", class_count_diff); } out->print_cr(")"); - out->print("( instance classes #" SIZE_FORMAT, _current_baseline.instance_class_count()); + out->print("( instance classes #%zu", _current_baseline.instance_class_count()); const ssize_t instance_class_count_diff = counter_diff(_current_baseline.instance_class_count(), _early_baseline.instance_class_count()); if (instance_class_count_diff != 0) { - out->print(" " SSIZE_PLUS_FORMAT, instance_class_count_diff); + out->print(" %+zd", instance_class_count_diff); } - out->print(", array classes #" SIZE_FORMAT, _current_baseline.array_class_count()); + out->print(", array classes #%zu", _current_baseline.array_class_count()); const ssize_t array_class_count_diff = counter_diff(_current_baseline.array_class_count(), _early_baseline.array_class_count()); if (array_class_count_diff != 0) { - out->print(" " SSIZE_PLUS_FORMAT, array_class_count_diff); + out->print(" %+zd", array_class_count_diff); } out->print_cr(")"); } else if (mem_tag == mtThread) { // report thread count - out->print("(threads #" SIZE_FORMAT, _current_baseline.thread_count()); + out->print("(threads #%zu", _current_baseline.thread_count()); const ssize_t thread_count_diff = counter_diff(_current_baseline.thread_count(), _early_baseline.thread_count()); if (thread_count_diff != 0) { - out->print(" " SSIZE_PLUS_FORMAT, thread_count_diff); + out->print(" %+zd", thread_count_diff); } out->print_cr(")"); @@ -724,7 +724,7 @@ void MemSummaryDiffReporter::diff_summary_of_type(MemTag mem_tag, size_t current_tracking_overhead = amount_in_current_scale(_current_baseline.malloc_tracking_overhead()); size_t early_tracking_overhead = amount_in_current_scale(_early_baseline.malloc_tracking_overhead()); - out->print("(tracking overhead=" SIZE_FORMAT "%s", + out->print("(tracking overhead=%zu%s", amount_in_current_scale(_current_baseline.malloc_tracking_overhead()), scale); int64_t overhead_diff = diff_in_current_scale(_current_baseline.malloc_tracking_overhead(), @@ -770,7 +770,7 @@ void MemSummaryDiffReporter::print_metaspace_diff(const char* header, int64_t diff_waste = diff_in_current_scale(current_waste, early_waste); // Diff used - out->print("( used=" SIZE_FORMAT "%s", + out->print("( used=%zu%s", amount_in_current_scale(current_stats.used()), scale); if (diff_used != 0) { out->print(" " INT64_PLUS_FORMAT "%s", diff_used, scale); @@ -780,7 +780,7 @@ void MemSummaryDiffReporter::print_metaspace_diff(const char* header, // Diff waste const float waste_percentage = current_stats.committed() == 0 ? 0.0f : ((float)current_waste * 100.0f) / (float)current_stats.committed(); - out->print("( waste=" SIZE_FORMAT "%s =%2.2f%%", + out->print("( waste=%zu%s =%2.2f%%", amount_in_current_scale(current_waste), scale, waste_percentage); if (diff_waste != 0) { out->print(" " INT64_PLUS_FORMAT "%s", diff_waste, scale); diff --git a/src/hotspot/share/nmt/memTracker.cpp b/src/hotspot/share/nmt/memTracker.cpp index fb9c9a50db1f7..8f84948fa5ce4 100644 --- a/src/hotspot/share/nmt/memTracker.cpp +++ b/src/hotspot/share/nmt/memTracker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2023 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -22,7 +22,6 @@ * questions. * */ -#include "precompiled.hpp" #include "jvm.h" #include "logging/log.hpp" #include "logging/logStream.hpp" @@ -52,6 +51,8 @@ NMT_TrackingLevel MemTracker::_tracking_level = NMT_unknown; MemBaseline MemTracker::_baseline; +bool MemTracker::NmtVirtualMemoryLocker::_safe_to_use; + void MemTracker::initialize() { bool rc = true; assert(_tracking_level == NMT_unknown, "only call once"); diff --git a/src/hotspot/share/nmt/memTracker.hpp b/src/hotspot/share/nmt/memTracker.hpp index 6ba1db2e7ffe6..119720448d9ee 100644 --- a/src/hotspot/share/nmt/memTracker.hpp +++ b/src/hotspot/share/nmt/memTracker.hpp @@ -31,7 +31,6 @@ #include "nmt/threadStackTracker.hpp" #include "nmt/virtualMemoryTracker.hpp" #include "runtime/mutexLocker.hpp" -#include "runtime/threadCritical.hpp" #include "utilities/debug.hpp" #include "utilities/nativeCallStack.hpp" @@ -62,6 +61,12 @@ class MemTracker : AllStatic { return _tracking_level != NMT_unknown; } + // This may be called on a detached thread during VM init, so we should check that first. + static inline void assert_locked() { + assert(!NmtVirtualMemoryLocker::is_safe_to_use() || NmtVirtualMemory_lock->owned_by_self(), + "should have acquired NmtVirtualMemory_lock"); + } + static inline NMT_TrackingLevel tracking_level() { return _tracking_level; } @@ -125,7 +130,7 @@ class MemTracker : AllStatic { assert_post_init(); if (!enabled()) return; if (addr != nullptr) { - ThreadCritical tc; + NmtVirtualMemoryLocker nvml; VirtualMemoryTracker::add_reserved_region((address)addr, size, stack, mem_tag); } } @@ -151,7 +156,7 @@ class MemTracker : AllStatic { assert_post_init(); if (!enabled()) return; if (addr != nullptr) { - ThreadCritical tc; + NmtVirtualMemoryLocker nvml; VirtualMemoryTracker::add_reserved_region((address)addr, size, stack, mem_tag); VirtualMemoryTracker::add_committed_region((address)addr, size, stack); } @@ -162,7 +167,7 @@ class MemTracker : AllStatic { assert_post_init(); if (!enabled()) return; if (addr != nullptr) { - ThreadCritical tc; + NmtVirtualMemoryLocker nvml; VirtualMemoryTracker::add_committed_region((address)addr, size, stack); } } @@ -170,7 +175,7 @@ class MemTracker : AllStatic { static inline MemoryFileTracker::MemoryFile* register_file(const char* descriptive_name) { assert_post_init(); if (!enabled()) return nullptr; - MemoryFileTracker::Instance::Locker lock; + NmtVirtualMemoryLocker nvml; return MemoryFileTracker::Instance::make_file(descriptive_name); } @@ -178,7 +183,7 @@ class MemTracker : AllStatic { assert_post_init(); if (!enabled()) return; assert(file != nullptr, "must be"); - MemoryFileTracker::Instance::Locker lock; + NmtVirtualMemoryLocker nvml; MemoryFileTracker::Instance::free_file(file); } @@ -187,7 +192,7 @@ class MemTracker : AllStatic { assert_post_init(); if (!enabled()) return; assert(file != nullptr, "must be"); - MemoryFileTracker::Instance::Locker lock; + NmtVirtualMemoryLocker nvml; MemoryFileTracker::Instance::allocate_memory(file, offset, size, stack, mem_tag); } @@ -196,7 +201,7 @@ class MemTracker : AllStatic { assert_post_init(); if (!enabled()) return; assert(file != nullptr, "must be"); - MemoryFileTracker::Instance::Locker lock; + NmtVirtualMemoryLocker nvml; MemoryFileTracker::Instance::free_memory(file, offset, size); } @@ -210,7 +215,7 @@ class MemTracker : AllStatic { assert_post_init(); if (!enabled()) return; if (addr != nullptr) { - ThreadCritical tc; + NmtVirtualMemoryLocker nvml; VirtualMemoryTracker::split_reserved_region((address)addr, size, split, mem_tag, split_tag); } } @@ -219,7 +224,7 @@ class MemTracker : AllStatic { assert_post_init(); if (!enabled()) return; if (addr != nullptr) { - ThreadCritical tc; + NmtVirtualMemoryLocker nvml; VirtualMemoryTracker::set_reserved_region_type((address)addr, mem_tag); } } @@ -269,6 +274,39 @@ class MemTracker : AllStatic { // and return true; false if not found. static bool print_containing_region(const void* p, outputStream* out); + /* + * NmtVirtualMemoryLocker is similar to MutexLocker but can be used during VM init before mutexes are ready or + * current thread has been assigned. Performs no action during VM init. + * + * Unlike malloc, NMT requires locking for virtual memory operations. This is because it must synchronize the usage + * of global data structures used for modelling the effect of virtual memory operations. + * It is important that locking is used such that the actual OS memory operations (mmap) are done atomically with the + * corresponding NMT accounting (updating the internal model). Currently, this is not the case in all situations + * (see JDK-8341491), but this should be changed in the future. + * + * An issue with using Mutex is that NMT is used early during VM initialization before mutexes are initialized + * and current thread is attached. Mutexes do not work under those conditions, so we must use a flag to avoid + * attempting to lock until initialization is finished. Lack of synchronization here should not be a problem since it + * is single threaded at that point in time anyway. + */ + class NmtVirtualMemoryLocker: StackObj { + // Returns true if it is safe to start using this locker. + static bool _safe_to_use; + ConditionalMutexLocker _cml; + + public: + NmtVirtualMemoryLocker(): _cml(NmtVirtualMemory_lock, _safe_to_use, Mutex::_no_safepoint_check_flag){} + + static inline bool is_safe_to_use() { + return _safe_to_use; + } + + // Set in Threads::create_vm once threads and mutexes have been initialized. + static inline void set_safe_to_use() { + _safe_to_use = true; + } + }; + private: static void report(bool summary_only, outputStream* output, size_t scale); @@ -277,8 +315,6 @@ class MemTracker : AllStatic { static NMT_TrackingLevel _tracking_level; // Stored baseline static MemBaseline _baseline; - // Query lock - static Mutex* _query_lock; }; #endif // SHARE_NMT_MEMTRACKER_HPP diff --git a/src/hotspot/share/nmt/memoryFileTracker.cpp b/src/hotspot/share/nmt/memoryFileTracker.cpp index 0777d5aafc32d..f4dac97d2dab7 100644 --- a/src/hotspot/share/nmt/memoryFileTracker.cpp +++ b/src/hotspot/share/nmt/memoryFileTracker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * 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,20 +22,17 @@ * */ -#include "precompiled.hpp" #include "memory/allocation.hpp" #include "nmt/memTracker.hpp" #include "nmt/memoryFileTracker.hpp" #include "nmt/nmtCommon.hpp" #include "nmt/nmtNativeCallStackStorage.hpp" #include "nmt/vmatree.hpp" -#include "runtime/mutex.hpp" #include "utilities/growableArray.hpp" #include "utilities/nativeCallStack.hpp" #include "utilities/ostream.hpp" MemoryFileTracker* MemoryFileTracker::Instance::_tracker = nullptr; -PlatformMutex* MemoryFileTracker::Instance::_mutex = nullptr; MemoryFileTracker::MemoryFileTracker(bool is_detailed_mode) : _stack_storage(is_detailed_mode), _files() {} @@ -87,7 +84,7 @@ void MemoryFileTracker::print_report_on(const MemoryFile* file, outputStream* st if (prev->val().out.type() == VMATree::StateType::Committed) { const VMATree::position& start_addr = prev->key(); const VMATree::position& end_addr = current->key(); - stream->print_cr("[" PTR_FORMAT " - " PTR_FORMAT "] allocated " SIZE_FORMAT "%s" " for %s from", + stream->print_cr("[" PTR_FORMAT " - " PTR_FORMAT "] allocated %zu%s" " for %s from", start_addr, end_addr, NMTUtil::amount_in_scale(end_addr - start_addr, scale), NMTUtil::scale_name(scale), @@ -132,7 +129,6 @@ bool MemoryFileTracker::Instance::initialize(NMT_TrackingLevel tracking_level) { _tracker = static_cast(os::malloc(sizeof(MemoryFileTracker), mtNMT)); if (_tracker == nullptr) return false; new (_tracker) MemoryFileTracker(tracking_level == NMT_TrackingLevel::NMT_detail); - _mutex = new PlatformMutex(); return true; } @@ -189,11 +185,3 @@ void MemoryFileTracker::summary_snapshot(VirtualMemorySnapshot* snapshot) const void MemoryFileTracker::Instance::summary_snapshot(VirtualMemorySnapshot* snapshot) { _tracker->summary_snapshot(snapshot); } - -MemoryFileTracker::Instance::Locker::Locker() { - MemoryFileTracker::Instance::_mutex->lock(); -} - -MemoryFileTracker::Instance::Locker::~Locker() { - MemoryFileTracker::Instance::_mutex->unlock(); -} diff --git a/src/hotspot/share/nmt/memoryFileTracker.hpp b/src/hotspot/share/nmt/memoryFileTracker.hpp index 94f9cb2006cdc..035e9b466e264 100644 --- a/src/hotspot/share/nmt/memoryFileTracker.hpp +++ b/src/hotspot/share/nmt/memoryFileTracker.hpp @@ -30,7 +30,6 @@ #include "nmt/nmtNativeCallStackStorage.hpp" #include "nmt/virtualMemoryTracker.hpp" #include "nmt/vmatree.hpp" -#include "runtime/mutex.hpp" #include "runtime/os.inline.hpp" #include "utilities/growableArray.hpp" #include "utilities/nativeCallStack.hpp" @@ -93,14 +92,8 @@ class MemoryFileTracker { class Instance : public AllStatic { static MemoryFileTracker* _tracker; - static PlatformMutex* _mutex; public: - class Locker : public StackObj { - public: - Locker(); - ~Locker(); - }; static bool initialize(NMT_TrackingLevel tracking_level); diff --git a/src/hotspot/share/nmt/nativeCallStackPrinter.cpp b/src/hotspot/share/nmt/nativeCallStackPrinter.cpp index 70031698a7d80..c2a54961abe76 100644 --- a/src/hotspot/share/nmt/nativeCallStackPrinter.cpp +++ b/src/hotspot/share/nmt/nativeCallStackPrinter.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2024, Red Hat, Inc. All rights reserved. - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * */ -#include "precompiled.hpp" #include "logging/log.hpp" #include "nmt/nativeCallStackPrinter.hpp" #include "utilities/globalDefinitions.hpp" diff --git a/src/hotspot/share/nmt/nmtCommon.cpp b/src/hotspot/share/nmt/nmtCommon.cpp index 24a4cb1105adf..318762a7ce768 100644 --- a/src/hotspot/share/nmt/nmtCommon.cpp +++ b/src/hotspot/share/nmt/nmtCommon.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved. * 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 "precompiled.hpp" + #include "nmt/nmtCommon.hpp" #include "utilities/globalDefinitions.hpp" diff --git a/src/hotspot/share/nmt/nmtDCmd.cpp b/src/hotspot/share/nmt/nmtDCmd.cpp index cb42212ba6b15..0c6dc5241a2a3 100644 --- a/src/hotspot/share/nmt/nmtDCmd.cpp +++ b/src/hotspot/share/nmt/nmtDCmd.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. * */ -#include "precompiled.hpp" #include "memory/resourceArea.hpp" #include "nmt/memReporter.hpp" #include "nmt/memTracker.hpp" diff --git a/src/hotspot/share/nmt/nmtNativeCallStackStorage.cpp b/src/hotspot/share/nmt/nmtNativeCallStackStorage.cpp index fd7a67a358e87..3e5c1d2f0ea65 100644 --- a/src/hotspot/share/nmt/nmtNativeCallStackStorage.cpp +++ b/src/hotspot/share/nmt/nmtNativeCallStackStorage.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "memory/allocation.hpp" #include "nmt/nmtNativeCallStackStorage.hpp" diff --git a/src/hotspot/share/nmt/nmtPreInit.cpp b/src/hotspot/share/nmt/nmtPreInit.cpp index 0aa74566f42cb..34a2d8dd7d2ee 100644 --- a/src/hotspot/share/nmt/nmtPreInit.cpp +++ b/src/hotspot/share/nmt/nmtPreInit.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2022, 2023 SAP SE. All rights reserved. - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * */ -#include "precompiled.hpp" #include "nmt/nmtPreInit.hpp" #include "runtime/os.hpp" #include "utilities/align.hpp" @@ -132,7 +131,7 @@ void NMTPreInitAllocationTable::print_state(outputStream* st) const { num_entries += chain_len; longest_chain = MAX2(chain_len, longest_chain); } - st->print("entries: %d (primary: %d, empties: %d), sum bytes: " SIZE_FORMAT + st->print("entries: %d (primary: %d, empties: %d), sum bytes: %zu" ", longest chain length: %d", num_entries, num_primary_entries, table_size - num_primary_entries, sum_bytes, longest_chain); @@ -143,7 +142,7 @@ void NMTPreInitAllocationTable::print_map(outputStream* st) const { for (int i = 0; i < table_size; i++) { st->print("[%d]: ", i); for (NMTPreInitAllocation* a = _entries[i]; a != nullptr; a = a->next) { - st->print( PTR_FORMAT "(" SIZE_FORMAT ") ", p2i(a->payload), a->size); + st->print( PTR_FORMAT "(%zu) ", p2i(a->payload), a->size); } st->cr(); } diff --git a/src/hotspot/share/nmt/nmtTreap.hpp b/src/hotspot/share/nmt/nmtTreap.hpp index b6be654f12777..e7cc91eefd9a1 100644 --- a/src/hotspot/share/nmt/nmtTreap.hpp +++ b/src/hotspot/share/nmt/nmtTreap.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * 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,7 @@ #include "utilities/growableArray.hpp" #include "utilities/macros.hpp" #include "utilities/powerOfTwo.hpp" +#include // A Treap is a self-balanced binary tree where each node is equipped with a // priority. It adds the invariant that the priority of a parent P is strictly larger @@ -228,7 +229,9 @@ class Treap { : _allocator(), _root(nullptr), _prng_seed(_initial_seed), - _node_count(0) {} + _node_count(0) { + static_assert(std::is_trivially_destructible::value, "must be"); + } ~Treap() { this->remove_all(); @@ -266,6 +269,7 @@ class Treap { if (second_split.right != nullptr) { // The key k existed, we delete it. _node_count--; + second_split.right->_value.~V(); _allocator.free(second_split.right); } // Merge together everything @@ -283,6 +287,7 @@ class Treap { if (head == nullptr) continue; to_delete.push(head->_left); to_delete.push(head->_right); + head->_value.~V(); _allocator.free(head); } _root = nullptr; diff --git a/src/hotspot/share/nmt/nmtUsage.cpp b/src/hotspot/share/nmt/nmtUsage.cpp index aa1d681b8a531..771f507616089 100644 --- a/src/hotspot/share/nmt/nmtUsage.cpp +++ b/src/hotspot/share/nmt/nmtUsage.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * 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,9 +22,9 @@ * */ -#include "precompiled.hpp" #include "nmt/mallocTracker.hpp" #include "nmt/memoryFileTracker.hpp" +#include "nmt/memTracker.hpp" #include "nmt/nmtCommon.hpp" #include "nmt/nmtUsage.hpp" #include "nmt/threadStackTracker.hpp" @@ -94,7 +94,7 @@ void NMTUsage::update_vm_usage() { { // MemoryFileTracker addition using MFT = MemoryFileTracker::Instance; - MFT::Locker lock; + MemTracker::NmtVirtualMemoryLocker nvml; MFT::iterate_summary([&](MemTag tag, const VirtualMemory* vm) { int i = NMTUtil::tag_to_index(tag); _vm_by_type[i].committed += vm->committed(); diff --git a/src/hotspot/share/nmt/threadStackTracker.cpp b/src/hotspot/share/nmt/threadStackTracker.cpp index 6f112fa8fc5c2..dabb23f0801e3 100644 --- a/src/hotspot/share/nmt/threadStackTracker.cpp +++ b/src/hotspot/share/nmt/threadStackTracker.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2019, 2024, Red Hat, Inc. All rights reserved. - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * 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,13 +23,11 @@ * */ -#include "precompiled.hpp" #include "nmt/memTracker.hpp" #include "nmt/threadStackTracker.hpp" #include "nmt/virtualMemoryTracker.hpp" #include "runtime/os.hpp" -#include "runtime/threadCritical.hpp" #include "utilities/align.hpp" #include "utilities/debug.hpp" #include "utilities/globalDefinitions.hpp" @@ -53,7 +51,7 @@ void ThreadStackTracker::new_thread_stack(void* base, size_t size, const NativeC assert(base != nullptr, "Should have been filtered"); align_thread_stack_boundaries_inward(base, size); - ThreadCritical tc; + MemTracker::NmtVirtualMemoryLocker nvml; VirtualMemoryTracker::add_reserved_region((address)base, size, stack, mtThreadStack); _thread_count++; } @@ -63,7 +61,7 @@ void ThreadStackTracker::delete_thread_stack(void* base, size_t size) { assert(base != nullptr, "Should have been filtered"); align_thread_stack_boundaries_inward(base, size); - ThreadCritical tc; + MemTracker::NmtVirtualMemoryLocker nvml; VirtualMemoryTracker::remove_released_region((address)base, size); _thread_count--; } diff --git a/src/hotspot/share/nmt/virtualMemoryTracker.cpp b/src/hotspot/share/nmt/virtualMemoryTracker.cpp index d298381f1038f..231ca6f8875bb 100644 --- a/src/hotspot/share/nmt/virtualMemoryTracker.cpp +++ b/src/hotspot/share/nmt/virtualMemoryTracker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. * */ -#include "precompiled.hpp" #include "logging/log.hpp" #include "memory/metaspaceStats.hpp" #include "memory/metaspaceUtils.hpp" @@ -30,7 +29,6 @@ #include "nmt/threadStackTracker.hpp" #include "nmt/virtualMemoryTracker.hpp" #include "runtime/os.hpp" -#include "runtime/threadCritical.hpp" #include "utilities/ostream.hpp" VirtualMemorySnapshot VirtualMemorySummary::_snapshot; @@ -338,10 +336,12 @@ bool VirtualMemoryTracker::add_reserved_region(address base_addr, size_t size, assert(base_addr != nullptr, "Invalid address"); assert(size > 0, "Invalid size"); assert(_reserved_regions != nullptr, "Sanity check"); + MemTracker::assert_locked(); + ReservedMemoryRegion rgn(base_addr, size, stack, mem_tag); ReservedMemoryRegion* reserved_rgn = _reserved_regions->find(rgn); - log_debug(nmt)("Add reserved region \'%s\' (" INTPTR_FORMAT ", " SIZE_FORMAT ")", + log_debug(nmt)("Add reserved region \'%s\' (" INTPTR_FORMAT ", %zu)", rgn.mem_tag_name(), p2i(rgn.base()), rgn.size()); if (reserved_rgn == nullptr) { VirtualMemorySummary::record_reserved_memory(size, mem_tag); @@ -381,7 +381,7 @@ bool VirtualMemoryTracker::add_reserved_region(address base_addr, size_t size, // CDS reserves the whole region for mapping CDS archive, then maps each section into the region. // NMT reports CDS as a whole. if (reserved_rgn->mem_tag() == mtClassShared) { - log_debug(nmt)("CDS reserved region \'%s\' as a whole (" INTPTR_FORMAT ", " SIZE_FORMAT ")", + log_debug(nmt)("CDS reserved region \'%s\' as a whole (" INTPTR_FORMAT ", %zu)", reserved_rgn->mem_tag_name(), p2i(reserved_rgn->base()), reserved_rgn->size()); assert(reserved_rgn->contain_region(base_addr, size), "Reserved CDS region should contain this mapping region"); return true; @@ -390,7 +390,7 @@ bool VirtualMemoryTracker::add_reserved_region(address base_addr, size_t size, // Mapped CDS string region. // The string region(s) is part of the java heap. if (reserved_rgn->mem_tag() == mtJavaHeap) { - log_debug(nmt)("CDS reserved region \'%s\' as a whole (" INTPTR_FORMAT ", " SIZE_FORMAT ")", + log_debug(nmt)("CDS reserved region \'%s\' as a whole (" INTPTR_FORMAT ", %zu)", reserved_rgn->mem_tag_name(), p2i(reserved_rgn->base()), reserved_rgn->size()); assert(reserved_rgn->contain_region(base_addr, size), "Reserved heap region should contain this mapping region"); return true; @@ -416,6 +416,7 @@ bool VirtualMemoryTracker::add_reserved_region(address base_addr, size_t size, void VirtualMemoryTracker::set_reserved_region_type(address addr, MemTag mem_tag) { assert(addr != nullptr, "Invalid address"); assert(_reserved_regions != nullptr, "Sanity check"); + MemTracker::assert_locked(); ReservedMemoryRegion rgn(addr, 1); ReservedMemoryRegion* reserved_rgn = _reserved_regions->find(rgn); @@ -434,18 +435,19 @@ bool VirtualMemoryTracker::add_committed_region(address addr, size_t size, assert(addr != nullptr, "Invalid address"); assert(size > 0, "Invalid size"); assert(_reserved_regions != nullptr, "Sanity check"); + MemTracker::assert_locked(); ReservedMemoryRegion rgn(addr, size); ReservedMemoryRegion* reserved_rgn = _reserved_regions->find(rgn); if (reserved_rgn == nullptr) { - log_debug(nmt)("Add committed region \'%s\', No reserved region found for (" INTPTR_FORMAT ", " SIZE_FORMAT ")", + log_debug(nmt)("Add committed region \'%s\', No reserved region found for (" INTPTR_FORMAT ", %zu)", rgn.mem_tag_name(), p2i(rgn.base()), rgn.size()); } assert(reserved_rgn != nullptr, "Add committed region, No reserved region found"); assert(reserved_rgn->contain_region(addr, size), "Not completely contained"); bool result = reserved_rgn->add_committed_region(addr, size, stack); - log_debug(nmt)("Add committed region \'%s\'(" INTPTR_FORMAT ", " SIZE_FORMAT ") %s", + log_debug(nmt)("Add committed region \'%s\'(" INTPTR_FORMAT ", %zu) %s", reserved_rgn->mem_tag_name(), p2i(rgn.base()), rgn.size(), (result ? "Succeeded" : "Failed")); return result; } @@ -454,14 +456,15 @@ bool VirtualMemoryTracker::remove_uncommitted_region(address addr, size_t size) assert(addr != nullptr, "Invalid address"); assert(size > 0, "Invalid size"); assert(_reserved_regions != nullptr, "Sanity check"); + MemTracker::assert_locked(); ReservedMemoryRegion rgn(addr, size); ReservedMemoryRegion* reserved_rgn = _reserved_regions->find(rgn); - assert(reserved_rgn != nullptr, "No reserved region (" INTPTR_FORMAT ", " SIZE_FORMAT ")", p2i(addr), size); + assert(reserved_rgn != nullptr, "No reserved region (" INTPTR_FORMAT ", %zu)", p2i(addr), size); assert(reserved_rgn->contain_region(addr, size), "Not completely contained"); const char* type_name = reserved_rgn->mem_tag_name(); // after remove, info is not complete bool result = reserved_rgn->remove_uncommitted_region(addr, size); - log_debug(nmt)("Removed uncommitted region \'%s\' (" INTPTR_FORMAT ", " SIZE_FORMAT ") %s", + log_debug(nmt)("Removed uncommitted region \'%s\' (" INTPTR_FORMAT ", %zu) %s", type_name, p2i(addr), size, (result ? " Succeeded" : "Failed")); return result; } @@ -469,11 +472,12 @@ bool VirtualMemoryTracker::remove_uncommitted_region(address addr, size_t size) bool VirtualMemoryTracker::remove_released_region(ReservedMemoryRegion* rgn) { assert(rgn != nullptr, "Sanity check"); assert(_reserved_regions != nullptr, "Sanity check"); + MemTracker::assert_locked(); // uncommit regions within the released region ReservedMemoryRegion backup(*rgn); bool result = rgn->remove_uncommitted_region(rgn->base(), rgn->size()); - log_debug(nmt)("Remove uncommitted region \'%s\' (" INTPTR_FORMAT ", " SIZE_FORMAT ") %s", + log_debug(nmt)("Remove uncommitted region \'%s\' (" INTPTR_FORMAT ", %zu) %s", backup.mem_tag_name(), p2i(backup.base()), backup.size(), (result ? "Succeeded" : "Failed")); if (!result) { return false; @@ -481,7 +485,7 @@ bool VirtualMemoryTracker::remove_released_region(ReservedMemoryRegion* rgn) { VirtualMemorySummary::record_released_memory(rgn->size(), rgn->mem_tag()); result = _reserved_regions->remove(*rgn); - log_debug(nmt)("Removed region \'%s\' (" INTPTR_FORMAT ", " SIZE_FORMAT ") from _reserved_regions %s" , + log_debug(nmt)("Removed region \'%s\' (" INTPTR_FORMAT ", %zu) from _reserved_regions %s" , backup.mem_tag_name(), p2i(backup.base()), backup.size(), (result ? "Succeeded" : "Failed")); return result; } @@ -490,12 +494,13 @@ bool VirtualMemoryTracker::remove_released_region(address addr, size_t size) { assert(addr != nullptr, "Invalid address"); assert(size > 0, "Invalid size"); assert(_reserved_regions != nullptr, "Sanity check"); + MemTracker::assert_locked(); ReservedMemoryRegion rgn(addr, size); ReservedMemoryRegion* reserved_rgn = _reserved_regions->find(rgn); if (reserved_rgn == nullptr) { - log_debug(nmt)("No reserved region found for (" INTPTR_FORMAT ", " SIZE_FORMAT ")!", + log_debug(nmt)("No reserved region found for (" INTPTR_FORMAT ", %zu)!", p2i(rgn.base()), rgn.size()); } assert(reserved_rgn != nullptr, "No reserved region"); @@ -571,7 +576,7 @@ bool VirtualMemoryTracker::split_reserved_region(address addr, size_t size, size const char* name = reserved_rgn->mem_tag_name(); remove_released_region(reserved_rgn); - log_debug(nmt)("Split region \'%s\' (" INTPTR_FORMAT ", " SIZE_FORMAT ") with size " SIZE_FORMAT, + log_debug(nmt)("Split region \'%s\' (" INTPTR_FORMAT ", %zu) with size %zu", name, p2i(rgn.base()), rgn.size(), split); // Now, create two new regions. add_reserved_region(addr, split, original_stack, mem_tag); @@ -621,6 +626,9 @@ class SnapshotThreadStackWalker : public VirtualMemoryWalker { SnapshotThreadStackWalker() {} bool do_allocation_site(const ReservedMemoryRegion* rgn) { + if (MemTracker::NmtVirtualMemoryLocker::is_safe_to_use()) { + assert_lock_strong(NmtVirtualMemory_lock); + } if (rgn->mem_tag() == mtThreadStack) { address stack_bottom = rgn->thread_stack_uncommitted_bottom(); address committed_start; @@ -661,7 +669,7 @@ void VirtualMemoryTracker::snapshot_thread_stacks() { bool VirtualMemoryTracker::walk_virtual_memory(VirtualMemoryWalker* walker) { assert(_reserved_regions != nullptr, "Sanity check"); - ThreadCritical tc; + MemTracker::NmtVirtualMemoryLocker nvml; // Check that the _reserved_regions haven't been deleted. if (_reserved_regions != nullptr) { LinkedListNode* head = _reserved_regions->head(); diff --git a/src/hotspot/share/nmt/vmatree.cpp b/src/hotspot/share/nmt/vmatree.cpp index ec4f405f1c9cd..21aee26ca8782 100644 --- a/src/hotspot/share/nmt/vmatree.cpp +++ b/src/hotspot/share/nmt/vmatree.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2024, Red Hat Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "logging/log.hpp" #include "nmt/vmatree.hpp" #include "utilities/globalDefinitions.hpp" @@ -220,7 +219,7 @@ VMATree::SummaryDiff VMATree::register_mapping(position A, position B, StateType #ifdef ASSERT void VMATree::print_on(outputStream* out) { visit_in_order([&](TreapNode* current) { - out->print(SIZE_FORMAT " (%s) - %s - ", current->key(), NMTUtil::tag_to_name(out_state(current).mem_tag()), + out->print("%zu (%s) - %s - ", current->key(), NMTUtil::tag_to_name(out_state(current).mem_tag()), statetype_to_string(out_state(current).type())); }); out->cr(); diff --git a/src/hotspot/share/oops/accessBackend.cpp b/src/hotspot/share/oops/accessBackend.cpp index be191316f25d2..3b64bbb61f24d 100644 --- a/src/hotspot/share/oops/accessBackend.cpp +++ b/src/hotspot/share/oops/accessBackend.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "accessBackend.inline.hpp" #include "gc/shared/collectedHeap.hpp" #include "oops/oop.inline.hpp" diff --git a/src/hotspot/share/oops/annotations.cpp b/src/hotspot/share/oops/annotations.cpp index 8b2b236960dd7..606c18b350d04 100644 --- a/src/hotspot/share/oops/annotations.cpp +++ b/src/hotspot/share/oops/annotations.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderData.hpp" #include "logging/log.hpp" #include "memory/metadataFactory.hpp" diff --git a/src/hotspot/share/oops/array.hpp b/src/hotspot/share/oops/array.hpp index 25dd8cd6bebe7..12e23080166ec 100644 --- a/src/hotspot/share/oops/array.hpp +++ b/src/hotspot/share/oops/array.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -74,12 +74,12 @@ class Array: public MetaspaceObj { assert(is_aligned(left, sizeof(T)), "Must be"); size_t elements = left / sizeof(T); - assert(elements <= (size_t)INT_MAX, "number of elements " SIZE_FORMAT "doesn't fit into an int.", elements); + assert(elements <= (size_t)INT_MAX, "number of elements %zu doesn't fit into an int.", elements); int length = (int)elements; assert((size_t)size(length) * BytesPerWord == (size_t)bytes, - "Expected: " SIZE_FORMAT " got: " SIZE_FORMAT, + "Expected: %zu got: %zu", bytes, (size_t)size(length) * BytesPerWord); return length; @@ -135,7 +135,7 @@ class Array: public MetaspaceObj { size_t bytes = align_up(byte_sizeof(length), BytesPerWord); size_t words = bytes / BytesPerWord; - assert(words <= INT_MAX, "Overflow: " SIZE_FORMAT, words); + assert(words <= INT_MAX, "Overflow: %zu", words); return (int)words; } diff --git a/src/hotspot/share/oops/arrayKlass.cpp b/src/hotspot/share/oops/arrayKlass.cpp index 54b02cfd948d0..8b6a97fd62d68 100644 --- a/src/hotspot/share/oops/arrayKlass.cpp +++ b/src/hotspot/share/oops/arrayKlass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/cdsConfig.hpp" #include "cds/metaspaceShared.hpp" #include "classfile/javaClasses.hpp" diff --git a/src/hotspot/share/oops/compressedKlass.cpp b/src/hotspot/share/oops/compressedKlass.cpp index 050314ef813c6..fc8c0513ca036 100644 --- a/src/hotspot/share/oops/compressedKlass.cpp +++ b/src/hotspot/share/oops/compressedKlass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "logging/log.hpp" #include "memory/metaspace.hpp" #include "oops/compressedKlass.inline.hpp" diff --git a/src/hotspot/share/oops/compressedOops.cpp b/src/hotspot/share/oops/compressedOops.cpp index 5532b406b6d4d..675b5b44f5367 100644 --- a/src/hotspot/share/oops/compressedOops.cpp +++ b/src/hotspot/share/oops/compressedOops.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "logging/log.hpp" #include "logging/logStream.hpp" #include "memory/memRegion.hpp" @@ -161,7 +160,7 @@ bool CompressedOops::base_overlaps() { } void CompressedOops::print_mode(outputStream* st) { - st->print("Heap address: " PTR_FORMAT ", size: " SIZE_FORMAT " MB", + st->print("Heap address: " PTR_FORMAT ", size: %zu MB", p2i(_heap_address_range.start()), _heap_address_range.byte_size()/M); st->print(", Compressed Oops mode: %s", mode_to_string(mode())); diff --git a/src/hotspot/share/oops/constMethod.cpp b/src/hotspot/share/oops/constMethod.cpp index a6a93d6f48a94..1fed47f7ff226 100644 --- a/src/hotspot/share/oops/constMethod.cpp +++ b/src/hotspot/share/oops/constMethod.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "interpreter/interpreter.hpp" #include "memory/metadataFactory.hpp" #include "memory/metaspaceClosure.hpp" diff --git a/src/hotspot/share/oops/constMethodFlags.cpp b/src/hotspot/share/oops/constMethodFlags.cpp index 69b017cb18055..16bf2aab61374 100644 --- a/src/hotspot/share/oops/constMethodFlags.cpp +++ b/src/hotspot/share/oops/constMethodFlags.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "oops/constMethodFlags.hpp" #include "runtime/atomic.hpp" #include "utilities/ostream.hpp" diff --git a/src/hotspot/share/oops/constantPool.cpp b/src/hotspot/share/oops/constantPool.cpp index 22896d9e00fb1..8aba2bb2ba354 100644 --- a/src/hotspot/share/oops/constantPool.cpp +++ b/src/hotspot/share/oops/constantPool.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/aotConstantPoolResolver.hpp" #include "cds/archiveBuilder.hpp" #include "cds/archiveHeapLoader.hpp" @@ -332,8 +331,7 @@ objArrayOop ConstantPool::prepare_resolved_references_for_archiving() { } InstanceKlass *ik = pool_holder(); - if (!(ik->is_shared_boot_class() || ik->is_shared_platform_class() || - ik->is_shared_app_class())) { + if (!SystemDictionaryShared::is_builtin_loader(ik->class_loader_data())) { // Archiving resolved references for classes from non-builtin loaders // is not yet supported. return nullptr; @@ -345,12 +343,11 @@ objArrayOop ConstantPool::prepare_resolved_references_for_archiving() { int rr_len = rr->length(); GrowableArray keep_resolved_refs(rr_len, rr_len, false); - ConstantPool* src_cp = ArchiveBuilder::current()->get_source_addr(this); - src_cp->iterate_archivable_resolved_references([&](int rr_index) { + iterate_archivable_resolved_references([&](int rr_index) { keep_resolved_refs.at_put(rr_index, true); }); - objArrayOop scratch_rr = HeapShared::scratch_resolved_references(src_cp); + objArrayOop scratch_rr = HeapShared::scratch_resolved_references(this); Array* ref_map = reference_map(); int ref_map_len = ref_map == nullptr ? 0 : ref_map->length(); for (int i = 0; i < rr_len; i++) { @@ -378,32 +375,6 @@ objArrayOop ConstantPool::prepare_resolved_references_for_archiving() { return rr; } -void ConstantPool::find_required_hidden_classes() { - if (_cache == nullptr) { - return; - } - - ClassLoaderData* loader_data = pool_holder()->class_loader_data(); - if (loader_data == nullptr) { - // These are custom loader classes from the preimage - return; - } - - if (!SystemDictionaryShared::is_builtin_loader(loader_data)) { - // Archiving resolved references for classes from non-builtin loaders - // is not yet supported. - return; - } - - objArrayOop rr = resolved_references(); - if (rr != nullptr) { - iterate_archivable_resolved_references([&](int rr_index) { - oop obj = rr->obj_at(rr_index); - HeapShared::find_required_hidden_classes_in_object(obj); - }); - } -} - void ConstantPool::add_dumped_interned_strings() { InstanceKlass* ik = pool_holder(); if (!ik->is_linked()) { @@ -2046,138 +2017,6 @@ const char* ConstantPool::printable_name_at(int cp_index) { #endif // PRODUCT -// JVMTI GetConstantPool support - -// For debugging of constant pool -const bool debug_cpool = false; - -#define DBG(code) do { if (debug_cpool) { (code); } } while(0) - -static void print_cpool_bytes(jint cnt, u1 *bytes) { - const char* WARN_MSG = "Must not be such entry!"; - jint size = 0; - u2 idx1, idx2; - - for (jint idx = 1; idx < cnt; idx++) { - jint ent_size = 0; - u1 tag = *bytes++; - size++; // count tag - - printf("const #%03d, tag: %02d ", idx, tag); - switch(tag) { - case JVM_CONSTANT_Invalid: { - printf("Invalid"); - break; - } - case JVM_CONSTANT_Unicode: { - printf("Unicode %s", WARN_MSG); - break; - } - case JVM_CONSTANT_Utf8: { - u2 len = Bytes::get_Java_u2(bytes); - char str[128]; - if (len > 127) { - len = 127; - } - strncpy(str, (char *) (bytes+2), len); - str[len] = '\0'; - printf("Utf8 \"%s\"", str); - ent_size = 2 + len; - break; - } - case JVM_CONSTANT_Integer: { - u4 val = Bytes::get_Java_u4(bytes); - printf("int %d", *(int *) &val); - ent_size = 4; - break; - } - case JVM_CONSTANT_Float: { - u4 val = Bytes::get_Java_u4(bytes); - printf("float %5.3ff", *(float *) &val); - ent_size = 4; - break; - } - case JVM_CONSTANT_Long: { - u8 val = Bytes::get_Java_u8(bytes); - printf("long " INT64_FORMAT, (int64_t) *(jlong *) &val); - ent_size = 8; - idx++; // Long takes two cpool slots - break; - } - case JVM_CONSTANT_Double: { - u8 val = Bytes::get_Java_u8(bytes); - printf("double %5.3fd", *(jdouble *)&val); - ent_size = 8; - idx++; // Double takes two cpool slots - break; - } - case JVM_CONSTANT_Class: { - idx1 = Bytes::get_Java_u2(bytes); - printf("class #%03d", idx1); - ent_size = 2; - break; - } - case JVM_CONSTANT_String: { - idx1 = Bytes::get_Java_u2(bytes); - printf("String #%03d", idx1); - ent_size = 2; - break; - } - case JVM_CONSTANT_Fieldref: { - idx1 = Bytes::get_Java_u2(bytes); - idx2 = Bytes::get_Java_u2(bytes+2); - printf("Field #%03d, #%03d", (int) idx1, (int) idx2); - ent_size = 4; - break; - } - case JVM_CONSTANT_Methodref: { - idx1 = Bytes::get_Java_u2(bytes); - idx2 = Bytes::get_Java_u2(bytes+2); - printf("Method #%03d, #%03d", idx1, idx2); - ent_size = 4; - break; - } - case JVM_CONSTANT_InterfaceMethodref: { - idx1 = Bytes::get_Java_u2(bytes); - idx2 = Bytes::get_Java_u2(bytes+2); - printf("InterfMethod #%03d, #%03d", idx1, idx2); - ent_size = 4; - break; - } - case JVM_CONSTANT_NameAndType: { - idx1 = Bytes::get_Java_u2(bytes); - idx2 = Bytes::get_Java_u2(bytes+2); - printf("NameAndType #%03d, #%03d", idx1, idx2); - ent_size = 4; - break; - } - case JVM_CONSTANT_ClassIndex: { - printf("ClassIndex %s", WARN_MSG); - break; - } - case JVM_CONSTANT_UnresolvedClass: { - printf("UnresolvedClass: %s", WARN_MSG); - break; - } - case JVM_CONSTANT_UnresolvedClassInError: { - printf("UnresolvedClassInErr: %s", WARN_MSG); - break; - } - case JVM_CONSTANT_StringIndex: { - printf("StringIndex: %s", WARN_MSG); - break; - } - } - printf(";\n"); - bytes += ent_size; - size += ent_size; - } - printf("Cpool size: %d\n", size); - fflush(nullptr); - return; -} /* end print_cpool_bytes */ - - // Returns size of constant pool entry. jint ConstantPool::cpool_entry_size(jint idx) { switch(tag_at(idx).value()) { @@ -2240,7 +2079,6 @@ jint ConstantPool::hash_entries_to(SymbolHash *symmap, case JVM_CONSTANT_Utf8: { Symbol* sym = symbol_at(idx); symmap->add_if_absent(sym, idx); - DBG(printf("adding symbol entry %s = %d\n", sym->as_utf8(), idx)); break; } case JVM_CONSTANT_Class: @@ -2248,7 +2086,6 @@ jint ConstantPool::hash_entries_to(SymbolHash *symmap, case JVM_CONSTANT_UnresolvedClassInError: { Symbol* sym = klass_name_at(idx); classmap->add_if_absent(sym, idx); - DBG(printf("adding class entry %s = %d\n", sym->as_utf8(), idx)); break; } case JVM_CONSTANT_Long: @@ -2282,15 +2119,12 @@ int ConstantPool::copy_cpool_bytes(int cpool_size, assert(size + ent_size <= cpool_size, "Size mismatch"); *bytes = tag; - DBG(printf("#%03hd tag=%03hd, ", (short)idx, (short)tag)); switch(tag) { case JVM_CONSTANT_Invalid: { - DBG(printf("JVM_CONSTANT_Invalid")); break; } case JVM_CONSTANT_Unicode: { assert(false, "Wrong constant pool tag: JVM_CONSTANT_Unicode"); - DBG(printf("JVM_CONSTANT_Unicode")); break; } case JVM_CONSTANT_Utf8: { @@ -2302,7 +2136,6 @@ int ConstantPool::copy_cpool_bytes(int cpool_size, for (int i = 0; i < len; i++) { bytes[3+i] = (u1) str[i]; } - DBG(printf("JVM_CONSTANT_Utf8: %s ", str)); break; } case JVM_CONSTANT_Integer: { @@ -2335,7 +2168,6 @@ int ConstantPool::copy_cpool_bytes(int cpool_size, idx1 = tbl->symbol_to_value(sym); assert(idx1 != 0, "Have not found a hashtable entry"); Bytes::put_Java_u2((address) (bytes+1), idx1); - DBG(printf("JVM_CONSTANT_Class: idx=#%03hd, %s", idx1, sym->as_utf8())); break; } case JVM_CONSTANT_String: { @@ -2344,7 +2176,6 @@ int ConstantPool::copy_cpool_bytes(int cpool_size, idx1 = tbl->symbol_to_value(sym); assert(idx1 != 0, "Have not found a hashtable entry"); Bytes::put_Java_u2((address) (bytes+1), idx1); - DBG(printf("JVM_CONSTANT_String: idx=#%03hd, %s", idx1, sym->as_utf8())); break; } case JVM_CONSTANT_Fieldref: @@ -2354,7 +2185,6 @@ int ConstantPool::copy_cpool_bytes(int cpool_size, idx2 = uncached_name_and_type_ref_index_at(idx); Bytes::put_Java_u2((address) (bytes+1), idx1); Bytes::put_Java_u2((address) (bytes+3), idx2); - DBG(printf("JVM_CONSTANT_Methodref: %hd %hd", idx1, idx2)); break; } case JVM_CONSTANT_NameAndType: { @@ -2362,21 +2192,18 @@ int ConstantPool::copy_cpool_bytes(int cpool_size, idx2 = signature_ref_index_at(idx); Bytes::put_Java_u2((address) (bytes+1), idx1); Bytes::put_Java_u2((address) (bytes+3), idx2); - DBG(printf("JVM_CONSTANT_NameAndType: %hd %hd", idx1, idx2)); break; } case JVM_CONSTANT_ClassIndex: { *bytes = JVM_CONSTANT_Class; idx1 = checked_cast(klass_index_at(idx)); Bytes::put_Java_u2((address) (bytes+1), idx1); - DBG(printf("JVM_CONSTANT_ClassIndex: %hd", idx1)); break; } case JVM_CONSTANT_StringIndex: { *bytes = JVM_CONSTANT_String; idx1 = checked_cast(string_index_at(idx)); Bytes::put_Java_u2((address) (bytes+1), idx1); - DBG(printf("JVM_CONSTANT_StringIndex: %hd", idx1)); break; } case JVM_CONSTANT_MethodHandle: @@ -2386,7 +2213,6 @@ int ConstantPool::copy_cpool_bytes(int cpool_size, idx1 = checked_cast(method_handle_index_at(idx)); *(bytes+1) = (unsigned char) kind; Bytes::put_Java_u2((address) (bytes+2), idx1); - DBG(printf("JVM_CONSTANT_MethodHandle: %d %hd", kind, idx1)); break; } case JVM_CONSTANT_MethodType: @@ -2394,7 +2220,6 @@ int ConstantPool::copy_cpool_bytes(int cpool_size, *bytes = JVM_CONSTANT_MethodType; idx1 = checked_cast(method_type_index_at(idx)); Bytes::put_Java_u2((address) (bytes+1), idx1); - DBG(printf("JVM_CONSTANT_MethodType: %hd", idx1)); break; } case JVM_CONSTANT_Dynamic: @@ -2405,7 +2230,6 @@ int ConstantPool::copy_cpool_bytes(int cpool_size, assert(idx2 == bootstrap_name_and_type_ref_index_at(idx), "correct half of u4"); Bytes::put_Java_u2((address) (bytes+1), idx1); Bytes::put_Java_u2((address) (bytes+3), idx2); - DBG(printf("JVM_CONSTANT_Dynamic: %hd %hd", idx1, idx2)); break; } case JVM_CONSTANT_InvokeDynamic: { @@ -2415,23 +2239,17 @@ int ConstantPool::copy_cpool_bytes(int cpool_size, assert(idx2 == bootstrap_name_and_type_ref_index_at(idx), "correct half of u4"); Bytes::put_Java_u2((address) (bytes+1), idx1); Bytes::put_Java_u2((address) (bytes+3), idx2); - DBG(printf("JVM_CONSTANT_InvokeDynamic: %hd %hd", idx1, idx2)); break; } } - DBG(printf("\n")); bytes += ent_size; size += ent_size; } assert(size == cpool_size, "Size mismatch"); - // Keep temporarily for debugging until it's stable. - DBG(print_cpool_bytes(cnt, start_bytes)); return (int)(bytes - start_bytes); } /* end copy_cpool_bytes */ -#undef DBG - bool ConstantPool::is_maybe_on_stack() const { // This method uses the similar logic as nmethod::is_maybe_on_stack() if (!Continuations::enabled()) { diff --git a/src/hotspot/share/oops/constantPool.hpp b/src/hotspot/share/oops/constantPool.hpp index 935151c7cda7d..4457f8a84e7c8 100644 --- a/src/hotspot/share/oops/constantPool.hpp +++ b/src/hotspot/share/oops/constantPool.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -684,7 +684,6 @@ class ConstantPool : public Metadata { #if INCLUDE_CDS // CDS support objArrayOop prepare_resolved_references_for_archiving() NOT_CDS_JAVA_HEAP_RETURN_(nullptr); - void find_required_hidden_classes() NOT_CDS_JAVA_HEAP_RETURN; void add_dumped_interned_strings() NOT_CDS_JAVA_HEAP_RETURN; void remove_unshareable_info(); void restore_unshareable_info(TRAPS); diff --git a/src/hotspot/share/oops/cpCache.cpp b/src/hotspot/share/oops/cpCache.cpp index 66650ee65bf56..f4c53c0089e62 100644 --- a/src/hotspot/share/oops/cpCache.cpp +++ b/src/hotspot/share/oops/cpCache.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/aotConstantPoolResolver.hpp" #include "cds/archiveBuilder.hpp" #include "cds/cdsConfig.hpp" @@ -409,6 +408,17 @@ void ConstantPoolCache::remove_unshareable_info() { if (_resolved_method_entries != nullptr) { remove_resolved_method_entries_if_non_deterministic(); } + +#if INCLUDE_CDS_JAVA_HEAP + _archived_references_index = -1; + if (CDSConfig::is_dumping_heap()) { + ConstantPool* src_cp = ArchiveBuilder::current()->get_source_addr(constant_pool()); + oop rr = HeapShared::scratch_resolved_references(src_cp); + if (rr != nullptr) { + _archived_references_index = HeapShared::append_root(rr); + } + } +#endif } void ConstantPoolCache::remove_resolved_field_entries_if_non_deterministic() { @@ -610,11 +620,6 @@ void ConstantPoolCache::clear_archived_references() { _archived_references_index = -1; } } - -void ConstantPoolCache::set_archived_references(int root_index) { - assert(CDSConfig::is_dumping_heap(), "sanity"); - _archived_references_index = root_index; -} #endif #if INCLUDE_JVMTI diff --git a/src/hotspot/share/oops/cpCache.hpp b/src/hotspot/share/oops/cpCache.hpp index 8652409a1a446..6490a012e9aeb 100644 --- a/src/hotspot/share/oops/cpCache.hpp +++ b/src/hotspot/share/oops/cpCache.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -110,7 +110,6 @@ class ConstantPoolCache: public MetaspaceObj { MetaspaceObj::Type type() const { return ConstantPoolCacheType; } oop archived_references() NOT_CDS_JAVA_HEAP_RETURN_(nullptr); - void set_archived_references(int root_index) NOT_CDS_JAVA_HEAP_RETURN; void clear_archived_references() NOT_CDS_JAVA_HEAP_RETURN; inline objArrayOop resolved_references(); diff --git a/src/hotspot/share/oops/fieldInfo.cpp b/src/hotspot/share/oops/fieldInfo.cpp index 50a3b427d178e..300b45277ada6 100644 --- a/src/hotspot/share/oops/fieldInfo.cpp +++ b/src/hotspot/share/oops/fieldInfo.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "oops/fieldInfo.inline.hpp" #include "runtime/atomic.hpp" @@ -34,7 +33,7 @@ void FieldInfo::print(outputStream* os, ConstantPool* cp) { name_index(), name(cp)->as_utf8(), signature_index(), signature(cp)->as_utf8(), offset(), - access_flags().as_int(), + access_flags().as_field_flags(), field_flags().as_uint(), initializer_index(), generic_signature_index(), @@ -97,7 +96,7 @@ Array* FieldInfoStream::create_FieldInfoStream(GrowableArray* fie assert(fi_ref->name_index() == fi.name_index(), "Must be"); assert(fi_ref->signature_index() == fi.signature_index(), "Must be"); assert(fi_ref->offset() == fi.offset(), "Must be"); - assert(fi_ref->access_flags().as_int() == fi.access_flags().as_int(), "Must be"); + assert(fi_ref->access_flags().as_field_flags() == fi.access_flags().as_field_flags(), "Must be"); assert(fi_ref->field_flags().as_uint() == fi.field_flags().as_uint(), " Must be"); if(fi_ref->field_flags().is_initialized()) { assert(fi_ref->initializer_index() == fi.initializer_index(), "Must be"); diff --git a/src/hotspot/share/oops/fieldInfo.inline.hpp b/src/hotspot/share/oops/fieldInfo.inline.hpp index 2e6727f1fb9f1..d3d4d765081d0 100644 --- a/src/hotspot/share/oops/fieldInfo.inline.hpp +++ b/src/hotspot/share/oops/fieldInfo.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * 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 @@ inline void Mapper::map_field_info(const FieldInfo& fi) { _consumer->accept_uint(fi.name_index()); _consumer->accept_uint(fi.signature_index()); _consumer->accept_uint(fi.offset()); - _consumer->accept_uint(fi.access_flags().as_int()); + _consumer->accept_uint(fi.access_flags().as_field_flags()); _consumer->accept_uint(fi.field_flags().as_uint()); if(fi.field_flags().has_any_optionals()) { if (fi.field_flags().is_initialized()) { @@ -102,7 +102,7 @@ inline void FieldInfoReader::read_field_info(FieldInfo& fi) { fi._name_index = checked_cast(next_uint()); fi._signature_index = checked_cast(next_uint()); fi._offset = next_uint(); - fi._access_flags = AccessFlags(next_uint()); + fi._access_flags = AccessFlags(checked_cast(next_uint())); fi._field_flags = FieldInfo::FieldFlags(next_uint()); if (fi._field_flags.is_initialized()) { fi._initializer_index = checked_cast(next_uint()); diff --git a/src/hotspot/share/oops/generateOopMap.cpp b/src/hotspot/share/oops/generateOopMap.cpp index 918e6969713c9..e3119a24cef44 100644 --- a/src/hotspot/share/oops/generateOopMap.cpp +++ b/src/hotspot/share/oops/generateOopMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/vmSymbols.hpp" #include "interpreter/bytecodeStream.hpp" #include "logging/log.hpp" diff --git a/src/hotspot/share/oops/instanceClassLoaderKlass.cpp b/src/hotspot/share/oops/instanceClassLoaderKlass.cpp index 386f0b457ef5c..982a715c32413 100644 --- a/src/hotspot/share/oops/instanceClassLoaderKlass.cpp +++ b/src/hotspot/share/oops/instanceClassLoaderKlass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/cdsConfig.hpp" #include "oops/instanceClassLoaderKlass.hpp" diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp index ce46da55f986b..9e3f73596e27b 100644 --- a/src/hotspot/share/oops/instanceKlass.cpp +++ b/src/hotspot/share/oops/instanceKlass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/aotClassInitializer.hpp" #include "cds/archiveUtils.hpp" #include "cds/cdsConfig.hpp" @@ -3339,8 +3338,8 @@ InstanceKlass* InstanceKlass::compute_enclosing_class(bool* inner_is_member, TRA return outer_klass; } -jint InstanceKlass::compute_modifier_flags() const { - jint access = access_flags().as_int(); +u2 InstanceKlass::compute_modifier_flags() const { + u2 access = access_flags().as_unsigned_short(); // But check if it happens to be member class. InnerClassesIterator iter(this); @@ -3360,7 +3359,7 @@ jint InstanceKlass::compute_modifier_flags() const { } } // Remember to strip ACC_SUPER bit - return (access & (~JVM_ACC_SUPER)) & JVM_ACC_WRITTEN_FLAGS; + return (access & (~JVM_ACC_SUPER)); } jint InstanceKlass::jvmti_class_status() const { @@ -3654,7 +3653,7 @@ void InstanceKlass::print_on(outputStream* st) const { st->print(" "); } } - if (n >= MaxSubklassPrintSize) st->print("(" INTX_FORMAT " more klasses...)", n - MaxSubklassPrintSize); + if (n >= MaxSubklassPrintSize) st->print("(%zd more klasses...)", n - MaxSubklassPrintSize); st->cr(); if (is_interface()) { @@ -3806,7 +3805,7 @@ void InstanceKlass::oop_print_on(oop obj, outputStream* st) { } } - st->print_cr(BULLET"---- fields (total size " SIZE_FORMAT " words):", oop_size(obj)); + st->print_cr(BULLET"---- fields (total size %zu words):", oop_size(obj)); FieldPrinter print_field(st, obj); print_nonstatic_fields(&print_field); diff --git a/src/hotspot/share/oops/instanceKlass.hpp b/src/hotspot/share/oops/instanceKlass.hpp index 8209a692a8242..cedc17e9bafde 100644 --- a/src/hotspot/share/oops/instanceKlass.hpp +++ b/src/hotspot/share/oops/instanceKlass.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -391,7 +391,7 @@ class InstanceKlass: public Klass { public: int field_offset (int index) const { return field(index).offset(); } - int field_access_flags(int index) const { return field(index).access_flags().as_int(); } + int field_access_flags(int index) const { return field(index).access_flags().as_field_flags(); } FieldInfo::FieldFlags field_flags(int index) const { return field(index).field_flags(); } FieldStatus field_status(int index) const { return fields_status()->at(index); } inline Symbol* field_name (int index) const; @@ -682,8 +682,6 @@ class InstanceKlass: public Klass { #if INCLUDE_JVMTI // Redefinition locking. Class can only be redefined by one thread at a time. - // The flag is in access_flags so that it can be set and reset using atomic - // operations, and not be reset by other misc_flag settings. bool is_being_redefined() const { return _misc_flags.is_being_redefined(); } void set_is_being_redefined(bool value) { _misc_flags.set_is_being_redefined(value); } @@ -1127,7 +1125,7 @@ class InstanceKlass: public Klass { void compute_has_loops_flag_for_methods(); #endif - jint compute_modifier_flags() const; + u2 compute_modifier_flags() const; public: // JVMTI support diff --git a/src/hotspot/share/oops/instanceKlassFlags.cpp b/src/hotspot/share/oops/instanceKlassFlags.cpp index 864fe60af2ea3..8d2adfba9046a 100644 --- a/src/hotspot/share/oops/instanceKlassFlags.cpp +++ b/src/hotspot/share/oops/instanceKlassFlags.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoader.hpp" #include "classfile/classLoaderData.inline.hpp" #include "oops/instanceKlassFlags.hpp" diff --git a/src/hotspot/share/oops/instanceMirrorKlass.cpp b/src/hotspot/share/oops/instanceMirrorKlass.cpp index a90c9284b1a9a..798d5115143e0 100644 --- a/src/hotspot/share/oops/instanceMirrorKlass.cpp +++ b/src/hotspot/share/oops/instanceMirrorKlass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/cdsConfig.hpp" #include "cds/serializeClosure.hpp" #include "classfile/javaClasses.inline.hpp" @@ -54,7 +53,7 @@ size_t InstanceMirrorKlass::instance_size(Klass* k) { instanceOop InstanceMirrorKlass::allocate_instance(Klass* k, TRAPS) { // Query before forming handle. size_t size = instance_size(k); - assert(size > 0, "total object size must be non-zero: " SIZE_FORMAT, size); + assert(size > 0, "total object size must be non-zero: %zu", size); // Since mirrors can be variable sized because of the static fields, store // the size in the mirror itself. diff --git a/src/hotspot/share/oops/instanceOop.cpp b/src/hotspot/share/oops/instanceOop.cpp index 8f58feccec4d2..faba5d18acf51 100644 --- a/src/hotspot/share/oops/instanceOop.cpp +++ b/src/hotspot/share/oops/instanceOop.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "oops/instanceOop.hpp" // <> diff --git a/src/hotspot/share/oops/instanceRefKlass.cpp b/src/hotspot/share/oops/instanceRefKlass.cpp index 1fea112dc8754..eb507495cf554 100644 --- a/src/hotspot/share/oops/instanceRefKlass.cpp +++ b/src/hotspot/share/oops/instanceRefKlass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/cdsConfig.hpp" #include "classfile/classFileParser.hpp" #include "classfile/javaClasses.hpp" diff --git a/src/hotspot/share/oops/instanceStackChunkKlass.cpp b/src/hotspot/share/oops/instanceStackChunkKlass.cpp index 2b819b27f642e..bf08cfd25ab7d 100644 --- a/src/hotspot/share/oops/instanceStackChunkKlass.cpp +++ b/src/hotspot/share/oops/instanceStackChunkKlass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/cdsConfig.hpp" #include "cds/serializeClosure.hpp" #include "classfile/vmClasses.hpp" diff --git a/src/hotspot/share/oops/klass.cpp b/src/hotspot/share/oops/klass.cpp index 884816764a079..40e5e62dbc715 100644 --- a/src/hotspot/share/oops/klass.cpp +++ b/src/hotspot/share/oops/klass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/archiveHeapLoader.hpp" #include "cds/cdsConfig.hpp" #include "cds/heapShared.hpp" @@ -817,6 +816,19 @@ void Klass::remove_java_mirror() { ResourceMark rm; log_trace(cds, unshareable)("remove java_mirror: %s", external_name()); } + +#if INCLUDE_CDS_JAVA_HEAP + _archived_mirror_index = -1; + if (CDSConfig::is_dumping_heap()) { + Klass* src_k = ArchiveBuilder::current()->get_source_addr(this); + oop orig_mirror = src_k->java_mirror(); + oop scratch_mirror = HeapShared::scratch_java_mirror(orig_mirror); + if (scratch_mirror != nullptr) { + _archived_mirror_index = HeapShared::append_root(scratch_mirror); + } + } +#endif + // Just null out the mirror. The class_loader_data() no longer exists. clear_java_mirror_handle(); } @@ -900,12 +912,6 @@ void Klass::clear_archived_mirror_index() { } _archived_mirror_index = -1; } - -// No GC barrier -void Klass::set_archived_java_mirror(int mirror_index) { - assert(CDSConfig::is_dumping_heap(), "sanity"); - _archived_mirror_index = mirror_index; -} #endif // INCLUDE_CDS_JAVA_HEAP void Klass::check_array_allocation_length(int length, int max_length, TRAPS) { @@ -1305,7 +1311,7 @@ static void print_negative_lookup_stats(uintx bitmap, outputStream* st) { void Klass::print_secondary_supers_on(outputStream* st) const { if (secondary_supers() != nullptr) { st->print(" - "); st->print("%d elements;", _secondary_supers->length()); - st->print_cr(" bitmap: " UINTX_FORMAT_X_0 ";", _secondary_supers_bitmap); + st->print_cr(" bitmap: " UINTX_FORMAT_X_0, _secondary_supers_bitmap); if (_secondary_supers_bitmap != SECONDARY_SUPERS_BITMAP_EMPTY && _secondary_supers_bitmap != SECONDARY_SUPERS_BITMAP_FULL) { st->print(" - "); print_positive_lookup_stats(secondary_supers(), diff --git a/src/hotspot/share/oops/klass.hpp b/src/hotspot/share/oops/klass.hpp index 2c75d6da3b8cb..a3e1e4524795f 100644 --- a/src/hotspot/share/oops/klass.hpp +++ b/src/hotspot/share/oops/klass.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -66,7 +66,7 @@ class Klass : public Metadata { friend class JVMCIVMStructs; public: // Klass Kinds for all subclasses of Klass - enum KlassKind { + enum KlassKind : u2 { InstanceKlassKind, InstanceRefKlassKind, InstanceMirrorKlassKind, @@ -113,15 +113,20 @@ class Klass : public Metadata { // // Final note: This comes first, immediately after C++ vtable, // because it is frequently queried. - jint _layout_helper; + jint _layout_helper; // Klass kind used to resolve the runtime type of the instance. // - Used to implement devirtualized oop closure dispatching. // - Various type checking in the JVM const KlassKind _kind; + AccessFlags _access_flags; // Access flags. The class/interface distinction is stored here. + // Some flags created by the JVM, not in the class file itself, + // are in _misc_flags below. // Processed access flags, for use by Class.getModifiers. - jint _modifier_flags; + u2 _modifier_flags; + + KlassFlags _misc_flags; // The fields _super_check_offset, _secondary_super_cache, _secondary_supers // and _primary_supers all help make fast subtype checks. See big discussion @@ -157,22 +162,12 @@ class Klass : public Metadata { // Provide access the corresponding instance java.lang.ClassLoader. ClassLoaderData* _class_loader_data; + markWord _prototype_header; // Used to initialize objects' header + // Bitmap and hash code used by hashed secondary supers. uintx _secondary_supers_bitmap; uint8_t _hash_slot; - markWord _prototype_header; // Used to initialize objects' header - - int _vtable_len; // vtable length. This field may be read very often when we - // have lots of itable dispatches (e.g., lambdas and streams). - // Keep it away from the beginning of a Klass to avoid cacheline - // contention that may happen when a nearby object is modified. - AccessFlags _access_flags; // Access flags. The class/interface distinction is stored here. - // Some flags created by the JVM, not in the class file itself, - // are in _misc_flags below. - - JFR_ONLY(DEFINE_TRACE_ID_FIELD;) - private: // This is an index into FileMapHeader::_shared_path_table[], to // associate this class with the JAR file where it's loaded from during @@ -200,10 +195,17 @@ class Klass : public Metadata { }; #endif - KlassFlags _misc_flags; + int _vtable_len; // vtable length. This field may be read very often when we + // have lots of itable dispatches (e.g., lambdas and streams). + // Keep it away from the beginning of a Klass to avoid cacheline + // contention that may happen when a nearby object is modified. CDS_JAVA_HEAP_ONLY(int _archived_mirror_index;) +public: + + JFR_ONLY(DEFINE_TRACE_ID_FIELD;) + protected: Klass(KlassKind kind); @@ -281,7 +283,6 @@ class Klass : public Metadata { void set_java_mirror(Handle m); oop archived_java_mirror() NOT_CDS_JAVA_HEAP_RETURN_(nullptr); - void set_archived_java_mirror(int mirror_index) NOT_CDS_JAVA_HEAP_RETURN; // Temporary mirror switch used by RedefineClasses OopHandle java_mirror_handle() const { return _java_mirror; } @@ -292,8 +293,8 @@ class Klass : public Metadata { void clear_java_mirror_handle() { _java_mirror = OopHandle(); } // modifier flags - jint modifier_flags() const { return _modifier_flags; } - void set_modifier_flags(jint flags) { _modifier_flags = flags; } + u2 modifier_flags() const { return _modifier_flags; } + void set_modifier_flags(u2 flags) { _modifier_flags = flags; } // size helper int layout_helper() const { return _layout_helper; } @@ -756,7 +757,7 @@ class Klass : public Metadata { virtual void release_C_heap_structures(bool release_constant_pool = true); public: - virtual jint compute_modifier_flags() const = 0; + virtual u2 compute_modifier_flags() const = 0; // JVMTI support virtual jint jvmti_class_status() const; diff --git a/src/hotspot/share/oops/klassFlags.cpp b/src/hotspot/share/oops/klassFlags.cpp index 6399762e8df56..e5d6d68901f2d 100644 --- a/src/hotspot/share/oops/klassFlags.cpp +++ b/src/hotspot/share/oops/klassFlags.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "oops/klassFlags.hpp" #include "utilities/ostream.hpp" diff --git a/src/hotspot/share/oops/klassVtable.cpp b/src/hotspot/share/oops/klassVtable.cpp index e1bffc90d5129..20a8063771d97 100644 --- a/src/hotspot/share/oops/klassVtable.cpp +++ b/src/hotspot/share/oops/klassVtable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/metaspaceShared.hpp" #include "classfile/classLoaderDataGraph.hpp" #include "classfile/javaClasses.hpp" diff --git a/src/hotspot/share/oops/markWord.cpp b/src/hotspot/share/oops/markWord.cpp index a9b1a7b026ac6..2ba57cddc67cd 100644 --- a/src/hotspot/share/oops/markWord.cpp +++ b/src/hotspot/share/oops/markWord.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "oops/markWord.hpp" #include "runtime/basicLock.inline.hpp" #include "runtime/javaThread.hpp" diff --git a/src/hotspot/share/oops/metadata.cpp b/src/hotspot/share/oops/metadata.cpp index 242fc89c4137e..be3b523c5d5b1 100644 --- a/src/hotspot/share/oops/metadata.cpp +++ b/src/hotspot/share/oops/metadata.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "oops/metadata.hpp" #include "memory/resourceArea.hpp" #include "prims/jvmtiRedefineClasses.hpp" diff --git a/src/hotspot/share/oops/method.cpp b/src/hotspot/share/oops/method.cpp index d0b29a4a30992..a0f6a901cf783 100644 --- a/src/hotspot/share/oops/method.cpp +++ b/src/hotspot/share/oops/method.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/cdsConfig.hpp" #include "cds/cppVtables.hpp" #include "cds/metaspaceShared.hpp" @@ -1021,7 +1020,7 @@ void Method::print_made_not_compilable(int comp_level, bool is_osr, bool report, } if ((TraceDeoptimization || LogCompilation) && (xtty != nullptr)) { ttyLocker ttyl; - xtty->begin_elem("make_not_compilable thread='" UINTX_FORMAT "' osr='%d' level='%d'", + xtty->begin_elem("make_not_compilable thread='%zu' osr='%d' level='%d'", os::current_thread_id(), is_osr, comp_level); if (reason != nullptr) { xtty->print(" reason=\'%s\'", reason); @@ -1435,7 +1434,7 @@ methodHandle Method::make_method_handle_intrinsic(vmIntrinsics::ID iid, cp->set_is_for_method_handle_intrinsic(); // decide on access bits: public or not? - int flags_bits = (JVM_ACC_NATIVE | JVM_ACC_SYNTHETIC | JVM_ACC_FINAL); + u2 flags_bits = (JVM_ACC_NATIVE | JVM_ACC_SYNTHETIC | JVM_ACC_FINAL); bool must_be_static = MethodHandles::is_signature_polymorphic_static(iid); if (must_be_static) flags_bits |= JVM_ACC_STATIC; assert((flags_bits & JVM_ACC_PUBLIC) == 0, "do not expose these methods"); @@ -1652,8 +1651,8 @@ void Method::init_intrinsic_id(vmSymbolID klass_id) { && sig_id == vmSymbolID::NO_SID) { return; } - jshort flags = access_flags().as_short(); + u2 flags = access_flags().as_method_flags(); vmIntrinsics::ID id = vmIntrinsics::find_id(klass_id, name_id, sig_id, flags); if (id != vmIntrinsics::_none) { set_intrinsic_id(id); @@ -2300,7 +2299,7 @@ void Method::print_on(outputStream* st) const { st->print (" - method holder: "); method_holder()->print_value_on(st); st->cr(); st->print (" - constants: " PTR_FORMAT " ", p2i(constants())); constants()->print_value_on(st); st->cr(); - st->print (" - access: 0x%x ", access_flags().as_int()); access_flags().print_on(st); st->cr(); + st->print (" - access: 0x%x ", access_flags().as_method_flags()); access_flags().print_on(st); st->cr(); st->print (" - flags: 0x%x ", _flags.as_int()); _flags.print_on(st); st->cr(); st->print (" - name: "); name()->print_value_on(st); st->cr(); st->print (" - signature: "); signature()->print_value_on(st); st->cr(); diff --git a/src/hotspot/share/oops/method.hpp b/src/hotspot/share/oops/method.hpp index 271d8b3986378..7b13337ecafcf 100644 --- a/src/hotspot/share/oops/method.hpp +++ b/src/hotspot/share/oops/method.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -75,8 +75,8 @@ class Method : public Metadata { MethodData* _method_data; MethodCounters* _method_counters; AdapterHandlerEntry* _adapter; - AccessFlags _access_flags; // Access flags int _vtable_index; // vtable index of this method (see VtableIndexFlag) + AccessFlags _access_flags; // Access flags MethodFlags _flags; u2 _intrinsic_id; // vmSymbols::intrinsic_id (0 == _none) diff --git a/src/hotspot/share/oops/methodCounters.cpp b/src/hotspot/share/oops/methodCounters.cpp index 93fd7e65c6bcd..4abf9ba53e7f9 100644 --- a/src/hotspot/share/oops/methodCounters.cpp +++ b/src/hotspot/share/oops/methodCounters.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "compiler/compiler_globals.hpp" #include "compiler/compilerOracle.hpp" #include "oops/method.hpp" diff --git a/src/hotspot/share/oops/methodData.cpp b/src/hotspot/share/oops/methodData.cpp index 3c0c0b5468971..1abc34acc6b20 100644 --- a/src/hotspot/share/oops/methodData.cpp +++ b/src/hotspot/share/oops/methodData.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciMethodData.hpp" #include "classfile/vmSymbols.hpp" #include "compiler/compilationPolicy.hpp" diff --git a/src/hotspot/share/oops/methodFlags.cpp b/src/hotspot/share/oops/methodFlags.cpp index 4945dcc4b8396..ae73726b26845 100644 --- a/src/hotspot/share/oops/methodFlags.cpp +++ b/src/hotspot/share/oops/methodFlags.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "oops/methodFlags.hpp" #include "utilities/ostream.hpp" diff --git a/src/hotspot/share/oops/objArrayKlass.cpp b/src/hotspot/share/oops/objArrayKlass.cpp index 04bc374e5226c..288a1ed359bbd 100644 --- a/src/hotspot/share/oops/objArrayKlass.cpp +++ b/src/hotspot/share/oops/objArrayKlass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/moduleEntry.hpp" #include "classfile/packageEntry.hpp" #include "classfile/symbolTable.hpp" @@ -341,12 +340,12 @@ void ObjArrayKlass::metaspace_pointers_do(MetaspaceClosure* it) { it->push(&_bottom_klass); } -jint ObjArrayKlass::compute_modifier_flags() const { +u2 ObjArrayKlass::compute_modifier_flags() const { // The modifier for an objectArray is the same as its element assert (element_klass() != nullptr, "should be initialized"); // Return the flags of the bottom element type. - jint element_flags = bottom_klass()->compute_modifier_flags(); + u2 element_flags = bottom_klass()->compute_modifier_flags(); return (element_flags & (JVM_ACC_PUBLIC | JVM_ACC_PRIVATE | JVM_ACC_PROTECTED)) | (JVM_ACC_ABSTRACT | JVM_ACC_FINAL); diff --git a/src/hotspot/share/oops/objArrayKlass.hpp b/src/hotspot/share/oops/objArrayKlass.hpp index e16f1f2eb0fcd..c44c8d28f6247 100644 --- a/src/hotspot/share/oops/objArrayKlass.hpp +++ b/src/hotspot/share/oops/objArrayKlass.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -143,7 +143,7 @@ class ObjArrayKlass : public ArrayKlass { inline void oop_oop_iterate_elements_bounded(objArrayOop a, OopClosureType* closure, void* low, void* high); public: - jint compute_modifier_flags() const; + u2 compute_modifier_flags() const; public: // Printing diff --git a/src/hotspot/share/oops/objArrayOop.cpp b/src/hotspot/share/oops/objArrayOop.cpp index 18a93fb54834d..363f6710da85f 100644 --- a/src/hotspot/share/oops/objArrayOop.cpp +++ b/src/hotspot/share/oops/objArrayOop.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "oops/access.inline.hpp" #include "oops/objArrayKlass.hpp" #include "oops/objArrayOop.inline.hpp" diff --git a/src/hotspot/share/oops/objLayout.cpp b/src/hotspot/share/oops/objLayout.cpp index 3d18d319ed209..774fe24d376e8 100644 --- a/src/hotspot/share/oops/objLayout.cpp +++ b/src/hotspot/share/oops/objLayout.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "oops/markWord.hpp" #include "oops/objLayout.hpp" #include "runtime/globals.hpp" diff --git a/src/hotspot/share/oops/oop.cpp b/src/hotspot/share/oops/oop.cpp index 11cab4c043b5c..7f0068f747343 100644 --- a/src/hotspot/share/oops/oop.cpp +++ b/src/hotspot/share/oops/oop.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/cdsConfig.hpp" #include "classfile/altHashing.hpp" #include "classfile/javaClasses.inline.hpp" diff --git a/src/hotspot/share/oops/oop.inline.hpp b/src/hotspot/share/oops/oop.inline.hpp index 9ce953380ba82..3dad778a73a47 100644 --- a/src/hotspot/share/oops/oop.inline.hpp +++ b/src/hotspot/share/oops/oop.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -220,8 +220,8 @@ size_t oopDesc::size_given_klass(Klass* klass) { } } - assert(s > 0, "Oop size must be greater than zero, not " SIZE_FORMAT, s); - assert(is_object_aligned(s), "Oop size is not properly aligned: " SIZE_FORMAT, s); + assert(s > 0, "Oop size must be greater than zero, not %zu", s); + assert(is_object_aligned(s), "Oop size is not properly aligned: %zu", s); return s; } diff --git a/src/hotspot/share/oops/oopHandle.inline.hpp b/src/hotspot/share/oops/oopHandle.inline.hpp index 06acd2912745c..be5078704a4dc 100644 --- a/src/hotspot/share/oops/oopHandle.inline.hpp +++ b/src/hotspot/share/oops/oopHandle.inline.hpp @@ -31,11 +31,23 @@ #include "gc/shared/oopStorage.inline.hpp" inline oop OopHandle::resolve() const { - return (_obj == nullptr) ? (oop)nullptr : NativeAccess<>::oop_load(_obj); + if (_obj == nullptr) { + return (oop) nullptr; + } else { + oop oop = NativeAccess<>::oop_load(_obj); + assert(oopDesc::is_oop_or_null(oop), "Should be oop: " PTR_FORMAT, p2i(oop)); + return oop; + } } inline oop OopHandle::peek() const { - return (_obj == nullptr) ? (oop)nullptr : NativeAccess::oop_load(_obj); + if (_obj == nullptr) { + return (oop) nullptr; + } else { + oop obj = NativeAccess::oop_load(_obj); + assert(oopDesc::is_oop_or_null(obj), "Should be oop: " PTR_FORMAT, p2i(obj)); + return obj; + } } inline OopHandle::OopHandle(OopStorage* storage, oop obj) : @@ -44,6 +56,7 @@ inline OopHandle::OopHandle(OopStorage* storage, oop obj) : vm_exit_out_of_memory(sizeof(oop), OOM_MALLOC_ERROR, "Cannot create oop handle"); } + assert(oopDesc::is_oop_or_null(obj), "Should be oop: " PTR_FORMAT, p2i(obj)); NativeAccess<>::oop_store(_obj, obj); } @@ -58,15 +71,22 @@ inline void OopHandle::release(OopStorage* storage) { inline void OopHandle::replace(oop obj) { assert(!is_empty(), "should not use replace"); + assert(oopDesc::is_oop_or_null(obj), "Should be oop: " PTR_FORMAT, p2i(obj)); NativeAccess<>::oop_store(_obj, obj); } inline oop OopHandle::xchg(oop new_value) { - return NativeAccess::oop_atomic_xchg(_obj, new_value); + assert(oopDesc::is_oop_or_null(new_value), "Should be oop: " PTR_FORMAT, p2i(new_value)); + oop obj = NativeAccess::oop_atomic_xchg(_obj, new_value); + assert(oopDesc::is_oop_or_null(obj), "Should be oop: " PTR_FORMAT, p2i(obj)); + return obj; } inline oop OopHandle::cmpxchg(oop old_value, oop new_value) { - return NativeAccess::oop_atomic_cmpxchg(_obj, old_value, new_value); + assert(oopDesc::is_oop_or_null(new_value), "Should be oop: " PTR_FORMAT, p2i(new_value)); + oop obj = NativeAccess::oop_atomic_cmpxchg(_obj, old_value, new_value); + assert(oopDesc::is_oop_or_null(obj), "Should be oop: " PTR_FORMAT, p2i(obj)); + return obj; } #endif // SHARE_OOPS_OOPHANDLE_INLINE_HPP diff --git a/src/hotspot/share/oops/oopsHierarchy.cpp b/src/hotspot/share/oops/oopsHierarchy.cpp index 21260f5b1c99e..a62d37ce2ba31 100644 --- a/src/hotspot/share/oops/oopsHierarchy.cpp +++ b/src/hotspot/share/oops/oopsHierarchy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "memory/universe.hpp" #include "oops/oopsHierarchy.hpp" #include "runtime/javaThread.hpp" diff --git a/src/hotspot/share/oops/recordComponent.cpp b/src/hotspot/share/oops/recordComponent.cpp index 5007bebfb9b59..176e83820e473 100644 --- a/src/hotspot/share/oops/recordComponent.cpp +++ b/src/hotspot/share/oops/recordComponent.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "logging/log.hpp" #include "memory/metadataFactory.hpp" #include "memory/metaspaceClosure.hpp" diff --git a/src/hotspot/share/oops/resolvedFieldEntry.cpp b/src/hotspot/share/oops/resolvedFieldEntry.cpp index 8324325130696..dd0a81ce0f3cb 100644 --- a/src/hotspot/share/oops/resolvedFieldEntry.cpp +++ b/src/hotspot/share/oops/resolvedFieldEntry.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/archiveBuilder.hpp" #include "oops/resolvedFieldEntry.hpp" diff --git a/src/hotspot/share/oops/resolvedIndyEntry.cpp b/src/hotspot/share/oops/resolvedIndyEntry.cpp index 93ba3d6916c3e..09060596caae2 100644 --- a/src/hotspot/share/oops/resolvedIndyEntry.cpp +++ b/src/hotspot/share/oops/resolvedIndyEntry.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/archiveBuilder.hpp" #include "code/compressedStream.hpp" #include "oops/method.hpp" diff --git a/src/hotspot/share/oops/resolvedMethodEntry.cpp b/src/hotspot/share/oops/resolvedMethodEntry.cpp index 9564dbbcdc4b5..2dc533dbee00a 100644 --- a/src/hotspot/share/oops/resolvedMethodEntry.cpp +++ b/src/hotspot/share/oops/resolvedMethodEntry.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/archiveBuilder.hpp" #include "oops/method.hpp" #include "oops/resolvedMethodEntry.hpp" diff --git a/src/hotspot/share/oops/stackChunkOop.cpp b/src/hotspot/share/oops/stackChunkOop.cpp index 7319e93b6679c..13a94d65f8ebe 100644 --- a/src/hotspot/share/oops/stackChunkOop.cpp +++ b/src/hotspot/share/oops/stackChunkOop.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "code/nmethod.hpp" #include "code/scopeDesc.hpp" #include "gc/shared/barrierSet.hpp" @@ -497,7 +496,7 @@ class StackChunkVerifyOopsClosure : public OopClosure { assert(obj == nullptr || dbg_is_good_oop(obj), "p: " PTR_FORMAT " obj: " PTR_FORMAT, p2i(p), p2i(obj)); if (_chunk->has_bitmap()) { BitMap::idx_t index = _chunk->bit_index_for(p); - assert(_chunk->bitmap().at(index), "Bit not set at index " SIZE_FORMAT " corresponding to " PTR_FORMAT, index, p2i(p)); + assert(_chunk->bitmap().at(index), "Bit not set at index %zu corresponding to " PTR_FORMAT, index, p2i(p)); } } @@ -582,7 +581,7 @@ class StackChunkVerifyBitmapClosure : public BitMapClosure { oop obj = _chunk->load_oop(p); assert(obj == nullptr || dbg_is_good_oop(obj), - "p: " PTR_FORMAT " obj: " PTR_FORMAT " index: " SIZE_FORMAT, + "p: " PTR_FORMAT " obj: " PTR_FORMAT " index: %zu", p2i(p), p2i((oopDesc*)obj), index); return true; // continue processing diff --git a/src/hotspot/share/oops/symbol.cpp b/src/hotspot/share/oops/symbol.cpp index 276a201824117..4fc120ff19fca 100644 --- a/src/hotspot/share/oops/symbol.cpp +++ b/src/hotspot/share/oops/symbol.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/archiveBuilder.hpp" #include "cds/metaspaceShared.hpp" #include "classfile/altHashing.hpp" diff --git a/src/hotspot/share/oops/symbolHandle.cpp b/src/hotspot/share/oops/symbolHandle.cpp index 350f0dd96c863..0ed441ebb0feb 100644 --- a/src/hotspot/share/oops/symbolHandle.cpp +++ b/src/hotspot/share/oops/symbolHandle.cpp @@ -21,7 +21,6 @@ * questions. */ -#include "precompiled.hpp" #include "oops/symbolHandle.hpp" #include "runtime/atomic.hpp" diff --git a/src/hotspot/share/oops/typeArrayKlass.cpp b/src/hotspot/share/oops/typeArrayKlass.cpp index 8ca6a49fc46a4..95377a8452df4 100644 --- a/src/hotspot/share/oops/typeArrayKlass.cpp +++ b/src/hotspot/share/oops/typeArrayKlass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/moduleEntry.hpp" #include "classfile/packageEntry.hpp" #include "classfile/symbolTable.hpp" @@ -75,7 +74,7 @@ TypeArrayKlass* TypeArrayKlass::allocate(ClassLoaderData* loader_data, BasicType return new (loader_data, size, THREAD) TypeArrayKlass(type, name); } -jint TypeArrayKlass::compute_modifier_flags() const { +u2 TypeArrayKlass::compute_modifier_flags() const { return JVM_ACC_ABSTRACT | JVM_ACC_FINAL | JVM_ACC_PUBLIC; } diff --git a/src/hotspot/share/oops/typeArrayKlass.hpp b/src/hotspot/share/oops/typeArrayKlass.hpp index 9dc3ed607fe3a..6ec72ae49c0c8 100644 --- a/src/hotspot/share/oops/typeArrayKlass.hpp +++ b/src/hotspot/share/oops/typeArrayKlass.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * 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 @@ class TypeArrayKlass : public ArrayKlass { // Copying void copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS); - jint compute_modifier_flags() const; + u2 compute_modifier_flags() const; // Oop iterators. Since there are no oops in TypeArrayKlasses, // these functions only return the size of the object. diff --git a/src/hotspot/share/oops/weakHandle.cpp b/src/hotspot/share/oops/weakHandle.cpp index 9671ad97bbea0..36241689bbb34 100644 --- a/src/hotspot/share/oops/weakHandle.cpp +++ b/src/hotspot/share/oops/weakHandle.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/oopStorage.hpp" #include "oops/access.inline.hpp" #include "oops/oop.hpp" diff --git a/src/hotspot/share/opto/addnode.cpp b/src/hotspot/share/opto/addnode.cpp index b44aa53f298c4..928e06ee938cf 100644 --- a/src/hotspot/share/opto/addnode.cpp +++ b/src/hotspot/share/opto/addnode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "memory/allocation.inline.hpp" #include "opto/addnode.hpp" #include "opto/castnode.hpp" @@ -395,159 +394,9 @@ Node* AddNode::IdealIL(PhaseGVN* phase, bool can_reshape, BasicType bt) { } } - // Convert a + a + ... + a into a*n - Node* serial_additions = convert_serial_additions(phase, bt); - if (serial_additions != nullptr) { - return serial_additions; - } - return AddNode::Ideal(phase, can_reshape); } -// Try to convert a serial of additions into a single multiplication. Also convert `(a * CON) + a` to `(CON + 1) * a` as -// a side effect. On success, a new MulNode is returned. -Node* AddNode::convert_serial_additions(PhaseGVN* phase, BasicType bt) { - // We need to make sure that the current AddNode is not part of a MulNode that has already been optimized to a - // power-of-2 addition (e.g., 3 * a => (a << 2) + a). Without this check, GVN would keep trying to optimize the same - // node and can't progress. For example, 3 * a => (a << 2) + a => 3 * a => (a << 2) + a => ... - if (find_power_of_two_addition_pattern(this, bt, nullptr) != nullptr) { - return nullptr; - } - - Node* in1 = in(1); - Node* in2 = in(2); - jlong multiplier; - - // While multiplications can be potentially optimized to power-of-2 subtractions (e.g., a * 7 => (a << 3) - a), - // (x - y) + y => x is already handled by the Identity() methods. So, we don't need to check for that pattern here. - if (find_simple_addition_pattern(in1, bt, &multiplier) == in2 - || find_simple_lshift_pattern(in1, bt, &multiplier) == in2 - || find_simple_multiplication_pattern(in1, bt, &multiplier) == in2 - || find_power_of_two_addition_pattern(in1, bt, &multiplier) == in2) { - multiplier++; // +1 for the in2 term - - Node* con = (bt == T_INT) - ? (Node*) phase->intcon((jint) multiplier) // intentional type narrowing to allow overflow at max_jint - : (Node*) phase->longcon(multiplier); - return MulNode::make(con, in2, bt); - } - - return nullptr; -} - -// Try to match `a + a`. On success, return `a` and set `2` as `multiplier`. -// The method matches `n` for pattern: AddNode(a, a). -Node* AddNode::find_simple_addition_pattern(Node* n, BasicType bt, jlong* multiplier) { - if (n->Opcode() == Op_Add(bt) && n->in(1) == n->in(2)) { - *multiplier = 2; - return n->in(1); - } - - return nullptr; -} - -// Try to match `a << CON`. On success, return `a` and set `1 << CON` as `multiplier`. -// Match `n` for pattern: LShiftNode(a, CON). -// Note that the power-of-2 multiplication optimization could potentially convert a MulNode to this pattern. -Node* AddNode::find_simple_lshift_pattern(Node* n, BasicType bt, jlong* multiplier) { - // Note that power-of-2 multiplication optimization could potentially convert a MulNode to this pattern - if (n->Opcode() == Op_LShift(bt) && n->in(2)->is_Con()) { - Node* con = n->in(2); - if (con->is_top()) { - return nullptr; - } - - *multiplier = ((jlong) 1 << con->get_int()); - return n->in(1); - } - - return nullptr; -} - -// Try to match `CON * a`. On success, return `a` and set `CON` as `multiplier`. -// Match `n` for patterns: -// - MulNode(CON, a) -// - MulNode(a, CON) -Node* AddNode::find_simple_multiplication_pattern(Node* n, BasicType bt, jlong* multiplier) { - // This optimization technically only produces MulNode(CON, a), but we might as match MulNode(a, CON), too. - if (n->Opcode() == Op_Mul(bt) && (n->in(1)->is_Con() || n->in(2)->is_Con())) { - Node* con = n->in(1); - Node* base = n->in(2); - - // swap ConNode to lhs for easier matching - if (!con->is_Con()) { - swap(con, base); - } - - if (con->is_top()) { - return nullptr; - } - - *multiplier = con->get_integer_as_long(bt); - return base; - } - - return nullptr; -} - -// Try to match `(a << CON1) + (a << CON2)`. On success, return `a` and set `(1 << CON1) + (1 << CON2)` as `multiplier`. -// Match `n` for patterns: -// - AddNode(LShiftNode(a, CON), LShiftNode(a, CON)/a) -// - AddNode(LShiftNode(a, CON)/a, LShiftNode(a, CON)) -// given that lhs is different from rhs. -// Note that one of the term of the addition could simply be `a` (i.e., a << 0). Calling this function with `multiplier` -// being null is safe. -Node* AddNode::find_power_of_two_addition_pattern(Node* n, BasicType bt, jlong* multiplier) { - if (n->Opcode() == Op_Add(bt) && n->in(1) != n->in(2)) { - Node* lhs = n->in(1); - Node* rhs = n->in(2); - - // swap LShiftNode to lhs for easier matching - if (lhs->Opcode() != Op_LShift(bt)) { - swap(lhs, rhs); - } - - // AddNode(LShiftNode(a, CON), *)? - if (lhs->Opcode() != Op_LShift(bt) || !lhs->in(2)->is_Con()) { - return nullptr; - } - - jlong lhs_multiplier = 0; - if (multiplier != nullptr) { - Node* con = lhs->in(2); - if (con->is_top()) { - return nullptr; - } - - lhs_multiplier = (jlong) 1 << con->get_int(); - } - - // AddNode(LShiftNode(a, CON), a)? - if (lhs->in(1) == rhs) { - if (multiplier != nullptr) { - *multiplier = lhs_multiplier + 1; - } - - return rhs; - } - - // AddNode(LShiftNode(a, CON), LShiftNode(a, CON2))? - if (rhs->Opcode() == Op_LShift(bt) && lhs->in(1) == rhs->in(1) && rhs->in(2)->is_Con()) { - if (multiplier != nullptr) { - Node* con = rhs->in(2); - if (con->is_top()) { - return nullptr; - } - - *multiplier = lhs_multiplier + ((jlong) 1 << con->get_int()); - } - - return lhs->in(1); - } - return nullptr; - } - return nullptr; -} Node* AddINode::Ideal(PhaseGVN* phase, bool can_reshape) { Node* in1 = in(1); @@ -1270,7 +1119,7 @@ Node* MaxNode::build_min_max(Node* a, Node* b, bool is_max, bool is_unsigned, co cmp = gvn.transform(CmpNode::make(b, a, bt, is_unsigned)); } Node* bol = gvn.transform(new BoolNode(cmp, BoolTest::lt)); - res = gvn.transform(CMoveNode::make(nullptr, bol, a, b, t)); + res = gvn.transform(CMoveNode::make(bol, a, b, t)); } if (hook != nullptr) { hook->destruct(&gvn); @@ -1299,7 +1148,7 @@ Node* MaxNode::build_min_max_diff_with_zero(Node* a, Node* b, bool is_max, const } Node* sub = gvn.transform(SubNode::make(a, b, bt)); Node* bol = gvn.transform(new BoolNode(cmp, BoolTest::lt)); - Node* res = gvn.transform(CMoveNode::make(nullptr, bol, sub, zero, t)); + Node* res = gvn.transform(CMoveNode::make(bol, sub, zero, t)); if (hook != nullptr) { hook->destruct(&gvn); } diff --git a/src/hotspot/share/opto/addnode.hpp b/src/hotspot/share/opto/addnode.hpp index 0a2c42b7796d0..c409fb8cea839 100644 --- a/src/hotspot/share/opto/addnode.hpp +++ b/src/hotspot/share/opto/addnode.hpp @@ -42,13 +42,6 @@ typedef const Pair ConstAddOperands; // by virtual functions. class AddNode : public Node { virtual uint hash() const; - - Node* convert_serial_additions(PhaseGVN* phase, BasicType bt); - static Node* find_simple_addition_pattern(Node* n, BasicType bt, jlong* multiplier); - static Node* find_simple_lshift_pattern(Node* n, BasicType bt, jlong* multiplier); - static Node* find_simple_multiplication_pattern(Node* n, BasicType bt, jlong* multiplier); - static Node* find_power_of_two_addition_pattern(Node* n, BasicType bt, jlong* multiplier); - public: AddNode( Node *in1, Node *in2 ) : Node(nullptr,in1,in2) { init_class_id(Class_Add); diff --git a/src/hotspot/share/opto/arraycopynode.cpp b/src/hotspot/share/opto/arraycopynode.cpp index 724164d7f4fd6..23a6ee31fffde 100644 --- a/src/hotspot/share/opto/arraycopynode.cpp +++ b/src/hotspot/share/opto/arraycopynode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/c2/barrierSetC2.hpp" #include "gc/shared/c2/cardTableBarrierSetC2.hpp" @@ -33,6 +32,8 @@ #include "utilities/macros.hpp" #include "utilities/powerOfTwo.hpp" +const TypeFunc* ArrayCopyNode::_arraycopy_type_Type = nullptr; + ArrayCopyNode::ArrayCopyNode(Compile* C, bool alloc_tightly_coupled, bool has_negative_length_guard) : CallNode(arraycopy_type(), nullptr, TypePtr::BOTTOM), _kind(None), diff --git a/src/hotspot/share/opto/arraycopynode.hpp b/src/hotspot/share/opto/arraycopynode.hpp index 12004b970bd8d..f792722068fe3 100644 --- a/src/hotspot/share/opto/arraycopynode.hpp +++ b/src/hotspot/share/opto/arraycopynode.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * 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,7 @@ class GraphKit; class ArrayCopyNode : public CallNode { + static const TypeFunc* _arraycopy_type_Type; private: // What kind of arraycopy variant is this? @@ -65,7 +66,15 @@ class ArrayCopyNode : public CallNode { bool _arguments_validated; +public: + static const TypeFunc* arraycopy_type() { + assert(_arraycopy_type_Type != nullptr, "should be initialized"); + return _arraycopy_type_Type; + } + + static void initialize_arraycopy_Type() { + assert(_arraycopy_type_Type == nullptr, "should be"); const Type** fields = TypeTuple::fields(ParmLimit - TypeFunc::Parms); fields[Src] = TypeInstPtr::BOTTOM; fields[SrcPos] = TypeInt::INT; @@ -83,9 +92,10 @@ class ArrayCopyNode : public CallNode { const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields); - return TypeFunc::make(domain, range); + _arraycopy_type_Type = TypeFunc::make(domain, range); } +private: ArrayCopyNode(Compile* C, bool alloc_tightly_coupled, bool has_negative_length_guard); intptr_t get_length_if_constant(PhaseGVN *phase) const; diff --git a/src/hotspot/share/opto/block.cpp b/src/hotspot/share/opto/block.cpp index 14bc9e0797cc6..8e49226c26275 100644 --- a/src/hotspot/share/opto/block.cpp +++ b/src/hotspot/share/opto/block.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "libadt/vectset.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" diff --git a/src/hotspot/share/opto/buildOopMap.cpp b/src/hotspot/share/opto/buildOopMap.cpp index c2f771bedb701..f135df211145e 100644 --- a/src/hotspot/share/opto/buildOopMap.cpp +++ b/src/hotspot/share/opto/buildOopMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "code/vmreg.inline.hpp" #include "compiler/oopMap.hpp" #include "memory/resourceArea.hpp" diff --git a/src/hotspot/share/opto/bytecodeInfo.cpp b/src/hotspot/share/opto/bytecodeInfo.cpp index 35365f37f485f..55c72a0c35a27 100644 --- a/src/hotspot/share/opto/bytecodeInfo.cpp +++ b/src/hotspot/share/opto/bytecodeInfo.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciReplay.hpp" #include "classfile/vmSymbols.hpp" #include "compiler/compilationPolicy.hpp" diff --git a/src/hotspot/share/opto/c2_CodeStubs.cpp b/src/hotspot/share/opto/c2_CodeStubs.cpp index bbdb7a1c85600..e99d48cd8419a 100644 --- a/src/hotspot/share/opto/c2_CodeStubs.cpp +++ b/src/hotspot/share/opto/c2_CodeStubs.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/codeBuffer.hpp" #include "code/codeBlob.hpp" #include "opto/c2_CodeStubs.hpp" diff --git a/src/hotspot/share/opto/c2compiler.cpp b/src/hotspot/share/opto/c2compiler.cpp index c6744d0c7bd0b..40b43e383dc75 100644 --- a/src/hotspot/share/opto/c2compiler.cpp +++ b/src/hotspot/share/opto/c2compiler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/vmClasses.hpp" #include "compiler/compilationMemoryStatistic.hpp" #include "compiler/compilerDefinitions.inline.hpp" diff --git a/src/hotspot/share/opto/callGenerator.cpp b/src/hotspot/share/opto/callGenerator.cpp index 514fece6bb479..8ebb9f662c4f7 100644 --- a/src/hotspot/share/opto/callGenerator.cpp +++ b/src/hotspot/share/opto/callGenerator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/bcEscapeAnalyzer.hpp" #include "ci/ciCallSite.hpp" #include "ci/ciObjArray.hpp" diff --git a/src/hotspot/share/opto/callnode.cpp b/src/hotspot/share/opto/callnode.cpp index 83ea2eea1a8aa..e330115a81de5 100644 --- a/src/hotspot/share/opto/callnode.cpp +++ b/src/hotspot/share/opto/callnode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "compiler/compileLog.hpp" #include "ci/bcEscapeAnalyzer.hpp" #include "compiler/oopMap.hpp" @@ -718,7 +717,9 @@ void CallNode::dump_spec(outputStream *st) const { const Type *CallNode::bottom_type() const { return tf()->range(); } const Type* CallNode::Value(PhaseGVN* phase) const { - if (phase->type(in(0)) == Type::TOP) return Type::TOP; + if (in(0) == nullptr || phase->type(in(0)) == Type::TOP) { + return Type::TOP; + } return tf()->range(); } @@ -1666,6 +1667,8 @@ Node *AllocateArrayNode::make_ideal_length(const TypeOopPtr* oop_type, PhaseValu } //============================================================================= +const TypeFunc* LockNode::_lock_type_Type = nullptr; + uint LockNode::size_of() const { return sizeof(*this); } // Redundant lock elimination diff --git a/src/hotspot/share/opto/callnode.hpp b/src/hotspot/share/opto/callnode.hpp index 2d3835b71ad42..ad5e9daa8f69d 100644 --- a/src/hotspot/share/opto/callnode.hpp +++ b/src/hotspot/share/opto/callnode.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1190,9 +1190,16 @@ class AbstractLockNode: public CallNode { // 2 - a FastLockNode // class LockNode : public AbstractLockNode { + static const TypeFunc* _lock_type_Type; public: - static const TypeFunc *lock_type() { + static inline const TypeFunc* lock_type() { + assert(_lock_type_Type != nullptr, "should be initialized"); + return _lock_type_Type; + } + + static void initialize_lock_Type() { + assert(_lock_type_Type == nullptr, "should be called once"); // create input type (domain) const Type **fields = TypeTuple::fields(3); fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // Object to be Locked @@ -1205,7 +1212,7 @@ class LockNode : public AbstractLockNode { const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0,fields); - return TypeFunc::make(domain,range); + _lock_type_Type = TypeFunc::make(domain,range); } virtual int Opcode() const; diff --git a/src/hotspot/share/opto/castnode.cpp b/src/hotspot/share/opto/castnode.cpp index 600cf7503db44..1644b997fb8dd 100644 --- a/src/hotspot/share/opto/castnode.cpp +++ b/src/hotspot/share/opto/castnode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "opto/addnode.hpp" #include "opto/callnode.hpp" #include "opto/castnode.hpp" diff --git a/src/hotspot/share/opto/cfgnode.cpp b/src/hotspot/share/opto/cfgnode.cpp index 3e451fc789eeb..14afecd2550df 100644 --- a/src/hotspot/share/opto/cfgnode.cpp +++ b/src/hotspot/share/opto/cfgnode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/c2/barrierSetC2.hpp" #include "memory/allocation.inline.hpp" diff --git a/src/hotspot/share/opto/chaitin.cpp b/src/hotspot/share/opto/chaitin.cpp index 4a200241bb7f2..30d8e1ac287ce 100644 --- a/src/hotspot/share/opto/chaitin.cpp +++ b/src/hotspot/share/opto/chaitin.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "compiler/compileLog.hpp" #include "compiler/oopMap.hpp" #include "memory/allocation.inline.hpp" diff --git a/src/hotspot/share/opto/classes.cpp b/src/hotspot/share/opto/classes.cpp index 0297125da9eec..61d164773a29e 100644 --- a/src/hotspot/share/opto/classes.cpp +++ b/src/hotspot/share/opto/classes.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "opto/addnode.hpp" #include "opto/arraycopynode.hpp" #include "opto/callnode.hpp" diff --git a/src/hotspot/share/opto/coalesce.cpp b/src/hotspot/share/opto/coalesce.cpp index 9625a97666ddc..42e3f31492753 100644 --- a/src/hotspot/share/opto/coalesce.cpp +++ b/src/hotspot/share/opto/coalesce.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "memory/allocation.inline.hpp" #include "opto/block.hpp" #include "opto/c2compiler.hpp" diff --git a/src/hotspot/share/opto/compile.cpp b/src/hotspot/share/opto/compile.cpp index 2da8e27d95cd4..a96735a15e70b 100644 --- a/src/hotspot/share/opto/compile.cpp +++ b/src/hotspot/share/opto/compile.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "asm/macroAssembler.inline.hpp" #include "ci/ciReplay.hpp" diff --git a/src/hotspot/share/opto/connode.cpp b/src/hotspot/share/opto/connode.cpp index 00049c6f19e36..db3875dd95d7d 100644 --- a/src/hotspot/share/opto/connode.cpp +++ b/src/hotspot/share/opto/connode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "memory/allocation.inline.hpp" #include "opto/addnode.hpp" #include "opto/compile.hpp" diff --git a/src/hotspot/share/opto/constantTable.cpp b/src/hotspot/share/opto/constantTable.cpp index bcfc048746f5e..ddab9e95e3659 100644 --- a/src/hotspot/share/opto/constantTable.cpp +++ b/src/hotspot/share/opto/constantTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/codeBuffer.hpp" #include "asm/macroAssembler.hpp" #include "opto/block.hpp" diff --git a/src/hotspot/share/opto/convertnode.cpp b/src/hotspot/share/opto/convertnode.cpp index 0a2131782a237..07956d56f1c36 100644 --- a/src/hotspot/share/opto/convertnode.cpp +++ b/src/hotspot/share/opto/convertnode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "opto/addnode.hpp" #include "opto/castnode.hpp" #include "opto/connode.hpp" diff --git a/src/hotspot/share/opto/countbitsnode.cpp b/src/hotspot/share/opto/countbitsnode.cpp index f9de303ffe474..4023678b51c68 100644 --- a/src/hotspot/share/opto/countbitsnode.cpp +++ b/src/hotspot/share/opto/countbitsnode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "opto/countbitsnode.hpp" #include "opto/opcodes.hpp" #include "opto/phaseX.hpp" diff --git a/src/hotspot/share/opto/divnode.cpp b/src/hotspot/share/opto/divnode.cpp index e1b143f65f8cb..ef27a3d7a14fb 100644 --- a/src/hotspot/share/opto/divnode.cpp +++ b/src/hotspot/share/opto/divnode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "memory/allocation.inline.hpp" #include "opto/addnode.hpp" #include "opto/connode.hpp" @@ -35,6 +34,7 @@ #include "opto/phaseX.hpp" #include "opto/subnode.hpp" #include "utilities/powerOfTwo.hpp" +#include "opto/runtime.hpp" // Portions of code courtesy of Clifford Click @@ -42,6 +42,23 @@ #include +ModFloatingNode::ModFloatingNode(Compile* C, const TypeFunc* tf, const char* name) : CallLeafNode(tf, nullptr, name, TypeRawPtr::BOTTOM) { + add_flag(Flag_is_macro); + C->add_macro_node(this); +} + +ModDNode::ModDNode(Compile* C, Node* a, Node* b) : ModFloatingNode(C, OptoRuntime::Math_DD_D_Type(), "drem") { + init_req(TypeFunc::Parms + 0, a); + init_req(TypeFunc::Parms + 1, C->top()); + init_req(TypeFunc::Parms + 2, b); + init_req(TypeFunc::Parms + 3, C->top()); +} + +ModFNode::ModFNode(Compile* C, Node* a, Node* b) : ModFloatingNode(C, OptoRuntime::modf_Type(), "frem") { + init_req(TypeFunc::Parms + 0, a); + init_req(TypeFunc::Parms + 1, b); +} + //----------------------magic_int_divide_constants----------------------------- // Compute magic multiplier and shift constant for converting a 32 bit divide // by constant into a multiply/shift/add series. Return false if calculations @@ -1377,39 +1394,48 @@ const Type* ModLNode::Value(PhaseGVN* phase) const { return TypeLong::make( i1->get_con() % i2->get_con() ); } +Node *UModLNode::Ideal(PhaseGVN *phase, bool can_reshape) { + return unsigned_mod_ideal(phase, can_reshape, this); +} -//============================================================================= -//------------------------------Value------------------------------------------ -const Type* ModFNode::Value(PhaseGVN* phase) const { - // Either input is TOP ==> the result is TOP - const Type *t1 = phase->type( in(1) ); - const Type *t2 = phase->type( in(2) ); - if( t1 == Type::TOP ) return Type::TOP; - if( t2 == Type::TOP ) return Type::TOP; +const Type* UModLNode::Value(PhaseGVN* phase) const { + return unsigned_mod_value(phase, this); +} - // Either input is BOTTOM ==> the result is the local BOTTOM - const Type *bot = bottom_type(); - if( (t1 == bot) || (t2 == bot) || - (t1 == Type::BOTTOM) || (t2 == Type::BOTTOM) ) - return bot; +Node* ModFNode::Ideal(PhaseGVN* phase, bool can_reshape) { + if (!can_reshape) { + return nullptr; + } + + // Either input is TOP ==> the result is TOP + const Type* t1 = phase->type(dividend()); + const Type* t2 = phase->type(divisor()); + if (t1 == Type::TOP || t2 == Type::TOP) { + return phase->C->top(); + } // If either number is not a constant, we know nothing. if ((t1->base() != Type::FloatCon) || (t2->base() != Type::FloatCon)) { - return Type::FLOAT; // note: x%x can be either NaN or 0 + return nullptr; // note: x%x can be either NaN or 0 } float f1 = t1->getf(); float f2 = t2->getf(); - jint x1 = jint_cast(f1); // note: *(int*)&f1, not just (int)f1 - jint x2 = jint_cast(f2); + jint x1 = jint_cast(f1); // note: *(int*)&f1, not just (int)f1 + jint x2 = jint_cast(f2); // If either is a NaN, return an input NaN - if (g_isnan(f1)) return t1; - if (g_isnan(f2)) return t2; + if (g_isnan(f1)) { + return replace_with_con(phase, t1); + } + if (g_isnan(f2)) { + return replace_with_con(phase, t2); + } // If an operand is infinity or the divisor is +/- zero, punt. - if (!g_isfinite(f1) || !g_isfinite(f2) || x2 == 0 || x2 == min_jint) - return Type::FLOAT; + if (!g_isfinite(f1) || !g_isfinite(f2) || x2 == 0 || x2 == min_jint) { + return nullptr; + } // We must be modulo'ing 2 float constants. // Make sure that the sign of the fmod is equal to the sign of the dividend @@ -1418,51 +1444,43 @@ const Type* ModFNode::Value(PhaseGVN* phase) const { xr ^= min_jint; } - return TypeF::make(jfloat_cast(xr)); -} - -//============================================================================= -//------------------------------Idealize--------------------------------------- -Node *UModLNode::Ideal(PhaseGVN *phase, bool can_reshape) { - return unsigned_mod_ideal(phase, can_reshape, this); + return replace_with_con(phase, TypeF::make(jfloat_cast(xr))); } -const Type* UModLNode::Value(PhaseGVN* phase) const { - return unsigned_mod_value(phase, this); -} +Node* ModDNode::Ideal(PhaseGVN* phase, bool can_reshape) { + if (!can_reshape) { + return nullptr; + } -//============================================================================= -//------------------------------Value------------------------------------------ -const Type* ModDNode::Value(PhaseGVN* phase) const { // Either input is TOP ==> the result is TOP - const Type *t1 = phase->type( in(1) ); - const Type *t2 = phase->type( in(2) ); - if( t1 == Type::TOP ) return Type::TOP; - if( t2 == Type::TOP ) return Type::TOP; - - // Either input is BOTTOM ==> the result is the local BOTTOM - const Type *bot = bottom_type(); - if( (t1 == bot) || (t2 == bot) || - (t1 == Type::BOTTOM) || (t2 == Type::BOTTOM) ) - return bot; + const Type* t1 = phase->type(dividend()); + const Type* t2 = phase->type(divisor()); + if (t1 == Type::TOP || t2 == Type::TOP) { + return nullptr; + } // If either number is not a constant, we know nothing. if ((t1->base() != Type::DoubleCon) || (t2->base() != Type::DoubleCon)) { - return Type::DOUBLE; // note: x%x can be either NaN or 0 + return nullptr; // note: x%x can be either NaN or 0 } double f1 = t1->getd(); double f2 = t2->getd(); - jlong x1 = jlong_cast(f1); // note: *(long*)&f1, not just (long)f1 - jlong x2 = jlong_cast(f2); + jlong x1 = jlong_cast(f1); // note: *(long*)&f1, not just (long)f1 + jlong x2 = jlong_cast(f2); // If either is a NaN, return an input NaN - if (g_isnan(f1)) return t1; - if (g_isnan(f2)) return t2; + if (g_isnan(f1)) { + return replace_with_con(phase, t1); + } + if (g_isnan(f2)) { + return replace_with_con(phase, t2); + } // If an operand is infinity or the divisor is +/- zero, punt. - if (!g_isfinite(f1) || !g_isfinite(f2) || x2 == 0 || x2 == min_jlong) - return Type::DOUBLE; + if (!g_isfinite(f1) || !g_isfinite(f2) || x2 == 0 || x2 == min_jlong) { + return nullptr; + } // We must be modulo'ing 2 double constants. // Make sure that the sign of the fmod is equal to the sign of the dividend @@ -1471,7 +1489,36 @@ const Type* ModDNode::Value(PhaseGVN* phase) const { xr ^= min_jlong; } - return TypeD::make(jdouble_cast(xr)); + return replace_with_con(phase, TypeD::make(jdouble_cast(xr))); +} + +Node* ModFloatingNode::replace_with_con(PhaseGVN* phase, const Type* con) { + Compile* C = phase->C; + Node* con_node = phase->makecon(con); + CallProjections projs; + extract_projections(&projs, false, false); + C->gvn_replace_by(projs.fallthrough_proj, in(TypeFunc::Control)); + if (projs.fallthrough_catchproj != nullptr) { + C->gvn_replace_by(projs.fallthrough_catchproj, in(TypeFunc::Control)); + } + if (projs.fallthrough_memproj != nullptr) { + C->gvn_replace_by(projs.fallthrough_memproj, in(TypeFunc::Memory)); + } + if (projs.catchall_memproj != nullptr) { + C->gvn_replace_by(projs.catchall_memproj, C->top()); + } + if (projs.fallthrough_ioproj != nullptr) { + C->gvn_replace_by(projs.fallthrough_ioproj, in(TypeFunc::I_O)); + } + assert(projs.catchall_ioproj == nullptr, "no exceptions from floating mod"); + assert(projs.catchall_catchproj == nullptr, "no exceptions from floating mod"); + if (projs.resproj != nullptr) { + C->gvn_replace_by(projs.resproj, con_node); + } + C->gvn_replace_by(this, C->top()); + C->remove_macro_node(this); + disconnect_inputs(C); + return nullptr; } //============================================================================= diff --git a/src/hotspot/share/opto/divnode.hpp b/src/hotspot/share/opto/divnode.hpp index b9a4a32d156e9..b3eb97d3996da 100644 --- a/src/hotspot/share/opto/divnode.hpp +++ b/src/hotspot/share/opto/divnode.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ #ifndef SHARE_OPTO_DIVNODE_HPP #define SHARE_OPTO_DIVNODE_HPP +#include "opto/callnode.hpp" #include "opto/multnode.hpp" #include "opto/node.hpp" #include "opto/opcodes.hpp" @@ -140,26 +141,41 @@ class ModLNode : public Node { virtual uint ideal_reg() const { return Op_RegL; } }; -//------------------------------ModFNode--------------------------------------- +// Base class for float and double modulus +class ModFloatingNode : public CallLeafNode { +protected: + Node* replace_with_con(PhaseGVN* phase, const Type* con); + +public: + ModFloatingNode(Compile* C, const TypeFunc* tf, const char *name); +}; + // Float Modulus -class ModFNode : public Node { +class ModFNode : public ModFloatingNode { +private: + Node* dividend() const { return in(TypeFunc::Parms + 0); } + Node* divisor() const { return in(TypeFunc::Parms + 1); } + public: - ModFNode( Node *c, Node *in1, Node *in2 ) : Node(c,in1, in2) {} + ModFNode(Compile* C, Node* a, Node* b); virtual int Opcode() const; - virtual const Type* Value(PhaseGVN* phase) const; - virtual const Type *bottom_type() const { return Type::FLOAT; } virtual uint ideal_reg() const { return Op_RegF; } + virtual uint size_of() const { return sizeof(*this); } + virtual Node* Ideal(PhaseGVN* phase, bool can_reshape); }; -//------------------------------ModDNode--------------------------------------- // Double Modulus -class ModDNode : public Node { +class ModDNode : public ModFloatingNode { +private: + Node* dividend() const { return in(TypeFunc::Parms + 0); } + Node* divisor() const { return in(TypeFunc::Parms + 2); } + public: - ModDNode( Node *c, Node *in1, Node *in2 ) : Node(c, in1, in2) {} + ModDNode(Compile* C, Node* a, Node* b); virtual int Opcode() const; - virtual const Type* Value(PhaseGVN* phase) const; - virtual const Type *bottom_type() const { return Type::DOUBLE; } virtual uint ideal_reg() const { return Op_RegD; } + virtual uint size_of() const { return sizeof(*this); } + virtual Node* Ideal(PhaseGVN* phase, bool can_reshape); }; //------------------------------UModINode--------------------------------------- diff --git a/src/hotspot/share/opto/doCall.cpp b/src/hotspot/share/opto/doCall.cpp index 0a5e27ed5b13f..68a799fc6f355 100644 --- a/src/hotspot/share/opto/doCall.cpp +++ b/src/hotspot/share/opto/doCall.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciCallSite.hpp" #include "ci/ciMethodHandle.hpp" #include "ci/ciSymbols.hpp" diff --git a/src/hotspot/share/opto/domgraph.cpp b/src/hotspot/share/opto/domgraph.cpp index 6bed1b1a2bd57..a80358e1d0f7d 100644 --- a/src/hotspot/share/opto/domgraph.cpp +++ b/src/hotspot/share/opto/domgraph.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "libadt/vectset.hpp" #include "memory/allocation.hpp" #include "memory/resourceArea.hpp" diff --git a/src/hotspot/share/opto/escape.cpp b/src/hotspot/share/opto/escape.cpp index 6d845c86a5f88..684b50ded4f67 100644 --- a/src/hotspot/share/opto/escape.cpp +++ b/src/hotspot/share/opto/escape.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/bcEscapeAnalyzer.hpp" #include "compiler/compileLog.hpp" #include "gc/shared/barrierSet.hpp" diff --git a/src/hotspot/share/opto/gcm.cpp b/src/hotspot/share/opto/gcm.cpp index ebdefe597ff1f..c9cdd235f03bb 100644 --- a/src/hotspot/share/opto/gcm.cpp +++ b/src/hotspot/share/opto/gcm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "libadt/vectset.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" @@ -1265,13 +1264,15 @@ bool PhaseCFG::is_cheaper_block(Block* LCA, Node* self, uint target_latency, return C->randomized_select(cand_cnt); } - // Better Frequency - if (LCA->_freq < least_freq) { + const double delta = 1 + PROB_UNLIKELY_MAG(4); + + // Better Frequency. Add a small delta to the comparison to not needlessly + // hoist because of, e.g., small numerical inaccuracies. + if (LCA->_freq * delta < least_freq) { return true; } // Otherwise, choose with latency - const double delta = 1 + PROB_UNLIKELY_MAG(4); if (!in_latency && // No block containing latency LCA->_freq < least_freq * delta && // No worse frequency target_latency >= end_latency && // within latency range diff --git a/src/hotspot/share/opto/generateOptoStub.cpp b/src/hotspot/share/opto/generateOptoStub.cpp index b6f09dcc439f3..b13504ab10e56 100644 --- a/src/hotspot/share/opto/generateOptoStub.cpp +++ b/src/hotspot/share/opto/generateOptoStub.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "memory/resourceArea.hpp" #include "opto/addnode.hpp" #include "opto/callnode.hpp" diff --git a/src/hotspot/share/opto/graphKit.cpp b/src/hotspot/share/opto/graphKit.cpp index 0cc68c426398e..82a7eaaea8218 100644 --- a/src/hotspot/share/opto/graphKit.cpp +++ b/src/hotspot/share/opto/graphKit.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciUtilities.hpp" #include "classfile/javaClasses.hpp" #include "ci/ciObjArray.hpp" diff --git a/src/hotspot/share/opto/idealGraphPrinter.cpp b/src/hotspot/share/opto/idealGraphPrinter.cpp index 42726a34d015e..6a28074f4d954 100644 --- a/src/hotspot/share/opto/idealGraphPrinter.cpp +++ b/src/hotspot/share/opto/idealGraphPrinter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "memory/resourceArea.hpp" #include "opto/chaitin.hpp" #include "opto/idealGraphPrinter.hpp" @@ -210,7 +209,7 @@ void IdealGraphPrinter::end_head() { void IdealGraphPrinter::print_attr(const char *name, intptr_t val) { stringStream stream; - stream.print(INTX_FORMAT, val); + stream.print("%zd", val); print_attr(name, stream.freeze()); } @@ -945,7 +944,7 @@ void IdealGraphPrinter::init_network_stream() { } else { // It would be nice if we could shut down cleanly but it should // be an error if we can't connect to the visualizer. - fatal("Couldn't connect to visualizer at %s:" INTX_FORMAT, + fatal("Couldn't connect to visualizer at %s:%zd", PrintIdealGraphAddress, PrintIdealGraphPort); } } diff --git a/src/hotspot/share/opto/idealKit.cpp b/src/hotspot/share/opto/idealKit.cpp index baa055bc60aeb..528a0e294119e 100644 --- a/src/hotspot/share/opto/idealKit.cpp +++ b/src/hotspot/share/opto/idealKit.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "opto/addnode.hpp" #include "opto/callnode.hpp" #include "opto/cfgnode.hpp" diff --git a/src/hotspot/share/opto/ifg.cpp b/src/hotspot/share/opto/ifg.cpp index d12698121b939..3793983b62aaf 100644 --- a/src/hotspot/share/opto/ifg.cpp +++ b/src/hotspot/share/opto/ifg.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "compiler/oopMap.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" diff --git a/src/hotspot/share/opto/ifnode.cpp b/src/hotspot/share/opto/ifnode.cpp index 3c50e7993c208..5660213556032 100644 --- a/src/hotspot/share/opto/ifnode.cpp +++ b/src/hotspot/share/opto/ifnode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciTypeFlow.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" diff --git a/src/hotspot/share/opto/indexSet.cpp b/src/hotspot/share/opto/indexSet.cpp index e0c063145c6ef..cc46c4152c4ea 100644 --- a/src/hotspot/share/opto/indexSet.cpp +++ b/src/hotspot/share/opto/indexSet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "memory/allocation.inline.hpp" #include "opto/chaitin.hpp" #include "opto/compile.hpp" diff --git a/src/hotspot/share/opto/intrinsicnode.cpp b/src/hotspot/share/opto/intrinsicnode.cpp index 010579722bb10..e67352d85bdcc 100644 --- a/src/hotspot/share/opto/intrinsicnode.cpp +++ b/src/hotspot/share/opto/intrinsicnode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "opto/intrinsicnode.hpp" #include "opto/addnode.hpp" #include "opto/mulnode.hpp" diff --git a/src/hotspot/share/opto/lcm.cpp b/src/hotspot/share/opto/lcm.cpp index 0079f366640e8..8d2809f987ca0 100644 --- a/src/hotspot/share/opto/lcm.cpp +++ b/src/hotspot/share/opto/lcm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "gc/shared/gc_globals.hpp" #include "memory/allocation.inline.hpp" diff --git a/src/hotspot/share/opto/library_call.cpp b/src/hotspot/share/opto/library_call.cpp index 40b19eecd9f65..9ed7bea750de7 100644 --- a/src/hotspot/share/opto/library_call.cpp +++ b/src/hotspot/share/opto/library_call.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "ci/ciUtilities.inline.hpp" #include "classfile/vmIntrinsics.hpp" @@ -2140,18 +2139,18 @@ bool LibraryCallKit::inline_number_methods(vmIntrinsics::ID id) { Node* arg = argument(0); Node* n = nullptr; switch (id) { - case vmIntrinsics::_numberOfLeadingZeros_i: n = new CountLeadingZerosINode( arg); break; - case vmIntrinsics::_numberOfLeadingZeros_l: n = new CountLeadingZerosLNode( arg); break; - case vmIntrinsics::_numberOfTrailingZeros_i: n = new CountTrailingZerosINode(arg); break; - case vmIntrinsics::_numberOfTrailingZeros_l: n = new CountTrailingZerosLNode(arg); break; - case vmIntrinsics::_bitCount_i: n = new PopCountINode( arg); break; - case vmIntrinsics::_bitCount_l: n = new PopCountLNode( arg); break; - case vmIntrinsics::_reverseBytes_c: n = new ReverseBytesUSNode(nullptr, arg); break; - case vmIntrinsics::_reverseBytes_s: n = new ReverseBytesSNode( nullptr, arg); break; - case vmIntrinsics::_reverseBytes_i: n = new ReverseBytesINode( nullptr, arg); break; - case vmIntrinsics::_reverseBytes_l: n = new ReverseBytesLNode( nullptr, arg); break; - case vmIntrinsics::_reverse_i: n = new ReverseINode(nullptr, arg); break; - case vmIntrinsics::_reverse_l: n = new ReverseLNode(nullptr, arg); break; + case vmIntrinsics::_numberOfLeadingZeros_i: n = new CountLeadingZerosINode( arg); break; + case vmIntrinsics::_numberOfLeadingZeros_l: n = new CountLeadingZerosLNode( arg); break; + case vmIntrinsics::_numberOfTrailingZeros_i: n = new CountTrailingZerosINode(arg); break; + case vmIntrinsics::_numberOfTrailingZeros_l: n = new CountTrailingZerosLNode(arg); break; + case vmIntrinsics::_bitCount_i: n = new PopCountINode( arg); break; + case vmIntrinsics::_bitCount_l: n = new PopCountLNode( arg); break; + case vmIntrinsics::_reverseBytes_c: n = new ReverseBytesUSNode( arg); break; + case vmIntrinsics::_reverseBytes_s: n = new ReverseBytesSNode( arg); break; + case vmIntrinsics::_reverseBytes_i: n = new ReverseBytesINode( arg); break; + case vmIntrinsics::_reverseBytes_l: n = new ReverseBytesLNode( arg); break; + case vmIntrinsics::_reverse_i: n = new ReverseINode( arg); break; + case vmIntrinsics::_reverse_l: n = new ReverseLNode( arg); break; default: fatal_unexpected_iid(id); break; } set_result(_gvn.transform(n)); @@ -3871,7 +3870,7 @@ Node* LibraryCallKit::generate_klass_flags_guard(Node* kls, int modifier_mask, i } Node* LibraryCallKit::generate_interface_guard(Node* kls, RegionNode* region) { return generate_klass_flags_guard(kls, JVM_ACC_INTERFACE, 0, region, - Klass::access_flags_offset(), TypeInt::INT, T_INT); + Klass::access_flags_offset(), TypeInt::CHAR, T_CHAR); } // Use this for testing if Klass is_hidden, has_finalizer, and is_cloneable_fast. @@ -3904,8 +3903,7 @@ bool LibraryCallKit::inline_native_Class_query(vmIntrinsics::ID id) { break; case vmIntrinsics::_getModifiers: prim_return_value = intcon(JVM_ACC_ABSTRACT | JVM_ACC_FINAL | JVM_ACC_PUBLIC); - assert(is_power_of_2((int)JVM_ACC_WRITTEN_FLAGS+1), "change next line"); - return_type = TypeInt::make(0, JVM_ACC_WRITTEN_FLAGS, Type::WidenMin); + return_type = TypeInt::CHAR; break; case vmIntrinsics::_isInterface: prim_return_value = intcon(0); @@ -3927,7 +3925,7 @@ bool LibraryCallKit::inline_native_Class_query(vmIntrinsics::ID id) { break; case vmIntrinsics::_getClassAccessFlags: prim_return_value = intcon(JVM_ACC_ABSTRACT | JVM_ACC_FINAL | JVM_ACC_PUBLIC); - return_type = TypeInt::INT; // not bool! 6297094 + return_type = TypeInt::CHAR; break; default: fatal_unexpected_iid(id); @@ -3988,7 +3986,7 @@ bool LibraryCallKit::inline_native_Class_query(vmIntrinsics::ID id) { case vmIntrinsics::_getModifiers: p = basic_plus_adr(kls, in_bytes(Klass::modifier_flags_offset())); - query_value = make_load(nullptr, p, TypeInt::INT, T_INT, MemNode::unordered); + query_value = make_load(nullptr, p, TypeInt::CHAR, T_CHAR, MemNode::unordered); break; case vmIntrinsics::_isInterface: @@ -4053,7 +4051,7 @@ bool LibraryCallKit::inline_native_Class_query(vmIntrinsics::ID id) { case vmIntrinsics::_getClassAccessFlags: p = basic_plus_adr(kls, in_bytes(Klass::access_flags_offset())); - query_value = make_load(nullptr, p, TypeInt::INT, T_INT, MemNode::unordered); + query_value = make_load(nullptr, p, TypeInt::CHAR, T_CHAR, MemNode::unordered); break; default: @@ -4257,7 +4255,7 @@ bool LibraryCallKit::inline_native_subtype_check() { //---------------------generate_array_guard_common------------------------ Node* LibraryCallKit::generate_array_guard_common(Node* kls, RegionNode* region, - bool obj_array, bool not_array) { + bool obj_array, bool not_array, Node** obj) { if (stopped()) { return nullptr; @@ -4299,7 +4297,14 @@ Node* LibraryCallKit::generate_array_guard_common(Node* kls, RegionNode* region, // invert the test if we are looking for a non-array if (not_array) btest = BoolTest(btest).negate(); Node* bol = _gvn.transform(new BoolNode(cmp, btest)); - return generate_fair_guard(bol, region); + Node* ctrl = generate_fair_guard(bol, region); + Node* is_array_ctrl = not_array ? control() : ctrl; + if (obj != nullptr && is_array_ctrl != nullptr && is_array_ctrl != top()) { + // Keep track of the fact that 'obj' is an array to prevent + // array specific accesses from floating above the guard. + *obj = _gvn.transform(new CastPPNode(is_array_ctrl, *obj, TypeAryPtr::BOTTOM)); + } + return ctrl; } @@ -4394,7 +4399,7 @@ bool LibraryCallKit::inline_native_getLength() { if (stopped()) return true; // Deoptimize if it is a non-array. - Node* non_array = generate_non_array_guard(load_object_klass(array), nullptr); + Node* non_array = generate_non_array_guard(load_object_klass(array), nullptr, &array); if (non_array != nullptr) { PreserveJVMState pjvms(this); @@ -5131,7 +5136,7 @@ bool LibraryCallKit::inline_unsafe_setMemory() { // Call it. Note that the length argument is not scaled. make_runtime_call(flags, - OptoRuntime::make_setmemory_Type(), + OptoRuntime::unsafe_setmemory_Type(), StubRoutines::unsafe_setmemory(), "unsafe_setmemory", dst_type, @@ -5254,12 +5259,13 @@ bool LibraryCallKit::inline_native_clone(bool is_virtual) { record_for_igvn(result_reg); Node* obj_klass = load_object_klass(obj); - Node* array_ctl = generate_array_guard(obj_klass, (RegionNode*)nullptr); + Node* array_obj = obj; + Node* array_ctl = generate_array_guard(obj_klass, (RegionNode*)nullptr, &array_obj); if (array_ctl != nullptr) { // It's an array. PreserveJVMState pjvms(this); set_control(array_ctl); - Node* obj_length = load_array_length(obj); + Node* obj_length = load_array_length(array_obj); Node* array_size = nullptr; // Size of the array without object alignment padding. Node* alloc_obj = new_array(obj_klass, obj_length, 0, &array_size, /*deoptimize_on_exception=*/true); @@ -5273,7 +5279,7 @@ bool LibraryCallKit::inline_native_clone(bool is_virtual) { set_control(is_obja); // Generate a direct call to the right arraycopy function(s). // Clones are always tightly coupled. - ArrayCopyNode* ac = ArrayCopyNode::make(this, true, obj, intcon(0), alloc_obj, intcon(0), obj_length, true, false); + ArrayCopyNode* ac = ArrayCopyNode::make(this, true, array_obj, intcon(0), alloc_obj, intcon(0), obj_length, true, false); ac->set_clone_oop_array(); Node* n = _gvn.transform(ac); assert(n == ac, "cannot disappear"); @@ -5294,7 +5300,7 @@ bool LibraryCallKit::inline_native_clone(bool is_virtual) { // the object.) if (!stopped()) { - copy_to_clone(obj, alloc_obj, array_size, true); + copy_to_clone(array_obj, alloc_obj, array_size, true); // Present the results of the copy. result_reg->init_req(_array_path, control()); @@ -5915,8 +5921,8 @@ bool LibraryCallKit::inline_arraycopy() { record_for_igvn(slow_region); // (1) src and dest are arrays. - generate_non_array_guard(load_object_klass(src), slow_region); - generate_non_array_guard(load_object_klass(dest), slow_region); + generate_non_array_guard(load_object_klass(src), slow_region, &src); + generate_non_array_guard(load_object_klass(dest), slow_region, &dest); // (2) src and dest arrays must have elements of the same BasicType // done at macro expansion or at Ideal transformation time @@ -8264,14 +8270,14 @@ bool LibraryCallKit::inline_fma(vmIntrinsics::ID id) { a = round_double_node(argument(0)); b = round_double_node(argument(2)); c = round_double_node(argument(4)); - result = _gvn.transform(new FmaDNode(control(), a, b, c)); + result = _gvn.transform(new FmaDNode(a, b, c)); break; case vmIntrinsics::_fmaF: assert(callee()->signature()->size() == 3, "fma has 3 parameters of size 1 each."); a = argument(0); b = argument(1); c = argument(2); - result = _gvn.transform(new FmaFNode(control(), a, b, c)); + result = _gvn.transform(new FmaFNode(a, b, c)); break; default: fatal_unexpected_iid(id); break; @@ -8532,7 +8538,7 @@ bool LibraryCallKit::inline_getObjectSize() { PhiNode* result_val = new PhiNode(result_reg, TypeLong::LONG); record_for_igvn(result_reg); - Node* array_ctl = generate_array_guard(klass_node, nullptr); + Node* array_ctl = generate_array_guard(klass_node, nullptr, &obj); if (array_ctl != nullptr) { // Array case: size is round(header + element_size*arraylength). // Since arraylength is different for every array instance, we have to diff --git a/src/hotspot/share/opto/library_call.hpp b/src/hotspot/share/opto/library_call.hpp index f629f757df2bf..c3edebd367bf2 100644 --- a/src/hotspot/share/opto/library_call.hpp +++ b/src/hotspot/share/opto/library_call.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -163,20 +163,20 @@ class LibraryCallKit : public GraphKit { RegionNode* region); Node* generate_interface_guard(Node* kls, RegionNode* region); Node* generate_hidden_class_guard(Node* kls, RegionNode* region); - Node* generate_array_guard(Node* kls, RegionNode* region) { - return generate_array_guard_common(kls, region, false, false); + Node* generate_array_guard(Node* kls, RegionNode* region, Node** obj = nullptr) { + return generate_array_guard_common(kls, region, false, false, obj); } - Node* generate_non_array_guard(Node* kls, RegionNode* region) { - return generate_array_guard_common(kls, region, false, true); + Node* generate_non_array_guard(Node* kls, RegionNode* region, Node** obj = nullptr) { + return generate_array_guard_common(kls, region, false, true, obj); } - Node* generate_objArray_guard(Node* kls, RegionNode* region) { - return generate_array_guard_common(kls, region, true, false); + Node* generate_objArray_guard(Node* kls, RegionNode* region, Node** obj = nullptr) { + return generate_array_guard_common(kls, region, true, false, obj); } - Node* generate_non_objArray_guard(Node* kls, RegionNode* region) { - return generate_array_guard_common(kls, region, true, true); + Node* generate_non_objArray_guard(Node* kls, RegionNode* region, Node** obj = nullptr) { + return generate_array_guard_common(kls, region, true, true, obj); } Node* generate_array_guard_common(Node* kls, RegionNode* region, - bool obj_array, bool not_array); + bool obj_array, bool not_array, Node** obj = nullptr); Node* generate_virtual_guard(Node* obj_klass, RegionNode* slow_region); CallJavaNode* generate_method_call(vmIntrinsicID method_id, bool is_virtual, bool is_static, bool res_not_null); CallJavaNode* generate_method_call_static(vmIntrinsicID method_id, bool res_not_null) { diff --git a/src/hotspot/share/opto/live.cpp b/src/hotspot/share/opto/live.cpp index 7112d7aaaf0ee..cd202f5e35f29 100644 --- a/src/hotspot/share/opto/live.cpp +++ b/src/hotspot/share/opto/live.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" #include "opto/callnode.hpp" diff --git a/src/hotspot/share/opto/locknode.cpp b/src/hotspot/share/opto/locknode.cpp index 917d9d2bada12..4587bfd4fd6ec 100644 --- a/src/hotspot/share/opto/locknode.cpp +++ b/src/hotspot/share/opto/locknode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "opto/locknode.hpp" #include "opto/parse.hpp" #include "opto/rootnode.hpp" diff --git a/src/hotspot/share/opto/loopPredicate.cpp b/src/hotspot/share/opto/loopPredicate.cpp index 02649d3711a99..dc7d125cc913e 100644 --- a/src/hotspot/share/opto/loopPredicate.cpp +++ b/src/hotspot/share/opto/loopPredicate.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "memory/allocation.hpp" #include "opto/addnode.hpp" #include "opto/callnode.hpp" @@ -100,8 +99,7 @@ void PhaseIdealLoop::register_control(Node* n, IdealLoopTree *loop, Node* pred, // is an IfTrue projection. This code is also used to clone predicates to cloned loops. IfTrueNode* PhaseIdealLoop::create_new_if_for_predicate(ParsePredicateSuccessProj* parse_predicate_success_proj, Node* new_entry, const Deoptimization::DeoptReason reason, - const int opcode, const bool rewire_uncommon_proj_phi_inputs, - AssertionPredicateType assertion_predicate_type) { + const int opcode, const bool rewire_uncommon_proj_phi_inputs) { assert(parse_predicate_success_proj->is_uncommon_trap_if_pattern(reason), "must be a uct if pattern!"); ParsePredicateNode* parse_predicate = parse_predicate_success_proj->in(0)->as_ParsePredicate(); ParsePredicateUncommonProj* uncommon_proj = parse_predicate->uncommon_proj(); @@ -143,12 +141,10 @@ IfTrueNode* PhaseIdealLoop::create_new_if_for_predicate(ParsePredicateSuccessPro IfNode* new_iff = nullptr; switch (opcode) { case Op_If: - new_iff = new IfNode(entry, parse_predicate->in(1), parse_predicate->_prob, parse_predicate->_fcnt - NOT_PRODUCT(COMMA assertion_predicate_type)); + new_iff = new IfNode(entry, parse_predicate->in(1), parse_predicate->_prob, parse_predicate->_fcnt); break; case Op_RangeCheck: - new_iff = new RangeCheckNode(entry, parse_predicate->in(1), parse_predicate->_prob, parse_predicate->_fcnt - NOT_PRODUCT(COMMA assertion_predicate_type)); + new_iff = new RangeCheckNode(entry, parse_predicate->in(1), parse_predicate->_prob, parse_predicate->_fcnt); break; case Op_ParsePredicate: new_iff = new ParsePredicateNode(entry, reason, &_igvn); @@ -272,150 +268,15 @@ void PhaseIdealLoop::fix_cloned_data_node_controls(const ProjNode* old_uncommon_ orig_to_clone.iterate_all(orig_clone_action); } -IfProjNode* PhaseIdealLoop::clone_parse_predicate_to_unswitched_loop(ParsePredicateSuccessProj* parse_predicate_proj, - Node* new_entry, Deoptimization::DeoptReason reason, - const bool slow_loop) { - - IfProjNode* new_predicate_proj = create_new_if_for_predicate(parse_predicate_proj, new_entry, reason, Op_ParsePredicate, - slow_loop); - assert(new_predicate_proj->is_IfTrue(), "the success projection of a Parse Predicate is a true projection"); - ParsePredicateNode* parse_predicate = new_predicate_proj->in(0)->as_ParsePredicate(); - return new_predicate_proj; -} - -// Clones Template Assertion Predicates to both unswitched loops starting at 'old_predicate_proj' by following its -// control inputs. It also rewires the control edges of data nodes with dependencies in the loop from the old predicates -// to the new cloned predicates. -void PhaseIdealLoop::clone_assertion_predicates_to_unswitched_loop(IdealLoopTree* loop, const Node_List& old_new, - ParsePredicateSuccessProj* old_parse_predicate_proj, - ParsePredicateNode* true_path_loop_parse_predicate, - ParsePredicateNode* false_path_loop_parse_predicate) { - // Push the original Template Assertion Predicates on a list to later process them in reverse order to keep the - // original predicate order. - Unique_Node_List list; - get_template_assertion_predicates(old_parse_predicate_proj, list); - - Node_List to_process; - for (int i = list.size() - 1; i >= 0; i--) { - IfTrueNode* template_assertion_predicate_success_proj = list.at(i)->as_IfTrue(); - assert(template_assertion_predicate_success_proj->in(0)->is_If(), "must be If node"); - - IfTrueNode* true_path_loop_proj = - clone_assertion_predicate_for_unswitched_loops(template_assertion_predicate_success_proj, - true_path_loop_parse_predicate); - IfTrueNode* false_path_loop_proj = - clone_assertion_predicate_for_unswitched_loops(template_assertion_predicate_success_proj, - false_path_loop_parse_predicate); - - // Update control dependent data nodes. - for (DUIterator j = template_assertion_predicate_success_proj->outs(); - template_assertion_predicate_success_proj->has_out(j); - j++) { - Node* true_path_loop_node = template_assertion_predicate_success_proj->out(j); - if (loop->is_member(get_loop(ctrl_or_self(true_path_loop_node)))) { - assert(true_path_loop_node->in(0) == template_assertion_predicate_success_proj, "only control edge"); - Node* false_path_loop_node = old_new[true_path_loop_node->_idx]; - assert(false_path_loop_node->in(0) == template_assertion_predicate_success_proj, "only control edge"); - _igvn.replace_input_of(true_path_loop_node, 0, true_path_loop_proj); - to_process.push(false_path_loop_node); - --j; - } - } - // Have to delay updates to the false path loop so uses of predicate are not modified while we iterate on them. - while (to_process.size() > 0) { - Node* slow_node = to_process.pop(); - _igvn.replace_input_of(slow_node, 0, false_path_loop_proj); - } - } -} - -// Put all Template Assertion Predicate projections on a list, starting at 'predicate' and going up in the tree. If 'get_opaque' -// is set, then the OpaqueTemplateAssertionPredicateNode nodes of the Assertion Predicates are put on the list instead -// of the projections. -void PhaseIdealLoop::get_template_assertion_predicates(ParsePredicateSuccessProj* parse_predicate_proj, Unique_Node_List& list, - const bool get_opaque) { +// Put all OpaqueTemplateAssertionPredicate nodes on a list, starting at 'predicate' and going up in the tree. +void PhaseIdealLoop::get_opaque_template_assertion_predicate_nodes(ParsePredicateSuccessProj* parse_predicate_proj, + Unique_Node_List& list) { Deoptimization::DeoptReason deopt_reason = parse_predicate_proj->in(0)->as_ParsePredicate()->deopt_reason(); PredicateBlockIterator predicate_iterator(parse_predicate_proj, deopt_reason); - TemplateAssertionPredicateCollector template_assertion_predicate_collector(list, get_opaque); - predicate_iterator.for_each(template_assertion_predicate_collector); -} - -// Clone an Assertion Predicate for an unswitched loop. OpaqueLoopInit and OpaqueLoopStride nodes are cloned and uncommon -// traps are kept for the predicate (a Halt node is used later when creating pre/main/post loops and copying this cloned -// predicate again). -IfTrueNode* -PhaseIdealLoop::clone_assertion_predicate_for_unswitched_loops(IfTrueNode* template_assertion_predicate_success_proj, - ParsePredicateNode* unswitched_loop_parse_predicate) { - TemplateAssertionPredicate template_assertion_predicate(template_assertion_predicate_success_proj); - IfTrueNode* template_success_proj = template_assertion_predicate.clone(unswitched_loop_parse_predicate->in(0), this); - _igvn.replace_input_of(unswitched_loop_parse_predicate, 0, template_success_proj); - set_idom(unswitched_loop_parse_predicate, template_success_proj, dom_depth(template_success_proj)); - return template_success_proj; + OpaqueTemplateAssertionPredicateCollector opaque_template_assertion_predicate_collector(list); + predicate_iterator.for_each(opaque_template_assertion_predicate_collector); } -// Clone the old Parse Predicates and Assertion Predicates before the unswitch If to the unswitched loops after the -// unswitch If. -void PhaseIdealLoop::clone_parse_and_assertion_predicates_to_unswitched_loop(IdealLoopTree* loop, Node_List& old_new, - IfProjNode*& true_path_loop_entry, - IfProjNode*& false_path_loop_entry) { - LoopNode* head = loop->_head->as_Loop(); - Node* entry = head->skip_strip_mined()->in(LoopNode::EntryControl); - - const Predicates predicates(entry); - clone_loop_predication_predicates_to_unswitched_loop(loop, old_new, predicates.loop_predicate_block(), - Deoptimization::Reason_predicate, true_path_loop_entry, false_path_loop_entry); - clone_loop_predication_predicates_to_unswitched_loop(loop, old_new, predicates.profiled_loop_predicate_block(), - Deoptimization::Reason_profile_predicate, true_path_loop_entry, false_path_loop_entry); - - const PredicateBlock* loop_limit_check_predicate_block = predicates.loop_limit_check_predicate_block(); - if (loop_limit_check_predicate_block->has_parse_predicate() && !head->is_CountedLoop()) { - // Don't clone the Loop Limit Check Parse Predicate if we already have a counted loop (a Loop Limit Check Predicate - // is only created when converting a LoopNode to a CountedLoopNode). - clone_parse_predicate_to_unswitched_loops(loop_limit_check_predicate_block, Deoptimization::Reason_loop_limit_check, - true_path_loop_entry, false_path_loop_entry); - } -} - -// Clone the Parse Predicate and Template Assertion Predicates of a Loop Predication related Predicate Block. -void PhaseIdealLoop::clone_loop_predication_predicates_to_unswitched_loop(IdealLoopTree* loop, const Node_List& old_new, - const PredicateBlock* predicate_block, - Deoptimization::DeoptReason reason, - IfProjNode*& true_path_loop_entry, - IfProjNode*& false_path_loop_entry) { - if (predicate_block->has_parse_predicate()) { - // We currently only clone Assertion Predicates if there are Parse Predicates. This is not entirely correct and will - // be changed with the complete fix for Assertion Predicates. - clone_parse_predicate_to_unswitched_loops(predicate_block, reason, true_path_loop_entry, false_path_loop_entry); - assert(true_path_loop_entry->in(0)->is_ParsePredicate() && false_path_loop_entry->in(0)->is_ParsePredicate(), - "must be success projections of the cloned Parse Predicates"); - clone_assertion_predicates_to_unswitched_loop(loop, old_new, predicate_block->parse_predicate_success_proj(), - true_path_loop_entry->in(0)->as_ParsePredicate(), - false_path_loop_entry->in(0)->as_ParsePredicate()); - } -} - -void PhaseIdealLoop::clone_parse_predicate_to_unswitched_loops(const PredicateBlock* predicate_block, - Deoptimization::DeoptReason reason, - IfProjNode*& iffast_pred, IfProjNode*& ifslow_pred) { - assert(predicate_block->has_parse_predicate(), "must have parse predicate"); - ParsePredicateSuccessProj* parse_predicate_proj = predicate_block->parse_predicate_success_proj(); - iffast_pred = clone_parse_predicate_to_unswitched_loop(parse_predicate_proj, iffast_pred, reason, false); - check_cloned_parse_predicate_for_unswitching(iffast_pred, true); - - ifslow_pred = clone_parse_predicate_to_unswitched_loop(parse_predicate_proj, ifslow_pred, reason, true); - check_cloned_parse_predicate_for_unswitching(ifslow_pred, false); -} - -#ifndef PRODUCT -void PhaseIdealLoop::check_cloned_parse_predicate_for_unswitching(const Node* new_entry, const bool is_fast_loop) { - assert(new_entry != nullptr, "IfTrue or IfFalse after clone predicate"); - if (TraceLoopPredicate) { - tty->print("Parse Predicate cloned to %s loop: ", is_fast_loop ? "fast" : "slow"); - new_entry->in(0)->dump(); - } -} -#endif - //------------------------------Invariance----------------------------------- // Helper class for loop_predication_impl to compute invariance on the fly and // clone invariants. @@ -469,7 +330,7 @@ class Invariance : public StackObj { // loop, it was marked invariant but n is only invariant if // it depends only on that test. Otherwise, unless that test // is out of the loop, it's not invariant. - if (n->is_CFG() || n->depends_only_on_test() || n->in(0) == nullptr || !_phase->is_member(_lpt, n->in(0))) { + if (n->is_CFG() || (n->depends_only_on_test() && _phase->igvn().no_dependent_zero_check(n)) || n->in(0) == nullptr || !_phase->is_member(_lpt, n->in(0))) { _invariant.set(n->_idx); // I am a invariant too } } diff --git a/src/hotspot/share/opto/loopTransform.cpp b/src/hotspot/share/opto/loopTransform.cpp index d8d7be5c89c1e..03a7bf50e70b6 100644 --- a/src/hotspot/share/opto/loopTransform.cpp +++ b/src/hotspot/share/opto/loopTransform.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "compiler/compileLog.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/c2/barrierSetC2.hpp" @@ -1424,11 +1423,13 @@ void PhaseIdealLoop::insert_pre_post_loops(IdealLoopTree *loop, Node_List &old_n _igvn.hash_delete(outer_main_head); outer_main_head->set_req(LoopNode::EntryControl, min_taken); set_idom(outer_main_head, min_taken, dd_main_head); + assert(post_head->in(1)->is_IfProj(), "must be zero-trip guard If node projection of the post loop"); VectorSet visited; Node_Stack clones(main_head->back_control()->outcnt()); // Step B3: Make the fall-in values to the main-loop come from the // fall-out values of the pre-loop. + const uint last_node_index_in_pre_loop_body = Compile::current()->unique() - 1; for (DUIterator i2 = main_head->outs(); main_head->has_out(i2); i2++) { Node* main_phi = main_head->out(i2); if (main_phi->is_Phi() && main_phi->in(0) == main_head && main_phi->outcnt() > 0) { @@ -1441,21 +1442,13 @@ void PhaseIdealLoop::insert_pre_post_loops(IdealLoopTree *loop, Node_List &old_n main_phi->set_req(LoopNode::EntryControl, fallpre); } } + DEBUG_ONLY(const uint last_node_index_from_backedge_goo = Compile::current()->unique() - 1); - // Nodes inside the loop may be control dependent on a predicate - // that was moved before the preloop. If the back branch of the main - // or post loops becomes dead, those nodes won't be dependent on the - // test that guards that loop nest anymore which could lead to an - // incorrect array access because it executes independently of the - // test that was guarding the loop nest. We add a special CastII on - // the if branch that enters the loop, between the input induction - // variable value and the induction variable Phi to preserve correct - // dependencies. - - assert(post_head->in(1)->is_IfProj(), "must be zero-trip guard If node projection of the post loop"); DEBUG_ONLY(ensure_zero_trip_guard_proj(outer_main_head->in(LoopNode::EntryControl), true);) if (UseLoopPredicate) { - initialize_assertion_predicates_for_main_loop(pre_head, main_head, first_node_index_in_pre_loop_body, old_new); + initialize_assertion_predicates_for_main_loop(pre_head, main_head, first_node_index_in_pre_loop_body, + last_node_index_in_pre_loop_body, + DEBUG_ONLY(last_node_index_from_backedge_goo COMMA) old_new); } // Step B4: Shorten the pre-loop to run only 1 iteration (for now). @@ -1729,10 +1722,15 @@ void PhaseIdealLoop::initialize_assertion_predicates_for_peeled_loop(CountedLoop // Target Loop: Original - main_loop_head void PhaseIdealLoop::initialize_assertion_predicates_for_main_loop(CountedLoopNode* pre_loop_head, CountedLoopNode* main_loop_head, - const uint first_node_index_in_cloned_loop_body, + const uint first_node_index_in_pre_loop_body, + const uint last_node_index_in_pre_loop_body, + DEBUG_ONLY(const uint last_node_index_from_backedge_goo COMMA) const Node_List& old_new) { - const NodeInOriginalLoopBody node_in_original_loop_body(first_node_index_in_cloned_loop_body, old_new); - create_assertion_predicates_at_loop(pre_loop_head, main_loop_head, node_in_original_loop_body, true); + assert(first_node_index_in_pre_loop_body < last_node_index_in_pre_loop_body, "cloned some nodes"); + const NodeInMainLoopBody node_in_main_loop_body(first_node_index_in_pre_loop_body, + last_node_index_in_pre_loop_body, + DEBUG_ONLY(last_node_index_from_backedge_goo COMMA) old_new); + create_assertion_predicates_at_main_or_post_loop(pre_loop_head, main_loop_head, node_in_main_loop_body, true); } // Source Loop: Original - main_loop_head @@ -1741,7 +1739,7 @@ void PhaseIdealLoop::initialize_assertion_predicates_for_post_loop(CountedLoopNo CountedLoopNode* post_loop_head, const uint first_node_index_in_cloned_loop_body) { const NodeInClonedLoopBody node_in_cloned_loop_body(first_node_index_in_cloned_loop_body); - create_assertion_predicates_at_loop(main_loop_head, post_loop_head, node_in_cloned_loop_body, false); + create_assertion_predicates_at_main_or_post_loop(main_loop_head, post_loop_head, node_in_cloned_loop_body, false); } void PhaseIdealLoop::create_assertion_predicates_at_loop(CountedLoopNode* source_loop_head, @@ -1754,6 +1752,47 @@ void PhaseIdealLoop::create_assertion_predicates_at_loop(CountedLoopNode* source PredicateIterator predicate_iterator(source_loop_entry); predicate_iterator.for_each(create_assertion_predicates_visitor); } + +void PhaseIdealLoop::create_assertion_predicates_at_main_or_post_loop(CountedLoopNode* source_loop_head, + CountedLoopNode* target_loop_head, + const NodeInLoopBody& _node_in_loop_body, + bool clone_template) { + Node* old_target_loop_head_entry = target_loop_head->skip_strip_mined()->in(LoopNode::EntryControl); + const uint node_index_before_new_assertion_predicate_nodes = C->unique(); + const bool need_to_rewire_old_target_loop_entry_dependencies = old_target_loop_head_entry->outcnt() > 1; + create_assertion_predicates_at_loop(source_loop_head, target_loop_head, _node_in_loop_body, clone_template); + if (need_to_rewire_old_target_loop_entry_dependencies) { + rewire_old_target_loop_entry_dependency_to_new_entry(target_loop_head, old_target_loop_head_entry, + node_index_before_new_assertion_predicate_nodes); + } +} + +// Rewire any control dependent nodes on the old target loop entry before adding Assertion Predicate related nodes. +// These have been added by PhaseIdealLoop::clone_up_backedge_goo() and assume to be ending up at the target loop entry +// which is no longer the case when adding additional Assertion Predicates. Fix this by rewiring these nodes to the new +// target loop entry which corresponds to the tail of the last Assertion Predicate before the target loop. This is safe +// to do because these control dependent nodes on the old target loop entry created by clone_up_backedge_goo() were +// pinned on the loop backedge before. The Assertion Predicates are not control dependent on these nodes in any way. +void PhaseIdealLoop::rewire_old_target_loop_entry_dependency_to_new_entry( + LoopNode* target_loop_head, const Node* old_target_loop_entry, + const uint node_index_before_new_assertion_predicate_nodes) { + Node* new_main_loop_entry = target_loop_head->skip_strip_mined()->in(LoopNode::EntryControl); + if (new_main_loop_entry == old_target_loop_entry) { + // No Assertion Predicates added. + return; + } + + for (DUIterator_Fast imax, i = old_target_loop_entry->fast_outs(imax); i < imax; i++) { + Node* out = old_target_loop_entry->fast_out(i); + if (!out->is_CFG() && out->_idx < node_index_before_new_assertion_predicate_nodes) { + _igvn.replace_input_of(out, 0, new_main_loop_entry); + set_ctrl(out, new_main_loop_entry); + --i; + --imax; + } + } +} + //------------------------------do_unroll-------------------------------------- // Unroll the loop body one step - make each trip do 2 iterations. void PhaseIdealLoop::do_unroll(IdealLoopTree *loop, Node_List &old_new, bool adjust_min_trip) { diff --git a/src/hotspot/share/opto/loopUnswitch.cpp b/src/hotspot/share/opto/loopUnswitch.cpp index a5a90b7e481e4..05e24e2271e5c 100644 --- a/src/hotspot/share/opto/loopUnswitch.cpp +++ b/src/hotspot/share/opto/loopUnswitch.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "memory/allocation.inline.hpp" #include "opto/castnode.hpp" #include "opto/cfgnode.hpp" @@ -236,15 +235,47 @@ class OriginalLoop : public StackObj { _phase(loop->_phase) {} NONCOPYABLE(OriginalLoop); + // 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) { + const uint first_false_path_loop_node_index = _phase->C->unique(); + clone_loop(unswitched_loop_selector); + + move_parse_and_template_assertion_predicates_to_unswitched_loops(unswitched_loop_selector, + first_false_path_loop_node_index); + 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); + } + 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); + void clone_loop(const UnswitchedLoopSelector& unswitched_loop_selector) { + _phase->clone_loop(_loop, _old_new, _phase->dom_depth(_loop_head), + PhaseIdealLoop::CloneIncludesStripMined, unswitched_loop_selector.selector()); + fix_loop_entries(unswitched_loop_selector); + } + + void fix_loop_entries(const UnswitchedLoopSelector& unswitched_loop_selector) { + _phase->replace_loop_entry(_loop_head, unswitched_loop_selector.true_path_loop_proj()); 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); + _phase->replace_loop_entry(false_path_loop_strip_mined_head, + unswitched_loop_selector.false_path_loop_proj()); } - Node* old_to_new(const Node* old) const { - return _old_new[old->_idx]; + // Moves the Parse And Template Assertion Predicates to the true and false path loop. They are inserted between the + // loop heads and the loop selector If projections. The old Parse and Template Assertion Predicates before + // the unswitched loop selector are killed. + void move_parse_and_template_assertion_predicates_to_unswitched_loops( + const UnswitchedLoopSelector& unswitched_loop_selector, const uint first_false_path_loop_node_index) const { + const NodeInOriginalLoopBody node_in_true_path_loop_body(first_false_path_loop_node_index, _old_new); + const NodeInClonedLoopBody node_in_false_path_loop_body(first_false_path_loop_node_index); + CloneUnswitchedLoopPredicatesVisitor + clone_unswitched_loop_predicates_visitor(_loop_head, old_to_new(_loop_head)->as_Loop(), node_in_true_path_loop_body, + node_in_false_path_loop_body, _phase); + Node* source_loop_entry = unswitched_loop_selector.selector()->in(0); + PredicateIterator predicate_iterator(source_loop_entry); + predicate_iterator.for_each(clone_unswitched_loop_predicates_visitor); } #ifdef ASSERT @@ -263,6 +294,10 @@ class OriginalLoop : public StackObj { } #endif // ASSERT + Node* old_to_new(const Node* old) const { + return _old_new[old->_idx]; + } + // 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. @@ -276,28 +311,6 @@ class OriginalLoop : public StackObj { _phase->dominated_by(unswitched_loop_selector.false_path_loop_proj(), unswitching_candidate_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. diff --git a/src/hotspot/share/opto/loopnode.cpp b/src/hotspot/share/opto/loopnode.cpp index 72870613cb0fb..40c29384c4379 100644 --- a/src/hotspot/share/opto/loopnode.cpp +++ b/src/hotspot/share/opto/loopnode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciMethodData.hpp" #include "compiler/compileLog.hpp" #include "gc/shared/barrierSet.hpp" @@ -2552,11 +2551,15 @@ const Type* LoopLimitNode::Value(PhaseGVN* phase) const { jlong trip_count = (limit_con - init_con + stride_m)/stride_con; jlong final_con = init_con + stride_con*trip_count; int final_int = (int)final_con; - // The final value should be in integer range since the loop - // is counted and the limit was checked for overflow. - // Assert checks for overflow only if all input nodes are ConINodes, as during CCP - // there might be a temporary overflow from PhiNodes see JDK-8309266 - assert((in(Init)->is_ConI() && in(Limit)->is_ConI() && in(Stride)->is_ConI()) ? final_con == (jlong)final_int : true, "final value should be integer"); + // The final value should be in integer range in almost all cases, + // since the loop is counted and the limit was checked for overflow. + // There some exceptions, for example: + // - During CCP, there might be a temporary overflow from PhiNodes, see JDK-8309266. + // - During PhaseIdealLoop::split_thru_phi, the LoopLimitNode floats possibly far above + // the loop and its predicates, and we might get constants on one side of the phi that + // would lead to overflows. Such a code path would never lead us to enter the loop + // because of the loop limit overflow check that happens after the LoopLimitNode + // computation with overflow, but before we enter the loop, see JDK-8335747. if (final_con == (jlong)final_int) { return TypeInt::make(final_int); } else { @@ -2579,12 +2582,10 @@ Node *LoopLimitNode::Ideal(PhaseGVN *phase, bool can_reshape) { if (stride_con == 1) return nullptr; // Identity - if (in(Init)->is_Con() && in(Limit)->is_Con()) - return nullptr; // Value - // Delay following optimizations until all loop optimizations // done to keep Ideal graph simple. if (!can_reshape || !phase->C->post_loop_opts_phase()) { + phase->C->record_for_post_loop_opts_igvn(this); return nullptr; } @@ -4458,7 +4459,7 @@ void PhaseIdealLoop::collect_useful_template_assertion_predicates_for_loop(Ideal const PredicateBlock* profiled_loop_predicate_block = predicates.profiled_loop_predicate_block(); if (profiled_loop_predicate_block->has_parse_predicate()) { ParsePredicateSuccessProj* parse_predicate_proj = profiled_loop_predicate_block->parse_predicate_success_proj(); - get_template_assertion_predicates(parse_predicate_proj, useful_predicates, true); + get_opaque_template_assertion_predicate_nodes(parse_predicate_proj, useful_predicates); } } @@ -4466,7 +4467,7 @@ void PhaseIdealLoop::collect_useful_template_assertion_predicates_for_loop(Ideal const PredicateBlock* loop_predicate_block = predicates.loop_predicate_block(); if (loop_predicate_block->has_parse_predicate()) { ParsePredicateSuccessProj* parse_predicate_proj = loop_predicate_block->parse_predicate_success_proj(); - get_template_assertion_predicates(parse_predicate_proj, useful_predicates, true); + get_opaque_template_assertion_predicate_nodes(parse_predicate_proj, useful_predicates); } } } @@ -6431,8 +6432,6 @@ void PhaseIdealLoop::build_loop_late_post_work(Node *n, bool pinned) { case Op_DivF: case Op_DivD: case Op_ModI: - case Op_ModF: - case Op_ModD: case Op_LoadB: // Same with Loads; they can sink case Op_LoadUB: // during loop optimizations. case Op_LoadUS: diff --git a/src/hotspot/share/opto/loopnode.hpp b/src/hotspot/share/opto/loopnode.hpp index acafea3fce86e..91508c512cb8c 100644 --- a/src/hotspot/share/opto/loopnode.hpp +++ b/src/hotspot/share/opto/loopnode.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -942,7 +942,8 @@ class PhaseIdealLoop : public PhaseTransform { static void ensure_zero_trip_guard_proj(Node* node, bool is_main_loop); #endif private: - static void get_template_assertion_predicates(ParsePredicateSuccessProj* parse_predicate_proj, Unique_Node_List& list, bool get_opaque = false); + static void get_opaque_template_assertion_predicate_nodes(ParsePredicateSuccessProj* parse_predicate_proj, + Unique_Node_List& list); void update_main_loop_assertion_predicates(CountedLoopNode* main_loop_head); void initialize_assertion_predicates_for_peeled_loop(CountedLoopNode* peeled_loop_head, CountedLoopNode* remaining_loop_head, @@ -950,12 +951,20 @@ class PhaseIdealLoop : public PhaseTransform { const Node_List& old_new); void initialize_assertion_predicates_for_main_loop(CountedLoopNode* pre_loop_head, CountedLoopNode* main_loop_head, - uint first_node_index_in_cloned_loop_body, + uint first_node_index_in_pre_loop_body, + uint last_node_index_in_pre_loop_body, + DEBUG_ONLY(uint last_node_index_from_backedge_goo COMMA) const Node_List& old_new); void initialize_assertion_predicates_for_post_loop(CountedLoopNode* main_loop_head, CountedLoopNode* post_loop_head, uint first_node_index_in_cloned_loop_body); void create_assertion_predicates_at_loop(CountedLoopNode* source_loop_head, CountedLoopNode* target_loop_head, const NodeInLoopBody& _node_in_loop_body, bool clone_template); + void create_assertion_predicates_at_main_or_post_loop(CountedLoopNode* source_loop_head, + CountedLoopNode* target_loop_head, + const NodeInLoopBody& _node_in_loop_body, bool clone_template); + void rewire_old_target_loop_entry_dependency_to_new_entry(LoopNode* target_loop_head, + const Node* old_target_loop_entry, + uint node_index_before_new_assertion_predicate_nodes); void insert_loop_limit_check_predicate(ParsePredicateSuccessProj* loop_limit_check_parse_proj, Node* cmp_limit, Node* bol); void log_loop_tree(); @@ -1350,9 +1359,8 @@ class PhaseIdealLoop : public PhaseTransform { // Create a new if above the uncommon_trap_if_pattern for the predicate to be promoted IfTrueNode* create_new_if_for_predicate( - ParsePredicateSuccessProj* parse_predicate_proj, Node* new_entry, Deoptimization::DeoptReason reason, int opcode, - bool rewire_uncommon_proj_phi_inputs = false, - AssertionPredicateType assertion_predicate_type = AssertionPredicateType::None); + ParsePredicateSuccessProj* parse_predicate_proj, Node* new_entry, Deoptimization::DeoptReason reason, int opcode, + bool rewire_uncommon_proj_phi_inputs = false); private: // Helper functions for create_new_if_for_predicate() @@ -1661,28 +1669,7 @@ 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*& true_path_loop_entry, - IfProjNode*& false_path_loop_entry); private: - void clone_loop_predication_predicates_to_unswitched_loop(IdealLoopTree* loop, const Node_List& old_new, - const PredicateBlock* predicate_block, - Deoptimization::DeoptReason reason, - IfProjNode*& true_path_loop_entry, - IfProjNode*& false_path_loop_entry); - void clone_parse_predicate_to_unswitched_loops(const PredicateBlock* predicate_block, Deoptimization::DeoptReason reason, - IfProjNode*& iffast_pred, IfProjNode*& ifslow_pred); - IfProjNode* clone_parse_predicate_to_unswitched_loop(ParsePredicateSuccessProj* parse_predicate_proj, Node* new_entry, - Deoptimization::DeoptReason reason, bool slow_loop); - void clone_assertion_predicates_to_unswitched_loop(IdealLoopTree* loop, const Node_List& old_new, - ParsePredicateSuccessProj* old_parse_predicate_proj, - ParsePredicateNode* true_path_loop_parse_predicate, - ParsePredicateNode* false_path_loop_parse_predicate); - IfTrueNode* clone_assertion_predicate_for_unswitched_loops(IfTrueNode* template_assertion_predicate_success_proj, - ParsePredicateNode* unswitched_loop_parse_predicate); - static void check_cloned_parse_predicate_for_unswitching(const Node* new_entry, bool is_fast_loop) PRODUCT_RETURN; bool _created_loop_node; DEBUG_ONLY(void dump_idoms(Node* early, Node* wrong_lca);) diff --git a/src/hotspot/share/opto/loopopts.cpp b/src/hotspot/share/opto/loopopts.cpp index 90b9bc84def14..8afce3e86ae0f 100644 --- a/src/hotspot/share/opto/loopopts.cpp +++ b/src/hotspot/share/opto/loopopts.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/c2/barrierSetC2.hpp" #include "memory/allocation.inline.hpp" @@ -857,9 +856,9 @@ Node *PhaseIdealLoop::conditional_move( Node *region ) { } } } - Node *cmov = CMoveNode::make(cmov_ctrl, iff->in(1), phi->in(1+flip), phi->in(2-flip), _igvn.type(phi)); - register_new_node( cmov, cmov_ctrl ); - _igvn.replace_node( phi, cmov ); + Node* cmov = CMoveNode::make(iff->in(1), phi->in(1+flip), phi->in(2-flip), _igvn.type(phi)); + register_new_node(cmov, cmov_ctrl); + _igvn.replace_node(phi, cmov); #ifndef PRODUCT if (TraceLoopOpts) { tty->print("CMOV "); diff --git a/src/hotspot/share/opto/machnode.cpp b/src/hotspot/share/opto/machnode.cpp index e271637893b28..5ecff618a9098 100644 --- a/src/hotspot/share/opto/machnode.cpp +++ b/src/hotspot/share/opto/machnode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/c2/barrierSetC2.hpp" #include "gc/shared/collectedHeap.hpp" diff --git a/src/hotspot/share/opto/macro.cpp b/src/hotspot/share/opto/macro.cpp index 289ea30a633e3..855506faa95e2 100644 --- a/src/hotspot/share/opto/macro.cpp +++ b/src/hotspot/share/opto/macro.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "compiler/compileLog.hpp" #include "gc/shared/collectedHeap.inline.hpp" #include "gc/shared/tlab_globals.hpp" @@ -430,6 +429,10 @@ Node *PhaseMacroExpand::value_from_mem_phi(Node *mem, BasicType ft, const Type * return nullptr; } values.at_put(j, res); + } else if (val->is_top()) { + // This indicates that this path into the phi is dead. Top will eventually also propagate into the Region. + // IGVN will clean this up later. + values.at_put(j, val); } else { DEBUG_ONLY( val->dump(); ) assert(false, "unknown node on this path"); @@ -2221,7 +2224,7 @@ void PhaseMacroExpand::expand_lock_node(LockNode *lock) { mem_phi->init_req(2, mem); // Make slow path call - CallNode *call = make_slow_call((CallNode *) lock, OptoRuntime::complete_monitor_enter_Type(), + CallNode* call = make_slow_call(lock, OptoRuntime::complete_monitor_enter_Type(), OptoRuntime::complete_monitor_locking_Java(), nullptr, slow_path, obj, box, nullptr); @@ -2430,6 +2433,8 @@ void PhaseMacroExpand::eliminate_macro_nodes() { break; default: assert(n->Opcode() == Op_LoopLimit || + n->Opcode() == Op_ModD || + n->Opcode() == Op_ModF || n->is_OpaqueNotNull() || n->is_OpaqueInitializedAssertionPredicate() || n->Opcode() == Op_MaxL || @@ -2581,7 +2586,30 @@ bool PhaseMacroExpand::expand_macro_nodes() { expand_subtypecheck_node(n->as_SubTypeCheck()); break; default: - assert(false, "unknown node type in macro list"); + switch (n->Opcode()) { + case Op_ModD: + case Op_ModF: { + bool is_drem = n->Opcode() == Op_ModD; + CallNode* mod_macro = n->as_Call(); + CallNode* call = new CallLeafNode(mod_macro->tf(), + is_drem ? CAST_FROM_FN_PTR(address, SharedRuntime::drem) + : CAST_FROM_FN_PTR(address, SharedRuntime::frem), + is_drem ? "drem" : "frem", TypeRawPtr::BOTTOM); + call->init_req(TypeFunc::Control, mod_macro->in(TypeFunc::Control)); + call->init_req(TypeFunc::I_O, mod_macro->in(TypeFunc::I_O)); + call->init_req(TypeFunc::Memory, mod_macro->in(TypeFunc::Memory)); + call->init_req(TypeFunc::ReturnAdr, mod_macro->in(TypeFunc::ReturnAdr)); + call->init_req(TypeFunc::FramePtr, mod_macro->in(TypeFunc::FramePtr)); + for (unsigned int i = 0; i < mod_macro->tf()->domain()->cnt() - TypeFunc::Parms; i++) { + call->init_req(TypeFunc::Parms + i, mod_macro->in(TypeFunc::Parms + i)); + } + _igvn.replace_node(mod_macro, call); + transform_later(call); + break; + } + default: + assert(false, "unknown node type in macro list"); + } } assert(C->macro_count() == (old_macro_count - 1), "expansion must have deleted one node from macro list"); if (C->failing()) return true; diff --git a/src/hotspot/share/opto/macroArrayCopy.cpp b/src/hotspot/share/opto/macroArrayCopy.cpp index 9600a3c6c2501..ab81507322cb7 100644 --- a/src/hotspot/share/opto/macroArrayCopy.cpp +++ b/src/hotspot/share/opto/macroArrayCopy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/tlab_globals.hpp" #include "opto/arraycopynode.hpp" diff --git a/src/hotspot/share/opto/matcher.cpp b/src/hotspot/share/opto/matcher.cpp index b94fb7101430e..3f111c4b0d17e 100644 --- a/src/hotspot/share/opto/matcher.cpp +++ b/src/hotspot/share/opto/matcher.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/c2/barrierSetC2.hpp" #include "memory/allocation.inline.hpp" diff --git a/src/hotspot/share/opto/mathexactnode.cpp b/src/hotspot/share/opto/mathexactnode.cpp index ff4edd2518989..326ebefd4eadc 100644 --- a/src/hotspot/share/opto/mathexactnode.cpp +++ b/src/hotspot/share/opto/mathexactnode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "memory/allocation.inline.hpp" #include "opto/addnode.hpp" #include "opto/cfgnode.hpp" diff --git a/src/hotspot/share/opto/memnode.cpp b/src/hotspot/share/opto/memnode.cpp index ad351fb81add7..a5a746626f8c5 100644 --- a/src/hotspot/share/opto/memnode.cpp +++ b/src/hotspot/share/opto/memnode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2024, Alibaba Group Holding Limited. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "classfile/javaClasses.hpp" #include "compiler/compileLog.hpp" #include "gc/shared/barrierSet.hpp" @@ -1976,24 +1975,24 @@ LoadNode::load_array_final_field(const TypeKlassPtr *tkls, if (tkls->offset() == in_bytes(Klass::modifier_flags_offset())) { // The field is Klass::_modifier_flags. Return its (constant) value. // (Folds up the 2nd indirection in aClassConstant.getModifiers().) - assert(this->Opcode() == Op_LoadI, "must load an int from _modifier_flags"); + assert(Opcode() == Op_LoadUS, "must load an unsigned short from _modifier_flags"); return TypeInt::make(klass->modifier_flags()); } if (tkls->offset() == in_bytes(Klass::access_flags_offset())) { // The field is Klass::_access_flags. Return its (constant) value. // (Folds up the 2nd indirection in Reflection.getClassAccessFlags(aClassConstant).) - assert(this->Opcode() == Op_LoadI, "must load an int from _access_flags"); + assert(Opcode() == Op_LoadUS, "must load an unsigned short from _access_flags"); return TypeInt::make(klass->access_flags()); } if (tkls->offset() == in_bytes(Klass::misc_flags_offset())) { // The field is Klass::_misc_flags. Return its (constant) value. // (Folds up the 2nd indirection in Reflection.getClassAccessFlags(aClassConstant).) - assert(this->Opcode() == Op_LoadUB, "must load an unsigned byte from _misc_flags"); + assert(Opcode() == Op_LoadUB, "must load an unsigned byte from _misc_flags"); return TypeInt::make(klass->misc_flags()); } if (tkls->offset() == in_bytes(Klass::layout_helper_offset())) { // The field is Klass::_layout_helper. Return its constant value if known. - assert(this->Opcode() == Op_LoadI, "must load an int from _layout_helper"); + assert(Opcode() == Op_LoadI, "must load an int from _layout_helper"); return TypeInt::make(klass->layout_helper()); } @@ -2014,6 +2013,17 @@ const Type* LoadNode::Value(PhaseGVN* phase) const { assert(off != Type::OffsetTop, "case covered by TypePtr::empty"); Compile* C = phase->C; + // If we are loading from a freshly-allocated object, produce a zero, + // if the load is provably beyond the header of the object. + // (Also allow a variable load from a fresh array to produce zero.) + const TypeOopPtr* tinst = tp->isa_oopptr(); + bool is_instance = (tinst != nullptr) && tinst->is_known_instance_field(); + Node* value = can_see_stored_value(mem, phase); + if (value != nullptr && value->is_Con()) { + assert(value->bottom_type()->higher_equal(_type), "sanity"); + return value->bottom_type(); + } + // Try to guess loaded type from pointer type if (tp->isa_aryptr()) { const TypeAryPtr* ary = tp->is_aryptr(); @@ -2220,20 +2230,6 @@ const Type* LoadNode::Value(PhaseGVN* phase) const { } } - // If we are loading from a freshly-allocated object, produce a zero, - // if the load is provably beyond the header of the object. - // (Also allow a variable load from a fresh array to produce zero.) - const TypeOopPtr *tinst = tp->isa_oopptr(); - bool is_instance = (tinst != nullptr) && tinst->is_known_instance_field(); - bool is_boxed_value = (tinst != nullptr) && tinst->is_ptr_to_boxed_value(); - if (ReduceFieldZeroing || is_instance || is_boxed_value) { - Node* value = can_see_stored_value(mem,phase); - if (value != nullptr && value->is_Con()) { - assert(value->bottom_type()->higher_equal(_type),"sanity"); - return value->bottom_type(); - } - } - bool is_vect = (_type->isa_vect() != nullptr); if (is_instance && !is_vect) { // If we have an instance type and our memory input is the @@ -2862,16 +2858,16 @@ class MergePrimitiveStores : public StackObj { return is_trace(TraceMergeStores::Tag::BASIC); } - bool is_trace_pointer() const { - return is_trace(TraceMergeStores::Tag::POINTER); + bool is_trace_pointer_parsing() const { + return is_trace(TraceMergeStores::Tag::POINTER_PARSING); } - bool is_trace_aliasing() const { - return is_trace(TraceMergeStores::Tag::ALIASING); + bool is_trace_pointer_aliasing() const { + return is_trace(TraceMergeStores::Tag::POINTER_ALIASING); } - bool is_trace_adjacency() const { - return is_trace(TraceMergeStores::Tag::ADJACENCY); + bool is_trace_pointer_adjacency() const { + return is_trace(TraceMergeStores::Tag::POINTER_ADJACENCY); } bool is_trace_success() const { @@ -2942,12 +2938,13 @@ bool MergePrimitiveStores::is_adjacent_pair(const StoreNode* use_store, const St ResourceMark rm; #ifndef PRODUCT - const TraceMemPointer trace(is_trace_pointer(), - is_trace_aliasing(), - is_trace_adjacency()); + const TraceMemPointer trace(is_trace_pointer_parsing(), + is_trace_pointer_aliasing(), + is_trace_pointer_adjacency(), + true); #endif - const MemPointer pointer_use(use_store NOT_PRODUCT( COMMA trace )); - const MemPointer pointer_def(def_store NOT_PRODUCT( COMMA trace )); + const MemPointer pointer_use(use_store NOT_PRODUCT(COMMA trace)); + const MemPointer pointer_def(def_store NOT_PRODUCT(COMMA trace)); return pointer_def.is_adjacent_to_and_before(pointer_use); } @@ -5194,7 +5191,7 @@ bool InitializeNode::stores_are_sane(PhaseValues* phase) { intptr_t st_off = get_store_offset(st, phase); if (st_off < 0) continue; // ignore dead garbage if (last_off > st_off) { - tty->print_cr("*** bad store offset at %d: " INTX_FORMAT " > " INTX_FORMAT, i, last_off, st_off); + tty->print_cr("*** bad store offset at %d: %zd > %zd", i, last_off, st_off); this->dump(2); assert(false, "ascending store offsets"); return false; diff --git a/src/hotspot/share/opto/mempointer.cpp b/src/hotspot/share/opto/mempointer.cpp index df443c69449cb..bede753ff07cf 100644 --- a/src/hotspot/share/opto/mempointer.cpp +++ b/src/hotspot/share/opto/mempointer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * 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,17 +22,29 @@ * */ -#include "precompiled.hpp" #include "opto/mempointer.hpp" +#include "opto/addnode.hpp" #include "utilities/resourceHash.hpp" +#include "classfile/vmSymbols.hpp" + +MemPointerParserCallback MemPointerParserCallback::_empty; + +MemPointer::MemPointer(const MemNode* mem, + MemPointerParserCallback& callback + NOT_PRODUCT(COMMA const TraceMemPointer& trace)) : + MemPointer(MemPointerParser::parse(mem, + callback + NOT_PRODUCT(COMMA trace))) {} // Recursively parse the pointer expression with a DFS all-path traversal // (i.e. with node repetitions), starting at the pointer. -MemPointerDecomposedForm MemPointerDecomposedFormParser::parse_decomposed_form() { +MemPointer MemPointerParser::parse(MemPointerParserCallback& callback + NOT_PRODUCT(COMMA const TraceMemPointer& trace)) { assert(_worklist.is_empty(), "no prior parsing"); assert(_summands.is_empty(), "no prior parsing"); Node* pointer = _mem->in(MemNode::Address); + const jint size = _mem->memory_size(); // Start with the trivial summand. _worklist.push(MemPointerSummand(pointer, NoOverflowInt(1))); @@ -42,12 +54,16 @@ MemPointerDecomposedForm MemPointerDecomposedFormParser::parse_decomposed_form() int traversal_count = 0; while (_worklist.is_nonempty()) { // Bail out if the graph is too complex. - if (traversal_count++ > 1000) { return MemPointerDecomposedForm::make_trivial(pointer); } - parse_sub_expression(_worklist.pop()); + if (traversal_count++ > 1000) { + return MemPointer::make_trivial(pointer, size NOT_PRODUCT(COMMA trace)); + } + parse_sub_expression(_worklist.pop(), callback); } // Bail out if there is a constant overflow. - if (_con.is_NaN()) { return MemPointerDecomposedForm::make_trivial(pointer); } + if (_con.is_NaN()) { + return MemPointer::make_trivial(pointer, size NOT_PRODUCT(COMMA trace)); + } // Sorting by variable idx means that all summands with the same variable are consecutive. // This simplifies the combining of summands with the same variable below. @@ -67,7 +83,7 @@ MemPointerDecomposedForm MemPointerDecomposedFormParser::parse_decomposed_form() } // Bail out if scale is NaN. if (scale.is_NaN()) { - return MemPointerDecomposedForm::make_trivial(pointer); + return MemPointer::make_trivial(pointer, size NOT_PRODUCT(COMMA trace)); } // Keep summands with non-zero scale. if (!scale.is_zero()) { @@ -76,13 +92,13 @@ MemPointerDecomposedForm MemPointerDecomposedFormParser::parse_decomposed_form() } _summands.trunc_to(pos_put); - return MemPointerDecomposedForm::make(pointer, _summands, _con); + return MemPointer::make(pointer, _summands, _con, size NOT_PRODUCT(COMMA trace)); } // Parse a sub-expression of the pointer, starting at the current summand. We parse the // current node, and see if it can be decomposed into further summands, or if the current // summand is terminal. -void MemPointerDecomposedFormParser::parse_sub_expression(const MemPointerSummand& summand) { +void MemPointerParser::parse_sub_expression(const MemPointerSummand& summand, MemPointerParserCallback& callback) { Node* n = summand.variable(); const NoOverflowInt scale = summand.scale(); const NoOverflowInt one(1); @@ -108,6 +124,7 @@ void MemPointerDecomposedFormParser::parse_sub_expression(const MemPointerSumman Node* b = n->in((opc == Op_AddP) ? 3 : 2); _worklist.push(MemPointerSummand(a, scale)); _worklist.push(MemPointerSummand(b, scale)); + callback.callback(n); return; } case Op_SubL: @@ -121,6 +138,7 @@ void MemPointerDecomposedFormParser::parse_sub_expression(const MemPointerSumman _worklist.push(MemPointerSummand(a, scale)); _worklist.push(MemPointerSummand(b, sub_scale)); + callback.callback(n); return; } case Op_MulL: @@ -155,26 +173,37 @@ void MemPointerDecomposedFormParser::parse_sub_expression(const MemPointerSumman NoOverflowInt new_scale = scale * factor; _worklist.push(MemPointerSummand(variable, new_scale)); + callback.callback(n); return; } + case Op_CastX2P: + // A CastX2P indicates that we are pointing to native memory, where some long is cast to + // a pointer. In general, we have no guarantees about this long, and just take it as a + // terminal summand. A CastX2P can also be a good candidate for a native-memory "base". + if (!sub_expression_has_native_base_candidate(n->in(1))) { + // General case: take CastX2P as a terminal summand, it is a candidate for the "base". + break; + } + // Fall-through: we can find a more precise native-memory "base". We further decompose + // the CastX2P to find this "base" and any other offsets from it. case Op_CastII: case Op_CastLL: - case Op_CastX2P: case Op_ConvI2L: - // On 32bit systems we can also look through ConvL2I, since the final result will always - // be truncated back with ConvL2I. On 64bit systems we cannot decompose ConvL2I because - // such int values will eventually be expanded to long with a ConvI2L: - // - // valL = max_jint + 1 - // ConvI2L(ConvL2I(valL)) = ConvI2L(min_jint) = min_jint != max_jint + 1 = valL - // - NOT_LP64( case Op_ConvL2I: ) - { - // Decompose: look through. - Node* a = n->in(1); - _worklist.push(MemPointerSummand(a, scale)); - return; - } + // On 32bit systems we can also look through ConvL2I, since the final result will always + // be truncated back with ConvL2I. On 64bit systems we cannot decompose ConvL2I because + // such int values will eventually be expanded to long with a ConvI2L: + // + // valL = max_jint + 1 + // ConvI2L(ConvL2I(valL)) = ConvI2L(min_jint) = min_jint != max_jint + 1 = valL + // + NOT_LP64( case Op_ConvL2I: ) + { + // Decompose: look through. + Node* a = n->in(1); + _worklist.push(MemPointerSummand(a, scale)); + callback.callback(n); + return; + } default: // All other operations cannot be further decomposed. We just add them to the // terminal summands below. @@ -186,9 +215,67 @@ void MemPointerDecomposedFormParser::parse_sub_expression(const MemPointerSumman _summands.push(summand); } +bool MemPointerParser::sub_expression_has_native_base_candidate(Node* start) { + // BFS over the expression. + // Allocate sufficient space in worklist for 100 limit below. + ResourceMark rm; + GrowableArray worklist(102); + worklist.append(start); + for (int i = 0; i < worklist.length(); i++) { + Node* n = worklist.at(i); + switch (n->Opcode()) { + case Op_AddL: + // Traverse to both inputs. + worklist.append(n->in(1)); + worklist.append(n->in(2)); + break; + case Op_SubL: + case Op_CastLL: + // Traverse to the first input. The base cannot be on the rhs of a sub. + worklist.append(n->in(1)); + break; + default: + if (is_native_memory_base_candidate(n)) { return true; } + break; + } + // This is a heuristic, so we are allowed to bail out early if the graph + // is too deep. The constant is chosen arbitrarily, not too large but big + // enough for all normal cases. + if (worklist.length() > 100) { return false; } + } + // Parsed over the whole expression, nothing found. + return false; +} + +// Check if the node is a candidate to be a memory segment "base". +// (1) CastX2P: some arbitrary long that is cast to a pointer. +// (2) LoadL from field jdk.internal.foreign.NativeMemorySegmentImpl.min +// Holds the address() of a native memory segment. +bool MemPointerParser::is_native_memory_base_candidate(Node* n) { + // (1) CastX2P + if (n->Opcode() == Op_CastX2P) { return true; } + + // (2) LoadL from field jdk.internal.foreign.NativeMemorySegmentImpl.min + if (n->Opcode() != Op_LoadL) { return false; } + LoadNode* load = n->as_Load(); + + const TypeInstPtr* inst_ptr = load->adr_type()->isa_instptr(); + if (inst_ptr == nullptr) { return false; } + + ciInstanceKlass* klass = inst_ptr->instance_klass(); + int offset = inst_ptr->offset(); + ciField* field = klass->get_field_by_offset(offset, false); + if (field == nullptr) { return false; } + + Symbol* field_symbol = field->name()->get_symbol(); + Symbol* holder_symbol = field->holder()->name()->get_symbol(); + return holder_symbol == vmSymbols::jdk_internal_foreign_NativeMemorySegmentImpl() && + field_symbol == vmSymbols::min_name(); +} + // Check if the decomposition of operation opc is guaranteed to be safe. // Please refer to the definition of "safe decomposition" in mempointer.hpp -bool MemPointerDecomposedFormParser::is_safe_to_decompose_op(const int opc, const NoOverflowInt& scale) const { +bool MemPointerParser::is_safe_to_decompose_op(const int opc, const NoOverflowInt& scale) const { #ifndef _LP64 // On 32-bit platforms, the pointer has 32bits, and thus any higher bits will always // be truncated. Thus, it does not matter if we have int or long overflows. @@ -298,37 +385,81 @@ bool MemPointerDecomposedFormParser::is_safe_to_decompose_op(const int opc, cons #endif } -// Compute the aliasing between two MemPointerDecomposedForm. We use the "MemPointer Lemma" to -// prove that the computed aliasing also applies for the underlying pointers. Note that the -// condition (S0) is already given, because the MemPointerDecomposedForm is always constructed -// using only safe decompositions. +MemPointer::Base MemPointer::Base::make(Node* pointer, const GrowableArray& summands) { + // Bad form -> unknown. + AddPNode* adr = pointer->isa_AddP(); + if (adr == nullptr) { return Base(); } + + // Non-TOP base -> object. + Node* maybe_object_base = adr->in(AddPNode::Base); + bool is_object_base = !maybe_object_base->is_top(); + + Node* base = find_base(is_object_base ? maybe_object_base : nullptr, summands); + + if (base == nullptr) { + // Not found -> unknown. + return Base(); + } else if (is_object_base) { + assert(base == maybe_object_base, "we confirmed that it is in summands"); + return Base(Object, base); + } else { + return Base(Native, base); + } +} + +Node* MemPointer::Base::find_base(Node* object_base, const GrowableArray& summands) { + for (int i = 0; i < summands.length(); i++) { + const MemPointerSummand& s = summands.at(i); + assert(s.variable() != nullptr, "no empty summands"); + // Object base. + if (object_base != nullptr && s.variable() == object_base && s.scale().is_one()) { + return object_base; + } + // Native base. + if (object_base == nullptr && + s.scale().is_one() && + MemPointerParser::is_native_memory_base_candidate(s.variable())) { + return s.variable(); + } + } + return nullptr; +} + +// Compute the aliasing between two MemPointer. We use the "MemPointer Lemma" to prove that the +// computed aliasing also applies for the underlying pointers. Note that the condition (S0) is +// already given, because the MemPointer is always constructed using only safe decompositions. // // Pre-Condition: // We assume that both pointers are in-bounds of their respective memory object. If this does // not hold, for example, with the use of Unsafe, then we would already have undefined behavior, // and we are allowed to do anything. -MemPointerAliasing MemPointerDecomposedForm::get_aliasing_with(const MemPointerDecomposedForm& other - NOT_PRODUCT( COMMA const TraceMemPointer& trace) ) const { +MemPointerAliasing MemPointer::get_aliasing_with(const MemPointer& other + NOT_PRODUCT( COMMA const TraceMemPointer& trace) ) const { #ifndef PRODUCT if (trace.is_trace_aliasing()) { - tty->print_cr("MemPointerDecomposedForm::get_aliasing_with:"); + tty->print_cr("MemPointer::get_aliasing_with:"); print_on(tty); other.print_on(tty); } #endif // "MemPointer Lemma" condition (S2): check if all summands are the same: - for (uint i = 0; i < SUMMANDS_SIZE; i++) { - const MemPointerSummand s1 = summands_at(i); - const MemPointerSummand s2 = other.summands_at(i); - if (s1 != s2) { + bool has_same_base = false; + if (has_different_object_base_but_otherwise_same_summands_as(other)) { + // At runtime, the two object bases can be: + // (1) different: we have no aliasing, pointers point to different memory objects. + // (2) the same: implies that all summands are the same, (S2) holds. + has_same_base = false; + } else if (has_same_summands_as(other)) { + // (S2) holds. If all summands are the same, also the base must be the same. + has_same_base = true; + } else { #ifndef PRODUCT - if (trace.is_trace_aliasing()) { - tty->print_cr(" -> Aliasing unknown, differ on summand %d.", i); - } -#endif - return MemPointerAliasing::make_unknown(); + if (trace.is_trace_aliasing()) { + tty->print_cr(" -> Aliasing unknown, summands are not the same."); } +#endif + return MemPointerAliasing::make_unknown(); } // "MemPointer Lemma" condition (S3): check that the constants do not differ too much: @@ -346,34 +477,86 @@ MemPointerAliasing MemPointerDecomposedForm::get_aliasing_with(const MemPointerD return MemPointerAliasing::make_unknown(); } - // "MemPointer Lemma" condition (S1): - // Given that all summands are the same, we know that both pointers point into the - // same memory object. With the Pre-Condition, we know that both pointers are in - // bounds of that same memory object. - - // Hence, all 4 conditions of the "MemoryPointer Lemma" are established, and hence - // we know that the distance between the underlying pointers is equal to the distance - // we computed for the MemPointers: - // p_other - p_this = distance = other.con - this.con + if (has_same_base) { + // "MemPointer Lemma" condition (S1): + // Given that all summands are the same, we know that both pointers point into the + // same memory object. With the Pre-Condition, we know that both pointers are in + // bounds of that same memory object. + // + // Hence, all 4 conditions of the "MemPointer Lemma" are established, and hence + // we know that the distance between the underlying pointers is equal to the distance + // we computed for the MemPointers: + // p_other - p_this = distance = other.con - this.con +#ifndef PRODUCT + if (trace.is_trace_aliasing()) { + tty->print_cr(" -> Aliasing always at distance = %d.", distance.value()); + } +#endif + return MemPointerAliasing::make_always_at_distance(distance.value()); + } else { + // At runtime, the two object bases can be: + // (1) different: pointers do not alias. + // (2) the same: implies that (S2) holds. The summands are all the same, and with + // the Pre-Condition, we know that both pointers are in bounds of the + // same memory object, i.e. (S1) holds. We have already proven (S0) + // and (S3), so all 4 conditions for "MemPointer Lemma" are given. #ifndef PRODUCT if (trace.is_trace_aliasing()) { - tty->print_cr(" -> Aliasing always, distance = %d.", distance.value()); + tty->print_cr(" -> Aliasing not or at distance = %d.", distance.value()); } #endif - return MemPointerAliasing::make_always(distance.value()); + return MemPointerAliasing::make_not_or_at_distance(distance.value()); + } +} + +bool MemPointer::has_same_summands_as(const MemPointer& other, uint start) const { + for (uint i = start; i < SUMMANDS_SIZE; i++) { + if (summands_at(i) != other.summands_at(i)) { return false; } + } + return true; +} + +bool MemPointer::has_different_object_base_but_otherwise_same_summands_as(const MemPointer& other) const { + if (!base().is_object() || + !other.base().is_object() || + base().object() == other.base().object()) { + // The base is the same, or we do not know if the base is different. + return false; + } + +#ifdef ASSERT + const MemPointerSummand base1(base().object(), NoOverflowInt(1)); + const MemPointerSummand base2(other.base().object(), NoOverflowInt(1)); + assert(summands_at(0) == base1 && other.summands_at(0) == base2, "bases in 0th element"); +#endif + + // Check if all other summands are the same. + return has_same_summands_as(other, 1); } +// Examples: +// p1 = MemPointer[size=1, base + i + 16] +// p2 = MemPointer[size=1, base + i + 17] +// -> Always at distance 1 +// -> p1 always adjacent and before p2 -> return true +// +// p1 = MemPointer[size=4, x + y + z + 4L * i + 16] +// p2 = MemPointer[size=4, x + y + z + 4L * i + 20] +// -> Always at distance 4 +// -> p1 always adjacent and before p2 -> return true +// +// p1 = MemPointer[size=4, base1 + 4L * i1 + 16] +// p2 = MemPointer[size=4, base2 + 4L * i2 + 20] +// -> Have differing summands, distance is unknown +// -> Unknown if adjacent at runtime -> return false bool MemPointer::is_adjacent_to_and_before(const MemPointer& other) const { - const MemPointerDecomposedForm& s1 = decomposed_form(); - const MemPointerDecomposedForm& s2 = other.decomposed_form(); - const MemPointerAliasing aliasing = s1.get_aliasing_with(s2 NOT_PRODUCT( COMMA _trace )); - const jint size = mem()->memory_size(); - const bool is_adjacent = aliasing.is_always_at_distance(size); + const MemPointerAliasing aliasing = get_aliasing_with(other NOT_PRODUCT( COMMA _trace )); + const bool is_adjacent = aliasing.is_always_at_distance(_size); #ifndef PRODUCT if (_trace.is_trace_adjacency()) { tty->print("Adjacent: %s, because size = %d and aliasing = ", - is_adjacent ? "true" : "false", size); + is_adjacent ? "true" : "false", _size); aliasing.print_on(tty); tty->cr(); } @@ -381,3 +564,57 @@ bool MemPointer::is_adjacent_to_and_before(const MemPointer& other) const { return is_adjacent; } + +// Examples: +// p1 = MemPointer[size=1, base + i + 16] +// p2 = MemPointer[size=1, base + i + 17] +// -> Always at distance 1 +// -> Can never overlap -> return true +// +// p1 = MemPointer[size=1, base + i + 16] +// p2 = MemPointer[size=1, base + i + 16] +// -> Always at distance 0 +// -> Always have exact overlap -> return false +// +// p1 = MemPointer[size=4, x + y + z + 4L * i + 16] +// p2 = MemPointer[size=4, x + y + z + 4L * i + 56] +// -> Always at distance 40 +// -> Can never overlap -> return true +// +// p1 = MemPointer[size=8, x + y + z + 4L * i + 16] +// p2 = MemPointer[size=8, x + y + z + 4L * i + 20] +// -> Always at distance 4 +// -> Always have partial overlap -> return false +// +// p1 = MemPointer[size=4, base1 + 4L * i1 + 16] +// p2 = MemPointer[size=4, base2 + 4L * i2 + 20] +// -> Have differing summands, distance is unknown +// -> Unknown if overlap at runtime -> return false +bool MemPointer::never_overlaps_with(const MemPointer& other) const { + const MemPointerAliasing aliasing = get_aliasing_with(other NOT_PRODUCT( COMMA _trace )); + + // The aliasing tries to compute: + // distance = other - this + // + // We know that we have no overlap if we can prove: + // this >= other + other.size || this + this.size <= other + // + // Which we can restate as: + // distance <= -other.size || this.size <= distance + // + const jint distance_lo = -other.size(); + const jint distance_hi = size(); + bool is_never_overlap = aliasing.is_never_in_distance_range(distance_lo, distance_hi); + +#ifndef PRODUCT + if (_trace.is_trace_overlap()) { + tty->print("Never Overlap: %s, distance_lo: %d, distance_hi: %d, aliasing: ", + is_never_overlap ? "true" : "false", distance_lo, distance_hi); + aliasing.print_on(tty); + tty->cr(); + } +#endif + + return is_never_overlap; +} + diff --git a/src/hotspot/share/opto/mempointer.hpp b/src/hotspot/share/opto/mempointer.hpp index 100fbfc71bd6c..f1d29f2453f52 100644 --- a/src/hotspot/share/opto/mempointer.hpp +++ b/src/hotspot/share/opto/mempointer.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * 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,8 +28,18 @@ #include "opto/memnode.hpp" #include "opto/noOverflowInt.hpp" -// The MemPointer is a shared facility to parse pointers and check the aliasing of pointers, -// e.g. checking if two stores are adjacent. +// The MemPointer is a shared facility to parse pointers and check the aliasing of pointers. +// +// A MemPointer points to a region in memory, starting at a "pointer", and extending for "size" bytes: +// [pointer, pointer + size) +// +// We can check if two loads / two stores: +// - are adjacent -> pack multiple memops into a single memop +// - never overlap -> independent, can swap order +// +// Other use-cases: +// - alignment -> find an alignment solution for all memops in a vectorized loop +// - detect partial overlap -> indicates store-to-load-forwarding failures // // ----------------------------------------------------------------------------------------- // @@ -143,7 +153,7 @@ // // ----------------------------------------------------------------------------------------- // -// MemPointerDecomposedForm: +// MemPointer: // When the pointer is parsed, it is decomposed into a SUM of summands plus a constant: // // pointer = SUM(summands) + con @@ -161,17 +171,6 @@ // On 64-bit systems, this decomposed form is computed with long-add/mul, on 32-bit systems // it is computed with int-add/mul. // -// MemPointerAliasing: -// The decomposed form allows us to determine the aliasing between two pointers easily. For -// example, if two pointers are identical, except for their constant: -// -// pointer1 = SUM(summands) + con1 -// pointer2 = SUM(summands) + con2 -// -// then we can easily compute the distance between the pointers (distance = con2 - con1), -// and determine if they are adjacent. -// -// MemPointerDecomposedFormParser: // Any pointer can be parsed into this (default / trivial) decomposed form: // // pointer = 1 * pointer + 0 @@ -194,11 +193,55 @@ // // This allows us to easily see that these two pointers are adjacent (distance = 4). // -// Hence, in MemPointerDecomposedFormParser::parse_decomposed_form, we start with the pointer as -// a trivial summand. A summand can either be decomposed further or it is terminal (cannot -// be decomposed further). We decompose the summands recursively until all remaining summands -// are terminal, see MemPointerDecomposedFormParser::parse_sub_expression. This effectively parses -// the pointer expression recursively. +// Hence, in MemPointerParser::parse, we start with the pointer as a trivial summand. A summand can either +// be decomposed further or it is terminal (cannot be decomposed further). We decompose the summands +// recursively until all remaining summands are terminal, see MemPointerParser::parse_sub_expression. +// This effectively parses the pointer expression recursively. +// +// MemPointerAliasing: +// The decomposed form allows us to determine the aliasing between two pointers easily. For +// example, if two pointers are identical, except for their constant: +// +// pointer1 = SUM(summands) + con1 +// pointer2 = SUM(summands) + con2 +// +// then we can easily compute the distance between the pointers (distance = con2 - con1), +// and determine if they are adjacent. +// +// MemPointer::Base +// The MemPointer is decomposed like this: +// pointer = SUM(summands) + con +// +// This is sufficient for simple adjacency checks and we do not need to know if the pointer references +// native (off-heap) or object (heap) memory. However, in some cases it is necessary or useful to know +// the object base, or the native pointer's base. +// +// - Object (heap) base (MemPointer::base().is_object()): +// Is the base of the Java object, which resides on the Java heap. +// Guarantees: +// - Always has an alignment of ObjectAlignmentInBytes. +// - A MemPointer with a given object base always must point into the memory of that object. Thus, +// if we have two pointers with two different bases at runtime, we know the two pointers do not +// alias. +// +// - Native (off-heap) base (MemPointer::base().is_native()): +// When we decompose a pointer to native memory, it is at first not clear that there is a base address. +// Even if we could know that there is some base address to which we add index offsets, we cannot know +// if this reference address points to the beginning of a native memory allocation or into the middle, +// or outside it. We also have no guarantee for alignment with such a base address. +// Still: we would like to find such a base if possible, and if two pointers are similar (i.e. have the +// same summands), we would like to find the same base. Further, it is reasonable to speculatively +// assume that such base addresses are aligned (TODO: need to add this speculative check in JDK-8323582). +// A base pointer must have scale = 1, and be accepted byMemPointer::is_native_memory_base_candidate. +// It can thus be one of these: +// (1) CastX2P +// This is simply some arbitrary long cast to a pointer. It may be computed as an addition of +// multiple long and even int values. In some cases this means that we could have further +// decomposed the CastX2P, but at that point it is even harder to tell what should be a good +// candidate for a native memory base. +// (2) LoadL from field jdk.internal.foreign.NativeMemorySegmentImpl.min +// This would be preferable over CastX2P, because it holds the address() of a native +// MemorySegment, i.e. we know it points to the beginning of that MemorySegment. // // ----------------------------------------------------------------------------------------- // @@ -259,12 +302,11 @@ // mp1 and mp2: // p1 - p2 = mp1 - mp2 // -// Note: MemPointerDecomposedForm::get_aliasing_with relies on this MemPointer Lemma to -// prove the correctness of its aliasing computation between two MemPointers. +// Note: MemPointer::get_aliasing_with relies on this MemPointer Lemma to prove the correctness of its +// aliasing computation between two MemPointers. // // -// Note: MemPointerDecomposedFormParser::is_safe_to_decompose_op checks that all -// decompositions we apply are safe. +// Note: MemPointerParser::is_safe_to_decompose_op checks that all decompositions we apply are safe. // // // Proof of the "MemPointer Lemma": @@ -341,41 +383,51 @@ // This shows that p1 and p2 have a distance greater than the array size, and hence at least one of the two // pointers must be out of bounds. This contradicts our assumption (S1) and we are done. - #ifndef PRODUCT class TraceMemPointer : public StackObj { private: - const bool _is_trace_pointer; + const bool _is_trace_parsing; const bool _is_trace_aliasing; const bool _is_trace_adjacency; + const bool _is_trace_overlap; public: - TraceMemPointer(const bool is_trace_pointer, + TraceMemPointer(const bool is_trace_parsing, const bool is_trace_aliasing, - const bool is_trace_adjacency) : - _is_trace_pointer( is_trace_pointer), + const bool is_trace_adjacency, + const bool is_trace_overlap) : + _is_trace_parsing( is_trace_parsing), _is_trace_aliasing( is_trace_aliasing), - _is_trace_adjacency(is_trace_adjacency) + _is_trace_adjacency(is_trace_adjacency), + _is_trace_overlap(is_trace_overlap) {} - bool is_trace_pointer() const { return _is_trace_pointer; } + bool is_trace_parsing() const { return _is_trace_parsing; } bool is_trace_aliasing() const { return _is_trace_aliasing; } bool is_trace_adjacency() const { return _is_trace_adjacency; } + bool is_trace_overlap() const { return _is_trace_overlap; } }; #endif // Class to represent aliasing between two MemPointer. class MemPointerAliasing { -public: - enum Aliasing { - Unknown, // Distance unknown. - // Example: two "int[]" with different variable index offsets. - // e.g. "array[i] vs array[j]". - // e.g. "array1[i] vs array2[j]". - Always}; // Constant distance = p1 - p2. - // Example: The same address expression, except for a constant offset - // e.g. "array[i] vs array[i+1]". private: + enum Aliasing { + Unknown, // Distance unknown. + // Example: two "int[]" (unknown if the same) with different variable index offsets: + // e.g. "array[i] vs array[j]". + // e.g. "array1[i] vs array2[j]". + AlwaysAtDistance, // Constant distance = p2 - p1. + // Example: The same address expression, except for a constant offset: + // e.g. "array[i] vs array[i+1]". + NotOrAtDistance}; // At compile-time, we know that at run-time it is either of these: + // (1) Not: The pointers belong to different memory objects. Distance unknown. + // (2) AtConstDistance: distance = p2 - p1. + // Example: two "int[]" (unknown if the same) with indices that only differ by a + // constant offset: + // e.g. "array1[i] vs array2[i+4]": + // if "array1 == array2": distance = 4. + // if "array1 != array2": different memory objects. const Aliasing _aliasing; const jint _distance; @@ -391,27 +443,39 @@ class MemPointerAliasing { return MemPointerAliasing(Unknown, 0); } - static MemPointerAliasing make_always(const jint distance) { - return MemPointerAliasing(Always, distance); + static MemPointerAliasing make_always_at_distance(const jint distance) { + return MemPointerAliasing(AlwaysAtDistance, distance); + } + + static MemPointerAliasing make_not_or_at_distance(const jint distance) { + return MemPointerAliasing(NotOrAtDistance, distance); } // Use case: exact aliasing and adjacency. bool is_always_at_distance(const jint distance) const { - return _aliasing == Always && _distance == distance; + return _aliasing == AlwaysAtDistance && _distance == distance; + } + + // Use case: overlap. + // Note: the bounds are exclusive: lo < element < hi + bool is_never_in_distance_range(const jint distance_lo, const jint distance_hi) const { + return (_aliasing == AlwaysAtDistance || _aliasing == NotOrAtDistance) && + (_distance <= distance_lo || distance_hi <= _distance); } #ifndef PRODUCT void print_on(outputStream* st) const { switch(_aliasing) { - case Unknown: st->print("Unknown"); break; - case Always: st->print("Always(%d)", _distance); break; + case Unknown: st->print("Unknown"); break; + case AlwaysAtDistance: st->print("AlwaysAtDistance(%d)", _distance); break; + case NotOrAtDistance: st->print("NotOrAtDistance(%d)", _distance); break; default: ShouldNotReachHere(); } } #endif }; -// Summand of a MemPointerDecomposedForm: +// Summand of a MemPointer: // // summand = scale * variable // @@ -437,13 +501,24 @@ class MemPointerSummand : public StackObj { NoOverflowInt scale() const { return _scale; } static int cmp_by_variable_idx(MemPointerSummand* p1, MemPointerSummand* p2) { - if (p1->variable() == nullptr) { - return (p2->variable() == nullptr) ? 0 : 1; - } else if (p2->variable() == nullptr) { + return cmp_by_variable_idx(*p1, *p2); + } + + static int cmp_by_variable_idx(const MemPointerSummand& p1, const MemPointerSummand& p2) { + if (p1.variable() == nullptr) { + return (p2.variable() == nullptr) ? 0 : 1; + } + if (p2.variable() == nullptr) { return -1; } + return p1.variable()->_idx - p2.variable()->_idx; + } - return p1->variable()->_idx - p2->variable()->_idx; + static int cmp(const MemPointerSummand& p1, const MemPointerSummand& p2) { + int cmp = cmp_by_variable_idx(p1, p2); + if (cmp != 0) { return cmp; } + + return NoOverflowInt::cmp(p1.scale(), p2.scale()); } friend bool operator==(const MemPointerSummand a, const MemPointerSummand b) { @@ -461,97 +536,302 @@ class MemPointerSummand : public StackObj { #ifndef PRODUCT void print_on(outputStream* st) const { - st->print("Summand["); _scale.print_on(st); - tty->print(" * [%d %s]]", _variable->_idx, _variable->Name()); + tty->print(" * [%d %s]", _variable->_idx, _variable->Name()); } #endif }; -// Decomposed form of the pointer sub-expression of "pointer". +// Parsing calls the callback on every decomposed node. These are all the +// nodes on the paths from the pointer to the summand variables, i.e. the +// "inner" nodes of the pointer expression. This callback is for example +// used in SuperWord::unrolling_analysis to collect all inner nodes of a +// pointer expression. +class MemPointerParserCallback : public StackObj { +private: + static MemPointerParserCallback _empty; + +public: + virtual void callback(Node* n) { /* do nothing by default */ } + + // Singleton for default arguments. + static MemPointerParserCallback& empty() { return _empty; } +}; + +// A MemPointer points to a region in memory, starting at a "pointer", and extending +// for "size" bytes: +// +// [pointer, pointer + size) +// +// Where the "pointer" is decomposed into the following form: // // pointer = SUM(summands) + con +// pointer = SUM(scale_i * variable_i) + con // -class MemPointerDecomposedForm : public StackObj { -private: +// Where SUM() adds all "scale_i * variable_i" for each i together. +// +// Note: if the base is known, then it is in the 0th summand. A base can be: +// - on-heap / object: base().object() +// - off-heap / native: base().native() +// +// pointer = scale_0 * variable_0 + scale_1 * scale_1 + ... + con +// pointer = 1 * base + scale_1 * scale_1 + ... + con +// +class MemPointer : public StackObj { +public: // We limit the number of summands to 10. This is just a best guess, and not at this // point supported by evidence. But I think it is reasonable: usually, a pointer // contains a base pointer (e.g. array pointer or null for native memory) and a few // variables. It should be rare that we have more than 9 variables. static const int SUMMANDS_SIZE = 10; - Node* _pointer; // pointer node associated with this (sub)pointer + // A base can be: + // - Known: + // - On-heap: Object + // - Off-heap: Native + // - Unknown + class Base : public StackObj { + private: + enum Kind { Unknown, Object, Native }; + Kind _kind; + Node* _base; + + Base(Kind kind, Node* base) : _kind(kind), _base(base) { + assert((kind == Unknown) == (base == nullptr), "known base"); + } - MemPointerSummand _summands[SUMMANDS_SIZE]; - NoOverflowInt _con; + public: + Base() : Base(Unknown, nullptr) {} + static Base make(Node* pointer, const GrowableArray& summands); -public: - // Empty - MemPointerDecomposedForm() : _pointer(nullptr), _con(NoOverflowInt::make_NaN()) {} + bool is_known() const { return _kind != Unknown; } + bool is_object() const { return _kind == Object; } + bool is_native() const { return _kind == Native; } + Node* object() const { assert(is_object(), "unexpected kind"); return _base; } + Node* native() const { assert(is_native(), "unexpected kind"); return _base; } + Node* object_or_native() const { assert(is_known(), "unexpected kind"); return _base; } + Node* object_or_native_or_null() const { return _base; } + +#ifndef PRODUCT + void print_on(outputStream* st) const { + switch (_kind) { + case Object: + st->print("object "); + st->print("%d %s", _base->_idx, _base->Name()); + break; + case Native: + st->print("native "); + st->print("%d %s", _base->_idx, _base->Name()); + break; + default: + st->print("unknown "); + }; + } +#endif + + private: + static Node* find_base(Node* object_base, const GrowableArray& summands); + }; private: + MemPointerSummand _summands[SUMMANDS_SIZE]; + const NoOverflowInt _con; + const Base _base; + const jint _size; + NOT_PRODUCT( const TraceMemPointer& _trace; ) + // Default / trivial: pointer = 0 + 1 * pointer - MemPointerDecomposedForm(Node* pointer) : _pointer(pointer), _con(NoOverflowInt(0)) { + MemPointer(Node* pointer, + const jint size + NOT_PRODUCT(COMMA const TraceMemPointer& trace)) : + _con(NoOverflowInt(0)), + _base(Base()), + _size(size) + NOT_PRODUCT(COMMA _trace(trace)) + { assert(pointer != nullptr, "pointer must be non-null"); _summands[0] = MemPointerSummand(pointer, NoOverflowInt(1)); + assert(1 <= _size && _size <= 2048 && is_power_of_2(_size), "sanity: no vector is expected to be larger"); } - MemPointerDecomposedForm(Node* pointer, const GrowableArray& summands, const NoOverflowInt& con) - : _pointer(pointer), _con(con) { + // pointer = SUM(SUMMANDS) + con + MemPointer(Node* pointer, + const GrowableArray& summands, + const NoOverflowInt& con, + const jint size + NOT_PRODUCT(COMMA const TraceMemPointer& trace)) : + _con(con), + _base(Base::make(pointer, summands)), + _size(size) + NOT_PRODUCT(COMMA _trace(trace)) + { assert(!_con.is_NaN(), "non-NaN constant"); assert(summands.length() <= SUMMANDS_SIZE, "summands must fit"); +#ifdef ASSERT for (int i = 0; i < summands.length(); i++) { - MemPointerSummand s = summands.at(i); + const MemPointerSummand& s = summands.at(i); assert(s.variable() != nullptr, "variable cannot be null"); assert(!s.scale().is_NaN(), "non-NaN scale"); - _summands[i] = s; + } +#endif + + // Put the base in the 0th summand. + Node* base = _base.object_or_native_or_null(); + int pos = 0; + if (base != nullptr) { + MemPointerSummand b(base, NoOverflowInt(1)); + _summands[0] = b; + pos++; + } + // Put all other summands afterward. + for (int i = 0; i < summands.length(); i++) { + const MemPointerSummand& s = summands.at(i); + if (s.variable() == base && s.scale().is_one()) { continue; } + _summands[pos++] = summands.at(i); + } + assert(pos == summands.length(), "copied all summands"); + + assert(1 <= _size && _size <= 2048 && is_power_of_2(_size), "sanity: no vector is expected to be larger"); + } + + // Mutated copy. + // The new MemPointer is identical, except it has a different size and con. + MemPointer(const MemPointer& old, + const NoOverflowInt new_con, + const jint new_size) : + _con(new_con), + _base(old.base()), + _size(new_size) + NOT_PRODUCT(COMMA _trace(old._trace)) + { + assert(!_con.is_NaN(), "non-NaN constant"); + for (int i = 0; i < SUMMANDS_SIZE; i++) { + _summands[i] = old.summands_at(i); } } public: - static MemPointerDecomposedForm make_trivial(Node* pointer) { - return MemPointerDecomposedForm(pointer); + // Parse pointer of MemNode. Delegates to MemPointerParser::parse. + // callback: receives a callback for every decomposed (inner) node + // of the pointer expression. + MemPointer(const MemNode* mem, + MemPointerParserCallback& callback + NOT_PRODUCT(COMMA const TraceMemPointer& trace)); + + // Parse pointer of MemNode. Delegates to MemPointerParser::parse. + MemPointer(const MemNode* mem + NOT_PRODUCT(COMMA const TraceMemPointer& trace)) : + MemPointer(mem, MemPointerParserCallback::empty() NOT_PRODUCT(COMMA trace)) {} + + static MemPointer make_trivial(Node* pointer, + const jint size + NOT_PRODUCT(COMMA const TraceMemPointer& trace)) { + return MemPointer(pointer, size NOT_PRODUCT(COMMA trace)); } - static MemPointerDecomposedForm make(Node* pointer, const GrowableArray& summands, const NoOverflowInt& con) { + static MemPointer make(Node* pointer, + const GrowableArray& summands, + const NoOverflowInt& con, + const jint size + NOT_PRODUCT(COMMA const TraceMemPointer& trace)) { if (summands.length() <= SUMMANDS_SIZE) { - return MemPointerDecomposedForm(pointer, summands, con); + return MemPointer(pointer, summands, con, size NOT_PRODUCT(COMMA trace)); } else { - return MemPointerDecomposedForm::make_trivial(pointer); + return MemPointer::make_trivial(pointer, size NOT_PRODUCT(COMMA trace)); } } - MemPointerAliasing get_aliasing_with(const MemPointerDecomposedForm& other - NOT_PRODUCT( COMMA const TraceMemPointer& trace) ) const; + MemPointer make_with_size(const jint new_size) const { + return MemPointer(*this, this->con(), new_size); + }; + + MemPointer make_with_con(const NoOverflowInt new_con) const { + return MemPointer(*this, new_con, this->size()); + }; - const MemPointerSummand summands_at(const uint i) const { +private: + MemPointerAliasing get_aliasing_with(const MemPointer& other + NOT_PRODUCT(COMMA const TraceMemPointer& trace)) const; + + bool has_same_summands_as(const MemPointer& other, uint start) const; + bool has_same_summands_as(const MemPointer& other) const { return has_same_summands_as(other, 0); } + bool has_different_object_base_but_otherwise_same_summands_as(const MemPointer& other) const; + +public: + bool has_same_non_base_summands_as(const MemPointer& other) const { + if (!base().is_known() || !other.base().is_known()) { + assert(false, "unknown base case is not answered optimally"); + return false; + } + // Known base at 0th summand: all other summands are non-base summands. + return has_same_summands_as(other, 1); + } + + const MemPointerSummand& summands_at(const uint i) const { assert(i < SUMMANDS_SIZE, "in bounds"); return _summands[i]; } const NoOverflowInt con() const { return _con; } + const Base& base() const { return _base; } + jint size() const { return _size; } + + static int cmp_summands(const MemPointer& a, const MemPointer& b) { + for (int i = 0; i < SUMMANDS_SIZE; i++) { + const MemPointerSummand& s_a = a.summands_at(i); + const MemPointerSummand& s_b = b.summands_at(i); + int cmp = MemPointerSummand::cmp(s_a, s_b); + if (cmp != 0) { return cmp;} + } + return 0; + } + + template + void for_each_non_empty_summand(Callback callback) const { + for (int i = 0; i < SUMMANDS_SIZE; i++) { + const MemPointerSummand& s = summands_at(i); + if (s.variable() != nullptr) { + callback(s); + } + } + } + + bool is_adjacent_to_and_before(const MemPointer& other) const; + bool never_overlaps_with(const MemPointer& other) const; #ifndef PRODUCT - void print_on(outputStream* st) const { - if (_pointer == nullptr) { - st->print_cr("MemPointerDecomposedForm empty."); + void print_form_on(outputStream* st) const { + if (_con.is_NaN()) { + st->print_cr("empty"); return; } - st->print("MemPointerDecomposedForm[%d %s: con = ", _pointer->_idx, _pointer->Name()); _con.print_on(st); for (int i = 0; i < SUMMANDS_SIZE; i++) { const MemPointerSummand& summand = _summands[i]; if (summand.variable() != nullptr) { - st->print(", "); + st->print(" + "); summand.print_on(st); } } - st->print_cr("]"); + } + + void print_on(outputStream* st, bool end_with_cr = true) const { + st->print("MemPointer[size: %2d, base: ", size()); + _base.print_on(st); + st->print(", form: "); + print_form_on(st); + st->print("]"); + if (end_with_cr) { st->cr(); } } #endif }; -class MemPointerDecomposedFormParser : public StackObj { +// Utility class. +// MemPointerParser::parse takes a MemNode (load or store) and computes its MemPointer. +// It temporarily allocates dynamic data structures (GrowableArray) in the resource +// area. This way, the computed MemPointer does not have to have any dynamic data +// structures and can be copied freely by value. +class MemPointerParser : public StackObj { private: const MemNode* _mem; @@ -561,58 +841,47 @@ class MemPointerDecomposedFormParser : public StackObj { GrowableArray _summands; // Resulting decomposed-form. - MemPointerDecomposedForm _decomposed_form; - -public: - MemPointerDecomposedFormParser(const MemNode* mem) : _mem(mem), _con(NoOverflowInt(0)) { - _decomposed_form = parse_decomposed_form(); - } - - const MemPointerDecomposedForm decomposed_form() const { return _decomposed_form; } - -private: - MemPointerDecomposedForm parse_decomposed_form(); - void parse_sub_expression(const MemPointerSummand& summand); - - bool is_safe_to_decompose_op(const int opc, const NoOverflowInt& scale) const; -}; - -// Facility to parse the pointer of a Load or Store, so that aliasing between two such -// memory operations can be determined (e.g. adjacency). -class MemPointer : public StackObj { -private: - const MemNode* _mem; - const MemPointerDecomposedForm _decomposed_form; + MemPointer _mem_pointer; - NOT_PRODUCT( const TraceMemPointer& _trace; ) + MemPointerParser(const MemNode* mem, + MemPointerParserCallback& callback + NOT_PRODUCT(COMMA const TraceMemPointer& trace)) : + _mem(mem), + _con(NoOverflowInt(0)), + _mem_pointer(parse(callback NOT_PRODUCT(COMMA trace))) {} public: - MemPointer(const MemNode* mem NOT_PRODUCT( COMMA const TraceMemPointer& trace)) : - _mem(mem), - _decomposed_form(init_decomposed_form(_mem)) - NOT_PRODUCT( COMMA _trace(trace) ) - { + static MemPointer parse(const MemNode* mem, + MemPointerParserCallback& callback + NOT_PRODUCT(COMMA const TraceMemPointer& trace)) { + assert(mem->is_Store() || mem->is_Load(), "only stores and loads are allowed"); + ResourceMark rm; + MemPointerParser parser(mem, callback NOT_PRODUCT(COMMA trace)); + #ifndef PRODUCT - if (_trace.is_trace_pointer()) { - tty->print_cr("MemPointer::MemPointer:"); - tty->print("mem: "); mem->dump(); - _mem->in(MemNode::Address)->dump_bfs(5, nullptr, "d"); - _decomposed_form.print_on(tty); + if (trace.is_trace_parsing()) { + tty->print_cr("\nMemPointerParser::parse:"); + tty->print(" mem: "); mem->dump(); + parser.mem_pointer().print_on(tty); + mem->in(MemNode::Address)->dump_bfs(7, nullptr, "d"); } #endif + + return parser.mem_pointer(); } - const MemNode* mem() const { return _mem; } - const MemPointerDecomposedForm decomposed_form() const { return _decomposed_form; } - bool is_adjacent_to_and_before(const MemPointer& other) const; + static bool is_native_memory_base_candidate(Node* n); private: - static const MemPointerDecomposedForm init_decomposed_form(const MemNode* mem) { - assert(mem->is_Store(), "only stores are supported"); - ResourceMark rm; - MemPointerDecomposedFormParser parser(mem); - return parser.decomposed_form(); - } + const MemPointer& mem_pointer() const { return _mem_pointer; } + + MemPointer parse(MemPointerParserCallback& callback + NOT_PRODUCT(COMMA const TraceMemPointer& trace)); + + void parse_sub_expression(const MemPointerSummand& summand, MemPointerParserCallback& callback); + static bool sub_expression_has_native_base_candidate(Node* n); + + bool is_safe_to_decompose_op(const int opc, const NoOverflowInt& scale) const; }; #endif // SHARE_OPTO_MEMPOINTER_HPP diff --git a/src/hotspot/share/opto/movenode.cpp b/src/hotspot/share/opto/movenode.cpp index dc65afff26f0f..4b3b8547bec22 100644 --- a/src/hotspot/share/opto/movenode.cpp +++ b/src/hotspot/share/opto/movenode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "opto/addnode.hpp" #include "opto/connode.hpp" #include "opto/convertnode.hpp" @@ -102,7 +101,7 @@ Node *CMoveNode::Ideal(PhaseGVN *phase, bool can_reshape) { // Canonicalize the node by moving constants to the right input. if (in(Condition)->is_Bool() && phase->type(in(IfFalse))->singleton() && !phase->type(in(IfTrue))->singleton()) { BoolNode* b = in(Condition)->as_Bool()->negate(phase); - return make(in(Control), phase->transform(b), in(IfTrue), in(IfFalse), _type); + return make(phase->transform(b), in(IfTrue), in(IfFalse), _type); } return nullptr; @@ -186,15 +185,15 @@ const Type* CMoveNode::Value(PhaseGVN* phase) const { //------------------------------make------------------------------------------- // Make a correctly-flavored CMove. Since _type is directly determined // from the inputs we do not need to specify it here. -CMoveNode *CMoveNode::make(Node *c, Node *bol, Node *left, Node *right, const Type *t) { +CMoveNode* CMoveNode::make(Node* bol, Node* left, Node* right, const Type* t) { switch( t->basic_type() ) { - case T_INT: return new CMoveINode( bol, left, right, t->is_int() ); - case T_FLOAT: return new CMoveFNode( bol, left, right, t ); - case T_DOUBLE: return new CMoveDNode( bol, left, right, t ); - case T_LONG: return new CMoveLNode( bol, left, right, t->is_long() ); - case T_OBJECT: return new CMovePNode( c, bol, left, right, t->is_oopptr() ); - case T_ADDRESS: return new CMovePNode( c, bol, left, right, t->is_ptr() ); - case T_NARROWOOP: return new CMoveNNode( c, bol, left, right, t ); + case T_INT: return new CMoveINode(bol, left, right, t->is_int()); + case T_FLOAT: return new CMoveFNode(bol, left, right, t); + case T_DOUBLE: return new CMoveDNode(bol, left, right, t); + case T_LONG: return new CMoveLNode(bol, left, right, t->is_long()); + case T_OBJECT: return new CMovePNode(bol, left, right, t->is_oopptr()); + case T_ADDRESS: return new CMovePNode(bol, left, right, t->is_ptr()); + case T_NARROWOOP: return new CMoveNNode(bol, left, right, t); default: ShouldNotReachHere(); return nullptr; @@ -278,7 +277,7 @@ Node *CMoveINode::Ideal(PhaseGVN *phase, bool can_reshape) { if( in(Condition)->is_Bool() ) { BoolNode* b = in(Condition)->as_Bool(); BoolNode* b2 = b->negate(phase); - return make(in(Control), phase->transform(b2), in(IfTrue), in(IfFalse), _type); + return make(phase->transform(b2), in(IfTrue), in(IfFalse), _type); } } diff --git a/src/hotspot/share/opto/movenode.hpp b/src/hotspot/share/opto/movenode.hpp index 02db0c73079f8..59974f797029a 100644 --- a/src/hotspot/share/opto/movenode.hpp +++ b/src/hotspot/share/opto/movenode.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,7 +47,7 @@ class CMoveNode : public TypeNode { virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); virtual const Type* Value(PhaseGVN* phase) const; virtual Node* Identity(PhaseGVN* phase); - static CMoveNode *make(Node *c, Node *bol, Node *left, Node *right, const Type *t); + static CMoveNode* make(Node* bol, Node* left, Node* right, const Type* t); // Helper function to spot cmove graph shapes static Node* is_cmove_id(PhaseTransform* phase, Node* cmp, Node* t, Node* f, BoolNode* b); static Node* Ideal_minmax(PhaseGVN* phase, CMoveNode* cmov); @@ -87,14 +87,14 @@ class CMoveLNode : public CMoveNode { //------------------------------CMovePNode------------------------------------- class CMovePNode : public CMoveNode { public: - CMovePNode( Node *c, Node *bol, Node *left, Node *right, const TypePtr* t ) : CMoveNode(bol,left,right,t) { init_req(Control,c); } + CMovePNode(Node* bol, Node* left, Node* right, const TypePtr* t) : CMoveNode(bol, left, right, t) {} virtual int Opcode() const; }; //------------------------------CMoveNNode------------------------------------- class CMoveNNode : public CMoveNode { public: - CMoveNNode( Node *c, Node *bol, Node *left, Node *right, const Type* t ) : CMoveNode(bol,left,right,t) { init_req(Control,c); } + CMoveNNode(Node* bol, Node* left, Node* right, const Type* t ) : CMoveNode(bol, left, right, t) {} virtual int Opcode() const; }; diff --git a/src/hotspot/share/opto/mulnode.cpp b/src/hotspot/share/opto/mulnode.cpp index ad98fda025f07..4720f59d5afb1 100644 --- a/src/hotspot/share/opto/mulnode.cpp +++ b/src/hotspot/share/opto/mulnode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "memory/allocation.inline.hpp" #include "opto/addnode.hpp" #include "opto/connode.hpp" diff --git a/src/hotspot/share/opto/mulnode.hpp b/src/hotspot/share/opto/mulnode.hpp index c8d168685d9e5..a34f41d2362d9 100644 --- a/src/hotspot/share/opto/mulnode.hpp +++ b/src/hotspot/share/opto/mulnode.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -388,7 +388,7 @@ inline Node* make_urshift(Node* a, Node* b) { // fused-multiply-add class FmaNode : public Node { public: - FmaNode(Node* c, Node* in1, Node* in2, Node* in3) : Node(c, in1, in2, in3) { + FmaNode(Node* in1, Node* in2, Node* in3) : Node(nullptr, in1, in2, in3) { assert(UseFMA, "Needs FMA instructions support."); } virtual Node* Ideal(PhaseGVN* phase, bool can_reshape); @@ -398,7 +398,7 @@ class FmaNode : public Node { // fused-multiply-add double class FmaDNode : public FmaNode { public: - FmaDNode(Node* c, Node* in1, Node* in2, Node* in3) : FmaNode(c, in1, in2, in3) {} + FmaDNode(Node* in1, Node* in2, Node* in3) : FmaNode(in1, in2, in3) {} virtual int Opcode() const; const Type* bottom_type() const { return Type::DOUBLE; } virtual uint ideal_reg() const { return Op_RegD; } @@ -409,7 +409,7 @@ class FmaDNode : public FmaNode { // fused-multiply-add float class FmaFNode : public FmaNode { public: - FmaFNode(Node* c, Node* in1, Node* in2, Node* in3) : FmaNode(c, in1, in2, in3) {} + FmaFNode(Node* in1, Node* in2, Node* in3) : FmaNode(in1, in2, in3) {} virtual int Opcode() const; const Type* bottom_type() const { return Type::FLOAT; } virtual uint ideal_reg() const { return Op_RegF; } diff --git a/src/hotspot/share/opto/multnode.cpp b/src/hotspot/share/opto/multnode.cpp index 904c9470b6d18..736e84315eee1 100644 --- a/src/hotspot/share/opto/multnode.cpp +++ b/src/hotspot/share/opto/multnode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "opto/callnode.hpp" #include "opto/cfgnode.hpp" #include "opto/matcher.hpp" diff --git a/src/hotspot/share/opto/narrowptrnode.cpp b/src/hotspot/share/opto/narrowptrnode.cpp index 412ecae69c5f0..7f86b8caecf9f 100644 --- a/src/hotspot/share/opto/narrowptrnode.cpp +++ b/src/hotspot/share/opto/narrowptrnode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "opto/narrowptrnode.hpp" #include "opto/phaseX.hpp" diff --git a/src/hotspot/share/opto/noOverflowInt.hpp b/src/hotspot/share/opto/noOverflowInt.hpp index 9da24645b4117..96473407cca11 100644 --- a/src/hotspot/share/opto/noOverflowInt.hpp +++ b/src/hotspot/share/opto/noOverflowInt.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,6 +52,7 @@ class NoOverflowInt { bool is_NaN() const { return _is_NaN; } jint value() const { assert(!is_NaN(), "NaN not allowed"); return _value; } bool is_zero() const { return !is_NaN() && value() == 0; } + bool is_one() const { return !is_NaN() && value() == 1; } friend NoOverflowInt operator+(const NoOverflowInt& a, const NoOverflowInt& b) { if (a.is_NaN()) { return a; } @@ -100,6 +101,23 @@ class NoOverflowInt { return a.value() % b.value() == 0; } + // This "cmp" is used for sort only. + // Note: the NaN semantics are different from floating arithmetic NaNs! + // - Smaller non-NaN are before larger non-NaN. + // - Any non-NaN are before NaN. + // - NaN is equal to NaN. + // Note: NaN indicate overflow, uninitialized, etc. + static int cmp(const NoOverflowInt& a, const NoOverflowInt& b) { + if (a.is_NaN()) { + return b.is_NaN() ? 0 : 1; + } else if (b.is_NaN()) { + return -1; + } + if (a.value() < b.value()) { return -1; } + if (a.value() > b.value()) { return 1; } + return 0; + } + #ifndef PRODUCT void print_on(outputStream* st) const { if (is_NaN()) { diff --git a/src/hotspot/share/opto/node.cpp b/src/hotspot/share/opto/node.cpp index 270bbc10a0d0f..89e7ead2c7619 100644 --- a/src/hotspot/share/opto/node.cpp +++ b/src/hotspot/share/opto/node.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2024, Alibaba Group Holding Limited. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/c2/barrierSetC2.hpp" #include "libadt/vectset.hpp" diff --git a/src/hotspot/share/opto/node.hpp b/src/hotspot/share/opto/node.hpp index 50ae1deecbf44..101006d9afc44 100644 --- a/src/hotspot/share/opto/node.hpp +++ b/src/hotspot/share/opto/node.hpp @@ -345,7 +345,7 @@ class Node { // The PhaseRenumberLive phase renumbers nodes based on liveness information. // Therefore, it updates the value of the _idx field. The parse-time _idx is // preserved in _parse_idx. - const node_idx_t _idx; + node_idx_t _idx; DEBUG_ONLY(const node_idx_t _parse_idx;) // IGV node identifier. Two nodes, possibly in different compilation phases, // have the same IGV identifier if (and only if) they are the very same node @@ -586,8 +586,7 @@ class Node { // Set this node's index, used by cisc_version to replace current node void set_idx(uint new_idx) { - const node_idx_t* ref = &_idx; - *(node_idx_t*)ref = new_idx; + _idx = new_idx; } // Swap input edge order. (Edge indexes i1 and i2 are usually 1 and 2.) void swap_edges(uint i1, uint i2) { diff --git a/src/hotspot/share/opto/opaquenode.cpp b/src/hotspot/share/opto/opaquenode.cpp index 8a8eea51db6d0..672ea13e507df 100644 --- a/src/hotspot/share/opto/opaquenode.cpp +++ b/src/hotspot/share/opto/opaquenode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,7 @@ * */ -#include "precompiled.hpp" +#include "opto/connode.hpp" #include "opto/loopnode.hpp" #include "opto/opaquenode.hpp" #include "opto/phaseX.hpp" diff --git a/src/hotspot/share/opto/opcodes.cpp b/src/hotspot/share/opto/opcodes.cpp index 3298ec9770322..b8dff8d93aae2 100644 --- a/src/hotspot/share/opto/opcodes.cpp +++ b/src/hotspot/share/opto/opcodes.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -// no precompiled headers // ---------------------------------------------------------------------------- // Build a table of class names as strings. Used both for debugging printouts diff --git a/src/hotspot/share/opto/output.cpp b/src/hotspot/share/opto/output.cpp index eb91ff7ea64aa..da58f33367663 100644 --- a/src/hotspot/share/opto/output.cpp +++ b/src/hotspot/share/opto/output.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.inline.hpp" #include "code/compiledIC.hpp" #include "code/debugInfo.hpp" diff --git a/src/hotspot/share/opto/parse.hpp b/src/hotspot/share/opto/parse.hpp index 039283bc863d1..579e0a5321196 100644 --- a/src/hotspot/share/opto/parse.hpp +++ b/src/hotspot/share/opto/parse.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -530,8 +530,7 @@ class Parse : public GraphKit { void do_instanceof(); // Helper functions for shifting & arithmetic - void modf(); - void modd(); + Node* floating_point_mod(Node* a, Node* b, BasicType type); void l2f(); // implementation of _get* and _put* bytecodes diff --git a/src/hotspot/share/opto/parse1.cpp b/src/hotspot/share/opto/parse1.cpp index 68b87d858a5bc..fd75e2f991c01 100644 --- a/src/hotspot/share/opto/parse1.cpp +++ b/src/hotspot/share/opto/parse1.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "compiler/compileLog.hpp" #include "interpreter/linkResolver.hpp" #include "memory/resourceArea.hpp" @@ -642,7 +641,7 @@ Parse::Parse(JVMState* caller, ciMethod* parse_method, float expected_uses) // for exiting control flow still refers to the inlined method. C->set_default_node_notes(caller_nn); - if (log) log->done("parse nodes='%d' live='%d' memory='" SIZE_FORMAT "'", + if (log) log->done("parse nodes='%d' live='%d' memory='%zu'", C->unique(), C->live_nodes(), C->node_arena()->used()); } diff --git a/src/hotspot/share/opto/parse2.cpp b/src/hotspot/share/opto/parse2.cpp index 73cf923480822..6257a6b872d42 100644 --- a/src/hotspot/share/opto/parse2.cpp +++ b/src/hotspot/share/opto/parse2.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciMethodData.hpp" #include "classfile/vmSymbols.hpp" #include "compiler/compileLog.hpp" @@ -1096,33 +1095,16 @@ void Parse::jump_switch_ranges(Node* key_val, SwitchRange *lo, SwitchRange *hi, #endif } -void Parse::modf() { - Node *f2 = pop(); - Node *f1 = pop(); - Node* c = make_runtime_call(RC_LEAF, OptoRuntime::modf_Type(), - CAST_FROM_FN_PTR(address, SharedRuntime::frem), - "frem", nullptr, //no memory effects - f1, f2); - Node* res = _gvn.transform(new ProjNode(c, TypeFunc::Parms + 0)); - - push(res); -} +Node* Parse::floating_point_mod(Node* a, Node* b, BasicType type) { + assert(type == BasicType::T_FLOAT || type == BasicType::T_DOUBLE, "only float and double are floating points"); + CallNode* mod = type == BasicType::T_DOUBLE ? static_cast(new ModDNode(C, a, b)) : new ModFNode(C, a, b); -void Parse::modd() { - Node *d2 = pop_pair(); - Node *d1 = pop_pair(); - Node* c = make_runtime_call(RC_LEAF, OptoRuntime::Math_DD_D_Type(), - CAST_FROM_FN_PTR(address, SharedRuntime::drem), - "drem", nullptr, //no memory effects - d1, top(), d2, top()); - Node* res_d = _gvn.transform(new ProjNode(c, TypeFunc::Parms + 0)); - -#ifdef ASSERT - Node* res_top = _gvn.transform(new ProjNode(c, TypeFunc::Parms + 1)); - assert(res_top == top(), "second value must be top"); -#endif - - push_pair(res_d); + Node* prev_mem = set_predefined_input_for_runtime_call(mod); + mod = _gvn.transform(mod)->as_Call(); + set_predefined_output_for_runtime_call(mod, prev_mem, TypeRawPtr::BOTTOM); + Node* result = _gvn.transform(new ProjNode(mod, TypeFunc::Parms + 0)); + record_for_igvn(mod); + return result; } void Parse::l2f() { @@ -2303,18 +2285,10 @@ void Parse::do_one_bytecode() { break; case Bytecodes::_frem: - if (Matcher::has_match_rule(Op_ModF)) { - // Generate a ModF node. - b = pop(); - a = pop(); - c = _gvn.transform( new ModFNode(nullptr,a,b) ); - d = precision_rounding(c); - push( d ); - } - else { - // Generate a call. - modf(); - } + // Generate a ModF node. + b = pop(); + a = pop(); + push(floating_point_mod(a, b, BasicType::T_FLOAT)); break; case Bytecodes::_fcmpl: @@ -2436,20 +2410,10 @@ void Parse::do_one_bytecode() { break; case Bytecodes::_drem: - if (Matcher::has_match_rule(Op_ModD)) { - // Generate a ModD node. - b = pop_pair(); - a = pop_pair(); - // a % b - - c = _gvn.transform( new ModDNode(nullptr,a,b) ); - d = dprecision_rounding(c); - push_pair( d ); - } - else { - // Generate a call. - modd(); - } + // Generate a ModD node. + b = pop_pair(); + a = pop_pair(); + push_pair(floating_point_mod(a, b, BasicType::T_DOUBLE)); break; case Bytecodes::_dcmpl: diff --git a/src/hotspot/share/opto/parse3.cpp b/src/hotspot/share/opto/parse3.cpp index 93f5bd6c0d52b..d0e2e90ec6bd7 100644 --- a/src/hotspot/share/opto/parse3.cpp +++ b/src/hotspot/share/opto/parse3.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "compiler/compileLog.hpp" #include "interpreter/linkResolver.hpp" #include "memory/universe.hpp" diff --git a/src/hotspot/share/opto/parseHelper.cpp b/src/hotspot/share/opto/parseHelper.cpp index ba4cc612cc31d..17fdb38c6b20e 100644 --- a/src/hotspot/share/opto/parseHelper.cpp +++ b/src/hotspot/share/opto/parseHelper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciSymbols.hpp" #include "compiler/compileLog.hpp" #include "oops/objArrayKlass.hpp" diff --git a/src/hotspot/share/opto/phase.cpp b/src/hotspot/share/opto/phase.cpp index 3684918cea579..5603033ce69d8 100644 --- a/src/hotspot/share/opto/phase.cpp +++ b/src/hotspot/share/opto/phase.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "code/nmethod.hpp" #include "compiler/compileBroker.hpp" #include "opto/compile.hpp" diff --git a/src/hotspot/share/opto/phaseX.cpp b/src/hotspot/share/opto/phaseX.cpp index dc4a27d8351fb..0dd2acd866477 100644 --- a/src/hotspot/share/opto/phaseX.cpp +++ b/src/hotspot/share/opto/phaseX.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/c2/barrierSetC2.hpp" #include "memory/allocation.inline.hpp" diff --git a/src/hotspot/share/opto/postaloc.cpp b/src/hotspot/share/opto/postaloc.cpp index c22d23bc1fcd1..7f4d2845792c9 100644 --- a/src/hotspot/share/opto/postaloc.cpp +++ b/src/hotspot/share/opto/postaloc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" #include "opto/chaitin.hpp" diff --git a/src/hotspot/share/opto/predicates.cpp b/src/hotspot/share/opto/predicates.cpp index a9cd1e638c180..50de5634e0d5f 100644 --- a/src/hotspot/share/opto/predicates.cpp +++ b/src/hotspot/share/opto/predicates.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "opto/addnode.hpp" #include "opto/callnode.hpp" #include "opto/castnode.hpp" @@ -82,6 +81,25 @@ ParsePredicateNode* ParsePredicate::init_parse_predicate(Node* parse_predicate_p return nullptr; } +ParsePredicateSuccessProj* ParsePredicate::clone_to_unswitched_loop(Node* new_control, const bool is_true_path_loop, + PhaseIdealLoop* phase) const { + ParsePredicateSuccessProj* success_proj = phase->create_new_if_for_predicate(_success_proj, new_control, + _parse_predicate_node->deopt_reason(), + Op_ParsePredicate, is_true_path_loop); + NOT_PRODUCT(trace_cloned_parse_predicate(is_true_path_loop, success_proj)); + return success_proj; +} + +#ifndef PRODUCT +void ParsePredicate::trace_cloned_parse_predicate(const bool is_true_path_loop, + const ParsePredicateSuccessProj* success_proj) { + if (TraceLoopPredicate) { + tty->print("Parse Predicate cloned to %s path loop: ", is_true_path_loop ? "true" : "false"); + success_proj->in(0)->dump(); + } +} +#endif // NOT PRODUCT + Deoptimization::DeoptReason RuntimePredicate::uncommon_trap_reason(IfProjNode* if_proj) { CallStaticJavaNode* uct_call = if_proj->is_uncommon_trap_if_pattern(); if (uct_call == nullptr) { @@ -135,7 +153,7 @@ void TemplateAssertionPredicate::rewire_loop_data_dependencies(IfTrueNode* targe PhaseIdealLoop* phase) const { for (DUIterator i = _success_proj->outs(); _success_proj->has_out(i); i++) { Node* output = _success_proj->out(i); - if (!output->is_CFG() && data_in_loop_body.check(output)) { + if (!output->is_CFG() && data_in_loop_body.check_node_in_loop_body(output)) { phase->igvn().replace_input_of(output, 0, target_predicate); --i; // account for the just deleted output } @@ -196,6 +214,12 @@ IfTrueNode* TemplateAssertionPredicate::initialize(PhaseIdealLoop* phase, Node* return success_proj; } +// Kills the Template Assertion Predicate by setting the condition to true. Will be folded away in the next IGVN round. +void TemplateAssertionPredicate::kill(PhaseIdealLoop* phase) const { + ConINode* true_con = phase->intcon(1); + phase->igvn().replace_input_of(_if_node, 1, true_con); +} + #ifdef ASSERT // Class to verify Initialized and Template Assertion Predicates by trying to find OpaqueLoop*Nodes. class OpaqueLoopNodesVerifier : public BFSActions { @@ -947,8 +971,8 @@ IfTrueNode* CreateAssertionPredicatesVisitor::clone_template_and_replace_init_in // x // | old target // Template Assertion loop entry -// Predicate 1 old target clone | \ -// | loop entry TAP 2 | cloned Template Assertion +// Predicate 1 old target clone | \ +// | loop entry TAP 2 | cloned Template Assertion // Template Assertion | ======> | Predicate 2 // Predicate 2 target loop | // | target loop #_current_predicate_chain_head @@ -977,6 +1001,73 @@ void CreateAssertionPredicatesVisitor::rewire_to_old_predicate_chain_head( } } +TargetLoopPredicateChain::TargetLoopPredicateChain(LoopNode* loop_head, PhaseIdealLoop* phase) + : DEBUG_ONLY(_old_target_loop_entry(loop_head->in(LoopNode::EntryControl)) COMMA) + DEBUG_ONLY(_node_index_before_cloning(phase->C->unique()) COMMA) + _current_predicate_chain_head(loop_head), + _phase(phase) {} + +// Inserts the provided newly cloned predicate to the head of the target loop predicate chain. +void TargetLoopPredicateChain::insert_predicate(IfTrueNode* predicate_success_proj) { + rewire_to_target_chain_head(predicate_success_proj); + _current_predicate_chain_head = predicate_success_proj->in(0); + assert(predicate_success_proj->_idx >= _node_index_before_cloning, "must be a newly cloned predicate"); + assert(_current_predicate_chain_head->in(0) == _old_target_loop_entry && + _old_target_loop_entry->unique_ctrl_out() == _current_predicate_chain_head , "must be connected now"); +} + +void TargetLoopPredicateChain::rewire_to_target_chain_head(IfTrueNode* template_assertion_predicate_success_proj) const { + if (_current_predicate_chain_head->is_Loop()) { + _phase->replace_loop_entry(_current_predicate_chain_head->as_Loop(), template_assertion_predicate_success_proj); + } else { + _phase->replace_control(_current_predicate_chain_head, template_assertion_predicate_success_proj); + } +} + +ClonePredicateToTargetLoop::ClonePredicateToTargetLoop(LoopNode* target_loop_head, const NodeInLoopBody& node_in_loop_body, + PhaseIdealLoop* phase) + : _old_target_loop_entry(target_loop_head->in(LoopNode::EntryControl)), + _target_loop_predicate_chain(target_loop_head, phase), + _node_in_loop_body(node_in_loop_body), + _phase(phase) {} + + +CloneUnswitchedLoopPredicatesVisitor::CloneUnswitchedLoopPredicatesVisitor( + LoopNode* true_path_loop_head, LoopNode* false_path_loop_head, + const NodeInOriginalLoopBody& node_in_true_path_loop_body, const NodeInClonedLoopBody& node_in_false_path_loop_body, + PhaseIdealLoop* phase) + : _clone_predicate_to_true_path_loop(true_path_loop_head, node_in_true_path_loop_body, phase), + _clone_predicate_to_false_path_loop(false_path_loop_head, node_in_false_path_loop_body, phase), + _phase(phase), + _has_hoisted_check_parse_predicates(false) {} + +// Keep track of whether we are in the correct Predicate Block where Template Assertion Predicates can be found. +// The PredicateIterator will always start at the loop entry and first visits the Loop Limit Check Predicate Block. +void CloneUnswitchedLoopPredicatesVisitor::visit(const ParsePredicate& parse_predicate) { + Deoptimization::DeoptReason deopt_reason = parse_predicate.head()->deopt_reason(); + if (deopt_reason == Deoptimization::Reason_predicate || + deopt_reason == Deoptimization::Reason_profile_predicate) { + _has_hoisted_check_parse_predicates = true; + } + + _clone_predicate_to_true_path_loop.clone_parse_predicate(parse_predicate, true); + _clone_predicate_to_false_path_loop.clone_parse_predicate(parse_predicate, false); + parse_predicate.kill(_phase->igvn()); +} + +// Clone the Template Assertion Predicate, which is currently found before the newly added unswitched loop selector, +// to the true path and false path loop. +void CloneUnswitchedLoopPredicatesVisitor::visit(const TemplateAssertionPredicate& template_assertion_predicate) { + if (!_has_hoisted_check_parse_predicates) { + // Only process if we are in the correct Predicate Block. + return; + } + + _clone_predicate_to_true_path_loop.clone_template_assertion_predicate(template_assertion_predicate); + _clone_predicate_to_false_path_loop.clone_template_assertion_predicate(template_assertion_predicate); + template_assertion_predicate.kill(_phase); +} + // Clone the Template Assertion Predicate and set a new input for the OpaqueLoopStrideNode. void UpdateStrideForAssertionPredicates::visit(const TemplateAssertionPredicate& template_assertion_predicate) { if (!template_assertion_predicate.is_last_value()) { diff --git a/src/hotspot/share/opto/predicates.hpp b/src/hotspot/share/opto/predicates.hpp index bc8c1a8ebdce8..22de46ea5615b 100644 --- a/src/hotspot/share/opto/predicates.hpp +++ b/src/hotspot/share/opto/predicates.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,6 @@ #define SHARE_OPTO_PREDICATES_HPP #include "opto/cfgnode.hpp" -#include "opto/connode.hpp" #include "opto/opaquenode.hpp" class IdealLoopTree; @@ -232,7 +231,7 @@ class Predicate : public StackObj { // Generic predicate visitor that does nothing. Subclass this visitor to add customized actions for each predicate. // The visit methods of this visitor are called from the predicate iterator classes which walk the predicate chain. // Use the UnifiedPredicateVisitor if the type of the predicate does not matter. -class PredicateVisitor : StackObj { +class PredicateVisitor : public StackObj { public: virtual void visit(const ParsePredicate& parse_predicate) {} virtual void visit(const RuntimePredicate& runtime_predicate) {} @@ -249,7 +248,7 @@ class PredicateVisitor : StackObj { // Interface to check whether a node is in a loop body or not. class NodeInLoopBody : public StackObj { public: - virtual bool check(Node* node) const = 0; + virtual bool check_node_in_loop_body(Node* node) const = 0; }; // Class to represent Assertion Predicates (i.e. either Initialized and/or Template Assertion Predicates). @@ -297,6 +296,8 @@ class ParsePredicate : public Predicate { } static ParsePredicateNode* init_parse_predicate(Node* parse_predicate_proj, Deoptimization::DeoptReason deopt_reason); + NOT_PRODUCT(static void trace_cloned_parse_predicate(bool is_true_path_loop, + const ParsePredicateSuccessProj* success_proj);) public: ParsePredicate(Node* parse_predicate_proj, Deoptimization::DeoptReason deopt_reason) @@ -325,6 +326,15 @@ class ParsePredicate : public Predicate { assert(is_valid(), "must be valid"); return _success_proj; } + + ParsePredicateSuccessProj* clone_to_unswitched_loop(Node* new_control, bool is_true_path_loop, + PhaseIdealLoop* phase) const; + + // Kills this Parse Predicate by marking it useless. Will be folded away in the next IGVN round. + void kill(const PhaseIterGVN& igvn) const { + _parse_predicate_node->mark_useless(); + igvn._worklist.push(_parse_predicate_node); + } }; // Class to represent a Runtime Predicate which always has an associated UCT on the failing path. @@ -399,6 +409,7 @@ class TemplateAssertionPredicate : public Predicate { IfTrueNode* initialize(PhaseIdealLoop* phase, Node* new_control) const; void rewire_loop_data_dependencies(IfTrueNode* target_predicate, const NodeInLoopBody& data_in_loop_body, PhaseIdealLoop* phase) const; + void kill(PhaseIdealLoop* phase) const; static bool is_predicate(Node* node); #ifdef ASSERT @@ -952,13 +963,52 @@ class NodeInOriginalLoopBody : public NodeInLoopBody { // Check if 'node' is not a cloned node (i.e. "< _first_node_index_in_cloned_loop_body") and if we've created a // clone from 'node' (i.e. _old_new entry is non-null). Then we know that 'node' belongs to the original loop body. - bool check(Node* node) const override { + bool check_node_in_loop_body(Node* node) const override { if (node->_idx < _first_node_index_in_cloned_loop_body) { Node* cloned_node = _old_new[node->_idx]; + // Check that the clone is actually part of the cloned loop body and not from some earlier cloning. return cloned_node != nullptr && cloned_node->_idx >= _first_node_index_in_cloned_loop_body; - } else { - return false; } + return false; + } +}; + +// This class checks whether a node is in the main loop body and not the pre loop body. We cannot use the +// NodeInOriginalLoopBody class because PhaseIdealLoop::clone_up_backedge_goo() could clone additional nodes that +// should be pinned at the main loop body entry. The check in NodeInOriginalLoopBody will ignore these. +class NodeInMainLoopBody : public NodeInLoopBody { + const uint _first_node_index_in_pre_loop_body; + const uint _last_node_index_in_pre_loop_body; + DEBUG_ONLY(const uint _last_node_index_from_backedge_goo;) + const Node_List& _old_new; + + public: + NodeInMainLoopBody(const uint first_node_index_in_pre_loop_body, const uint last_node_index_in_pre_loop_body, + DEBUG_ONLY(const uint last_node_index_from_backedge_goo COMMA) const Node_List& old_new) + : _first_node_index_in_pre_loop_body(first_node_index_in_pre_loop_body), + _last_node_index_in_pre_loop_body(last_node_index_in_pre_loop_body), + DEBUG_ONLY(_last_node_index_from_backedge_goo(last_node_index_from_backedge_goo) COMMA) + _old_new(old_new) {} + NONCOPYABLE(NodeInMainLoopBody); + + // Check if 'node' is not a cloned node (i.e. "< _first_node_index_in_cloned_loop_body") and if we've created a + // clone from 'node' (i.e. _old_new entry is non-null). Then we know that 'node' belongs to the original loop body. + // Additionally check if a node was cloned after the pre loop was created. This indicates that it was created by + // PhaseIdealLoop::clone_up_backedge_goo(). These nodes should also be pinned at the main loop entry. + bool check_node_in_loop_body(Node* node) const override { + if (node->_idx < _first_node_index_in_pre_loop_body) { + Node* cloned_node = _old_new[node->_idx]; + // Check that the clone is actually part of the cloned loop body and not from some earlier cloning. + bool cloned_node_in_pre_loop_body = cloned_node != nullptr && cloned_node->_idx >= _first_node_index_in_pre_loop_body; + assert(!cloned_node_in_pre_loop_body || cloned_node->_idx <= _last_node_index_in_pre_loop_body, + "clone must be part of pre loop body"); + return cloned_node_in_pre_loop_body; + } + // Created in PhaseIdealLoop::clone_up_backedge_goo()? + bool node_created_by_backedge_goo = node->_idx > _last_node_index_in_pre_loop_body; + assert(!node_created_by_backedge_goo || node->_idx <= _last_node_index_from_backedge_goo, + "cloned node must have been created in PhaseIdealLoop::clone_up_backedge_goo()"); + return node_created_by_backedge_goo; } }; @@ -973,7 +1023,7 @@ class NodeInClonedLoopBody : public NodeInLoopBody { // Check if 'node' is a clone. This can easily be achieved by comparing its node index to the first node index // inside the cloned loop body (all of them are clones). - bool check(Node* node) const override { + bool check_node_in_loop_body(Node* node) const override { return node->_idx >= _first_node_index_in_cloned_loop_body; } }; @@ -1006,25 +1056,103 @@ class CreateAssertionPredicatesVisitor : public PredicateVisitor { void visit(const TemplateAssertionPredicate& template_assertion_predicate) override; }; -// This visitor collects all Template Assertion Predicates If nodes or the corresponding Opaque nodes, depending on the -// provided 'get_opaque' flag, to the provided list. -class TemplateAssertionPredicateCollector : public PredicateVisitor { +// This class establishes a predicate chain at the target loop by rewiring newly cloned predicates to the current head +// of the predicate chain. +class TargetLoopPredicateChain : public StackObj { + DEBUG_ONLY(const Node* const _old_target_loop_entry;) + DEBUG_ONLY(const node_idx_t _node_index_before_cloning;) + Node* _current_predicate_chain_head; + PhaseIdealLoop* const _phase; + + void rewire_to_target_chain_head(IfTrueNode* template_assertion_predicate_success_proj) const; + +public: + TargetLoopPredicateChain(LoopNode* loop_head, PhaseIdealLoop* phase); + NONCOPYABLE(TargetLoopPredicateChain); + + void insert_predicate(IfTrueNode* predicate_success_proj); +}; + +// This class clones Parse and Template Assertion Predicates to the provided target loop. This also involves rewiring +// of any data pinned to Template Assertion Predicates. The Template Assertion Predicate Expressions are cloned +// without applying any changes to them. +// +// Each time a predicate is cloned, it is inserted at the top of previously cloned predicates. This ensures that the +// target loop predicate chain order of the newly cloned predicates is the same as in the source loop from which the +// predicates were cloned from. +// +// Template Assertion Predicate Example: +// +// x _old_target_loop_entry _old_target_loop_entry +// | | | | +// Template Assertion | Cloned Template 2. rewire data Cloned Template +// Predicate 1. clone | Assertion Predicate and predicate Assertion Predicate +// | \ =======> | ===============> | \ +// | data | | data +// | | | +// source loop head target loop head target loop head +class ClonePredicateToTargetLoop : public StackObj { + Node* const _old_target_loop_entry; // Used as control for each newly cloned predicate. + TargetLoopPredicateChain _target_loop_predicate_chain; + const NodeInLoopBody& _node_in_loop_body; + PhaseIdealLoop* const _phase; + +public: + ClonePredicateToTargetLoop(LoopNode* target_loop_head, const NodeInLoopBody& node_in_loop_body, PhaseIdealLoop* phase); + + // Clones the provided Parse Predicate to the head of the current predicate chain at the target loop. + void clone_parse_predicate(const ParsePredicate& parse_predicate, bool is_true_path_loop) { + ParsePredicateSuccessProj* cloned_parse_predicate_success_proj = + parse_predicate.clone_to_unswitched_loop(_old_target_loop_entry, is_true_path_loop, _phase); + _target_loop_predicate_chain.insert_predicate(cloned_parse_predicate_success_proj); + } + + // Clones the provided Template Assertion Predicate to the head of the current predicate chain at the target loop. + void clone_template_assertion_predicate(const TemplateAssertionPredicate& template_assertion_predicate) { + IfTrueNode* cloned_template_success_proj = template_assertion_predicate.clone(_old_target_loop_entry, + _phase); + template_assertion_predicate.rewire_loop_data_dependencies(cloned_template_success_proj, _node_in_loop_body, _phase); + _target_loop_predicate_chain.insert_predicate(cloned_template_success_proj); + } +}; + +// Visitor to clone Parse and Template Assertion Predicates from a loop to its unswitched true and false path loop. +// The cloned predicates are not updated in any way. Thus, an Initialized Assertion Predicate is also not required to +// be created. Note that the data dependencies from the Template Assertion Predicates are also updated to the newly +// cloned Template Assertion Predicates, depending on whether they belong to the true or false path loop. +class CloneUnswitchedLoopPredicatesVisitor : public PredicateVisitor { + ClonePredicateToTargetLoop _clone_predicate_to_true_path_loop; + ClonePredicateToTargetLoop _clone_predicate_to_false_path_loop; + + PhaseIdealLoop* const _phase; + bool _has_hoisted_check_parse_predicates; + + public: + CloneUnswitchedLoopPredicatesVisitor(LoopNode* true_path_loop_head, + LoopNode* false_path_loop_head, + const NodeInOriginalLoopBody& node_in_true_path_loop_body, + const NodeInClonedLoopBody& node_in_false_path_loop_body, + PhaseIdealLoop* phase); + NONCOPYABLE(CloneUnswitchedLoopPredicatesVisitor); + + using PredicateVisitor::visit; + + void visit(const ParsePredicate& parse_predicate) override; + void visit(const TemplateAssertionPredicate& template_assertion_predicate) override; +}; + +// This visitor collects all OpaqueTemplateAssertionNodes of Template Assertion Predicates. This is used for cleaning +// up unused Template Assertion Predicates. +class OpaqueTemplateAssertionPredicateCollector : public PredicateVisitor { Unique_Node_List& _list; - const bool _get_opaque; public: - TemplateAssertionPredicateCollector(Unique_Node_List& list, const bool get_opaque) - : _list(list), - _get_opaque(get_opaque) {} + explicit OpaqueTemplateAssertionPredicateCollector(Unique_Node_List& list) : _list(list) {} using PredicateVisitor::visit; void visit(const TemplateAssertionPredicate& template_assertion_predicate) override { - if (_get_opaque) { - _list.push(template_assertion_predicate.opaque_node()); - } else { - _list.push(template_assertion_predicate.tail()); - } + _list.push(template_assertion_predicate.opaque_node()); } }; diff --git a/src/hotspot/share/opto/reg_split.cpp b/src/hotspot/share/opto/reg_split.cpp index 9e41c39764333..42ae79feba7c7 100644 --- a/src/hotspot/share/opto/reg_split.cpp +++ b/src/hotspot/share/opto/reg_split.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "libadt/vectset.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.inline.hpp" diff --git a/src/hotspot/share/opto/regalloc.cpp b/src/hotspot/share/opto/regalloc.cpp index d06619976f368..644296715f575 100644 --- a/src/hotspot/share/opto/regalloc.cpp +++ b/src/hotspot/share/opto/regalloc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "opto/regalloc.hpp" static const int NodeRegsOverflowSize = 200; diff --git a/src/hotspot/share/opto/regmask.cpp b/src/hotspot/share/opto/regmask.cpp index 4b3fe291b5cd6..33f73262b16e6 100644 --- a/src/hotspot/share/opto/regmask.cpp +++ b/src/hotspot/share/opto/regmask.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "opto/ad.hpp" #include "opto/chaitin.hpp" #include "opto/compile.hpp" diff --git a/src/hotspot/share/opto/replacednodes.cpp b/src/hotspot/share/opto/replacednodes.cpp index d530de5a356b2..96216f9d7778e 100644 --- a/src/hotspot/share/opto/replacednodes.cpp +++ b/src/hotspot/share/opto/replacednodes.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "memory/resourceArea.hpp" #include "opto/cfgnode.hpp" #include "opto/phaseX.hpp" diff --git a/src/hotspot/share/opto/rootnode.cpp b/src/hotspot/share/opto/rootnode.cpp index 87bb053967896..4ced13abdb1f6 100644 --- a/src/hotspot/share/opto/rootnode.cpp +++ b/src/hotspot/share/opto/rootnode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "memory/allocation.inline.hpp" #include "opto/callnode.hpp" #include "opto/cfgnode.hpp" diff --git a/src/hotspot/share/opto/runtime.cpp b/src/hotspot/share/opto/runtime.cpp index 3dd94f619fd1a..30cfbddc1966a 100644 --- a/src/hotspot/share/opto/runtime.cpp +++ b/src/hotspot/share/opto/runtime.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/vmClasses.hpp" #include "classfile/vmSymbols.hpp" #include "code/codeCache.hpp" @@ -192,6 +191,72 @@ bool OptoRuntime::generate(ciEnv* env) { #undef GEN_C2_JVMTI_STUB // #undef gen +const TypeFunc* OptoRuntime::_new_instance_Type = nullptr; +const TypeFunc* OptoRuntime::_new_array_Type = nullptr; +const TypeFunc* OptoRuntime::_multianewarray2_Type = nullptr; +const TypeFunc* OptoRuntime::_multianewarray3_Type = nullptr; +const TypeFunc* OptoRuntime::_multianewarray4_Type = nullptr; +const TypeFunc* OptoRuntime::_multianewarray5_Type = nullptr; +const TypeFunc* OptoRuntime::_multianewarrayN_Type = nullptr; +const TypeFunc* OptoRuntime::_complete_monitor_enter_Type = nullptr; +const TypeFunc* OptoRuntime::_complete_monitor_exit_Type = nullptr; +const TypeFunc* OptoRuntime::_monitor_notify_Type = nullptr; +const TypeFunc* OptoRuntime::_uncommon_trap_Type = nullptr; +const TypeFunc* OptoRuntime::_athrow_Type = nullptr; +const TypeFunc* OptoRuntime::_rethrow_Type = nullptr; +const TypeFunc* OptoRuntime::_Math_D_D_Type = nullptr; +const TypeFunc* OptoRuntime::_Math_DD_D_Type = nullptr; +const TypeFunc* OptoRuntime::_modf_Type = nullptr; +const TypeFunc* OptoRuntime::_l2f_Type = nullptr; +const TypeFunc* OptoRuntime::_void_long_Type = nullptr; +const TypeFunc* OptoRuntime::_void_void_Type = nullptr; +const TypeFunc* OptoRuntime::_jfr_write_checkpoint_Type = nullptr; +const TypeFunc* OptoRuntime::_flush_windows_Type = nullptr; +const TypeFunc* OptoRuntime::_fast_arraycopy_Type = nullptr; +const TypeFunc* OptoRuntime::_checkcast_arraycopy_Type = nullptr; +const TypeFunc* OptoRuntime::_generic_arraycopy_Type = nullptr; +const TypeFunc* OptoRuntime::_slow_arraycopy_Type = nullptr; +const TypeFunc* OptoRuntime::_unsafe_setmemory_Type = nullptr; +const TypeFunc* OptoRuntime::_array_fill_Type = nullptr; +const TypeFunc* OptoRuntime::_array_sort_Type = nullptr; +const TypeFunc* OptoRuntime::_array_partition_Type = nullptr; +const TypeFunc* OptoRuntime::_aescrypt_block_Type = nullptr; +const TypeFunc* OptoRuntime::_cipherBlockChaining_aescrypt_Type = nullptr; +const TypeFunc* OptoRuntime::_electronicCodeBook_aescrypt_Type = nullptr; +const TypeFunc* OptoRuntime::_counterMode_aescrypt_Type = nullptr; +const TypeFunc* OptoRuntime::_galoisCounterMode_aescrypt_Type = nullptr; +const TypeFunc* OptoRuntime::_digestBase_implCompress_with_sha3_Type = nullptr; +const TypeFunc* OptoRuntime::_digestBase_implCompress_without_sha3_Type = nullptr; +const TypeFunc* OptoRuntime::_digestBase_implCompressMB_with_sha3_Type = nullptr; +const TypeFunc* OptoRuntime::_digestBase_implCompressMB_without_sha3_Type = nullptr; +const TypeFunc* OptoRuntime::_multiplyToLen_Type = nullptr; +const TypeFunc* OptoRuntime::_montgomeryMultiply_Type = nullptr; +const TypeFunc* OptoRuntime::_montgomerySquare_Type = nullptr; +const TypeFunc* OptoRuntime::_squareToLen_Type = nullptr; +const TypeFunc* OptoRuntime::_mulAdd_Type = nullptr; +const TypeFunc* OptoRuntime::_bigIntegerShift_Type = nullptr; +const TypeFunc* OptoRuntime::_vectorizedMismatch_Type = nullptr; +const TypeFunc* OptoRuntime::_ghash_processBlocks_Type = nullptr; +const TypeFunc* OptoRuntime::_chacha20Block_Type = nullptr; +const TypeFunc* OptoRuntime::_base64_encodeBlock_Type = nullptr; +const TypeFunc* OptoRuntime::_base64_decodeBlock_Type = nullptr; +const TypeFunc* OptoRuntime::_string_IndexOf_Type = nullptr; +const TypeFunc* OptoRuntime::_poly1305_processBlocks_Type = nullptr; +const TypeFunc* OptoRuntime::_intpoly_montgomeryMult_P256_Type = nullptr; +const TypeFunc* OptoRuntime::_intpoly_assign_Type = nullptr; +const TypeFunc* OptoRuntime::_updateBytesCRC32_Type = nullptr; +const TypeFunc* OptoRuntime::_updateBytesCRC32C_Type = nullptr; +const TypeFunc* OptoRuntime::_updateBytesAdler32_Type = nullptr; +const TypeFunc* OptoRuntime::_osr_end_Type = nullptr; +const TypeFunc* OptoRuntime::_register_finalizer_Type = nullptr; +#if INCLUDE_JFR +const TypeFunc* OptoRuntime::_class_id_load_barrier_Type = nullptr; +#endif // INCLUDE_JFR +#if INCLUDE_JVMTI +const TypeFunc* OptoRuntime::_notify_jvmti_vthread_Type = nullptr; +#endif // INCLUDE_JVMTI +const TypeFunc* OptoRuntime::_dtrace_method_entry_exit_Type = nullptr; +const TypeFunc* OptoRuntime::_dtrace_object_alloc_Type = nullptr; // Helper method to do generation of RunTimeStub's address OptoRuntime::generate_stub(ciEnv* env, @@ -498,7 +563,7 @@ JRT_BLOCK_ENTRY(void, OptoRuntime::monitor_notifyAll_C(oopDesc* obj, JavaThread* JRT_BLOCK_END; JRT_END -const TypeFunc *OptoRuntime::new_instance_Type() { +static const TypeFunc* make_new_instance_Type() { // create input type (domain) const Type **fields = TypeTuple::fields(1); fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // Klass to be allocated @@ -514,7 +579,7 @@ const TypeFunc *OptoRuntime::new_instance_Type() { } #if INCLUDE_JVMTI -const TypeFunc *OptoRuntime::notify_jvmti_vthread_Type() { +static const TypeFunc* make_notify_jvmti_vthread_Type() { // create input type (domain) const Type **fields = TypeTuple::fields(2); fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // VirtualThread oop @@ -530,7 +595,7 @@ const TypeFunc *OptoRuntime::notify_jvmti_vthread_Type() { } #endif -const TypeFunc *OptoRuntime::athrow_Type() { +static const TypeFunc* make_athrow_Type() { // create input type (domain) const Type **fields = TypeTuple::fields(1); fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // Klass to be allocated @@ -544,8 +609,7 @@ const TypeFunc *OptoRuntime::athrow_Type() { return TypeFunc::make(domain, range); } - -const TypeFunc *OptoRuntime::new_array_Type() { +static const TypeFunc* make_new_array_Type() { // create input type (domain) const Type **fields = TypeTuple::fields(2); fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // element klass @@ -561,11 +625,7 @@ const TypeFunc *OptoRuntime::new_array_Type() { return TypeFunc::make(domain, range); } -const TypeFunc *OptoRuntime::new_array_nozero_Type() { - return new_array_Type(); -} - -const TypeFunc *OptoRuntime::multianewarray_Type(int ndim) { +const TypeFunc* OptoRuntime::multianewarray_Type(int ndim) { // create input type (domain) const int nargs = ndim + 1; const Type **fields = TypeTuple::fields(nargs); @@ -582,23 +642,7 @@ const TypeFunc *OptoRuntime::multianewarray_Type(int ndim) { return TypeFunc::make(domain, range); } -const TypeFunc *OptoRuntime::multianewarray2_Type() { - return multianewarray_Type(2); -} - -const TypeFunc *OptoRuntime::multianewarray3_Type() { - return multianewarray_Type(3); -} - -const TypeFunc *OptoRuntime::multianewarray4_Type() { - return multianewarray_Type(4); -} - -const TypeFunc *OptoRuntime::multianewarray5_Type() { - return multianewarray_Type(5); -} - -const TypeFunc *OptoRuntime::multianewarrayN_Type() { +static const TypeFunc* make_multianewarrayN_Type() { // create input type (domain) const Type **fields = TypeTuple::fields(2); fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // element klass @@ -613,7 +657,7 @@ const TypeFunc *OptoRuntime::multianewarrayN_Type() { return TypeFunc::make(domain, range); } -const TypeFunc *OptoRuntime::uncommon_trap_Type() { +static const TypeFunc* make_uncommon_trap_Type() { // create input type (domain) const Type **fields = TypeTuple::fields(1); fields[TypeFunc::Parms+0] = TypeInt::INT; // trap_reason (deopt reason and action) @@ -628,7 +672,8 @@ const TypeFunc *OptoRuntime::uncommon_trap_Type() { //----------------------------------------------------------------------------- // Monitor Handling -const TypeFunc *OptoRuntime::complete_monitor_enter_Type() { + +static const TypeFunc* make_complete_monitor_enter_Type() { // create input type (domain) const Type **fields = TypeTuple::fields(2); fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // Object to be Locked @@ -643,12 +688,9 @@ const TypeFunc *OptoRuntime::complete_monitor_enter_Type() { return TypeFunc::make(domain,range); } -const TypeFunc *OptoRuntime::complete_monitor_locking_Type() { - return complete_monitor_enter_Type(); -} - //----------------------------------------------------------------------------- -const TypeFunc *OptoRuntime::complete_monitor_exit_Type() { + +static const TypeFunc* make_complete_monitor_exit_Type() { // create input type (domain) const Type **fields = TypeTuple::fields(3); fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // Object to be Locked @@ -664,7 +706,7 @@ const TypeFunc *OptoRuntime::complete_monitor_exit_Type() { return TypeFunc::make(domain, range); } -const TypeFunc *OptoRuntime::monitor_notify_Type() { +static const TypeFunc* make_monitor_notify_Type() { // create input type (domain) const Type **fields = TypeTuple::fields(1); fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // Object to be Locked @@ -676,11 +718,7 @@ const TypeFunc *OptoRuntime::monitor_notify_Type() { return TypeFunc::make(domain, range); } -const TypeFunc *OptoRuntime::monitor_notifyAll_Type() { - return monitor_notify_Type(); -} - -const TypeFunc* OptoRuntime::flush_windows_Type() { +static const TypeFunc* make_flush_windows_Type() { // create input type (domain) const Type** fields = TypeTuple::fields(1); fields[TypeFunc::Parms+0] = nullptr; // void @@ -694,7 +732,7 @@ const TypeFunc* OptoRuntime::flush_windows_Type() { return TypeFunc::make(domain, range); } -const TypeFunc* OptoRuntime::l2f_Type() { +static const TypeFunc* make_l2f_Type() { // create input type (domain) const Type **fields = TypeTuple::fields(2); fields[TypeFunc::Parms+0] = TypeLong::LONG; @@ -709,7 +747,7 @@ const TypeFunc* OptoRuntime::l2f_Type() { return TypeFunc::make(domain, range); } -const TypeFunc* OptoRuntime::modf_Type() { +static const TypeFunc* make_modf_Type() { const Type **fields = TypeTuple::fields(2); fields[TypeFunc::Parms+0] = Type::FLOAT; fields[TypeFunc::Parms+1] = Type::FLOAT; @@ -724,7 +762,7 @@ const TypeFunc* OptoRuntime::modf_Type() { return TypeFunc::make(domain, range); } -const TypeFunc *OptoRuntime::Math_D_D_Type() { +static const TypeFunc* make_Math_D_D_Type() { // create input type (domain) const Type **fields = TypeTuple::fields(2); // Symbol* name of class to be loaded @@ -741,7 +779,7 @@ const TypeFunc *OptoRuntime::Math_D_D_Type() { return TypeFunc::make(domain, range); } -const TypeFunc *OptoRuntime::Math_Vector_Vector_Type(uint num_arg, const TypeVect* in_type, const TypeVect* out_type) { +const TypeFunc* OptoRuntime::Math_Vector_Vector_Type(uint num_arg, const TypeVect* in_type, const TypeVect* out_type) { // create input type (domain) const Type **fields = TypeTuple::fields(num_arg); // Symbol* name of class to be loaded @@ -760,7 +798,7 @@ const TypeFunc *OptoRuntime::Math_Vector_Vector_Type(uint num_arg, const TypeVec return TypeFunc::make(domain, range); } -const TypeFunc* OptoRuntime::Math_DD_D_Type() { +static const TypeFunc* make_Math_DD_D_Type() { const Type **fields = TypeTuple::fields(4); fields[TypeFunc::Parms+0] = Type::DOUBLE; fields[TypeFunc::Parms+1] = Type::HALF; @@ -779,7 +817,7 @@ const TypeFunc* OptoRuntime::Math_DD_D_Type() { //-------------- currentTimeMillis, currentTimeNanos, etc -const TypeFunc* OptoRuntime::void_long_Type() { +static const TypeFunc* make_void_long_Type() { // create input type (domain) const Type **fields = TypeTuple::fields(0); const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+0, fields); @@ -793,34 +831,35 @@ const TypeFunc* OptoRuntime::void_long_Type() { return TypeFunc::make(domain, range); } -const TypeFunc* OptoRuntime::void_void_Type() { - // create input type (domain) - const Type **fields = TypeTuple::fields(0); - const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+0, fields); +static const TypeFunc* make_void_void_Type() { + // create input type (domain) + const Type **fields = TypeTuple::fields(0); + const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+0, fields); - // create result type (range) - fields = TypeTuple::fields(0); - const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields); - return TypeFunc::make(domain, range); - } + // create result type (range) + fields = TypeTuple::fields(0); + const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields); + return TypeFunc::make(domain, range); +} - const TypeFunc* OptoRuntime::jfr_write_checkpoint_Type() { - // create input type (domain) - const Type **fields = TypeTuple::fields(0); - const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms, fields); +static const TypeFunc* make_jfr_write_checkpoint_Type() { + // create input type (domain) + const Type **fields = TypeTuple::fields(0); + const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms, fields); - // create result type (range) - fields = TypeTuple::fields(0); - const TypeTuple *range = TypeTuple::make(TypeFunc::Parms, fields); - return TypeFunc::make(domain, range); - } + // create result type (range) + fields = TypeTuple::fields(0); + const TypeTuple *range = TypeTuple::make(TypeFunc::Parms, fields); + return TypeFunc::make(domain, range); +} // Takes as parameters: // void *dest // long size // uchar byte -const TypeFunc* OptoRuntime::make_setmemory_Type() { + +static const TypeFunc* make_setmemory_Type() { // create input type (domain) int argcnt = NOT_LP64(3) LP64_ONLY(4); const Type** fields = TypeTuple::fields(argcnt); @@ -885,29 +924,7 @@ static const TypeFunc* make_arraycopy_Type(ArrayCopyType act) { return TypeFunc::make(domain, range); } -const TypeFunc* OptoRuntime::fast_arraycopy_Type() { - // This signature is simple: Two base pointers and a size_t. - return make_arraycopy_Type(ac_fast); -} - -const TypeFunc* OptoRuntime::checkcast_arraycopy_Type() { - // An extension of fast_arraycopy_Type which adds type checking. - return make_arraycopy_Type(ac_checkcast); -} - -const TypeFunc* OptoRuntime::slow_arraycopy_Type() { - // This signature is exactly the same as System.arraycopy. - // There are no intptr_t (int/long) arguments. - return make_arraycopy_Type(ac_slow); -} - -const TypeFunc* OptoRuntime::generic_arraycopy_Type() { - // This signature is like System.arraycopy, except that it returns status. - return make_arraycopy_Type(ac_generic); -} - - -const TypeFunc* OptoRuntime::array_fill_Type() { +static const TypeFunc* make_array_fill_Type() { const Type** fields; int argp = TypeFunc::Parms; // create input type (domain): pointer, int, size_t @@ -926,7 +943,7 @@ const TypeFunc* OptoRuntime::array_fill_Type() { return TypeFunc::make(domain, range); } -const TypeFunc* OptoRuntime::array_partition_Type() { +static const TypeFunc* make_array_partition_Type() { // create input type (domain) int num_args = 7; int argcnt = num_args; @@ -949,7 +966,7 @@ const TypeFunc* OptoRuntime::array_partition_Type() { return TypeFunc::make(domain, range); } -const TypeFunc* OptoRuntime::array_sort_Type() { +static const TypeFunc* make_array_sort_Type() { // create input type (domain) int num_args = 4; int argcnt = num_args; @@ -969,8 +986,7 @@ const TypeFunc* OptoRuntime::array_sort_Type() { return TypeFunc::make(domain, range); } -// for aescrypt encrypt/decrypt operations, just three pointers returning void (length is constant) -const TypeFunc* OptoRuntime::aescrypt_block_Type() { +static const TypeFunc* make_aescrypt_block_Type() { // create input type (domain) int num_args = 3; int argcnt = num_args; @@ -989,10 +1005,7 @@ const TypeFunc* OptoRuntime::aescrypt_block_Type() { return TypeFunc::make(domain, range); } -/** - * int updateBytesCRC32(int crc, byte* b, int len) - */ -const TypeFunc* OptoRuntime::updateBytesCRC32_Type() { +static const TypeFunc* make_updateBytesCRC32_Type() { // create input type (domain) int num_args = 3; int argcnt = num_args; @@ -1011,10 +1024,7 @@ const TypeFunc* OptoRuntime::updateBytesCRC32_Type() { return TypeFunc::make(domain, range); } -/** - * int updateBytesCRC32C(int crc, byte* buf, int len, int* table) - */ -const TypeFunc* OptoRuntime::updateBytesCRC32C_Type() { +static const TypeFunc* make_updateBytesCRC32C_Type() { // create input type (domain) int num_args = 4; int argcnt = num_args; @@ -1034,10 +1044,7 @@ const TypeFunc* OptoRuntime::updateBytesCRC32C_Type() { return TypeFunc::make(domain, range); } -/** -* int updateBytesAdler32(int adler, bytes* b, int off, int len) -*/ -const TypeFunc* OptoRuntime::updateBytesAdler32_Type() { +static const TypeFunc* make_updateBytesAdler32_Type() { // create input type (domain) int num_args = 3; int argcnt = num_args; @@ -1056,8 +1063,7 @@ const TypeFunc* OptoRuntime::updateBytesAdler32_Type() { return TypeFunc::make(domain, range); } -// for cipherBlockChaining calls of aescrypt encrypt/decrypt, four pointers and a length, returning int -const TypeFunc* OptoRuntime::cipherBlockChaining_aescrypt_Type() { +static const TypeFunc* make_cipherBlockChaining_aescrypt_Type() { // create input type (domain) int num_args = 5; int argcnt = num_args; @@ -1078,8 +1084,7 @@ const TypeFunc* OptoRuntime::cipherBlockChaining_aescrypt_Type() { return TypeFunc::make(domain, range); } -// for electronicCodeBook calls of aescrypt encrypt/decrypt, three pointers and a length, returning int -const TypeFunc* OptoRuntime::electronicCodeBook_aescrypt_Type() { +static const TypeFunc* make_electronicCodeBook_aescrypt_Type() { // create input type (domain) int num_args = 4; int argcnt = num_args; @@ -1099,8 +1104,7 @@ const TypeFunc* OptoRuntime::electronicCodeBook_aescrypt_Type() { return TypeFunc::make(domain, range); } -//for counterMode calls of aescrypt encrypt/decrypt, four pointers and a length, returning int -const TypeFunc* OptoRuntime::counterMode_aescrypt_Type() { +static const TypeFunc* make_counterMode_aescrypt_Type() { // create input type (domain) int num_args = 7; int argcnt = num_args; @@ -1122,8 +1126,7 @@ const TypeFunc* OptoRuntime::counterMode_aescrypt_Type() { return TypeFunc::make(domain, range); } -//for counterMode calls of aescrypt encrypt/decrypt, four pointers and a length, returning int -const TypeFunc* OptoRuntime::galoisCounterMode_aescrypt_Type() { +static const TypeFunc* make_galoisCounterMode_aescrypt_Type() { // create input type (domain) int num_args = 8; int argcnt = num_args; @@ -1147,10 +1150,7 @@ const TypeFunc* OptoRuntime::galoisCounterMode_aescrypt_Type() { return TypeFunc::make(domain, range); } -/* - * void implCompress(byte[] buf, int ofs) - */ -const TypeFunc* OptoRuntime::digestBase_implCompress_Type(bool is_sha3) { +static const TypeFunc* make_digestBase_implCompress_Type(bool is_sha3) { // create input type (domain) int num_args = is_sha3 ? 3 : 2; int argcnt = num_args; @@ -1169,10 +1169,7 @@ const TypeFunc* OptoRuntime::digestBase_implCompress_Type(bool is_sha3) { return TypeFunc::make(domain, range); } -/* - * int implCompressMultiBlock(byte[] b, int ofs, int limit) - */ -const TypeFunc* OptoRuntime::digestBase_implCompressMB_Type(bool is_sha3) { +static const TypeFunc* make_digestBase_implCompressMB_Type(bool is_sha3) { // create input type (domain) int num_args = is_sha3 ? 5 : 4; int argcnt = num_args; @@ -1193,7 +1190,7 @@ const TypeFunc* OptoRuntime::digestBase_implCompressMB_Type(bool is_sha3) { return TypeFunc::make(domain, range); } -const TypeFunc* OptoRuntime::multiplyToLen_Type() { +static const TypeFunc* make_multiplyToLen_Type() { // create input type (domain) int num_args = 5; int argcnt = num_args; @@ -1214,7 +1211,7 @@ const TypeFunc* OptoRuntime::multiplyToLen_Type() { return TypeFunc::make(domain, range); } -const TypeFunc* OptoRuntime::squareToLen_Type() { +static const TypeFunc* make_squareToLen_Type() { // create input type (domain) int num_args = 4; int argcnt = num_args; @@ -1234,8 +1231,7 @@ const TypeFunc* OptoRuntime::squareToLen_Type() { return TypeFunc::make(domain, range); } -// for mulAdd calls, 2 pointers and 3 ints, returning int -const TypeFunc* OptoRuntime::mulAdd_Type() { +static const TypeFunc* make_mulAdd_Type() { // create input type (domain) int num_args = 5; int argcnt = num_args; @@ -1256,7 +1252,7 @@ const TypeFunc* OptoRuntime::mulAdd_Type() { return TypeFunc::make(domain, range); } -const TypeFunc* OptoRuntime::montgomeryMultiply_Type() { +static const TypeFunc* make_montgomeryMultiply_Type() { // create input type (domain) int num_args = 7; int argcnt = num_args; @@ -1280,7 +1276,7 @@ const TypeFunc* OptoRuntime::montgomeryMultiply_Type() { return TypeFunc::make(domain, range); } -const TypeFunc* OptoRuntime::montgomerySquare_Type() { +static const TypeFunc* make_montgomerySquare_Type() { // create input type (domain) int num_args = 6; int argcnt = num_args; @@ -1303,7 +1299,7 @@ const TypeFunc* OptoRuntime::montgomerySquare_Type() { return TypeFunc::make(domain, range); } -const TypeFunc * OptoRuntime::bigIntegerShift_Type() { +static const TypeFunc* make_bigIntegerShift_Type() { int argcnt = 5; const Type** fields = TypeTuple::fields(argcnt); int argp = TypeFunc::Parms; @@ -1322,7 +1318,7 @@ const TypeFunc * OptoRuntime::bigIntegerShift_Type() { return TypeFunc::make(domain, range); } -const TypeFunc* OptoRuntime::vectorizedMismatch_Type() { +static const TypeFunc* make_vectorizedMismatch_Type() { // create input type (domain) int num_args = 4; int argcnt = num_args; @@ -1342,47 +1338,44 @@ const TypeFunc* OptoRuntime::vectorizedMismatch_Type() { return TypeFunc::make(domain, range); } -// GHASH block processing -const TypeFunc* OptoRuntime::ghash_processBlocks_Type() { - int argcnt = 4; +static const TypeFunc* make_ghash_processBlocks_Type() { + int argcnt = 4; - const Type** fields = TypeTuple::fields(argcnt); - int argp = TypeFunc::Parms; - fields[argp++] = TypePtr::NOTNULL; // state - fields[argp++] = TypePtr::NOTNULL; // subkeyH - fields[argp++] = TypePtr::NOTNULL; // data - fields[argp++] = TypeInt::INT; // blocks - assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); - const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); + const Type** fields = TypeTuple::fields(argcnt); + int argp = TypeFunc::Parms; + fields[argp++] = TypePtr::NOTNULL; // state + fields[argp++] = TypePtr::NOTNULL; // subkeyH + fields[argp++] = TypePtr::NOTNULL; // data + fields[argp++] = TypeInt::INT; // blocks + assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); + const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); - // result type needed - fields = TypeTuple::fields(1); - fields[TypeFunc::Parms+0] = nullptr; // void - const TypeTuple* range = TypeTuple::make(TypeFunc::Parms, fields); - return TypeFunc::make(domain, range); + // result type needed + fields = TypeTuple::fields(1); + fields[TypeFunc::Parms+0] = nullptr; // void + const TypeTuple* range = TypeTuple::make(TypeFunc::Parms, fields); + return TypeFunc::make(domain, range); } -// ChaCha20 Block function -const TypeFunc* OptoRuntime::chacha20Block_Type() { - int argcnt = 2; +static const TypeFunc* make_chacha20Block_Type() { + int argcnt = 2; - const Type** fields = TypeTuple::fields(argcnt); - int argp = TypeFunc::Parms; - fields[argp++] = TypePtr::NOTNULL; // state - fields[argp++] = TypePtr::NOTNULL; // result + const Type** fields = TypeTuple::fields(argcnt); + int argp = TypeFunc::Parms; + fields[argp++] = TypePtr::NOTNULL; // state + fields[argp++] = TypePtr::NOTNULL; // result - assert(argp == TypeFunc::Parms + argcnt, "correct decoding"); - const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms + argcnt, fields); + assert(argp == TypeFunc::Parms + argcnt, "correct decoding"); + const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms + argcnt, fields); - // result type needed - fields = TypeTuple::fields(1); - fields[TypeFunc::Parms + 0] = TypeInt::INT; // key stream outlen as int - const TypeTuple* range = TypeTuple::make(TypeFunc::Parms + 1, fields); - return TypeFunc::make(domain, range); + // result type needed + fields = TypeTuple::fields(1); + fields[TypeFunc::Parms + 0] = TypeInt::INT; // key stream outlen as int + const TypeTuple* range = TypeTuple::make(TypeFunc::Parms + 1, fields); + return TypeFunc::make(domain, range); } -// Base64 encode function -const TypeFunc* OptoRuntime::base64_encodeBlock_Type() { +static const TypeFunc* make_base64_encodeBlock_Type() { int argcnt = 6; const Type** fields = TypeTuple::fields(argcnt); @@ -1403,8 +1396,7 @@ const TypeFunc* OptoRuntime::base64_encodeBlock_Type() { return TypeFunc::make(domain, range); } -// String IndexOf function -const TypeFunc* OptoRuntime::string_IndexOf_Type() { +static const TypeFunc* make_string_IndexOf_Type() { int argcnt = 4; const Type** fields = TypeTuple::fields(argcnt); @@ -1423,8 +1415,7 @@ const TypeFunc* OptoRuntime::string_IndexOf_Type() { return TypeFunc::make(domain, range); } -// Base64 decode function -const TypeFunc* OptoRuntime::base64_decodeBlock_Type() { +static const TypeFunc* make_base64_decodeBlock_Type() { int argcnt = 7; const Type** fields = TypeTuple::fields(argcnt); @@ -1446,8 +1437,7 @@ const TypeFunc* OptoRuntime::base64_decodeBlock_Type() { return TypeFunc::make(domain, range); } -// Poly1305 processMultipleBlocks function -const TypeFunc* OptoRuntime::poly1305_processBlocks_Type() { +static const TypeFunc* make_poly1305_processBlocks_Type() { int argcnt = 4; const Type** fields = TypeTuple::fields(argcnt); @@ -1466,8 +1456,7 @@ const TypeFunc* OptoRuntime::poly1305_processBlocks_Type() { return TypeFunc::make(domain, range); } -// MontgomeryIntegerPolynomialP256 multiply function -const TypeFunc* OptoRuntime::intpoly_montgomeryMult_P256_Type() { +static const TypeFunc* make_intpoly_montgomeryMult_P256_Type() { int argcnt = 3; const Type** fields = TypeTuple::fields(argcnt); @@ -1485,8 +1474,7 @@ const TypeFunc* OptoRuntime::intpoly_montgomeryMult_P256_Type() { return TypeFunc::make(domain, range); } -// IntegerPolynomial constant time assignment function -const TypeFunc* OptoRuntime::intpoly_assign_Type() { +static const TypeFunc* make_intpoly_assign_Type() { int argcnt = 4; const Type** fields = TypeTuple::fields(argcnt); @@ -1505,8 +1493,8 @@ const TypeFunc* OptoRuntime::intpoly_assign_Type() { return TypeFunc::make(domain, range); } -//------------- Interpreter state access for on stack replacement -const TypeFunc* OptoRuntime::osr_end_Type() { +//------------- Interpreter state for on stack replacement +static const TypeFunc* make_osr_end_Type() { // create input type (domain) const Type **fields = TypeTuple::fields(1); fields[TypeFunc::Parms+0] = TypeRawPtr::BOTTOM; // OSR temp buf @@ -1752,8 +1740,7 @@ address OptoRuntime::rethrow_C(oopDesc* exception, JavaThread* thread, address r return SharedRuntime::raw_exception_handler_for_return_address(thread, ret_pc); } - -const TypeFunc *OptoRuntime::rethrow_Type() { +static const TypeFunc* make_rethrow_Type() { // create input type (domain) const Type **fields = TypeTuple::fields(1); fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // Exception oop @@ -1803,8 +1790,7 @@ bool OptoRuntime::is_deoptimized_caller_frame(JavaThread *thread) { return caller_frame.is_deoptimized_frame(); } - -const TypeFunc *OptoRuntime::register_finalizer_Type() { +static const TypeFunc* make_register_finalizer_Type() { // create input type (domain) const Type **fields = TypeTuple::fields(1); fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // oop; Receiver @@ -1821,7 +1807,7 @@ const TypeFunc *OptoRuntime::register_finalizer_Type() { } #if INCLUDE_JFR -const TypeFunc *OptoRuntime::class_id_load_barrier_Type() { +static const TypeFunc* make_class_id_load_barrier_Type() { // create input type (domain) const Type **fields = TypeTuple::fields(1); fields[TypeFunc::Parms+0] = TypeInstPtr::KLASS; @@ -1834,11 +1820,10 @@ const TypeFunc *OptoRuntime::class_id_load_barrier_Type() { return TypeFunc::make(domain,range); } -#endif +#endif // INCLUDE_JFR //----------------------------------------------------------------------------- -// Dtrace support. entry and exit probes have the same signature -const TypeFunc *OptoRuntime::dtrace_method_entry_exit_Type() { +static const TypeFunc* make_dtrace_method_entry_exit_Type() { // create input type (domain) const Type **fields = TypeTuple::fields(2); fields[TypeFunc::Parms+0] = TypeRawPtr::BOTTOM; // Thread-local storage @@ -1853,7 +1838,7 @@ const TypeFunc *OptoRuntime::dtrace_method_entry_exit_Type() { return TypeFunc::make(domain,range); } -const TypeFunc *OptoRuntime::dtrace_object_alloc_Type() { +static const TypeFunc* make_dtrace_object_alloc_Type() { // create input type (domain) const Type **fields = TypeTuple::fields(2); fields[TypeFunc::Parms+0] = TypeRawPtr::BOTTOM; // Thread-local storage @@ -1869,7 +1854,6 @@ const TypeFunc *OptoRuntime::dtrace_object_alloc_Type() { return TypeFunc::make(domain,range); } - JRT_ENTRY_NO_ASYNC(void, OptoRuntime::register_finalizer_C(oopDesc* obj, JavaThread* current)) assert(oopDesc::is_oop(obj), "must be a valid oop"); assert(obj->klass()->has_finalizer(), "shouldn't be here otherwise"); @@ -1955,6 +1939,75 @@ NamedCounter* OptoRuntime::new_named_counter(JVMState* youngest_jvms, NamedCount return c; } +void OptoRuntime::initialize_types() { + _new_instance_Type = make_new_instance_Type(); + _new_array_Type = make_new_array_Type(); + _multianewarray2_Type = multianewarray_Type(2); + _multianewarray3_Type = multianewarray_Type(3); + _multianewarray4_Type = multianewarray_Type(4); + _multianewarray5_Type = multianewarray_Type(5); + _multianewarrayN_Type = make_multianewarrayN_Type(); + _complete_monitor_enter_Type = make_complete_monitor_enter_Type(); + _complete_monitor_exit_Type = make_complete_monitor_exit_Type(); + _monitor_notify_Type = make_monitor_notify_Type(); + _uncommon_trap_Type = make_uncommon_trap_Type(); + _athrow_Type = make_athrow_Type(); + _rethrow_Type = make_rethrow_Type(); + _Math_D_D_Type = make_Math_D_D_Type(); + _Math_DD_D_Type = make_Math_DD_D_Type(); + _modf_Type = make_modf_Type(); + _l2f_Type = make_l2f_Type(); + _void_long_Type = make_void_long_Type(); + _void_void_Type = make_void_void_Type(); + _jfr_write_checkpoint_Type = make_jfr_write_checkpoint_Type(); + _flush_windows_Type = make_flush_windows_Type(); + _fast_arraycopy_Type = make_arraycopy_Type(ac_fast); + _checkcast_arraycopy_Type = make_arraycopy_Type(ac_checkcast); + _generic_arraycopy_Type = make_arraycopy_Type(ac_generic); + _slow_arraycopy_Type = make_arraycopy_Type(ac_slow); + _unsafe_setmemory_Type = make_setmemory_Type(); + _array_fill_Type = make_array_fill_Type(); + _array_sort_Type = make_array_sort_Type(); + _array_partition_Type = make_array_partition_Type(); + _aescrypt_block_Type = make_aescrypt_block_Type(); + _cipherBlockChaining_aescrypt_Type = make_cipherBlockChaining_aescrypt_Type(); + _electronicCodeBook_aescrypt_Type = make_electronicCodeBook_aescrypt_Type(); + _counterMode_aescrypt_Type = make_counterMode_aescrypt_Type(); + _galoisCounterMode_aescrypt_Type = make_galoisCounterMode_aescrypt_Type(); + _digestBase_implCompress_with_sha3_Type = make_digestBase_implCompress_Type( /* is_sha3= */ true); + _digestBase_implCompress_without_sha3_Type = make_digestBase_implCompress_Type( /* is_sha3= */ false);; + _digestBase_implCompressMB_with_sha3_Type = make_digestBase_implCompressMB_Type(/* is_sha3= */ true); + _digestBase_implCompressMB_without_sha3_Type = make_digestBase_implCompressMB_Type(/* is_sha3= */ false); + _multiplyToLen_Type = make_multiplyToLen_Type(); + _montgomeryMultiply_Type = make_montgomeryMultiply_Type(); + _montgomerySquare_Type = make_montgomerySquare_Type(); + _squareToLen_Type = make_squareToLen_Type(); + _mulAdd_Type = make_mulAdd_Type(); + _bigIntegerShift_Type = make_bigIntegerShift_Type(); + _vectorizedMismatch_Type = make_vectorizedMismatch_Type(); + _ghash_processBlocks_Type = make_ghash_processBlocks_Type(); + _chacha20Block_Type = make_chacha20Block_Type(); + _base64_encodeBlock_Type = make_base64_encodeBlock_Type(); + _base64_decodeBlock_Type = make_base64_decodeBlock_Type(); + _string_IndexOf_Type = make_string_IndexOf_Type(); + _poly1305_processBlocks_Type = make_poly1305_processBlocks_Type(); + _intpoly_montgomeryMult_P256_Type = make_intpoly_montgomeryMult_P256_Type(); + _intpoly_assign_Type = make_intpoly_assign_Type(); + _updateBytesCRC32_Type = make_updateBytesCRC32_Type(); + _updateBytesCRC32C_Type = make_updateBytesCRC32C_Type(); + _updateBytesAdler32_Type = make_updateBytesAdler32_Type(); + _osr_end_Type = make_osr_end_Type(); + _register_finalizer_Type = make_register_finalizer_Type(); + JFR_ONLY( + _class_id_load_barrier_Type = make_class_id_load_barrier_Type(); + ) +#if INCLUDE_JVMTI + _notify_jvmti_vthread_Type = make_notify_jvmti_vthread_Type(); +#endif // INCLUDE_JVMTI + _dtrace_method_entry_exit_Type = make_dtrace_method_entry_exit_Type(); + _dtrace_object_alloc_Type = make_dtrace_object_alloc_Type(); +} + int trace_exception_counter = 0; static void trace_exception(outputStream* st, oop exception_oop, address exception_pc, const char* msg) { trace_exception_counter++; diff --git a/src/hotspot/share/opto/runtime.hpp b/src/hotspot/share/opto/runtime.hpp index dc608cf746a73..fceece73f6603 100644 --- a/src/hotspot/share/opto/runtime.hpp +++ b/src/hotspot/share/opto/runtime.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -131,6 +131,74 @@ class OptoRuntime : public AllStatic { #undef C2_STUB_FIELD_DECLARE #undef C2_JVMTI_STUB_FIELD_DECLARE + // static TypeFunc* data members + static const TypeFunc* _new_instance_Type; + static const TypeFunc* _new_array_Type; + static const TypeFunc* _multianewarray2_Type; + static const TypeFunc* _multianewarray3_Type; + static const TypeFunc* _multianewarray4_Type; + static const TypeFunc* _multianewarray5_Type; + static const TypeFunc* _multianewarrayN_Type; + static const TypeFunc* _complete_monitor_enter_Type; + static const TypeFunc* _complete_monitor_exit_Type; + static const TypeFunc* _monitor_notify_Type; + static const TypeFunc* _uncommon_trap_Type; + static const TypeFunc* _athrow_Type; + static const TypeFunc* _rethrow_Type; + static const TypeFunc* _Math_D_D_Type; + static const TypeFunc* _Math_DD_D_Type; + static const TypeFunc* _modf_Type; + static const TypeFunc* _l2f_Type; + static const TypeFunc* _void_long_Type; + static const TypeFunc* _void_void_Type; + static const TypeFunc* _jfr_write_checkpoint_Type; + static const TypeFunc* _flush_windows_Type; + static const TypeFunc* _fast_arraycopy_Type; + static const TypeFunc* _checkcast_arraycopy_Type; + static const TypeFunc* _generic_arraycopy_Type; + static const TypeFunc* _slow_arraycopy_Type; + static const TypeFunc* _unsafe_setmemory_Type; + static const TypeFunc* _array_fill_Type; + static const TypeFunc* _array_sort_Type; + static const TypeFunc* _array_partition_Type; + static const TypeFunc* _aescrypt_block_Type; + static const TypeFunc* _cipherBlockChaining_aescrypt_Type; + static const TypeFunc* _electronicCodeBook_aescrypt_Type; + static const TypeFunc* _counterMode_aescrypt_Type; + static const TypeFunc* _galoisCounterMode_aescrypt_Type; + static const TypeFunc* _digestBase_implCompress_with_sha3_Type; + static const TypeFunc* _digestBase_implCompress_without_sha3_Type; + static const TypeFunc* _digestBase_implCompressMB_with_sha3_Type; + static const TypeFunc* _digestBase_implCompressMB_without_sha3_Type; + static const TypeFunc* _multiplyToLen_Type; + static const TypeFunc* _montgomeryMultiply_Type; + static const TypeFunc* _montgomerySquare_Type; + static const TypeFunc* _squareToLen_Type; + static const TypeFunc* _mulAdd_Type; + static const TypeFunc* _bigIntegerShift_Type; + static const TypeFunc* _vectorizedMismatch_Type; + static const TypeFunc* _ghash_processBlocks_Type; + static const TypeFunc* _chacha20Block_Type; + static const TypeFunc* _base64_encodeBlock_Type; + static const TypeFunc* _base64_decodeBlock_Type; + static const TypeFunc* _string_IndexOf_Type; + static const TypeFunc* _poly1305_processBlocks_Type; + static const TypeFunc* _intpoly_montgomeryMult_P256_Type; + static const TypeFunc* _intpoly_assign_Type; + static const TypeFunc* _updateBytesCRC32_Type; + static const TypeFunc* _updateBytesCRC32C_Type; + static const TypeFunc* _updateBytesAdler32_Type; + static const TypeFunc* _osr_end_Type; + static const TypeFunc* _register_finalizer_Type; +#if INCLUDE_JFR + static const TypeFunc* _class_id_load_barrier_Type; +#endif // INCLUDE_JFR +#if INCLUDE_JVMTI + static const TypeFunc* _notify_jvmti_vthread_Type; +#endif // INCLUDE_JVMTI + static const TypeFunc* _dtrace_method_entry_exit_Type; + static const TypeFunc* _dtrace_object_alloc_Type; + // Stub names indexed by sharedStubId static const char *_stub_names[]; @@ -242,95 +310,365 @@ class OptoRuntime : public AllStatic { // Type functions // ====================================================== - static const TypeFunc* new_instance_Type(); // object allocation (slow case) - static const TypeFunc* new_array_Type (); // [a]newarray (slow case) - static const TypeFunc* new_array_nozero_Type (); // [a]newarray (slow case) + static inline const TypeFunc* new_instance_Type() { + assert(_new_instance_Type != nullptr, "should be initialized"); + return _new_instance_Type; + } + + static inline const TypeFunc* new_array_Type() { + assert(_new_array_Type != nullptr, "should be initialized"); + return _new_array_Type; + } + + static inline const TypeFunc* new_array_nozero_Type() { + return new_array_Type(); + } + static const TypeFunc* multianewarray_Type(int ndim); // multianewarray - static const TypeFunc* multianewarray2_Type(); // multianewarray - static const TypeFunc* multianewarray3_Type(); // multianewarray - static const TypeFunc* multianewarray4_Type(); // multianewarray - static const TypeFunc* multianewarray5_Type(); // multianewarray - static const TypeFunc* multianewarrayN_Type(); // multianewarray - static const TypeFunc* complete_monitor_enter_Type(); - static const TypeFunc* complete_monitor_locking_Type(); - static const TypeFunc* complete_monitor_exit_Type(); - static const TypeFunc* monitor_notify_Type(); - static const TypeFunc* monitor_notifyAll_Type(); - static const TypeFunc* uncommon_trap_Type(); - static const TypeFunc* athrow_Type(); - static const TypeFunc* rethrow_Type(); - static const TypeFunc* Math_D_D_Type(); // sin,cos & friends - static const TypeFunc* Math_DD_D_Type(); // mod,pow & friends + + static inline const TypeFunc* multianewarray2_Type() { + assert(_multianewarray2_Type != nullptr, "should be initialized"); + return _multianewarray2_Type; + } + + static inline const TypeFunc* multianewarray3_Type() { + assert(_multianewarray3_Type != nullptr, "should be initialized"); + return _multianewarray3_Type; + } + + static inline const TypeFunc* multianewarray4_Type() { + assert(_multianewarray4_Type != nullptr, "should be initialized"); + return _multianewarray4_Type; + } + + static inline const TypeFunc* multianewarray5_Type() { + assert(_multianewarray5_Type != nullptr, "should be initialized"); + return _multianewarray5_Type; + } + + static inline const TypeFunc* multianewarrayN_Type() { + assert(_multianewarrayN_Type != nullptr, "should be initialized"); + return _multianewarrayN_Type; + } + + static inline const TypeFunc* complete_monitor_enter_Type() { + assert(_complete_monitor_enter_Type != nullptr, "should be initialized"); + return _complete_monitor_enter_Type; + } + + static inline const TypeFunc* complete_monitor_locking_Type() { + return complete_monitor_enter_Type(); + } + + static inline const TypeFunc* complete_monitor_exit_Type() { + assert(_complete_monitor_exit_Type != nullptr, "should be initialized"); + return _complete_monitor_exit_Type; + } + + static inline const TypeFunc* monitor_notify_Type() { + assert(_monitor_notify_Type != nullptr, "should be initialized"); + return _monitor_notify_Type; + } + + static inline const TypeFunc* monitor_notifyAll_Type() { + return monitor_notify_Type(); + } + + static inline const TypeFunc* uncommon_trap_Type() { + assert(_uncommon_trap_Type != nullptr, "should be initialized"); + return _uncommon_trap_Type; + } + + static inline const TypeFunc* athrow_Type() { + assert(_athrow_Type != nullptr, "should be initialized"); + return _athrow_Type; + } + + static inline const TypeFunc* rethrow_Type() { + assert(_rethrow_Type != nullptr, "should be initialized"); + return _rethrow_Type; + } + + static inline const TypeFunc* Math_D_D_Type() { + assert(_Math_D_D_Type != nullptr, "should be initialized"); + return _Math_D_D_Type; + } + + static inline const TypeFunc* Math_DD_D_Type() { + assert(_Math_DD_D_Type != nullptr, "should be initialized"); + return _Math_DD_D_Type; + } + static const TypeFunc* Math_Vector_Vector_Type(uint num_arg, const TypeVect* in_type, const TypeVect* out_type); - static const TypeFunc* modf_Type(); - static const TypeFunc* l2f_Type(); - static const TypeFunc* void_long_Type(); - static const TypeFunc* void_void_Type(); - static const TypeFunc* jfr_write_checkpoint_Type(); + static inline const TypeFunc* modf_Type() { + assert(_modf_Type != nullptr, "should be initialized"); + return _modf_Type; + } - static const TypeFunc* flush_windows_Type(); + static inline const TypeFunc* l2f_Type() { + assert(_l2f_Type != nullptr, "should be initialized"); + return _l2f_Type; + } + + static inline const TypeFunc* void_long_Type() { + assert(_void_long_Type != nullptr, "should be initialized"); + return _void_long_Type; + } + + static inline const TypeFunc* void_void_Type() { + assert(_void_void_Type != nullptr, "should be initialized"); + return _void_void_Type; + } + + static const TypeFunc* jfr_write_checkpoint_Type() { + assert(_jfr_write_checkpoint_Type != nullptr, "should be initialized"); + return _jfr_write_checkpoint_Type; + } + + static const TypeFunc* flush_windows_Type() { + assert(_flush_windows_Type != nullptr, "should be initialized"); + return _flush_windows_Type; + } // arraycopy routine types - static const TypeFunc* fast_arraycopy_Type(); // bit-blasters - static const TypeFunc* checkcast_arraycopy_Type(); - static const TypeFunc* generic_arraycopy_Type(); - static const TypeFunc* slow_arraycopy_Type(); // the full routine + static inline const TypeFunc* fast_arraycopy_Type() { + assert(_fast_arraycopy_Type != nullptr, "should be initialized"); + // This signature is simple: Two base pointers and a size_t. + return _fast_arraycopy_Type; + } + + static inline const TypeFunc* checkcast_arraycopy_Type() { + assert(_checkcast_arraycopy_Type != nullptr, "should be initialized"); + // An extension of fast_arraycopy_Type which adds type checking. + return _checkcast_arraycopy_Type; + } + + static inline const TypeFunc* generic_arraycopy_Type() { + assert(_generic_arraycopy_Type != nullptr, "should be initialized"); + // This signature is like System.arraycopy, except that it returns status. + return _generic_arraycopy_Type; + } + + static inline const TypeFunc* slow_arraycopy_Type() { + assert(_slow_arraycopy_Type != nullptr, "should be initialized"); + // This signature is exactly the same as System.arraycopy. + // There are no intptr_t (int/long) arguments. + return _slow_arraycopy_Type; + } // the full routine - static const TypeFunc* make_setmemory_Type(); + static inline const TypeFunc* unsafe_setmemory_Type() { + assert(_unsafe_setmemory_Type != nullptr, "should be initialized"); + return _unsafe_setmemory_Type; + } + + static inline const TypeFunc* array_fill_Type() { + assert(_array_fill_Type != nullptr, "should be initialized"); + return _array_fill_Type; + } + + static inline const TypeFunc* array_sort_Type() { + assert(_array_sort_Type != nullptr, "should be initialized"); + return _array_sort_Type; + } + + static inline const TypeFunc* array_partition_Type() { + assert(_array_partition_Type != nullptr, "should be initialized"); + return _array_partition_Type; + } + + // for aescrypt encrypt/decrypt operations, just three pointers returning void (length is constant) + static inline const TypeFunc* aescrypt_block_Type() { + assert(_aescrypt_block_Type != nullptr, "should be initialized"); + return _aescrypt_block_Type; + } + + // for cipherBlockChaining calls of aescrypt encrypt/decrypt, four pointers and a length, returning int + static inline const TypeFunc* cipherBlockChaining_aescrypt_Type() { + assert(_cipherBlockChaining_aescrypt_Type != nullptr, "should be initialized"); + return _cipherBlockChaining_aescrypt_Type; + } + + // for electronicCodeBook calls of aescrypt encrypt/decrypt, three pointers and a length, returning int + static inline const TypeFunc* electronicCodeBook_aescrypt_Type() { + assert(_electronicCodeBook_aescrypt_Type != nullptr, "should be initialized"); + return _electronicCodeBook_aescrypt_Type; + } + + //for counterMode calls of aescrypt encrypt/decrypt, four pointers and a length, returning int + static inline const TypeFunc* counterMode_aescrypt_Type() { + assert(_counterMode_aescrypt_Type != nullptr, "should be initialized"); + return _counterMode_aescrypt_Type; + } - static const TypeFunc* array_fill_Type(); + //for counterMode calls of aescrypt encrypt/decrypt, four pointers and a length, returning int + static inline const TypeFunc* galoisCounterMode_aescrypt_Type() { + assert(_galoisCounterMode_aescrypt_Type != nullptr, "should be initialized"); + return _galoisCounterMode_aescrypt_Type; + } - static const TypeFunc* array_sort_Type(); - static const TypeFunc* array_partition_Type(); - static const TypeFunc* aescrypt_block_Type(); - static const TypeFunc* cipherBlockChaining_aescrypt_Type(); - static const TypeFunc* electronicCodeBook_aescrypt_Type(); - static const TypeFunc* counterMode_aescrypt_Type(); - static const TypeFunc* galoisCounterMode_aescrypt_Type(); + /* + * void implCompress(byte[] buf, int ofs) + */ + static inline const TypeFunc* digestBase_implCompress_Type(bool is_sha3) { + assert((_digestBase_implCompress_with_sha3_Type != nullptr) && + (_digestBase_implCompress_without_sha3_Type != nullptr), "should be initialized"); + return is_sha3 ? _digestBase_implCompress_with_sha3_Type : _digestBase_implCompress_without_sha3_Type; + } - static const TypeFunc* digestBase_implCompress_Type(bool is_sha3); - static const TypeFunc* digestBase_implCompressMB_Type(bool is_sha3); + /* + * int implCompressMultiBlock(byte[] b, int ofs, int limit) + */ + static inline const TypeFunc* digestBase_implCompressMB_Type(bool is_sha3) { + assert((_digestBase_implCompressMB_with_sha3_Type != nullptr) && + (_digestBase_implCompressMB_without_sha3_Type != nullptr), "should be initialized"); + return is_sha3 ? _digestBase_implCompressMB_with_sha3_Type : _digestBase_implCompressMB_without_sha3_Type; + } - static const TypeFunc* multiplyToLen_Type(); - static const TypeFunc* montgomeryMultiply_Type(); - static const TypeFunc* montgomerySquare_Type(); + static inline const TypeFunc* multiplyToLen_Type() { + assert(_multiplyToLen_Type != nullptr, "should be initialized"); + return _multiplyToLen_Type; + } + + static inline const TypeFunc* montgomeryMultiply_Type() { + assert(_montgomeryMultiply_Type != nullptr, "should be initialized"); + return _montgomeryMultiply_Type; + } - static const TypeFunc* squareToLen_Type(); + static inline const TypeFunc* montgomerySquare_Type() { + assert(_montgomerySquare_Type != nullptr, "should be initialized"); + return _montgomerySquare_Type; + } - static const TypeFunc* mulAdd_Type(); + static inline const TypeFunc* squareToLen_Type() { + assert(_squareToLen_Type != nullptr, "should be initialized"); + return _squareToLen_Type; + } - static const TypeFunc* bigIntegerShift_Type(); + // for mulAdd calls, 2 pointers and 3 ints, returning int + static inline const TypeFunc* mulAdd_Type() { + assert(_mulAdd_Type != nullptr, "should be initialized"); + return _mulAdd_Type; + } - static const TypeFunc* vectorizedMismatch_Type(); + static inline const TypeFunc* bigIntegerShift_Type() { + assert(_bigIntegerShift_Type != nullptr, "should be initialized"); + return _bigIntegerShift_Type; + } - static const TypeFunc* ghash_processBlocks_Type(); - static const TypeFunc* chacha20Block_Type(); - static const TypeFunc* base64_encodeBlock_Type(); - static const TypeFunc* base64_decodeBlock_Type(); - static const TypeFunc* string_IndexOf_Type(); - static const TypeFunc* poly1305_processBlocks_Type(); - static const TypeFunc* intpoly_montgomeryMult_P256_Type(); - static const TypeFunc* intpoly_assign_Type(); + static inline const TypeFunc* vectorizedMismatch_Type() { + assert(_vectorizedMismatch_Type != nullptr, "should be initialized"); + return _vectorizedMismatch_Type; + } - static const TypeFunc* updateBytesCRC32_Type(); - static const TypeFunc* updateBytesCRC32C_Type(); + // GHASH block processing + static inline const TypeFunc* ghash_processBlocks_Type() { + assert(_ghash_processBlocks_Type != nullptr, "should be initialized"); + return _ghash_processBlocks_Type; + } + + // ChaCha20 Block function + static inline const TypeFunc* chacha20Block_Type() { + assert(_chacha20Block_Type != nullptr, "should be initialized"); + return _chacha20Block_Type; + } + + // Base64 encode function + static inline const TypeFunc* base64_encodeBlock_Type() { + assert(_base64_encodeBlock_Type != nullptr, "should be initialized"); + return _base64_encodeBlock_Type; + } + + // Base64 decode function + static inline const TypeFunc* base64_decodeBlock_Type() { + assert(_base64_decodeBlock_Type != nullptr, "should be initialized"); + return _base64_decodeBlock_Type; + } + + // String IndexOf function + static inline const TypeFunc* string_IndexOf_Type() { + assert(_string_IndexOf_Type != nullptr, "should be initialized"); + return _string_IndexOf_Type; + } + + // Poly1305 processMultipleBlocks function + static inline const TypeFunc* poly1305_processBlocks_Type() { + assert(_poly1305_processBlocks_Type != nullptr, "should be initialized"); + return _poly1305_processBlocks_Type; + } + + // MontgomeryIntegerPolynomialP256 multiply function + static inline const TypeFunc* intpoly_montgomeryMult_P256_Type() { + assert(_intpoly_montgomeryMult_P256_Type != nullptr, "should be initialized"); + return _intpoly_montgomeryMult_P256_Type; + } + + // IntegerPolynomial constant time assignment function + static inline const TypeFunc* intpoly_assign_Type() { + assert(_intpoly_assign_Type != nullptr, "should be initialized"); + return _intpoly_assign_Type; + } + + /** + * int updateBytesCRC32(int crc, byte* b, int len) + */ + static inline const TypeFunc* updateBytesCRC32_Type() { + assert(_updateBytesCRC32_Type != nullptr, "should be initialized"); + return _updateBytesCRC32_Type; + } + + /** + * int updateBytesCRC32C(int crc, byte* buf, int len, int* table) + */ + static inline const TypeFunc* updateBytesCRC32C_Type() { + assert(_updateBytesCRC32C_Type != nullptr, "should be initialized"); + return _updateBytesCRC32C_Type; + } + + /** + * int updateBytesAdler32(int adler, bytes* b, int off, int len) + */ + static inline const TypeFunc* updateBytesAdler32_Type() { + assert(_updateBytesAdler32_Type != nullptr, "should be initialized"); + return _updateBytesAdler32_Type; + } - static const TypeFunc* updateBytesAdler32_Type(); // leaf on stack replacement interpreter accessor types - static const TypeFunc* osr_end_Type(); + static inline const TypeFunc* osr_end_Type() { + assert(_osr_end_Type != nullptr, "should be initialized"); + return _osr_end_Type; + } - static const TypeFunc* register_finalizer_Type(); + static inline const TypeFunc* register_finalizer_Type() { + assert(_register_finalizer_Type != nullptr, "should be initialized"); + return _register_finalizer_Type; + } + +#if INCLUDE_JFR + static inline const TypeFunc* class_id_load_barrier_Type() { + assert(_class_id_load_barrier_Type != nullptr, "should be initialized"); + return _class_id_load_barrier_Type; + } +#endif // INCLUDE_JFR - JFR_ONLY(static const TypeFunc* class_id_load_barrier_Type();) #if INCLUDE_JVMTI - static const TypeFunc* notify_jvmti_vthread_Type(); + static inline const TypeFunc* notify_jvmti_vthread_Type() { + assert(_notify_jvmti_vthread_Type != nullptr, "should be initialized"); + return _notify_jvmti_vthread_Type; + } #endif - // Dtrace support - static const TypeFunc* dtrace_method_entry_exit_Type(); - static const TypeFunc* dtrace_object_alloc_Type(); + // Dtrace support. entry and exit probes have the same signature + static inline const TypeFunc* dtrace_method_entry_exit_Type() { + assert(_dtrace_method_entry_exit_Type != nullptr, "should be initialized"); + return _dtrace_method_entry_exit_Type; + } + + static inline const TypeFunc* dtrace_object_alloc_Type() { + assert(_dtrace_object_alloc_Type != nullptr, "should be initialized"); + return _dtrace_object_alloc_Type; + } private: static NamedCounter * volatile _named_counters; @@ -343,6 +681,7 @@ class OptoRuntime : public AllStatic { // dumps all the named counters static void print_named_counters(); + static void initialize_types(); }; #endif // SHARE_OPTO_RUNTIME_HPP diff --git a/src/hotspot/share/opto/split_if.cpp b/src/hotspot/share/opto/split_if.cpp index a46fa5c5d86c6..d94d47591739c 100644 --- a/src/hotspot/share/opto/split_if.cpp +++ b/src/hotspot/share/opto/split_if.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "memory/allocation.inline.hpp" #include "opto/addnode.hpp" #include "opto/callnode.hpp" diff --git a/src/hotspot/share/opto/stringopts.cpp b/src/hotspot/share/opto/stringopts.cpp index 34267666c2a8a..f867fcf4d234c 100644 --- a/src/hotspot/share/opto/stringopts.cpp +++ b/src/hotspot/share/opto/stringopts.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciSymbols.hpp" #include "classfile/javaClasses.hpp" #include "compiler/compileLog.hpp" @@ -174,6 +173,9 @@ class StringConcat : public ResourceObj { assert(!_control.contains(ctrl), "only push once"); _control.push(ctrl); } + bool has_control(Node* ctrl) { + return _control.contains(ctrl); + } void add_constructor(Node* init) { assert(!_constructors.contains(init), "only push once"); _constructors.push(init); @@ -408,7 +410,66 @@ Node_List PhaseStringOpts::collect_toString_calls() { return string_calls; } -// Recognize a fluent-chain of StringBuilder/Buffer. They are either explicit usages +PhaseStringOpts::ProcessAppendResult PhaseStringOpts::process_append_candidate(CallStaticJavaNode* cnode, + StringConcat* sc, + ciMethod* m, + ciSymbol* string_sig, + ciSymbol* int_sig, + ciSymbol* char_sig) { + if (cnode->method() != nullptr && !cnode->method()->is_static() && + cnode->method()->holder() == m->holder() && + cnode->method()->name() == ciSymbols::append_name() && + (cnode->method()->signature()->as_symbol() == string_sig || + cnode->method()->signature()->as_symbol() == char_sig || + cnode->method()->signature()->as_symbol() == int_sig)) { + if (sc->has_control(cnode)) { + return ProcessAppendResult::AppendWasAdded; + } + sc->add_control(cnode); + Node* arg = cnode->in(TypeFunc::Parms + 1); + if (arg == nullptr || arg->is_top()) { +#ifndef PRODUCT + if (PrintOptimizeStringConcat) { + tty->print("giving up because the call is effectively dead"); + cnode->jvms()->dump_spec(tty); + tty->cr(); + } +#endif + return ProcessAppendResult::AbortOptimization; + } + + if (cnode->method()->signature()->as_symbol() == int_sig) { + sc->push_int(arg); + } else if (cnode->method()->signature()->as_symbol() == char_sig) { + sc->push_char(arg); + } else if (arg->is_Proj() && arg->in(0)->is_CallStaticJava()) { + CallStaticJavaNode* csj = arg->in(0)->as_CallStaticJava(); + if (csj->method() != nullptr && + csj->method()->intrinsic_id() == vmIntrinsics::_Integer_toString && + arg->outcnt() == 1) { + // _control is the list of StringBuilder calls nodes which + // will be replaced by new String code after this optimization. + // Integer::toString() call is not part of StringBuilder calls + // chain. It could be eliminated only if its result is used + // only by this SB calls chain. + // Another limitation: it should be used only once because + // it is unknown that it is used only by this SB calls chain + // until all related SB calls nodes are collected. + assert(arg->unique_out() == cnode, "sanity"); + sc->add_control(csj); + sc->push_int(csj->in(TypeFunc::Parms)); + } else { + sc->push_string(arg); + } + } else { + sc->push_string(arg); + } + return ProcessAppendResult::AppendWasAdded; + } + return ProcessAppendResult::CandidateIsNotAppend; +} + +// Recognize fluent-chain and non-fluent uses of StringBuilder/Buffer. They are either explicit usages // of them or the legacy bytecodes of string concatenation prior to JEP-280. eg. // // String result = new StringBuilder() @@ -417,18 +478,17 @@ Node_List PhaseStringOpts::collect_toString_calls() { // .append(123) // .toString(); // "foobar123" // -// PS: Only a certain subset of constructor and append methods are acceptable. -// The criterion is that the length of argument is easy to work out in this phrase. -// It will drop complex cases such as Object. +// Fluent-chains are recognized by walking upwards along the receivers, starting from toString(). +// Once the allocation of the StringBuilder has been reached, DU pairs are examined to find the +// constructor and non-fluent uses of the StringBuilder such as in this example: // -// Since it walks along the receivers of fluent-chain, it will give up if the codeshape is -// not "fluent" enough. eg. // StringBuilder sb = new StringBuilder(); // sb.append("foo"); // sb.toString(); // -// The receiver of toString method is the result of Allocation Node(CheckCastPP). -// The append method is overlooked. It will fail at validate_control_flow() test. +// PS: Only a certain subset of constructor and append methods are acceptable. +// The criterion is that the length of argument is easy to work out in this phrase. +// It will drop complex cases such as Object. // StringConcat* PhaseStringOpts::build_candidate(CallStaticJavaNode* call) { ciMethod* m = call->method(); @@ -467,7 +527,7 @@ StringConcat* PhaseStringOpts::build_candidate(CallStaticJavaNode* call) { if (cnode == nullptr) { alloc = recv->isa_Allocate(); if (alloc == nullptr) { - break; + return nullptr; } // Find the constructor call Node* result = alloc->result_cast(); @@ -479,7 +539,7 @@ StringConcat* PhaseStringOpts::build_candidate(CallStaticJavaNode* call) { alloc->jvms()->dump_spec(tty); tty->cr(); } #endif - break; + return nullptr; } Node* constructor = nullptr; for (SimpleDUIterator i(result); i.has_next(); i.next()) { @@ -490,6 +550,10 @@ StringConcat* PhaseStringOpts::build_candidate(CallStaticJavaNode* call) { use->method()->name() == ciSymbols::object_initializer_name() && use->method()->holder() == m->holder()) { // Matched the constructor. + if (constructor != nullptr) { + // The constructor again. We must only process it once. + continue; + } ciSymbol* sig = use->method()->signature()->as_symbol(); if (sig == ciSymbols::void_method_signature() || sig == ciSymbols::int_void_signature() || @@ -543,7 +607,16 @@ StringConcat* PhaseStringOpts::build_candidate(CallStaticJavaNode* call) { } #endif } - break; + } else if (use != nullptr) { + if (process_append_candidate(use, sc, m, string_sig, int_sig, char_sig) == ProcessAppendResult::AbortOptimization) { + // We must abort if process_append_candidate tells us to... + return nullptr; + } + // ...but we do not care if we really found an append or not: + // - If we found an append, that's perfect. Nothing further to do. + // - If this is a call to an unrelated method, validate_mem_flow() (and validate_control_flow()) + // will later check if this call prevents the optimization. So nothing to do here. + // We will continue to look for the constructor (if not found already) and appends. } } if (constructor == nullptr) { @@ -554,7 +627,7 @@ StringConcat* PhaseStringOpts::build_candidate(CallStaticJavaNode* call) { alloc->jvms()->dump_spec(tty); tty->cr(); } #endif - break; + return nullptr; } // Walked all the way back and found the constructor call so see @@ -569,62 +642,23 @@ StringConcat* PhaseStringOpts::build_candidate(CallStaticJavaNode* call) { } else { return nullptr; } - } else if (cnode->method() == nullptr) { - break; - } else if (!cnode->method()->is_static() && - cnode->method()->holder() == m->holder() && - cnode->method()->name() == ciSymbols::append_name() && - (cnode->method()->signature()->as_symbol() == string_sig || - cnode->method()->signature()->as_symbol() == char_sig || - cnode->method()->signature()->as_symbol() == int_sig)) { - sc->add_control(cnode); - Node* arg = cnode->in(TypeFunc::Parms + 1); - if (arg == nullptr || arg->is_top()) { + } else { + ProcessAppendResult result = process_append_candidate(cnode, sc, m, string_sig, int_sig, char_sig); + + if (result == ProcessAppendResult::AbortOptimization) { + return nullptr; + } else if (result == ProcessAppendResult::CandidateIsNotAppend) { + // some unhandled signature #ifndef PRODUCT if (PrintOptimizeStringConcat) { - tty->print("giving up because the call is effectively dead"); - cnode->jvms()->dump_spec(tty); tty->cr(); + tty->print("giving up because encountered unexpected signature "); + cnode->tf()->dump(); + tty->cr(); + cnode->in(TypeFunc::Parms + 1)->dump(); } #endif - break; - } - if (cnode->method()->signature()->as_symbol() == int_sig) { - sc->push_int(arg); - } else if (cnode->method()->signature()->as_symbol() == char_sig) { - sc->push_char(arg); - } else { - if (arg->is_Proj() && arg->in(0)->is_CallStaticJava()) { - CallStaticJavaNode* csj = arg->in(0)->as_CallStaticJava(); - if (csj->method() != nullptr && - csj->method()->intrinsic_id() == vmIntrinsics::_Integer_toString && - arg->outcnt() == 1) { - // _control is the list of StringBuilder calls nodes which - // will be replaced by new String code after this optimization. - // Integer::toString() call is not part of StringBuilder calls - // chain. It could be eliminated only if its result is used - // only by this SB calls chain. - // Another limitation: it should be used only once because - // it is unknown that it is used only by this SB calls chain - // until all related SB calls nodes are collected. - assert(arg->unique_out() == cnode, "sanity"); - sc->add_control(csj); - sc->push_int(csj->in(TypeFunc::Parms)); - continue; - } - } - sc->push_string(arg); - } - continue; - } else { - // some unhandled signature -#ifndef PRODUCT - if (PrintOptimizeStringConcat) { - tty->print("giving up because encountered unexpected signature "); - cnode->tf()->dump(); tty->cr(); - cnode->in(TypeFunc::Parms + 1)->dump(); + return nullptr; } -#endif - break; } } return nullptr; diff --git a/src/hotspot/share/opto/stringopts.hpp b/src/hotspot/share/opto/stringopts.hpp index 21be4109c7d0d..99d554838d795 100644 --- a/src/hotspot/share/opto/stringopts.hpp +++ b/src/hotspot/share/opto/stringopts.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved. * 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 @@ class IdealVariable; class PhaseStringOpts : public Phase { friend class StringConcat; - private: +private: PhaseGVN* _gvn; // List of dead nodes to clean up aggressively at the end @@ -53,6 +53,23 @@ class PhaseStringOpts : public Phase { // a single string construction. StringConcat* build_candidate(CallStaticJavaNode* call); + enum class ProcessAppendResult { + // Indicates that the candidate was indeed an append and process_append_candidate processed it + // accordingly (added it to the StringConcat etc.) + AppendWasAdded, + // The candidate turned out not to be an append call. process_append_candidate did not do anything. + CandidateIsNotAppend, + // The candidate is an append call, but circumstances completely preventing string concat + // optimization were detected and the optimization must abort. + AbortOptimization + }; + + // Called from build_candidate. Looks at an "append candidate", a call that might be a call + // to StringBuilder::append. If so, adds it to the StringConcat. + ProcessAppendResult process_append_candidate(CallStaticJavaNode* cnode, StringConcat* sc, + ciMethod* m, ciSymbol* string_sig, ciSymbol* int_sig, + ciSymbol* char_sig); + // Replace all the SB calls in concat with an optimization String allocation void replace_string_concat(StringConcat* concat); @@ -105,12 +122,13 @@ class PhaseStringOpts : public Phase { unroll_string_copy_length = 6 }; - public: +public: PhaseStringOpts(PhaseGVN* gvn); #ifndef PRODUCT static void print_statistics(); - private: + +private: static uint _stropts_replaced; static uint _stropts_merged; static uint _stropts_total; diff --git a/src/hotspot/share/opto/subnode.cpp b/src/hotspot/share/opto/subnode.cpp index 445eb16821443..5c7ad22e22163 100644 --- a/src/hotspot/share/opto/subnode.cpp +++ b/src/hotspot/share/opto/subnode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "compiler/compileLog.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/c2/barrierSetC2.hpp" @@ -1416,9 +1415,7 @@ Node* BoolNode::make_predicate(Node* test_value, PhaseGVN* phase) { //--------------------------------as_int_value--------------------------------- Node* BoolNode::as_int_value(PhaseGVN* phase) { // Inverse to make_predicate. The CMove probably boils down to a Conv2B. - Node* cmov = CMoveNode::make(nullptr, this, - phase->intcon(0), phase->intcon(1), - TypeInt::BOOL); + Node* cmov = CMoveNode::make(this, phase->intcon(0), phase->intcon(1), TypeInt::BOOL); return phase->transform(cmov); } @@ -1623,27 +1620,17 @@ Node *BoolNode::Ideal(PhaseGVN *phase, bool can_reshape) { return new BoolNode( ncmp, _test.negate() ); } - // Change ((x & (m - 1)) u< m) into (m > 0) - // This is the off-by-one variant of ((x & m) u<= m) - if (cop == Op_CmpU && - _test._test == BoolTest::lt && - cmp1_op == Op_AndI) { - Node* l = cmp1->in(1); - Node* r = cmp1->in(2); - for (int repeat = 0; repeat < 2; repeat++) { - bool match = r->Opcode() == Op_AddI && r->in(2)->find_int_con(0) == -1 && - r->in(1) == cmp2; - if (match) { - // arraylength known to be non-negative, so a (arraylength != 0) is sufficient, - // but to be compatible with the array range check pattern, use (arraylength u> 0) - Node* ncmp = cmp2->Opcode() == Op_LoadRange - ? phase->transform(new CmpUNode(cmp2, phase->intcon(0))) - : phase->transform(new CmpINode(cmp2, phase->intcon(0))); - return new BoolNode(ncmp, BoolTest::gt); - } else { - // commute and try again - l = cmp1->in(2); - r = cmp1->in(1); + // Transform: "((x & (m - 1)) u 0)" + // This is case [CMPU_MASK] which is further described at the method comment of BoolNode::Value_cmpu_and_mask(). + if (cop == Op_CmpU && _test._test == BoolTest::lt && cmp1_op == Op_AndI) { + Node* m = cmp2; // RHS: m + for (int add_idx = 1; add_idx <= 2; add_idx++) { // LHS: "(m + (-1)) & x" or "x & (m + (-1))"? + Node* maybe_m_minus_1 = cmp1->in(add_idx); + if (maybe_m_minus_1->Opcode() == Op_AddI && + maybe_m_minus_1->in(2)->find_int_con(0) == -1 && + maybe_m_minus_1->in(1) == m) { + Node* m_cmpu_0 = phase->transform(new CmpUNode(m, phase->intcon(0))); + return new BoolNode(m_cmpu_0, BoolTest::gt); } } } @@ -1809,9 +1796,57 @@ Node *BoolNode::Ideal(PhaseGVN *phase, bool can_reshape) { // } } -//------------------------------Value------------------------------------------ -// Change ((x & m) u<= m) or ((m & x) u<= m) to always true -// Same with ((x & m) u< m+1) and ((m & x) u< m+1) +// We use the following Lemmas/insights for the following two transformations (1) and (2): +// x & y <=u y, for any x and y (Lemma 1, masking always results in a smaller unsigned number) +// y u 0) +// This is the off-by-one variant of the above. +// +// We now prove that this replacement is correct. This is the same as proving +// "m >u 0" if and only if "x & (m - 1) u 0 <=> x & (m - 1) m >u 0": +// We prove this by contradiction: +// Assume m <=u 0 which is equivalent to m == 0: +// and thus +// x & (m - 1) u 0 => x & (m - 1) u 0, no underflow of "m - 1" +// +// +// Note that the signed version of "m > 0": +// m > 0 <=> x & (m - 1) 0 +// is false which is a contradiction. +// +// (1a) and (1b) is covered by this method since we can directly return a true value as type while (2) is covered +// in BoolNode::Ideal since we create a new non-constant node (see [CMPU_MASK]). const Type* BoolNode::Value_cmpu_and_mask(PhaseValues* phase) const { Node* cmp = in(1); if (cmp != nullptr && cmp->Opcode() == Op_CmpU) { @@ -1819,14 +1854,21 @@ const Type* BoolNode::Value_cmpu_and_mask(PhaseValues* phase) const { Node* cmp2 = cmp->in(2); if (cmp1->Opcode() == Op_AndI) { - Node* bound = nullptr; + Node* m = nullptr; if (_test._test == BoolTest::le) { - bound = cmp2; + // (1a) "((x & m) <=u m)", cmp2 = m + m = cmp2; } else if (_test._test == BoolTest::lt && cmp2->Opcode() == Op_AddI && cmp2->in(2)->find_int_con(0) == 1) { - bound = cmp2->in(1); + // (1b) "(x & m) in(1); + const TypeInt* rhs_m_type = phase->type(rhs_m)->isa_int(); + if (rhs_m_type->_lo > -1 || rhs_m_type->_hi < -1) { + // Exclude any case where m == -1 is possible. + m = rhs_m; + } } - if (cmp1->in(2) == bound || cmp1->in(1) == bound) { + if (cmp1->in(2) == m || cmp1->in(1) == m) { return TypeInt::ONE; } } diff --git a/src/hotspot/share/opto/subnode.hpp b/src/hotspot/share/opto/subnode.hpp index 6ceaa851739d8..ca21e62867672 100644 --- a/src/hotspot/share/opto/subnode.hpp +++ b/src/hotspot/share/opto/subnode.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -532,9 +532,9 @@ class SqrtFNode : public Node { // reverse bytes of an integer class ReverseBytesINode : public Node { public: - ReverseBytesINode(Node *c, Node *in1) : Node(c, in1) {} + ReverseBytesINode(Node* in) : Node(nullptr, in) {} virtual int Opcode() const; - const Type *bottom_type() const { return TypeInt::INT; } + const Type* bottom_type() const { return TypeInt::INT; } virtual uint ideal_reg() const { return Op_RegI; } }; @@ -542,9 +542,9 @@ class ReverseBytesINode : public Node { // reverse bytes of a long class ReverseBytesLNode : public Node { public: - ReverseBytesLNode(Node *c, Node *in1) : Node(c, in1) {} + ReverseBytesLNode(Node* in) : Node(nullptr, in) {} virtual int Opcode() const; - const Type *bottom_type() const { return TypeLong::LONG; } + const Type* bottom_type() const { return TypeLong::LONG; } virtual uint ideal_reg() const { return Op_RegL; } }; @@ -552,9 +552,9 @@ class ReverseBytesLNode : public Node { // reverse bytes of an unsigned short / char class ReverseBytesUSNode : public Node { public: - ReverseBytesUSNode(Node *c, Node *in1) : Node(c, in1) {} + ReverseBytesUSNode(Node* in1) : Node(nullptr, in1) {} virtual int Opcode() const; - const Type *bottom_type() const { return TypeInt::CHAR; } + const Type* bottom_type() const { return TypeInt::CHAR; } virtual uint ideal_reg() const { return Op_RegI; } }; @@ -562,9 +562,9 @@ class ReverseBytesUSNode : public Node { // reverse bytes of a short class ReverseBytesSNode : public Node { public: - ReverseBytesSNode(Node *c, Node *in1) : Node(c, in1) {} + ReverseBytesSNode(Node* in) : Node(nullptr, in) {} virtual int Opcode() const; - const Type *bottom_type() const { return TypeInt::SHORT; } + const Type* bottom_type() const { return TypeInt::SHORT; } virtual uint ideal_reg() const { return Op_RegI; } }; @@ -572,9 +572,9 @@ class ReverseBytesSNode : public Node { // reverse bits of an int class ReverseINode : public Node { public: - ReverseINode(Node *c, Node *in1) : Node(c, in1) {} + ReverseINode(Node* in) : Node(nullptr, in) {} virtual int Opcode() const; - const Type *bottom_type() const { return TypeInt::INT; } + const Type* bottom_type() const { return TypeInt::INT; } virtual uint ideal_reg() const { return Op_RegI; } virtual Node* Identity(PhaseGVN* phase); virtual const Type* Value(PhaseGVN* phase) const; @@ -584,9 +584,9 @@ class ReverseINode : public Node { // reverse bits of a long class ReverseLNode : public Node { public: - ReverseLNode(Node *c, Node *in1) : Node(c, in1) {} + ReverseLNode(Node* in) : Node(nullptr, in) {} virtual int Opcode() const; - const Type *bottom_type() const { return TypeLong::LONG; } + const Type* bottom_type() const { return TypeLong::LONG; } virtual uint ideal_reg() const { return Op_RegL; } virtual Node* Identity(PhaseGVN* phase); virtual const Type* Value(PhaseGVN* phase) const; diff --git a/src/hotspot/share/opto/subtypenode.cpp b/src/hotspot/share/opto/subtypenode.cpp index 3fbe06f310b9f..9155be40bad98 100644 --- a/src/hotspot/share/opto/subtypenode.cpp +++ b/src/hotspot/share/opto/subtypenode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "opto/addnode.hpp" #include "opto/callnode.hpp" #include "opto/connode.hpp" diff --git a/src/hotspot/share/opto/superword.cpp b/src/hotspot/share/opto/superword.cpp index 8000e4fd39ed0..ae95c2bb6d8b1 100644 --- a/src/hotspot/share/opto/superword.cpp +++ b/src/hotspot/share/opto/superword.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved. * 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,10 +21,10 @@ * questions. */ -#include "precompiled.hpp" #include "opto/addnode.hpp" #include "opto/castnode.hpp" #include "opto/convertnode.hpp" +#include "opto/memnode.hpp" #include "opto/superword.hpp" #include "opto/superwordVTransformBuilder.hpp" #include "opto/vectornode.hpp" @@ -48,21 +48,63 @@ SuperWord::SuperWord(const VLoopAnalyzer &vloop_analyzer) : { } +// Collect ignored loop nodes during VPointer parsing. +class SuperWordUnrollingAnalysisIgnoredNodes : public MemPointerParserCallback { +private: + const VLoop& _vloop; + const Node_List& _body; + bool* _ignored; + +public: + SuperWordUnrollingAnalysisIgnoredNodes(const VLoop& vloop) : + _vloop(vloop), + _body(_vloop.lpt()->_body), + _ignored(NEW_RESOURCE_ARRAY(bool, _body.size())) + { + for (uint i = 0; i < _body.size(); i++) { + _ignored[i] = false; + } + } + + virtual void callback(Node* n) override { set_ignored(n); } + + void set_ignored(uint i) { + assert(i < _body.size(), "must be in bounds"); + _ignored[i] = true; + } + + void set_ignored(Node* n) { + // Only consider nodes in the loop. + Node* ctrl = _vloop.phase()->get_ctrl(n); + if (_vloop.lpt()->is_member(_vloop.phase()->get_loop(ctrl))) { + // Find the index in the loop. + for (uint j = 0; j < _body.size(); j++) { + if (n == _body.at(j)) { + set_ignored(j); + return; + } + } + assert(false, "must find"); + } + } + + bool is_ignored(uint i) const { + assert(i < _vloop.lpt()->_body.size(), "must be in bounds"); + return _ignored[i]; + } +}; + +// SuperWord unrolling analysis does: +// - Determine if the loop is a candidate for auto vectorization (SuperWord). +// - Find a good unrolling factor, to ensure full vector width utilization once we vectorize. void SuperWord::unrolling_analysis(const VLoop &vloop, int &local_loop_unroll_factor) { IdealLoopTree* lpt = vloop.lpt(); CountedLoopNode* cl = vloop.cl(); Node* cl_exit = vloop.cl_exit(); PhaseIdealLoop* phase = vloop.phase(); + SuperWordUnrollingAnalysisIgnoredNodes ignored_nodes(vloop); bool is_slp = true; - size_t ignored_size = lpt->_body.size(); - int *ignored_loop_nodes = NEW_RESOURCE_ARRAY(int, ignored_size); - Node_Stack nstack((int)ignored_size); - - // First clear the entries - for (uint i = 0; i < lpt->_body.size(); i++) { - ignored_loop_nodes[i] = -1; - } int max_vector = Matcher::max_vector_size_auto_vectorization(T_BYTE); @@ -77,7 +119,7 @@ void SuperWord::unrolling_analysis(const VLoop &vloop, int &local_loop_unroll_fa n->is_IfTrue() || n->is_CountedLoop() || (n == cl_exit)) { - ignored_loop_nodes[i] = n->_idx; + ignored_nodes.set_ignored(i); continue; } @@ -85,7 +127,7 @@ void SuperWord::unrolling_analysis(const VLoop &vloop, int &local_loop_unroll_fa IfNode *iff = n->as_If(); if (iff->_fcnt != COUNT_UNKNOWN && iff->_prob != PROB_UNKNOWN) { if (lpt->is_loop_exit(iff)) { - ignored_loop_nodes[i] = n->_idx; + ignored_nodes.set_ignored(i); continue; } } @@ -103,7 +145,7 @@ void SuperWord::unrolling_analysis(const VLoop &vloop, int &local_loop_unroll_fa // This must happen after check of phi/if if (n->is_Phi() || n->is_If()) { - ignored_loop_nodes[i] = n->_idx; + ignored_nodes.set_ignored(i); continue; } @@ -121,7 +163,7 @@ void SuperWord::unrolling_analysis(const VLoop &vloop, int &local_loop_unroll_fa bt = n->bottom_type()->basic_type(); } if (is_java_primitive(bt) == false) { - ignored_loop_nodes[i] = n->_idx; + ignored_nodes.set_ignored(i); continue; } @@ -132,30 +174,9 @@ void SuperWord::unrolling_analysis(const VLoop &vloop, int &local_loop_unroll_fa // save a queue of post process nodes if (n_ctrl != nullptr && lpt->is_member(phase->get_loop(n_ctrl))) { - // Process the memory expression - int stack_idx = 0; - bool have_side_effects = true; - if (adr->is_AddP() == false) { - nstack.push(adr, stack_idx++); - } else { - // Mark the components of the memory operation in nstack - VPointer p1(current, vloop, &nstack); - have_side_effects = p1.node_stack()->is_nonempty(); - } - - // Process the pointer stack - while (have_side_effects) { - Node* pointer_node = nstack.node(); - for (uint j = 0; j < lpt->_body.size(); j++) { - Node* cur_node = lpt->_body.at(j); - if (cur_node == pointer_node) { - ignored_loop_nodes[j] = cur_node->_idx; - break; - } - } - nstack.pop(); - have_side_effects = nstack.is_nonempty(); - } + // Parse the address expression with VPointer, and mark the internal + // nodes of the address expression in ignore_nodes. + VPointer p(current, vloop, ignored_nodes); } } } @@ -165,7 +186,7 @@ void SuperWord::unrolling_analysis(const VLoop &vloop, int &local_loop_unroll_fa // description can use bool flag_small_bt = false; for (uint i = 0; i < lpt->_body.size(); i++) { - if (ignored_loop_nodes[i] != -1) continue; + if (ignored_nodes.is_ignored(i)) continue; BasicType bt; Node* n = lpt->_body.at(i); @@ -477,21 +498,48 @@ bool SuperWord::SLP_extract() { return schedule_and_apply(); } +int SuperWord::MemOp::cmp_by_group(MemOp* a, MemOp* b) { + // Opcode + int c_Opcode = cmp_code(a->mem()->Opcode(), b->mem()->Opcode()); + if (c_Opcode != 0) { return c_Opcode; } + + // VPointer summands + return MemPointer::cmp_summands(a->vpointer().mem_pointer(), + b->vpointer().mem_pointer()); +} + +int SuperWord::MemOp::cmp_by_group_and_con_and_original_index(MemOp* a, MemOp* b) { + // Group + int cmp_group = cmp_by_group(a, b); + if (cmp_group != 0) { return cmp_group; } + + // VPointer con + jint a_con = a->vpointer().mem_pointer().con().value(); + jint b_con = b->vpointer().mem_pointer().con().value(); + int c_con = cmp_code(a_con, b_con); + if (c_con != 0) { return c_con; } + + return cmp_code(a->original_index(), b->original_index()); +} + // Find the "seed" memops pairs. These are pairs that we strongly suspect would lead to vectorization. void SuperWord::create_adjacent_memop_pairs() { ResourceMark rm; - GrowableArray vpointers; - - collect_valid_vpointers(vpointers); - - // Sort the VPointers. This does 2 things: - // - Separate the VPointer into groups: all memops that have the same opcode and the same - // VPointer, except for the offset. Adjacent memops must have the same opcode and the - // same VPointer, except for a shift in the offset. Thus, two memops can only be adjacent - // if they are in the same group. This decreases the work. - // - Sort by offset inside the groups. This decreases the work needed to determine adjacent - // memops inside a group. - vpointers.sort(VPointer::cmp_for_sort); + GrowableArray memops; + + collect_valid_memops(memops); + + // Sort the MemOps by group, and inside a group by VPointer con: + // - Group: all memops with the same opcode, and the same VPointer summands. Adjacent memops + // have the same opcode and the same VPointer summands, only the VPointer con is + // different. Thus, two memops can only be adjacent if they are in the same group. + // This decreases the work. + // - VPointer con: Sorting by VPointer con inside the group allows us to perform a sliding + // window algorithm, to determine adjacent memops efficiently. + // Since GrowableArray::sort relies on qsort, the sort is not stable on its own. This can lead + // to worse packing in some cases. To make the sort stable, our last cmp criterion is the + // original index, i.e. the position in the memops array before sorting. + memops.sort(MemOp::cmp_by_group_and_con_and_original_index); #ifndef PRODUCT if (is_trace_superword_adjacent_memops()) { @@ -499,7 +547,7 @@ void SuperWord::create_adjacent_memop_pairs() { } #endif - create_adjacent_memop_pairs_in_all_groups(vpointers); + create_adjacent_memop_pairs_in_all_groups(memops); #ifndef PRODUCT if (is_trace_superword_packset()) { @@ -509,35 +557,36 @@ void SuperWord::create_adjacent_memop_pairs() { #endif } -// Collect all memops vpointers that could potentially be vectorized. -void SuperWord::collect_valid_vpointers(GrowableArray& vpointers) { - for_each_mem([&] (const MemNode* mem, int bb_idx) { +// Collect all memops that could potentially be vectorized. +void SuperWord::collect_valid_memops(GrowableArray& memops) const { + int original_index = 0; + for_each_mem([&] (MemNode* mem, int bb_idx) { const VPointer& p = vpointer(mem); - if (p.valid() && + if (p.is_valid() && !mem->is_LoadStore() && is_java_primitive(mem->memory_type())) { - vpointers.append(&p); + memops.append(MemOp(mem, &p, original_index++)); } }); } // For each group, find the adjacent memops. -void SuperWord::create_adjacent_memop_pairs_in_all_groups(const GrowableArray &vpointers) { +void SuperWord::create_adjacent_memop_pairs_in_all_groups(const GrowableArray& memops) { int group_start = 0; - while (group_start < vpointers.length()) { - int group_end = find_group_end(vpointers, group_start); - create_adjacent_memop_pairs_in_one_group(vpointers, group_start, group_end); + while (group_start < memops.length()) { + int group_end = find_group_end(memops, group_start); + create_adjacent_memop_pairs_in_one_group(memops, group_start, group_end); group_start = group_end; } } -// Step forward until we find a VPointer of another group, or we reach the end of the array. -int SuperWord::find_group_end(const GrowableArray& vpointers, int group_start) { +// Step forward until we find a MemOp of another group, or we reach the end of the array. +int SuperWord::find_group_end(const GrowableArray& memops, int group_start) { int group_end = group_start + 1; - while (group_end < vpointers.length() && - VPointer::cmp_for_sort_by_group( - vpointers.adr_at(group_start), - vpointers.adr_at(group_end) + while (group_end < memops.length() && + MemOp::cmp_by_group( + memops.adr_at(group_start), + memops.adr_at(group_end) ) == 0) { group_end++; } @@ -546,39 +595,41 @@ int SuperWord::find_group_end(const GrowableArray& vpointers, i // Find adjacent memops for a single group, e.g. for all LoadI of the same base, invar, etc. // Create pairs and add them to the pairset. -void SuperWord::create_adjacent_memop_pairs_in_one_group(const GrowableArray& vpointers, const int group_start, const int group_end) { +void SuperWord::create_adjacent_memop_pairs_in_one_group(const GrowableArray& memops, const int group_start, const int group_end) { #ifndef PRODUCT if (is_trace_superword_adjacent_memops()) { tty->print_cr(" group:"); for (int i = group_start; i < group_end; i++) { - const VPointer* p = vpointers.at(i); + const MemOp& memop = memops.at(i); + tty->print(" "); + memop.mem()->dump(); tty->print(" "); - p->print(); + memop.vpointer().print_on(tty); } } #endif - MemNode* first = vpointers.at(group_start)->mem(); - int element_size = data_size(first); + MemNode* first = memops.at(group_start).mem(); + const int element_size = data_size(first); // For each ref in group: find others that can be paired: for (int i = group_start; i < group_end; i++) { - const VPointer* p1 = vpointers.at(i); - MemNode* mem1 = p1->mem(); + const VPointer& p1 = memops.at(i).vpointer(); + MemNode* mem1 = memops.at(i).mem(); bool found = false; // For each ref in group with larger or equal offset: for (int j = i + 1; j < group_end; j++) { - const VPointer* p2 = vpointers.at(j); - MemNode* mem2 = p2->mem(); + const VPointer& p2 = memops.at(j).vpointer(); + MemNode* mem2 = memops.at(j).mem(); assert(mem1 != mem2, "look only at pair of different memops"); // Check for correct distance. assert(data_size(mem1) == element_size, "all nodes in group must have the same element size"); assert(data_size(mem2) == element_size, "all nodes in group must have the same element size"); - assert(p1->offset_in_bytes() <= p2->offset_in_bytes(), "must be sorted by offset"); - if (p1->offset_in_bytes() + element_size > p2->offset_in_bytes()) { continue; } - if (p1->offset_in_bytes() + element_size < p2->offset_in_bytes()) { break; } + assert(p1.con() <= p2.con(), "must be sorted by offset"); + if (p1.con() + element_size > p2.con()) { continue; } + if (p1.con() + element_size < p2.con()) { break; } // Only allow nodes from same origin idx to be packed (see CompileCommand Option Vectorize) if (_do_vector_loop && !same_origin_idx(mem1, mem2)) { continue; } @@ -593,9 +644,9 @@ void SuperWord::create_adjacent_memop_pairs_in_one_group(const GrowableArrayprint_cr(" pair:"); } tty->print(" "); - p1->print(); + p1.print_on(tty); tty->print(" "); - p2->print(); + p2.print_on(tty); } #endif @@ -723,13 +774,9 @@ bool SuperWord::are_adjacent_refs(Node* s1, Node* s2) const { return false; } - // Adjacent memory references must have the same base, be comparable - // and have the correct distance between them. const VPointer& p1 = vpointer(s1->as_Mem()); const VPointer& p2 = vpointer(s2->as_Mem()); - 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); + return p1.is_adjacent_to_and_before(p2); } //------------------------------isomorphic--------------------------- @@ -1432,13 +1479,9 @@ const AlignmentSolution* SuperWord::pack_alignment_solution(const Node_List* pac 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(), + AlignmentSolver solver(mem_ref_p, + pack->at(0)->as_Mem(), pack->size(), - mem_ref_p.base(), - mem_ref_p.offset_in_bytes(), - mem_ref_p.invar(), - mem_ref_p.invar_factor(), - mem_ref_p.scale_in_bytes(), pre_end->init_trip(), pre_end->stride_con(), iv_stride() @@ -2611,10 +2654,9 @@ void VTransform::determine_mem_ref_and_aw_for_main_loop_alignment() { const GrowableArray& vtnodes = _graph.vtnodes(); for (int i = 0; i < vtnodes.length(); i++) { - VTransformVectorNode* vtn = vtnodes.at(i)->isa_Vector(); + VTransformMemVectorNode* vtn = vtnodes.at(i)->isa_MemVector(); if (vtn == nullptr) { continue; } - MemNode* p0 = vtn->nodes().at(0)->isa_Mem(); - if (p0 == nullptr) { continue; } + MemNode* p0 = vtn->nodes().at(0)->as_Mem(); int vw = p0->memory_size() * vtn->nodes().length(); if (vw > max_aw) { @@ -2660,8 +2702,8 @@ void VTransform::adjust_pre_loop_limit_to_align_main_loop_vectors() { Node* orig_limit = pre_opaq->original_loop_limit(); assert(orig_limit != nullptr && igvn().type(orig_limit) != Type::TOP, ""); - const VPointer& align_to_ref_p = vpointer(align_to_ref); - assert(align_to_ref_p.valid(), "sanity"); + const VPointer& p = vpointer(align_to_ref); + assert(p.is_valid(), "sanity"); // For the main-loop, we want the address of align_to_ref to be memory aligned // with some alignment width (aw, a power of 2). When we enter the main-loop, @@ -2669,7 +2711,7 @@ void VTransform::adjust_pre_loop_limit_to_align_main_loop_vectors() { // limit by executing adjust_pre_iter many extra iterations, we can change the // alignment of the address. // - // adr = base + offset + invar + scale * iv (1) + // adr = base + invar + iv_scale * iv + con (1) // adr % aw = 0 (2) // // Note, that we are defining the modulo operator "%" such that the remainder is @@ -2686,55 +2728,55 @@ void VTransform::adjust_pre_loop_limit_to_align_main_loop_vectors() { // We want to find adjust_pre_iter, such that the address is aligned when entering // the main-loop: // - // iv = new_limit = old_limit + adjust_pre_iter (3a, stride > 0) - // iv = new_limit = old_limit - adjust_pre_iter (3b, stride < 0) + // iv = new_limit = old_limit + adjust_pre_iter (3a, iv_stride > 0) + // iv = new_limit = old_limit - adjust_pre_iter (3b, iv_stride < 0) // - // We define boi as: + // We define bic as: // - // boi = base + offset + invar (4) + // bic = base + invar + con (4) // // And now we can simplify the address using (1), (3), and (4): // - // adr = boi + scale * new_limit - // adr = boi + scale * (old_limit + adjust_pre_iter) (5a, stride > 0) - // adr = boi + scale * (old_limit - adjust_pre_iter) (5b, stride < 0) + // adr = bic + iv_scale * new_limit + // adr = bic + iv_scale * (old_limit + adjust_pre_iter) (5a, iv_stride > 0) + // adr = bic + iv_scale * (old_limit - adjust_pre_iter) (5b, iv_stride < 0) // // And hence we can restate (2) with (5), and solve the equation for adjust_pre_iter: // - // (boi + scale * (old_limit + adjust_pre_iter) % aw = 0 (6a, stride > 0) - // (boi + scale * (old_limit - adjust_pre_iter) % aw = 0 (6b, stride < 0) + // (bic + iv_scale * (old_limit + adjust_pre_iter) % aw = 0 (6a, iv_stride > 0) + // (bic + iv_scale * (old_limit - adjust_pre_iter) % aw = 0 (6b, iv_stride < 0) // - // In most cases, scale is the element size, for example: + // In most cases, iv_scale is the element size, for example: // // for (i = 0; i < a.length; i++) { a[i] = ...; } // - // It is thus reasonable to assume that both abs(scale) and abs(stride) are + // It is thus reasonable to assume that both abs(iv_scale) and abs(iv_stride) are // strictly positive powers of 2. Further, they can be assumed to be non-zero, // otherwise the address does not depend on iv, and the alignment cannot be // affected by adjusting the pre-loop limit. // - // Further, if abs(scale) >= aw, then adjust_pre_iter has no effect on alignment, and - // we are not able to affect the alignment at all. Hence, we require abs(scale) < aw. + // Further, if abs(iv_scale) >= aw, then adjust_pre_iter has no effect on alignment, and + // we are not able to affect the alignment at all. Hence, we require abs(iv_scale) < aw. // - // Moreover, for alignment to be achievable, boi must be a multiple of scale. If strict + // Moreover, for alignment to be achievable, bic must be a multiple of iv_scale. If strict // alignment is required (i.e. -XX:+AlignVector), this is guaranteed by the filtering // done with the AlignmentSolver / AlignmentSolution. If strict alignment is not // required, then alignment is still preferable for performance, but not necessary. - // In many cases boi will be a multiple of scale, but if it is not, then the adjustment + // In many cases bic will be a multiple of iv_scale, but if it is not, then the adjustment // does not guarantee alignment, but the code is still correct. // - // Hence, in what follows we assume that boi is a multiple of scale, and in fact all - // terms in (6) are multiples of scale. Therefore we divide all terms by scale: + // Hence, in what follows we assume that bic is a multiple of iv_scale, and in fact all + // terms in (6) are multiples of iv_scale. Therefore we divide all terms by iv_scale: // - // AW = aw / abs(scale) (power of 2) (7) - // BOI = boi / abs(scale) (8) + // AW = aw / abs(iv_scale) (power of 2) (7) + // BIC = bic / abs(iv_scale) (8) // - // and restate (6), using (7) and (8), i.e. we divide (6) by abs(scale): + // and restate (6), using (7) and (8), i.e. we divide (6) by abs(iv_scale): // - // (BOI + sign(scale) * (old_limit + adjust_pre_iter) % AW = 0 (9a, stride > 0) - // (BOI + sign(scale) * (old_limit - adjust_pre_iter) % AW = 0 (9b, stride < 0) + // (BIC + sign(iv_scale) * (old_limit + adjust_pre_iter) % AW = 0 (9a, iv_stride > 0) + // (BIC + sign(iv_scale) * (old_limit - adjust_pre_iter) % AW = 0 (9b, iv_stride < 0) // - // where: sign(scale) = scale / abs(scale) = (scale > 0 ? 1 : -1) + // where: sign(iv_scale) = iv_scale / abs(iv_scale) = (iv_scale > 0 ? 1 : -1) // // Note, (9) allows for periodic solutions of adjust_pre_iter, with periodicity AW. // But we would like to spend as few iterations in the pre-loop as possible, @@ -2744,40 +2786,40 @@ void VTransform::adjust_pre_loop_limit_to_align_main_loop_vectors() { // // We solve (9) for adjust_pre_iter, in the following 4 cases: // - // Case A: scale > 0 && stride > 0 (i.e. sign(scale) = 1) - // (BOI + old_limit + adjust_pre_iter) % AW = 0 - // adjust_pre_iter = (-BOI - old_limit) % AW (11a) + // Case A: iv_scale > 0 && iv_stride > 0 (i.e. sign(iv_scale) = 1) + // (BIC + old_limit + adjust_pre_iter) % AW = 0 + // adjust_pre_iter = (-BIC - old_limit) % AW (11a) // - // Case B: scale < 0 && stride > 0 (i.e. sign(scale) = -1) - // (BOI - old_limit - adjust_pre_iter) % AW = 0 - // adjust_pre_iter = (BOI - old_limit) % AW (11b) + // Case B: iv_scale < 0 && iv_stride > 0 (i.e. sign(iv_scale) = -1) + // (BIC - old_limit - adjust_pre_iter) % AW = 0 + // adjust_pre_iter = (BIC - old_limit) % AW (11b) // - // Case C: scale > 0 && stride < 0 (i.e. sign(scale) = 1) - // (BOI + old_limit - adjust_pre_iter) % AW = 0 - // adjust_pre_iter = (BOI + old_limit) % AW (11c) + // Case C: iv_scale > 0 && iv_stride < 0 (i.e. sign(iv_scale) = 1) + // (BIC + old_limit - adjust_pre_iter) % AW = 0 + // adjust_pre_iter = (BIC + old_limit) % AW (11c) // - // Case D: scale < 0 && stride < 0 (i.e. sign(scale) = -1) - // (BOI - old_limit + adjust_pre_iter) % AW = 0 - // adjust_pre_iter = (-BOI + old_limit) % AW (11d) + // Case D: iv_scale < 0 && iv_stride < 0 (i.e. sign(iv_scale) = -1) + // (BIC - old_limit + adjust_pre_iter) % AW = 0 + // adjust_pre_iter = (-BIC + old_limit) % AW (11d) // // We now generalize the equations (11*) by using: // - // OP: (stride > 0) ? SUB : ADD - // XBOI: (stride * scale > 0) ? -BOI : BOI + // OP: (iv_stride > 0) ? SUB : ADD + // XBIC: (iv_stride * iv_scale > 0) ? -BIC : BIC // // which gives us the final pre-loop limit adjustment: // - // adjust_pre_iter = (XBOI OP old_limit) % AW (12) + // adjust_pre_iter = (XBIC OP old_limit) % AW (12) // - // We can construct XBOI by additionally defining: + // We can construct XBIC by additionally defining: // - // xboi = (stride * scale > 0) ? -boi : boi (13) + // xbic = (iv_stride * iv_scale > 0) ? -bic : bic (13) // // which gives us: // - // XBOI = (stride * scale > 0) ? -BOI : BOI - // = (stride * scale > 0) ? -boi / abs(scale) : boi / abs(scale) - // = xboi / abs(scale) (14) + // XBIC = (iv_stride * iv_scale > 0) ? -BIC : BIC + // = (iv_stride * iv_scale > 0) ? -bic / abs(iv_scale) : bic / abs(iv_scale) + // = xbic / abs(iv_scale) (14) // // When we have computed adjust_pre_iter, we update the pre-loop limit // with (3a, b). However, we have to make sure that the adjust_pre_iter @@ -2786,32 +2828,37 @@ void VTransform::adjust_pre_loop_limit_to_align_main_loop_vectors() { // the loop. Hence, we must constrain the updated limit as follows: // // constrained_limit = MIN(old_limit + adjust_pre_iter, orig_limit) - // = MIN(new_limit, orig_limit) (15a, stride > 0) + // = MIN(new_limit, orig_limit) (15a, iv_stride > 0) // constrained_limit = MAX(old_limit - adjust_pre_iter, orig_limit) - // = MAX(new_limit, orig_limit) (15a, stride < 0) + // = MAX(new_limit, orig_limit) (15a, iv_stride < 0) // - const int stride = iv_stride(); - const int scale = align_to_ref_p.scale_in_bytes(); - const int offset = align_to_ref_p.offset_in_bytes(); - Node* base = align_to_ref_p.adr(); - Node* invar = align_to_ref_p.invar(); + const int iv_stride = this->iv_stride(); + const int iv_scale = p.iv_scale(); + const int con = p.con(); + Node* base = p.mem_pointer().base().object_or_native(); #ifdef ASSERT if (_trace._align_vector) { tty->print_cr("\nVTransform::adjust_pre_loop_limit_to_align_main_loop_vectors:"); tty->print(" align_to_ref:"); align_to_ref->dump(); - tty->print_cr(" aw: %d", aw); - tty->print_cr(" stride: %d", stride); - tty->print_cr(" scale: %d", scale); - tty->print_cr(" offset: %d", offset); + tty->print(" "); + p.print_on(tty); + tty->print_cr(" aw: %d", aw); + tty->print_cr(" iv_stride: %d", iv_stride); + tty->print_cr(" iv_scale: %d", iv_scale); + tty->print_cr(" con: %d", con); tty->print(" base:"); base->dump(); - if (invar == nullptr) { - tty->print_cr(" invar: null"); + if (!p.has_invar_summands()) { + tty->print_cr(" invar: none"); } else { - tty->print(" invar:"); - invar->dump(); + tty->print_cr(" invar_summands:"); + p.for_each_invar_summand([&] (const MemPointerSummand& s) { + tty->print(" -> "); + s.print_on(tty); + }); + tty->cr(); } tty->print(" old_limit: "); old_limit->dump(); @@ -2820,111 +2867,131 @@ void VTransform::adjust_pre_loop_limit_to_align_main_loop_vectors() { } #endif - if (stride == 0 || !is_power_of_2(abs(stride)) || - scale == 0 || !is_power_of_2(abs(scale)) || - abs(scale) >= aw) { + if (iv_stride == 0 || !is_power_of_2(abs(iv_stride)) || + iv_scale == 0 || !is_power_of_2(abs(iv_scale)) || + abs(iv_scale) >= aw) { #ifdef ASSERT if (_trace._align_vector) { tty->print_cr(" Alignment cannot be affected by changing pre-loop limit because"); - tty->print_cr(" stride or scale are not power of 2, or abs(scale) >= aw."); + tty->print_cr(" iv_stride or iv_scale are not power of 2, or abs(iv_scale) >= aw."); } #endif // Cannot affect alignment, abort. return; } - assert(stride != 0 && is_power_of_2(abs(stride)) && - scale != 0 && is_power_of_2(abs(scale)) && - abs(scale) < aw, "otherwise we cannot affect alignment with pre-loop"); + assert(iv_stride != 0 && is_power_of_2(abs(iv_stride)) && + iv_scale != 0 && is_power_of_2(abs(iv_scale)) && + abs(iv_scale) < aw, "otherwise we cannot affect alignment with pre-loop"); - const int AW = aw / abs(scale); + const int AW = aw / abs(iv_scale); #ifdef ASSERT if (_trace._align_vector) { - tty->print_cr(" AW = aw(%d) / abs(scale(%d)) = %d", aw, scale, AW); + tty->print_cr(" AW = aw(%d) / abs(iv_scale(%d)) = %d", aw, iv_scale, AW); } #endif // 1: Compute (13a, b): - // xboi = -boi = (-base - offset - invar) (stride * scale > 0) - // xboi = +boi = (+base + offset + invar) (stride * scale < 0) - const bool is_sub = scale * stride > 0; - - // 1.1: offset - Node* xboi = igvn().intcon(is_sub ? -offset : offset); - TRACE_ALIGN_VECTOR_NODE(xboi); - - // 1.2: invar (if it exists) - if (invar != nullptr) { - if (igvn().type(invar)->isa_long()) { + // xbic = -bic = (-base - invar - con) (iv_stride * iv_scale > 0) + // xbic = +bic = (+base + invar + con) (iv_stride * iv_scale < 0) + const bool is_sub = iv_scale * iv_stride > 0; + + // 1.1: con + Node* xbic = igvn().intcon(is_sub ? -con : con); + TRACE_ALIGN_VECTOR_NODE(xbic); + + // 1.2: invar = SUM(invar_summands) + // We iteratively add / subtract all invar_summands, if there are any. + p.for_each_invar_summand([&] (const MemPointerSummand& s) { + Node* invar_variable = s.variable(); + jint invar_scale = s.scale().value(); + if (igvn().type(invar_variable)->isa_long()) { // Computations are done % (vector width/element size) so it's // safe to simply convert invar to an int and loose the upper 32 // bit half. - invar = new ConvL2INode(invar); - phase()->register_new_node(invar, pre_ctrl); - TRACE_ALIGN_VECTOR_NODE(invar); - } + invar_variable = new ConvL2INode(invar_variable); + phase()->register_new_node(invar_variable, pre_ctrl); + TRACE_ALIGN_VECTOR_NODE(invar_variable); + } + Node* invar_scale_con = igvn().intcon(invar_scale); + Node* invar_summand = new MulINode(invar_variable, invar_scale_con); + phase()->register_new_node(invar_summand, pre_ctrl); + TRACE_ALIGN_VECTOR_NODE(invar_summand); if (is_sub) { - xboi = new SubINode(xboi, invar); + xbic = new SubINode(xbic, invar_summand); } else { - xboi = new AddINode(xboi, invar); + xbic = new AddINode(xbic, invar_summand); } - phase()->register_new_node(xboi, pre_ctrl); - TRACE_ALIGN_VECTOR_NODE(xboi); - } + phase()->register_new_node(xbic, pre_ctrl); + TRACE_ALIGN_VECTOR_NODE(xbic); + }); // 1.3: base (unless base is guaranteed aw aligned) - if (aw > ObjectAlignmentInBytes || align_to_ref_p.base()->is_top()) { - // The base is only aligned with ObjectAlignmentInBytes with arrays. - // When the base() is top, we have no alignment guarantee at all. - // Hence, we must now take the base into account for the calculation. - Node* xbase = new CastP2XNode(nullptr, base); - phase()->register_new_node(xbase, pre_ctrl); - TRACE_ALIGN_VECTOR_NODE(xbase); -#ifdef _LP64 - xbase = new ConvL2INode(xbase); - phase()->register_new_node(xbase, pre_ctrl); - TRACE_ALIGN_VECTOR_NODE(xbase); -#endif + bool is_base_native = p.mem_pointer().base().is_native(); + if (aw > ObjectAlignmentInBytes || is_base_native) { + // For objects, the base is ObjectAlignmentInBytes aligned. + // For native memory, we simply have a long that was cast to + // a pointer via CastX2P, or if we parsed through the CastX2P + // we only have a long. There is no alignment guarantee, and + // we must always take the base into account for the calculation. + // + // Computations are done % (vector width/element size) so it's + // safe to simply convert invar to an int and loose the upper 32 + // bit half. The base could be ptr, long or int. We cast all + // to int. + Node* xbase = base; + if (igvn().type(xbase)->isa_ptr()) { + // ptr -> int/long + xbase = new CastP2XNode(nullptr, xbase); + phase()->register_new_node(xbase, pre_ctrl); + TRACE_ALIGN_VECTOR_NODE(xbase); + } + if (igvn().type(xbase)->isa_long()) { + // long -> int + xbase = new ConvL2INode(xbase); + phase()->register_new_node(xbase, pre_ctrl); + TRACE_ALIGN_VECTOR_NODE(xbase); + } if (is_sub) { - xboi = new SubINode(xboi, xbase); + xbic = new SubINode(xbic, xbase); } else { - xboi = new AddINode(xboi, xbase); + xbic = new AddINode(xbic, xbase); } - phase()->register_new_node(xboi, pre_ctrl); - TRACE_ALIGN_VECTOR_NODE(xboi); + phase()->register_new_node(xbic, pre_ctrl); + TRACE_ALIGN_VECTOR_NODE(xbic); } // 2: Compute (14): - // XBOI = xboi / abs(scale) + // XBIC = xbic / abs(iv_scale) // The division is executed as shift - Node* log2_abs_scale = igvn().intcon(exact_log2(abs(scale))); - Node* XBOI = new URShiftINode(xboi, log2_abs_scale); - phase()->register_new_node(XBOI, pre_ctrl); - TRACE_ALIGN_VECTOR_NODE(log2_abs_scale); - TRACE_ALIGN_VECTOR_NODE(XBOI); + Node* log2_abs_iv_scale = igvn().intcon(exact_log2(abs(iv_scale))); + Node* XBIC = new URShiftINode(xbic, log2_abs_iv_scale); + phase()->register_new_node(XBIC, pre_ctrl); + TRACE_ALIGN_VECTOR_NODE(log2_abs_iv_scale); + TRACE_ALIGN_VECTOR_NODE(XBIC); // 3: Compute (12): - // adjust_pre_iter = (XBOI OP old_limit) % AW + // adjust_pre_iter = (XBIC OP old_limit) % AW // - // 3.1: XBOI_OP_old_limit = XBOI OP old_limit - Node* XBOI_OP_old_limit = nullptr; - if (stride > 0) { - XBOI_OP_old_limit = new SubINode(XBOI, old_limit); + // 3.1: XBIC_OP_old_limit = XBIC OP old_limit + Node* XBIC_OP_old_limit = nullptr; + if (iv_stride > 0) { + XBIC_OP_old_limit = new SubINode(XBIC, old_limit); } else { - XBOI_OP_old_limit = new AddINode(XBOI, old_limit); + XBIC_OP_old_limit = new AddINode(XBIC, old_limit); } - phase()->register_new_node(XBOI_OP_old_limit, pre_ctrl); - TRACE_ALIGN_VECTOR_NODE(XBOI_OP_old_limit); + phase()->register_new_node(XBIC_OP_old_limit, pre_ctrl); + TRACE_ALIGN_VECTOR_NODE(XBIC_OP_old_limit); // 3.2: Compute: - // adjust_pre_iter = (XBOI OP old_limit) % AW - // = XBOI_OP_old_limit % AW - // = XBOI_OP_old_limit AND (AW - 1) + // adjust_pre_iter = (XBIC OP old_limit) % AW + // = XBIC_OP_old_limit % AW + // = XBIC_OP_old_limit AND (AW - 1) // Since AW is a power of 2, the modulo operation can be replaced with // a bitmask operation. Node* mask_AW = igvn().intcon(AW-1); - Node* adjust_pre_iter = new AndINode(XBOI_OP_old_limit, mask_AW); + Node* adjust_pre_iter = new AndINode(XBIC_OP_old_limit, mask_AW); phase()->register_new_node(adjust_pre_iter, pre_ctrl); TRACE_ALIGN_VECTOR_NODE(mask_AW); TRACE_ALIGN_VECTOR_NODE(adjust_pre_iter); @@ -2937,8 +3004,8 @@ void VTransform::adjust_pre_loop_limit_to_align_main_loop_vectors() { // range, and adjusts the main-loop limit so that we exit the main-loop // before we leave the "safe" range. After RCE, the range of the main-loop // can only be safely narrowed, and should never be widened. Hence, the - // pre-loop limit can only be increased (for stride > 0), but an add - // overflow might decrease it, or decreased (for stride < 0), but a sub + // pre-loop limit can only be increased (for iv_stride > 0), but an add + // overflow might decrease it, or decreased (for iv_stride < 0), but a sub // underflow might increase it. To prevent that, we perform the Sub / Add // and Max / Min with long operations. old_limit = new ConvI2LNode(old_limit); @@ -2952,11 +3019,11 @@ void VTransform::adjust_pre_loop_limit_to_align_main_loop_vectors() { TRACE_ALIGN_VECTOR_NODE(adjust_pre_iter); // 5: Compute (3a, b): - // new_limit = old_limit + adjust_pre_iter (stride > 0) - // new_limit = old_limit - adjust_pre_iter (stride < 0) + // new_limit = old_limit + adjust_pre_iter (iv_stride > 0) + // new_limit = old_limit - adjust_pre_iter (iv_stride < 0) // Node* new_limit = nullptr; - if (stride < 0) { + if (iv_stride < 0) { new_limit = new SubLNode(old_limit, adjust_pre_iter); } else { new_limit = new AddLNode(old_limit, adjust_pre_iter); @@ -2967,8 +3034,8 @@ void VTransform::adjust_pre_loop_limit_to_align_main_loop_vectors() { // 6: Compute (15a, b): // Prevent pre-loop from going past the original limit of the loop. Node* constrained_limit = - (stride > 0) ? (Node*) new MinLNode(phase()->C, new_limit, orig_limit) - : (Node*) new MaxLNode(phase()->C, new_limit, orig_limit); + (iv_stride > 0) ? (Node*) new MinLNode(phase()->C, new_limit, orig_limit) + : (Node*) new MaxLNode(phase()->C, new_limit, orig_limit); phase()->register_new_node(constrained_limit, pre_ctrl); TRACE_ALIGN_VECTOR_NODE(constrained_limit); diff --git a/src/hotspot/share/opto/superword.hpp b/src/hotspot/share/opto/superword.hpp index 8b24e0cf3a11a..57a403b449843 100644 --- a/src/hotspot/share/opto/superword.hpp +++ b/src/hotspot/share/opto/superword.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -56,8 +56,6 @@ // first statement is considered the left element, and the // second statement is considered the right element. -class VPointer; - // The PairSet is a set of pairs. These are later combined to packs, // and stored in the PackSet. class PairSet : public StackObj { @@ -474,7 +472,7 @@ class SuperWord : public ResourceObj { return _vloop_analyzer.types().same_velt_type(n1, n2); } - int data_size(Node* n) const { + int data_size(const Node* n) const { return _vloop_analyzer.types().data_size(n); } @@ -563,11 +561,43 @@ class SuperWord : public ResourceObj { bool SLP_extract(); // Find the "seed" memops pairs. These are pairs that we strongly suspect would lead to vectorization. + class MemOp : public StackObj { + private: + MemNode* _mem; + const VPointer* _vpointer; + int _original_index; + + public: + // Empty, for GrowableArray + MemOp() : + _mem(nullptr), + _vpointer(nullptr), + _original_index(-1) {} + MemOp(MemNode* mem, const VPointer* vpointer, int original_index) : + _mem(mem), + _vpointer(vpointer), + _original_index(original_index) {} + + MemNode* mem() const { return _mem; } + const VPointer& vpointer() const { return *_vpointer; } + int original_index() const { return _original_index; } + + static int cmp_by_group(MemOp* a, MemOp* b); + static int cmp_by_group_and_con_and_original_index(MemOp* a, MemOp* b); + + // We use two comparisons, because a subtraction could underflow. + template + static int cmp_code(T a, T b) { + if (a < b) { return -1; } + if (a > b) { return 1; } + return 0; + } + }; void create_adjacent_memop_pairs(); - void collect_valid_vpointers(GrowableArray& vpointers); - void create_adjacent_memop_pairs_in_all_groups(const GrowableArray& vpointers); - static int find_group_end(const GrowableArray& vpointers, int group_start); - void create_adjacent_memop_pairs_in_one_group(const GrowableArray& vpointers, const int group_start, int group_end); + void collect_valid_memops(GrowableArray& memops) const; + void create_adjacent_memop_pairs_in_all_groups(const GrowableArray& memops); + static int find_group_end(const GrowableArray& memops, int group_start); + void create_adjacent_memop_pairs_in_one_group(const GrowableArray& memops, const int group_start, int group_end); // Various methods to check if we can pack two nodes. bool can_pack_into_pair(Node* s1, Node* s2); diff --git a/src/hotspot/share/opto/superwordVTransformBuilder.cpp b/src/hotspot/share/opto/superwordVTransformBuilder.cpp index 2e32ce28d3ccb..aee6add2a98ef 100644 --- a/src/hotspot/share/opto/superwordVTransformBuilder.cpp +++ b/src/hotspot/share/opto/superwordVTransformBuilder.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "opto/superwordVTransformBuilder.hpp" #include "opto/vectornode.hpp" @@ -139,9 +138,13 @@ VTransformVectorNode* SuperWordVTransformBuilder::make_vector_vtnode_for_pack(co VTransformVectorNode* vtn = nullptr; if (p0->is_Load()) { - vtn = new (_vtransform.arena()) VTransformLoadVectorNode(_vtransform, pack_size); + const VPointer& scalar_p = _vloop_analyzer.vpointers().vpointer(p0->as_Load()); + const VPointer vector_p(scalar_p.make_with_size(scalar_p.size() * pack_size)); + vtn = new (_vtransform.arena()) VTransformLoadVectorNode(_vtransform, pack_size, vector_p); } else if (p0->is_Store()) { - vtn = new (_vtransform.arena()) VTransformStoreVectorNode(_vtransform, pack_size); + const VPointer& scalar_p = _vloop_analyzer.vpointers().vpointer(p0->as_Store()); + const VPointer vector_p(scalar_p.make_with_size(scalar_p.size() * pack_size)); + vtn = new (_vtransform.arena()) VTransformStoreVectorNode(_vtransform, pack_size, vector_p); } else if (p0->is_Bool()) { VTransformBoolTest kind = _packset.get_bool_test(pack); vtn = new (_vtransform.arena()) VTransformBoolVectorNode(_vtransform, pack_size, kind); @@ -311,4 +314,3 @@ void SuperWordVTransformBuilder::add_dependencies_of_node_to_vtnode(Node*n, VTra vtn->add_dependency(dependency); // Add every dependency only once per vtn. } } - diff --git a/src/hotspot/share/opto/traceAutoVectorizationTag.hpp b/src/hotspot/share/opto/traceAutoVectorizationTag.hpp index 038e04fe0c50b..0c08777c90c4b 100644 --- a/src/hotspot/share/opto/traceAutoVectorizationTag.hpp +++ b/src/hotspot/share/opto/traceAutoVectorizationTag.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,10 @@ #include "utilities/stringUtils.hpp" #define COMPILER_TRACE_AUTO_VECTORIZATION_TAG(flags) \ - flags(POINTER_ANALYSIS, "Trace VPointer (verbose)") \ + flags(POINTER_PARSING, "Trace VPointer/MemPointer parsing") \ + flags(POINTER_ALIASING, "Trace VPointer/MemPointer aliasing") \ + flags(POINTER_ADJACENCY, "Trace VPointer/MemPointer adjacency") \ + flags(POINTER_OVERLAP, "Trace VPointer/MemPointer overlap") \ flags(PRECONDITIONS, "Trace VLoop::check_preconditions") \ flags(LOOP_ANALYZER, "Trace VLoopAnalyzer::setup_submodules") \ flags(MEMORY_SLICES, "Trace VLoopMemorySlices") \ diff --git a/src/hotspot/share/opto/traceMergeStoresTag.hpp b/src/hotspot/share/opto/traceMergeStoresTag.hpp index 9f33c9efa0525..214173c02f7dd 100644 --- a/src/hotspot/share/opto/traceMergeStoresTag.hpp +++ b/src/hotspot/share/opto/traceMergeStoresTag.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * 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,9 +31,9 @@ namespace TraceMergeStores { #define COMPILER_TAG(flags) \ flags(BASIC, "Trace basic analysis steps") \ - flags(POINTER, "Trace pointer IR") \ - flags(ALIASING, "Trace MemPointerSimpleForm::get_aliasing_with") \ - flags(ADJACENCY, "Trace adjacency") \ + flags(POINTER_PARSING, "Trace pointer IR") \ + flags(POINTER_ALIASING, "Trace MemPointerSimpleForm::get_aliasing_with") \ + flags(POINTER_ADJACENCY, "Trace adjacency") \ flags(SUCCESS, "Trace successful merges") \ #define table_entry(name, description) name, diff --git a/src/hotspot/share/opto/type.cpp b/src/hotspot/share/opto/type.cpp index 407a4a20a9bda..364654ec42fd5 100644 --- a/src/hotspot/share/opto/type.cpp +++ b/src/hotspot/share/opto/type.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciMethodData.hpp" #include "ci/ciTypeFlow.hpp" #include "classfile/javaClasses.hpp" @@ -35,9 +34,12 @@ #include "oops/instanceMirrorKlass.hpp" #include "oops/objArrayKlass.hpp" #include "oops/typeArrayKlass.hpp" +#include "opto/callnode.hpp" +#include "opto/arraycopynode.hpp" #include "opto/matcher.hpp" #include "opto/node.hpp" #include "opto/opcodes.hpp" +#include "opto/runtime.hpp" #include "opto/type.hpp" #include "utilities/checkedCast.hpp" #include "utilities/powerOfTwo.hpp" @@ -582,6 +584,7 @@ void Type::Initialize_shared(Compile* current) { TypeAryPtr::_array_interfaces = TypeInterfaces::make(&array_interfaces); TypeAryKlassPtr::_array_interfaces = TypeAryPtr::_array_interfaces; + TypeAryPtr::BOTTOM = TypeAryPtr::make(TypePtr::BotPTR, TypeAry::make(Type::BOTTOM, TypeInt::POS), nullptr, false, Type::OffsetBot); TypeAryPtr::RANGE = TypeAryPtr::make( TypePtr::BotPTR, TypeAry::make(Type::BOTTOM,TypeInt::POS), nullptr /* current->env()->Object_klass() */, false, arrayOopDesc::length_offset_in_bytes()); TypeAryPtr::NARROWOOPS = TypeAryPtr::make(TypePtr::BotPTR, TypeAry::make(TypeNarrowOop::BOTTOM, TypeInt::POS), nullptr /*ciArrayKlass::make(o)*/, false, Type::OffsetBot); @@ -710,6 +713,10 @@ void Type::Initialize_shared(Compile* current) { mreg2type[Op_VecY] = TypeVect::VECTY; mreg2type[Op_VecZ] = TypeVect::VECTZ; + LockNode::initialize_lock_Type(); + ArrayCopyNode::initialize_arraycopy_Type(); + OptoRuntime::initialize_types(); + // Restore working type arena. current->set_type_arena(save); current->set_type_dict(nullptr); @@ -4682,16 +4689,17 @@ bool TypeAryKlassPtr::is_meet_subtype_of_helper(const TypeKlassPtr *other, bool //============================================================================= // Convenience common pre-built types. -const TypeAryPtr *TypeAryPtr::RANGE; -const TypeAryPtr *TypeAryPtr::OOPS; -const TypeAryPtr *TypeAryPtr::NARROWOOPS; -const TypeAryPtr *TypeAryPtr::BYTES; -const TypeAryPtr *TypeAryPtr::SHORTS; -const TypeAryPtr *TypeAryPtr::CHARS; -const TypeAryPtr *TypeAryPtr::INTS; -const TypeAryPtr *TypeAryPtr::LONGS; -const TypeAryPtr *TypeAryPtr::FLOATS; -const TypeAryPtr *TypeAryPtr::DOUBLES; +const TypeAryPtr* TypeAryPtr::BOTTOM; +const TypeAryPtr* TypeAryPtr::RANGE; +const TypeAryPtr* TypeAryPtr::OOPS; +const TypeAryPtr* TypeAryPtr::NARROWOOPS; +const TypeAryPtr* TypeAryPtr::BYTES; +const TypeAryPtr* TypeAryPtr::SHORTS; +const TypeAryPtr* TypeAryPtr::CHARS; +const TypeAryPtr* TypeAryPtr::INTS; +const TypeAryPtr* TypeAryPtr::LONGS; +const TypeAryPtr* TypeAryPtr::FLOATS; +const TypeAryPtr* TypeAryPtr::DOUBLES; //------------------------------make------------------------------------------- const TypeAryPtr *TypeAryPtr::make(PTR ptr, const TypeAry *ary, ciKlass* k, bool xk, int offset, diff --git a/src/hotspot/share/opto/type.hpp b/src/hotspot/share/opto/type.hpp index 2dd702b686b0a..4b540345d2766 100644 --- a/src/hotspot/share/opto/type.hpp +++ b/src/hotspot/share/opto/type.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1473,16 +1473,17 @@ class TypeAryPtr : public TypeOopPtr { virtual const TypeKlassPtr* as_klass_type(bool try_for_exact = false) const; // Convenience common pre-built types. - static const TypeAryPtr *RANGE; - static const TypeAryPtr *OOPS; - static const TypeAryPtr *NARROWOOPS; - static const TypeAryPtr *BYTES; - static const TypeAryPtr *SHORTS; - static const TypeAryPtr *CHARS; - static const TypeAryPtr *INTS; - static const TypeAryPtr *LONGS; - static const TypeAryPtr *FLOATS; - static const TypeAryPtr *DOUBLES; + static const TypeAryPtr* BOTTOM; + static const TypeAryPtr* RANGE; + static const TypeAryPtr* OOPS; + static const TypeAryPtr* NARROWOOPS; + static const TypeAryPtr* BYTES; + static const TypeAryPtr* SHORTS; + static const TypeAryPtr* CHARS; + static const TypeAryPtr* INTS; + static const TypeAryPtr* LONGS; + static const TypeAryPtr* FLOATS; + static const TypeAryPtr* DOUBLES; // selects one of the above: static const TypeAryPtr *get_array_body_type(BasicType elem) { assert((uint)elem <= T_CONFLICT && _array_body_type[elem] != nullptr, "bad elem type"); diff --git a/src/hotspot/share/opto/vector.cpp b/src/hotspot/share/opto/vector.cpp index 73f9b9e74ba78..a0121819978be 100644 --- a/src/hotspot/share/opto/vector.cpp +++ b/src/hotspot/share/opto/vector.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciSymbols.hpp" #include "gc/shared/barrierSet.hpp" #include "opto/castnode.hpp" diff --git a/src/hotspot/share/opto/vectorIntrinsics.cpp b/src/hotspot/share/opto/vectorIntrinsics.cpp index 51b320c8047e7..e33d7b1968682 100644 --- a/src/hotspot/share/opto/vectorIntrinsics.cpp +++ b/src/hotspot/share/opto/vectorIntrinsics.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciSymbols.hpp" #include "classfile/vmSymbols.hpp" #include "opto/library_call.hpp" diff --git a/src/hotspot/share/opto/vectorization.cpp b/src/hotspot/share/opto/vectorization.cpp index e7b0a149cd81c..ffc2314a59b1d 100644 --- a/src/hotspot/share/opto/vectorization.cpp +++ b/src/hotspot/share/opto/vectorization.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2023, Arm Limited. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -22,7 +22,6 @@ * questions. */ -#include "precompiled.hpp" #include "opto/addnode.hpp" #include "opto/connode.hpp" #include "opto/convertnode.hpp" @@ -30,19 +29,6 @@ #include "opto/rootnode.hpp" #include "opto/vectorization.hpp" -#ifndef PRODUCT -void VPointer::print_con_or_idx(const Node* n) { - if (n == nullptr) { - tty->print("( 0)"); - } else if (n->is_ConI()) { - jint val = n->as_ConI()->get_int(); - tty->print("(%4d)", val); - } else { - tty->print("[%4d]", n->_idx); - } -} -#endif - bool VLoop::check_preconditions() { #ifndef PRODUCT if (is_trace_preconditions()) { @@ -224,7 +210,7 @@ void VLoopVPointers::print() const { _body.for_each_mem([&] (const MemNode* mem, int bb_idx) { const VPointer& p = vpointer(mem); tty->print(" "); - p.print(); + p.print_on(tty); }); } #endif @@ -265,7 +251,7 @@ void VLoopDependencyGraph::construct() { if (n1->is_Load() && n2->is_Load()) { continue; } const VPointer& p2 = _vpointers.vpointer(n2); - if (!VPointer::not_equal(p1.cmp(p2))) { + if (!p1.never_overlaps_with(p2)) { // Possibly overlapping memory memory_pred_edges.append(_body.bb_idx(n2)); } @@ -406,1257 +392,39 @@ void VLoopDependencyGraph::PredsIterator::next() { } #ifndef PRODUCT -int VPointer::Tracer::_depth = 0; -#endif - -VPointer::VPointer(MemNode* const mem, const VLoop& vloop, - Node_Stack* nstack, bool analyze_only) : - _mem(mem), _vloop(vloop), - _base(nullptr), _adr(nullptr), _scale(0), _offset(0), _invar(nullptr), -#ifdef ASSERT - _debug_invar(nullptr), _debug_negate_invar(false), _debug_invar_scale(nullptr), -#endif - _has_int_index_after_convI2L(false), - _int_index_after_convI2L_offset(0), - _int_index_after_convI2L_invar(nullptr), - _int_index_after_convI2L_scale(0), - _nstack(nstack), _analyze_only(analyze_only), _stack_idx(0) -#ifndef PRODUCT - , _tracer(vloop.is_trace_pointer_analysis()) -#endif -{ - NOT_PRODUCT(_tracer.ctor_1(mem);) - - Node* adr = mem->in(MemNode::Address); - if (!adr->is_AddP()) { - assert(!valid(), "too complex"); - return; - } - // Match AddP(base, AddP(ptr, k*iv [+ invariant]), constant) - Node* base = adr->in(AddPNode::Base); - // The base address should be loop invariant - if (is_loop_member(base)) { - assert(!valid(), "base address is loop variant"); - return; - } - // unsafe references require misaligned vector access support - if (base->is_top() && !Matcher::misaligned_vectors_ok()) { - assert(!valid(), "unsafe access"); - return; - } - - NOT_PRODUCT(if(_tracer._is_trace_alignment) _tracer.store_depth();) - NOT_PRODUCT(_tracer.ctor_2(adr);) - - int i; - for (i = 0; ; i++) { - NOT_PRODUCT(_tracer.ctor_3(adr, i);) - - if (!scaled_iv_plus_offset(adr->in(AddPNode::Offset))) { - assert(!valid(), "too complex"); - return; - } - adr = adr->in(AddPNode::Address); - NOT_PRODUCT(_tracer.ctor_4(adr, i);) - - if (base == adr || !adr->is_AddP()) { - NOT_PRODUCT(_tracer.ctor_5(adr, base, i);) - break; // stop looking at addp's - } - } - if (!invariant(adr)) { - // The address must be invariant for the current loop. But if we are in a main-loop, - // it must also be invariant of the pre-loop, otherwise we cannot use this address - // for the pre-loop limit adjustment required for main-loop alignment. - assert(!valid(), "adr is loop variant"); - return; - } - - if (!base->is_top() && adr != base) { - assert(!valid(), "adr and base differ"); - return; - } - - NOT_PRODUCT(if(_tracer._is_trace_alignment) _tracer.restore_depth();) - NOT_PRODUCT(_tracer.ctor_6(mem);) - - // In the pointer analysis, and especially the AlignVector, analysis we assume that - // stride and scale are not too large. For example, we multiply "scale * stride", - // and assume that this does not overflow the int range. We also take "abs(scale)" - // and "abs(stride)", which would overflow for min_int = -(2^31). Still, we want - // to at least allow small and moderately large stride and scale. Therefore, we - // allow values up to 2^30, which is only a factor 2 smaller than the max/min int. - // Normal performance relevant code will have much lower values. And the restriction - // allows us to keep the rest of the autovectorization code much simpler, since we - // do not have to deal with overflows. - jlong long_scale = _scale; - jlong long_stride = _vloop.iv_stride(); - jlong max_val = 1 << 30; - if (abs(long_scale) >= max_val || - abs(long_stride) >= max_val || - abs(long_scale * long_stride) >= max_val) { - assert(!valid(), "adr stride*scale is too large"); - return; - } - - if (!is_safe_to_use_as_simple_form(base, adr)) { - assert(!valid(), "does not have simple form"); - return; - } - - _base = base; - _adr = adr; - assert(valid(), "Usable"); -} - -// Following is used to create a temporary object during -// the pattern match of an address expression. -VPointer::VPointer(VPointer* p) : - _mem(p->_mem), _vloop(p->_vloop), - _base(nullptr), _adr(nullptr), _scale(0), _offset(0), _invar(nullptr), -#ifdef ASSERT - _debug_invar(nullptr), _debug_negate_invar(false), _debug_invar_scale(nullptr), -#endif - _has_int_index_after_convI2L(false), - _int_index_after_convI2L_offset(0), - _int_index_after_convI2L_invar(nullptr), - _int_index_after_convI2L_scale(0), - _nstack(p->_nstack), _analyze_only(p->_analyze_only), _stack_idx(p->_stack_idx) -#ifndef PRODUCT - , _tracer(p->_tracer._is_trace_alignment) -#endif -{} - -// Biggest detectable factor of the invariant. -int VPointer::invar_factor() const { - Node* n = invar(); - if (n == nullptr) { - return 0; - } - int opc = n->Opcode(); - if (opc == Op_LShiftI && n->in(2)->is_Con()) { - return 1 << n->in(2)->get_int(); - } else if (opc == Op_LShiftL && n->in(2)->is_Con()) { - return 1 << n->in(2)->get_int(); - } - // All our best-effort has failed. - return 1; -} - -// We would like to make decisions about aliasing (i.e. removing memory edges) and adjacency -// (i.e. which loads/stores can be packed) based on the simple form: -// -// s_pointer = adr + offset + invar + scale * ConvI2L(iv) -// -// However, we parse the compound-long-int form: -// -// c_pointer = adr + long_offset + long_invar + long_scale * ConvI2L(int_index) -// int_index = int_offset + int_invar + int_scale * iv -// -// In general, the simple and the compound-long-int form do not always compute the same pointer -// at runtime. For example, the simple form would give a different result due to an overflow -// in the int_index. -// -// Example: -// For both forms, we have: -// iv = 0 -// scale = 1 -// -// We now account the offset and invar once to the long part and once to the int part: -// Pointer 1 (long offset and long invar): -// long_offset = min_int -// long_invar = min_int -// int_offset = 0 -// int_invar = 0 -// -// Pointer 2 (int offset and int invar): -// long_offset = 0 -// long_invar = 0 -// int_offset = min_int -// int_invar = min_int -// -// This gives us the following pointers: -// Compound-long-int form pointers: -// Form: -// c_pointer = adr + long_offset + long_invar + long_scale * ConvI2L(int_offset + int_invar + int_scale * iv) -// -// Pointers: -// c_pointer1 = adr + min_int + min_int + 1 * ConvI2L(0 + 0 + 1 * 0) -// = adr + min_int + min_int -// = adr - 2^32 -// -// c_pointer2 = adr + 0 + 0 + 1 * ConvI2L(min_int + min_int + 1 * 0) -// = adr + ConvI2L(min_int + min_int) -// = adr + 0 -// = adr -// -// Simple form pointers: -// Form: -// s_pointer = adr + offset + invar + scale * ConvI2L(iv) -// s_pointer = adr + (long_offset + int_offset) + (long_invar + int_invar) + (long_scale * int_scale) * ConvI2L(iv) -// -// Pointers: -// s_pointer1 = adr + (min_int + 0 ) + (min_int + 0 ) + 1 * 0 -// = adr + min_int + min_int -// = adr - 2^32 -// s_pointer2 = adr + (0 + min_int ) + (0 + min_int ) + 1 * 0 -// = adr + min_int + min_int -// = adr - 2^32 -// -// We see that the two addresses are actually 2^32 bytes apart (derived from the c_pointers), but their simple form look identical. -// -// Hence, we need to determine in which cases it is safe to make decisions based on the simple -// form, rather than the compound-long-int form. If we cannot prove that using the simple form -// is safe (i.e. equivalent to the compound-long-int form), then we do not get a valid VPointer, -// and the associated memop cannot be vectorized. -bool VPointer::is_safe_to_use_as_simple_form(Node* base, Node* adr) const { -#ifndef _LP64 - // On 32-bit platforms, there is never an explicit int_index with ConvI2L for the iv. Thus, the - // parsed pointer form is always the simple form, with int operations: - // - // pointer = adr + offset + invar + scale * iv - // - assert(!_has_int_index_after_convI2L, "32-bit never has an int_index with ConvI2L for the iv"); - return true; -#else - - // Array accesses that are not Unsafe always have a RangeCheck which ensures that there is no - // int_index overflow. This implies that the conversion to long can be done separately: - // - // ConvI2L(int_index) = ConvI2L(int_offset) + ConvI2L(int_invar) + ConvI2L(scale) * ConvI2L(iv) - // - // And hence, the simple form is guaranteed to be identical to the compound-long-int form at - // runtime and the VPointer is safe/valid to be used. - const TypeAryPtr* ary_ptr_t = _mem->adr_type()->isa_aryptr(); - if (ary_ptr_t != nullptr) { - if (!_mem->is_unsafe_access()) { - return true; - } - } - - // We did not find the int_index. Just to be safe, reject this VPointer. - if (!_has_int_index_after_convI2L) { - return false; - } - - int int_offset = _int_index_after_convI2L_offset; - Node* int_invar = _int_index_after_convI2L_invar; - int int_scale = _int_index_after_convI2L_scale; - int long_scale = _scale / int_scale; - - // If "int_index = iv", then the simple form is identical to the compound-long-int form. - // - // int_index = int_offset + int_invar + int_scale * iv - // = 0 0 1 * iv - // = iv - if (int_offset == 0 && int_invar == nullptr && int_scale == 1) { - return true; - } - - // Intuition: What happens if the int_index overflows? Let us look at two pointers on the "overflow edge": - // - // pointer1 = adr + ConvI2L(int_index1) - // pointer2 = adr + ConvI2L(int_index2) - // - // int_index1 = max_int + 0 = max_int -> very close to but before the overflow - // int_index2 = max_int + 1 = min_int -> just enough to get the overflow - // - // When looking at the difference of pointer1 and pointer2, we notice that it is very large - // (almost 2^32). Since arrays have at most 2^31 elements, chances are high that pointer2 is - // an actual out-of-bounds access at runtime. These would normally be prevented by range checks - // at runtime. However, if the access was done by using Unsafe, where range checks are omitted, - // then an out-of-bounds access constitutes undefined behavior. This means that we are allowed to - // do anything, including changing the behavior. - // - // If we can set the right conditions, we have a guarantee that an overflow is either impossible - // (no overflow or range checks preventing that) or undefined behavior. In both cases, we are - // safe to do a vectorization. - // - // Approach: We want to prove a lower bound for the distance between these two pointers, and an - // upper bound for the size of a memory object. We can derive such an upper bound for - // arrays. We know they have at most 2^31 elements. If we know the size of the elements - // in bytes, we have: - // - // array_element_size_in_bytes * 2^31 >= max_possible_array_size_in_bytes - // >= array_size_in_bytes (ARR) - // - // If some small difference "delta" leads to an int_index overflow, we know that the - // int_index1 before overflow must have been close to max_int, and the int_index2 after - // the overflow must be close to min_int: - // - // pointer1 = adr + long_offset + long_invar + long_scale * ConvI2L(int_index1) - // =approx adr + long_offset + long_invar + long_scale * max_int - // - // pointer2 = adr + long_offset + long_invar + long_scale * ConvI2L(int_index2) - // =approx adr + long_offset + long_invar + long_scale * min_int - // - // We realize that the pointer difference is very large: - // - // difference =approx long_scale * 2^32 - // - // Hence, if we set the right condition for long_scale and array_element_size_in_bytes, - // we can prove that an overflow is impossible (or would imply undefined behaviour). - // - // We must now take this intuition, and develop a rigorous proof. We start by stating the problem - // more precisely, with the help of some definitions and the Statement we are going to prove. - // - // Definition: - // Two VPointers are "comparable" (i.e. VPointer::comparable is true, set with VPointer::cmp()), - // iff all of these conditions apply for the simple form: - // 1) Both VPointers are valid. - // 2) The adr are identical, or both are array bases of different arrays. - // 3) They have identical scale. - // 4) They have identical invar. - // 5) The difference in offsets is limited: abs(offset1 - offset2) < 2^31. (DIFF) - // - // For the Vectorization Optimization, we pair-wise compare VPointers and determine if they are: - // 1) "not comparable": - // We do not optimize them (assume they alias, not assume adjacency). - // - // Whenever we chose this option based on the simple form, it is also correct based on the - // compound-long-int form, since we make no optimizations based on it. - // - // 2) "comparable" with different array bases at runtime: - // We assume they do not alias (remove memory edges), but not assume adjacency. - // - // Whenever we have two different array bases for the simple form, we also have different - // array bases for the compound-long-form. Since VPointers provably point to different - // memory objects, they can never alias. - // - // 3) "comparable" with the same base address: - // We compute the relative pointer difference, and based on the load/store size we can - // compute aliasing and adjacency. - // - // We must find a condition under which the pointer difference of the simple form is - // identical to the pointer difference of the compound-long-form. We do this with the - // Statement below, which we then proceed to prove. - // - // Statement: - // If two VPointers satisfy these 3 conditions: - // 1) They are "comparable". - // 2) They have the same base address. - // 3) Their long_scale is a multiple of the array element size in bytes: - // - // abs(long_scale) % array_element_size_in_bytes = 0 (A) - // - // Then their pointer difference of the simple form is identical to the pointer difference - // of the compound-long-int form. - // - // More precisely: - // Such two VPointers by definition have identical adr, invar, and scale. - // Their simple form is: - // - // s_pointer1 = adr + offset1 + invar + scale * ConvI2L(iv) (B1) - // s_pointer2 = adr + offset2 + invar + scale * ConvI2L(iv) (B2) - // - // Thus, the pointer difference of the simple forms collapses to the difference in offsets: - // - // s_difference = s_pointer1 - s_pointer2 = offset1 - offset2 (C) - // - // Their compound-long-int form for these VPointer is: - // - // c_pointer1 = adr + long_offset1 + long_invar1 + long_scale1 * ConvI2L(int_index1) (D1) - // int_index1 = int_offset1 + int_invar1 + int_scale1 * iv (D2) - // - // c_pointer2 = adr + long_offset2 + long_invar2 + long_scale2 * ConvI2L(int_index2) (D3) - // int_index2 = int_offset2 + int_invar2 + int_scale2 * iv (D4) - // - // And these are the offset1, offset2, invar and scale from the simple form (B1) and (B2): - // - // offset1 = long_offset1 + long_scale1 * ConvI2L(int_offset1) (D5) - // offset2 = long_offset2 + long_scale2 * ConvI2L(int_offset2) (D6) - // - // invar = long_invar1 + long_scale1 * ConvI2L(int_invar1) - // = long_invar2 + long_scale2 * ConvI2L(int_invar2) (D7) - // - // scale = long_scale1 * ConvI2L(int_scale1) - // = long_scale2 * ConvI2L(int_scale2) (D8) - // - // The pointer difference of the compound-long-int form is defined as: - // - // c_difference = c_pointer1 - c_pointer2 - // - // Thus, the statement claims that for the two VPointer we have: - // - // s_difference = c_difference (Statement) - // - // We prove the Statement with the help of a Lemma: - // - // Lemma: - // There is some integer x, such that: - // - // c_difference = s_difference + array_element_size_in_bytes * x * 2^32 (Lemma) - // - // From condition (DIFF), we can derive: - // - // abs(s_difference) < 2^31 (E) - // - // Assuming the Lemma, we prove the Statement: - // If "x = 0" (intuitively: the int_index does not overflow), then: - // c_difference = s_difference - // and hence the simple form computes the same pointer difference as the compound-long-int form. - // If "x != 0" (intuitively: the int_index overflows), then: - // abs(c_difference) >= abs(s_difference + array_element_size_in_bytes * x * 2^32) - // >= array_element_size_in_bytes * 2^32 - abs(s_difference) - // -- apply (E) -- - // > array_element_size_in_bytes * 2^32 - 2^31 - // >= array_element_size_in_bytes * 2^31 - // -- apply (ARR) -- - // >= max_possible_array_size_in_bytes - // >= array_size_in_bytes - // - // This shows that c_pointer1 and c_pointer2 have a distance that exceeds the maximum array size. - // Thus, at least one of the two pointers must be outside of the array bounds. But we can assume - // that out-of-bounds accesses do not happen. If they still do, it is undefined behavior. Hence, - // we are allowed to do anything. We can also "safely" use the simple form in this case even though - // it might not match the compound-long-int form at runtime. - // QED Statement. - // - // We must now prove the Lemma. - // - // ConvI2L always truncates by some power of 2^32, i.e. there is some integer y such that: - // - // ConvI2L(y1 + y2) = ConvI2L(y1) + ConvI2L(y2) + 2^32 * y (F) - // - // It follows, that there is an integer y1 such that: - // - // ConvI2L(int_index1) = ConvI2L(int_offset1 + int_invar1 + int_scale1 * iv) - // -- apply (F) -- - // = ConvI2L(int_offset1) - // + ConvI2L(int_invar1) - // + ConvI2L(int_scale1) * ConvI2L(iv) - // + y1 * 2^32 (G) - // - // Thus, we can write the compound-long-int form (D1) as: - // - // c_pointer1 = adr + long_offset1 + long_invar1 + long_scale1 * ConvI2L(int_index1) - // -- apply (G) -- - // = adr - // + long_offset1 - // + long_invar1 - // + long_scale1 * ConvI2L(int_offset1) - // + long_scale1 * ConvI2L(int_invar1) - // + long_scale1 * ConvI2L(int_scale1) * ConvI2L(iv) - // + long_scale1 * y1 * 2^32 (H) - // - // And we can write the simple form as: - // - // s_pointer1 = adr + offset1 + invar + scale * ConvI2L(iv) - // -- apply (D5, D7, D8) -- - // = adr - // + long_offset1 - // + long_scale1 * ConvI2L(int_offset1) - // + long_invar1 - // + long_scale1 * ConvI2L(int_invar1) - // + long_scale1 * ConvI2L(int_scale1) * ConvI2L(iv) (K) - // - // We now compute the pointer difference between the simple (K) and compound-long-int form (H). - // Most terms cancel out immediately: - // - // sc_difference1 = c_pointer1 - s_pointer1 = long_scale1 * y1 * 2^32 (L) - // - // Rearranging the equation (L), we get: - // - // c_pointer1 = s_pointer1 + long_scale1 * y1 * 2^32 (M) - // - // And since long_scale1 is a multiple of array_element_size_in_bytes, there is some integer - // x1, such that (M) implies: - // - // c_pointer1 = s_pointer1 + array_element_size_in_bytes * x1 * 2^32 (N) - // - // With an analogue equation for c_pointer2, we can now compute the pointer difference for - // the compound-long-int form: - // - // c_difference = c_pointer1 - c_pointer2 - // -- apply (N) -- - // = s_pointer1 + array_element_size_in_bytes * x1 * 2^32 - // -(s_pointer2 + array_element_size_in_bytes * x2 * 2^32) - // -- where "x = x1 - x2" -- - // = s_pointer1 - s_pointer2 + array_element_size_in_bytes * x * 2^32 - // -- apply (C) -- - // = s_difference + array_element_size_in_bytes * x * 2^32 - // QED Lemma. - if (ary_ptr_t != nullptr) { - BasicType array_element_bt = ary_ptr_t->elem()->array_element_basic_type(); - if (is_java_primitive(array_element_bt)) { - int array_element_size_in_bytes = type2aelembytes(array_element_bt); - if (abs(long_scale) % array_element_size_in_bytes == 0) { - return true; - } - } - } - - // General case: we do not know if it is safe to use the simple form. - return false; -#endif -} - -bool VPointer::is_loop_member(Node* n) const { - Node* n_c = phase()->get_ctrl(n); - return lpt()->is_member(phase()->get_loop(n_c)); -} - -bool VPointer::invariant(Node* n) const { - NOT_PRODUCT(Tracer::Depth dd;) - bool is_not_member = !is_loop_member(n); - if (is_not_member) { - CountedLoopNode* cl = lpt()->_head->as_CountedLoop(); - if (cl->is_main_loop()) { - // Check that n_c dominates the pre loop head node. If it does not, then - // we cannot use n as invariant for the pre loop CountedLoopEndNode check - // because n_c is either part of the pre loop or between the pre and the - // 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 is_not_member; -} - -// Match: k*iv + offset -// where: k is a constant that maybe zero, and -// offset is (k2 [+/- invariant]) where k2 maybe zero and invariant is optional -bool VPointer::scaled_iv_plus_offset(Node* n) { - NOT_PRODUCT(Tracer::Depth ddd;) - NOT_PRODUCT(_tracer.scaled_iv_plus_offset_1(n);) - - if (scaled_iv(n)) { - NOT_PRODUCT(_tracer.scaled_iv_plus_offset_2(n);) - return true; - } - - if (offset_plus_k(n)) { - NOT_PRODUCT(_tracer.scaled_iv_plus_offset_3(n);) - return true; - } - - int opc = n->Opcode(); - if (opc == Op_AddI) { - if (offset_plus_k(n->in(2)) && scaled_iv_plus_offset(n->in(1))) { - NOT_PRODUCT(_tracer.scaled_iv_plus_offset_4(n);) - return true; - } - if (offset_plus_k(n->in(1)) && scaled_iv_plus_offset(n->in(2))) { - NOT_PRODUCT(_tracer.scaled_iv_plus_offset_5(n);) - return true; - } - } else if (opc == Op_SubI || opc == Op_SubL) { - if (offset_plus_k(n->in(2), true) && scaled_iv_plus_offset(n->in(1))) { - // (offset1 + invar1 + scale * iv) - (offset2 + invar2) - // Subtraction handled via "negate" flag of "offset_plus_k". - NOT_PRODUCT(_tracer.scaled_iv_plus_offset_6(n);) - return true; - } - VPointer tmp(this); - if (offset_plus_k(n->in(1)) && tmp.scaled_iv_plus_offset(n->in(2))) { - // (offset1 + invar1) - (offset2 + invar2 + scale * iv) - // Subtraction handled explicitly below. - assert(_scale == 0, "shouldn't be set yet"); - // _scale = -tmp._scale - if (!try_MulI_no_overflow(-1, tmp._scale, _scale)) { - return false; // mul overflow. - } - // _offset -= tmp._offset - if (!try_SubI_no_overflow(_offset, tmp._offset, _offset)) { - return false; // sub overflow. - } - // _invar -= tmp._invar - if (tmp._invar != nullptr) { - maybe_add_to_invar(tmp._invar, true); -#ifdef ASSERT - _debug_invar_scale = tmp._debug_invar_scale; - _debug_negate_invar = !tmp._debug_negate_invar; -#endif - } - - // Forward info about the int_index: - assert(!_has_int_index_after_convI2L, "no previous int_index discovered"); - _has_int_index_after_convI2L = tmp._has_int_index_after_convI2L; - _int_index_after_convI2L_offset = tmp._int_index_after_convI2L_offset; - _int_index_after_convI2L_invar = tmp._int_index_after_convI2L_invar; - _int_index_after_convI2L_scale = tmp._int_index_after_convI2L_scale; - - NOT_PRODUCT(_tracer.scaled_iv_plus_offset_7(n);) - return true; - } - } - - NOT_PRODUCT(_tracer.scaled_iv_plus_offset_8(n);) - return false; -} - -// Match: k*iv where k is a constant that's not zero -bool VPointer::scaled_iv(Node* n) { - NOT_PRODUCT(Tracer::Depth ddd;) - NOT_PRODUCT(_tracer.scaled_iv_1(n);) - - if (_scale != 0) { // already found a scale - NOT_PRODUCT(_tracer.scaled_iv_2(n, _scale);) - return false; - } - - if (n == iv()) { - _scale = 1; - NOT_PRODUCT(_tracer.scaled_iv_3(n, _scale);) - return true; - } - if (_analyze_only && (is_loop_member(n))) { - _nstack->push(n, _stack_idx++); - } - - int opc = n->Opcode(); - if (opc == Op_MulI) { - if (n->in(1) == iv() && n->in(2)->is_Con()) { - _scale = n->in(2)->get_int(); - NOT_PRODUCT(_tracer.scaled_iv_4(n, _scale);) - return true; - } else if (n->in(2) == iv() && n->in(1)->is_Con()) { - _scale = n->in(1)->get_int(); - NOT_PRODUCT(_tracer.scaled_iv_5(n, _scale);) - return true; - } - } else if (opc == Op_LShiftI) { - if (n->in(1) == iv() && n->in(2)->is_Con()) { - if (!try_LShiftI_no_overflow(1, n->in(2)->get_int(), _scale)) { - return false; // shift overflow. - } - NOT_PRODUCT(_tracer.scaled_iv_6(n, _scale);) - return true; - } - } else if (opc == Op_ConvI2L && !has_iv()) { - // So far we have not found the iv yet, and are about to enter a ConvI2L subgraph, - // which may be the int index (that might overflow) for the memory access, of the form: - // - // int_index = int_offset + int_invar + int_scale * iv - // - // If we simply continue parsing with the current VPointer, then the int_offset and - // int_invar simply get added to the long offset and invar. But for the checks in - // VPointer::is_safe_to_use_as_simple_form() we need to have explicit access to the - // int_index. Thus, we must parse it explicitly here. For this, we use a temporary - // VPointer, to pattern match the int_index sub-expression of the address. - - NOT_PRODUCT(Tracer::Depth dddd;) - VPointer tmp(this); - NOT_PRODUCT(_tracer.scaled_iv_8(n, &tmp);) - - if (tmp.scaled_iv_plus_offset(n->in(1)) && tmp.has_iv()) { - // We successfully matched an integer index, of the form: - // int_index = int_offset + int_invar + int_scale * iv - // Forward scale. - assert(_scale == 0 && tmp._scale != 0, "iv only found just now"); - _scale = tmp._scale; - // Accumulate offset. - if (!try_AddI_no_overflow(_offset, tmp._offset, _offset)) { - return false; // add overflow. - } - // Accumulate invar. - if (tmp._invar != nullptr) { - maybe_add_to_invar(tmp._invar, false); - } - // Set info about the int_index: - assert(!_has_int_index_after_convI2L, "no previous int_index discovered"); - _has_int_index_after_convI2L = true; - _int_index_after_convI2L_offset = tmp._offset; - _int_index_after_convI2L_invar = tmp._invar; - _int_index_after_convI2L_scale = tmp._scale; - - NOT_PRODUCT(_tracer.scaled_iv_7(n);) - return true; - } - } else if (opc == Op_ConvI2L || opc == Op_CastII) { - if (scaled_iv_plus_offset(n->in(1))) { - NOT_PRODUCT(_tracer.scaled_iv_7(n);) - return true; - } - } else if (opc == Op_LShiftL && n->in(2)->is_Con()) { - if (!has_iv()) { - // Need to preserve the current _offset value, so - // create a temporary object for this expression subtree. - // Hacky, so should re-engineer the address pattern match. - NOT_PRODUCT(Tracer::Depth dddd;) - VPointer tmp(this); - NOT_PRODUCT(_tracer.scaled_iv_8(n, &tmp);) - - if (tmp.scaled_iv_plus_offset(n->in(1))) { - int shift = n->in(2)->get_int(); - // Accumulate scale. - if (!try_LShiftI_no_overflow(tmp._scale, shift, _scale)) { - return false; // shift overflow. - } - // Accumulate offset. - int shifted_offset = 0; - if (!try_LShiftI_no_overflow(tmp._offset, shift, shifted_offset)) { - return false; // shift overflow. - } - if (!try_AddI_no_overflow(_offset, shifted_offset, _offset)) { - return false; // add overflow. - } - // Accumulate invar. - if (tmp._invar != nullptr) { - BasicType bt = tmp._invar->bottom_type()->basic_type(); - assert(bt == T_INT || bt == T_LONG, ""); - maybe_add_to_invar(register_if_new(LShiftNode::make(tmp._invar, n->in(2), bt)), false); -#ifdef ASSERT - _debug_invar_scale = n->in(2); -#endif - } - - // Forward info about the int_index: - assert(!_has_int_index_after_convI2L, "no previous int_index discovered"); - _has_int_index_after_convI2L = tmp._has_int_index_after_convI2L; - _int_index_after_convI2L_offset = tmp._int_index_after_convI2L_offset; - _int_index_after_convI2L_invar = tmp._int_index_after_convI2L_invar; - _int_index_after_convI2L_scale = tmp._int_index_after_convI2L_scale; - - NOT_PRODUCT(_tracer.scaled_iv_9(n, _scale, _offset, _invar);) - return true; - } - } - } - NOT_PRODUCT(_tracer.scaled_iv_10(n);) - return false; -} - -// Match: offset is (k [+/- invariant]) -// where k maybe zero and invariant is optional, but not both. -bool VPointer::offset_plus_k(Node* n, bool negate) { - NOT_PRODUCT(Tracer::Depth ddd;) - NOT_PRODUCT(_tracer.offset_plus_k_1(n);) - - int opc = n->Opcode(); - if (opc == Op_ConI) { - if (!try_AddSubI_no_overflow(_offset, n->get_int(), negate, _offset)) { - return false; // add/sub overflow. - } - NOT_PRODUCT(_tracer.offset_plus_k_2(n, _offset);) - return true; - } else if (opc == Op_ConL) { - // Okay if value fits into an int - const TypeLong* t = n->find_long_type(); - if (t->higher_equal(TypeLong::INT)) { - jlong loff = n->get_long(); - jint off = (jint)loff; - if (!try_AddSubI_no_overflow(_offset, off, negate, _offset)) { - return false; // add/sub overflow. - } - NOT_PRODUCT(_tracer.offset_plus_k_3(n, _offset);) - return true; - } - NOT_PRODUCT(_tracer.offset_plus_k_4(n);) - return false; - } - assert((_debug_invar == nullptr) == (_invar == nullptr), ""); - - if (_analyze_only && is_loop_member(n)) { - _nstack->push(n, _stack_idx++); - } - if (opc == Op_AddI) { - if (n->in(2)->is_Con() && invariant(n->in(1))) { - maybe_add_to_invar(n->in(1), negate); - if (!try_AddSubI_no_overflow(_offset, n->in(2)->get_int(), negate, _offset)) { - return false; // add/sub overflow. - } - NOT_PRODUCT(_tracer.offset_plus_k_6(n, _invar, negate, _offset);) - return true; - } else if (n->in(1)->is_Con() && invariant(n->in(2))) { - if (!try_AddSubI_no_overflow(_offset, n->in(1)->get_int(), negate, _offset)) { - return false; // add/sub overflow. - } - maybe_add_to_invar(n->in(2), negate); - NOT_PRODUCT(_tracer.offset_plus_k_7(n, _invar, negate, _offset);) - return true; - } - } - if (opc == Op_SubI) { - if (n->in(2)->is_Con() && invariant(n->in(1))) { - maybe_add_to_invar(n->in(1), negate); - if (!try_AddSubI_no_overflow(_offset, n->in(2)->get_int(), !negate, _offset)) { - return false; // add/sub overflow. - } - NOT_PRODUCT(_tracer.offset_plus_k_8(n, _invar, negate, _offset);) - return true; - } else if (n->in(1)->is_Con() && invariant(n->in(2))) { - if (!try_AddSubI_no_overflow(_offset, n->in(1)->get_int(), negate, _offset)) { - return false; // add/sub overflow. - } - maybe_add_to_invar(n->in(2), !negate); - NOT_PRODUCT(_tracer.offset_plus_k_9(n, _invar, !negate, _offset);) - return true; - } - } - - if (!is_loop_member(n)) { - // 'n' is loop invariant. Skip ConvI2L and CastII nodes before checking if 'n' is dominating the pre loop. - if (opc == Op_ConvI2L) { - n = n->in(1); - } - if (n->Opcode() == Op_CastII) { - // Skip CastII nodes - assert(!is_loop_member(n), "sanity"); - n = n->in(1); - } - // Check if 'n' can really be used as invariant (not in main loop and dominating the pre loop). - if (invariant(n)) { - maybe_add_to_invar(n, negate); - NOT_PRODUCT(_tracer.offset_plus_k_10(n, _invar, negate, _offset);) - return true; - } - } - - NOT_PRODUCT(_tracer.offset_plus_k_11(n);) - return false; -} - -Node* VPointer::maybe_negate_invar(bool negate, Node* invar) { -#ifdef ASSERT - _debug_negate_invar = negate; -#endif - if (negate) { - BasicType bt = invar->bottom_type()->basic_type(); - assert(bt == T_INT || bt == T_LONG, ""); - Node* zero = phase()->zerocon(bt); - Node* sub = SubNode::make(zero, invar, bt); - invar = register_if_new(sub); - } - return invar; -} - -Node* VPointer::register_if_new(Node* n) const { - PhaseIterGVN& igvn = phase()->igvn(); - Node* prev = igvn.hash_find_insert(n); - if (prev != nullptr) { - n->destruct(&igvn); - n = prev; - } else { - Node* c = phase()->get_early_ctrl(n); - phase()->register_new_node(n, c); - } - return n; -} - -void VPointer::maybe_add_to_invar(Node* new_invar, bool negate) { - new_invar = maybe_negate_invar(negate, new_invar); - if (_invar == nullptr) { - _invar = new_invar; -#ifdef ASSERT - _debug_invar = new_invar; -#endif - return; - } -#ifdef ASSERT - _debug_invar = NodeSentinel; -#endif - BasicType new_invar_bt = new_invar->bottom_type()->basic_type(); - assert(new_invar_bt == T_INT || new_invar_bt == T_LONG, ""); - BasicType invar_bt = _invar->bottom_type()->basic_type(); - assert(invar_bt == T_INT || invar_bt == T_LONG, ""); - - BasicType bt = (new_invar_bt == T_LONG || invar_bt == T_LONG) ? T_LONG : T_INT; - Node* current_invar = _invar; - if (invar_bt != bt) { - assert(bt == T_LONG && invar_bt == T_INT, ""); - assert(new_invar_bt == bt, ""); - current_invar = register_if_new(new ConvI2LNode(current_invar)); - } else if (new_invar_bt != bt) { - assert(bt == T_LONG && new_invar_bt == T_INT, ""); - assert(invar_bt == bt, ""); - new_invar = register_if_new(new ConvI2LNode(new_invar)); - } - Node* add = AddNode::make(current_invar, new_invar, bt); - _invar = register_if_new(add); -} - -bool VPointer::try_AddI_no_overflow(int offset1, int offset2, int& result) { - jlong long_offset = java_add((jlong)(offset1), (jlong)(offset2)); - jint int_offset = java_add( offset1, offset2); - if (long_offset != int_offset) { - return false; - } - result = int_offset; - return true; -} - -bool VPointer::try_SubI_no_overflow(int offset1, int offset2, int& result) { - jlong long_offset = java_subtract((jlong)(offset1), (jlong)(offset2)); - jint int_offset = java_subtract( offset1, offset2); - if (long_offset != int_offset) { - return false; - } - result = int_offset; - return true; -} - -bool VPointer::try_AddSubI_no_overflow(int offset1, int offset2, bool is_sub, int& result) { - if (is_sub) { - return try_SubI_no_overflow(offset1, offset2, result); - } else { - return try_AddI_no_overflow(offset1, offset2, result); - } -} - -bool VPointer::try_LShiftI_no_overflow(int offset, int shift, int& result) { - if (shift < 0 || shift > 31) { - return false; - } - jlong long_offset = java_shift_left((jlong)(offset), shift); - jint int_offset = java_shift_left( offset, shift); - if (long_offset != int_offset) { - return false; - } - result = int_offset; - return true; -} - -bool VPointer::try_MulI_no_overflow(int offset1, int offset2, int& result) { - jlong long_offset = java_multiply((jlong)(offset1), (jlong)(offset2)); - jint int_offset = java_multiply( offset1, offset2); - if (long_offset != int_offset) { - return false; - } - result = int_offset; - return true; -} - -// We use two comparisons, because a subtraction could underflow. -#define RETURN_CMP_VALUE_IF_NOT_EQUAL(a, b) \ - if (a < b) { return -1; } \ - if (a > b) { return 1; } - -// To be in the same group, two VPointers must be the same, -// except for the offset. -int VPointer::cmp_for_sort_by_group(const VPointer** p1, const VPointer** p2) { - const VPointer* a = *p1; - const VPointer* b = *p2; - - RETURN_CMP_VALUE_IF_NOT_EQUAL(a->base()->_idx, b->base()->_idx); - RETURN_CMP_VALUE_IF_NOT_EQUAL(a->mem()->Opcode(), b->mem()->Opcode()); - RETURN_CMP_VALUE_IF_NOT_EQUAL(a->scale_in_bytes(), b->scale_in_bytes()); - - int a_inva_idx = a->invar() == nullptr ? 0 : a->invar()->_idx; - int b_inva_idx = b->invar() == nullptr ? 0 : b->invar()->_idx; - RETURN_CMP_VALUE_IF_NOT_EQUAL(a_inva_idx, b_inva_idx); - - return 0; // equal -} - -// We compare by group, then by offset, and finally by node idx. -int VPointer::cmp_for_sort(const VPointer** p1, const VPointer** p2) { - int cmp_group = cmp_for_sort_by_group(p1, p2); - if (cmp_group != 0) { return cmp_group; } - - const VPointer* a = *p1; - const VPointer* b = *p2; - - RETURN_CMP_VALUE_IF_NOT_EQUAL(a->offset_in_bytes(), b->offset_in_bytes()); - RETURN_CMP_VALUE_IF_NOT_EQUAL(a->mem()->_idx, b->mem()->_idx); - return 0; // equal -} - -#ifndef PRODUCT -// Function for printing the fields of a VPointer -void VPointer::print() const { - tty->print("VPointer[mem: %4d %10s, ", _mem->_idx, _mem->Name()); +void VPointer::print_on(outputStream* st, bool end_with_cr) const { + st->print("VPointer["); - if (!valid()) { - tty->print_cr("invalid]"); + if (!is_valid()) { + st->print_cr("invalid]"); return; } - tty->print("base: %4d, ", _base != nullptr ? _base->_idx : 0); - tty->print("adr: %4d, ", _adr != nullptr ? _adr->_idx : 0); - - tty->print(" base"); - VPointer::print_con_or_idx(_base); - - tty->print(" + offset(%4d)", _offset); - - tty->print(" + invar"); - VPointer::print_con_or_idx(_invar); - - tty->print_cr(" + scale(%4d) * iv]", _scale); -} -#endif - -// Following are functions for tracing VPointer match -#ifndef PRODUCT -void VPointer::Tracer::print_depth() const { - for (int ii = 0; ii < _depth; ++ii) { - tty->print(" "); - } -} - -void VPointer::Tracer::ctor_1(const Node* mem) { - if (_is_trace_alignment) { - print_depth(); tty->print(" %d VPointer::VPointer: start alignment analysis", mem->_idx); mem->dump(); - } -} + st->print("size: %2d, %s, ", size(), + _mem_pointer.base().is_object() ? "object" : "native"); -void VPointer::Tracer::ctor_2(Node* adr) { - if (_is_trace_alignment) { - //store_depth(); - inc_depth(); - print_depth(); tty->print(" %d (adr) VPointer::VPointer: ", adr->_idx); adr->dump(); - inc_depth(); - print_depth(); tty->print(" %d (base) VPointer::VPointer: ", adr->in(AddPNode::Base)->_idx); adr->in(AddPNode::Base)->dump(); - } -} + Node* base = _mem_pointer.base().object_or_native(); + tty->print("base(%d %s) + con(%3d) + iv_scale(%3d) * iv + invar(", + base->_idx, base->Name(), + _mem_pointer.con().value(), + _iv_scale); -void VPointer::Tracer::ctor_3(Node* adr, int i) { - if (_is_trace_alignment) { - inc_depth(); - Node* offset = adr->in(AddPNode::Offset); - print_depth(); tty->print(" %d (offset) VPointer::VPointer: i = %d: ", offset->_idx, i); offset->dump(); - } -} - -void VPointer::Tracer::ctor_4(Node* adr, int i) { - if (_is_trace_alignment) { - inc_depth(); - print_depth(); tty->print(" %d (adr) VPointer::VPointer: i = %d: ", adr->_idx, i); adr->dump(); - } -} - -void VPointer::Tracer::ctor_5(Node* adr, Node* base, int i) { - if (_is_trace_alignment) { - inc_depth(); - if (base == adr) { - print_depth(); tty->print_cr(" \\ %d (adr) == %d (base) VPointer::VPointer: breaking analysis at i = %d", adr->_idx, base->_idx, i); - } else if (!adr->is_AddP()) { - print_depth(); tty->print_cr(" \\ %d (adr) is NOT Addp VPointer::VPointer: breaking analysis at i = %d", adr->_idx, i); + int count = 0; + for_each_invar_summand([&] (const MemPointerSummand& s) { + if (count > 0) { + st->print(" + "); } + s.print_on(tty); + count++; + }); + if (count == 0) { + st->print("0"); } -} - -void VPointer::Tracer::ctor_6(const Node* mem) { - if (_is_trace_alignment) { - //restore_depth(); - print_depth(); tty->print_cr(" %d (adr) VPointer::VPointer: stop analysis", mem->_idx); - } -} - -void VPointer::Tracer::scaled_iv_plus_offset_1(Node* n) { - if (_is_trace_alignment) { - print_depth(); tty->print(" %d VPointer::scaled_iv_plus_offset testing node: ", n->_idx); - n->dump(); - } -} - -void VPointer::Tracer::scaled_iv_plus_offset_2(Node* n) { - if (_is_trace_alignment) { - print_depth(); tty->print_cr(" %d VPointer::scaled_iv_plus_offset: PASSED", n->_idx); - } -} - -void VPointer::Tracer::scaled_iv_plus_offset_3(Node* n) { - if (_is_trace_alignment) { - print_depth(); tty->print_cr(" %d VPointer::scaled_iv_plus_offset: PASSED", n->_idx); - } -} - -void VPointer::Tracer::scaled_iv_plus_offset_4(Node* n) { - if (_is_trace_alignment) { - print_depth(); tty->print_cr(" %d VPointer::scaled_iv_plus_offset: Op_AddI PASSED", n->_idx); - print_depth(); tty->print(" \\ %d VPointer::scaled_iv_plus_offset: in(1) is scaled_iv: ", n->in(1)->_idx); n->in(1)->dump(); - print_depth(); tty->print(" \\ %d VPointer::scaled_iv_plus_offset: in(2) is offset_plus_k: ", n->in(2)->_idx); n->in(2)->dump(); - } -} - -void VPointer::Tracer::scaled_iv_plus_offset_5(Node* n) { - if (_is_trace_alignment) { - print_depth(); tty->print_cr(" %d VPointer::scaled_iv_plus_offset: Op_AddI PASSED", n->_idx); - print_depth(); tty->print(" \\ %d VPointer::scaled_iv_plus_offset: in(2) is scaled_iv: ", n->in(2)->_idx); n->in(2)->dump(); - print_depth(); tty->print(" \\ %d VPointer::scaled_iv_plus_offset: in(1) is offset_plus_k: ", n->in(1)->_idx); n->in(1)->dump(); - } -} - -void VPointer::Tracer::scaled_iv_plus_offset_6(Node* n) { - if (_is_trace_alignment) { - print_depth(); tty->print_cr(" %d VPointer::scaled_iv_plus_offset: Op_%s PASSED", n->_idx, n->Name()); - print_depth(); tty->print(" \\ %d VPointer::scaled_iv_plus_offset: in(1) is scaled_iv: ", n->in(1)->_idx); n->in(1)->dump(); - print_depth(); tty->print(" \\ %d VPointer::scaled_iv_plus_offset: in(2) is offset_plus_k: ", n->in(2)->_idx); n->in(2)->dump(); - } -} - -void VPointer::Tracer::scaled_iv_plus_offset_7(Node* n) { - if (_is_trace_alignment) { - print_depth(); tty->print_cr(" %d VPointer::scaled_iv_plus_offset: Op_%s PASSED", n->_idx, n->Name()); - print_depth(); tty->print(" \\ %d VPointer::scaled_iv_plus_offset: in(2) is scaled_iv: ", n->in(2)->_idx); n->in(2)->dump(); - print_depth(); tty->print(" \\ %d VPointer::scaled_iv_plus_offset: in(1) is offset_plus_k: ", n->in(1)->_idx); n->in(1)->dump(); - } -} - -void VPointer::Tracer::scaled_iv_plus_offset_8(Node* n) { - if (_is_trace_alignment) { - print_depth(); tty->print_cr(" %d VPointer::scaled_iv_plus_offset: FAILED", n->_idx); - } -} - -void VPointer::Tracer::scaled_iv_1(Node* n) { - if (_is_trace_alignment) { - print_depth(); tty->print(" %d VPointer::scaled_iv: testing node: ", n->_idx); n->dump(); - } -} - -void VPointer::Tracer::scaled_iv_2(Node* n, int scale) { - if (_is_trace_alignment) { - print_depth(); tty->print_cr(" %d VPointer::scaled_iv: FAILED since another _scale has been detected before", n->_idx); - print_depth(); tty->print_cr(" \\ VPointer::scaled_iv: _scale (%d) != 0", scale); - } -} - -void VPointer::Tracer::scaled_iv_3(Node* n, int scale) { - if (_is_trace_alignment) { - print_depth(); tty->print_cr(" %d VPointer::scaled_iv: is iv, setting _scale = %d", n->_idx, scale); - } -} - -void VPointer::Tracer::scaled_iv_4(Node* n, int scale) { - if (_is_trace_alignment) { - print_depth(); tty->print_cr(" %d VPointer::scaled_iv: Op_MulI PASSED, setting _scale = %d", n->_idx, scale); - print_depth(); tty->print(" \\ %d VPointer::scaled_iv: in(1) is iv: ", n->in(1)->_idx); n->in(1)->dump(); - print_depth(); tty->print(" \\ %d VPointer::scaled_iv: in(2) is Con: ", n->in(2)->_idx); n->in(2)->dump(); - } -} - -void VPointer::Tracer::scaled_iv_5(Node* n, int scale) { - if (_is_trace_alignment) { - print_depth(); tty->print_cr(" %d VPointer::scaled_iv: Op_MulI PASSED, setting _scale = %d", n->_idx, scale); - print_depth(); tty->print(" \\ %d VPointer::scaled_iv: in(2) is iv: ", n->in(2)->_idx); n->in(2)->dump(); - print_depth(); tty->print(" \\ %d VPointer::scaled_iv: in(1) is Con: ", n->in(1)->_idx); n->in(1)->dump(); - } -} - -void VPointer::Tracer::scaled_iv_6(Node* n, int scale) { - if (_is_trace_alignment) { - print_depth(); tty->print_cr(" %d VPointer::scaled_iv: Op_LShiftI PASSED, setting _scale = %d", n->_idx, scale); - print_depth(); tty->print(" \\ %d VPointer::scaled_iv: in(1) is iv: ", n->in(1)->_idx); n->in(1)->dump(); - print_depth(); tty->print(" \\ %d VPointer::scaled_iv: in(2) is Con: ", n->in(2)->_idx); n->in(2)->dump(); - } -} - -void VPointer::Tracer::scaled_iv_7(Node* n) { - if (_is_trace_alignment) { - print_depth(); tty->print_cr(" %d VPointer::scaled_iv: Op_ConvI2L PASSED", n->_idx); - print_depth(); tty->print_cr(" \\ VPointer::scaled_iv: in(1) %d is scaled_iv_plus_offset: ", n->in(1)->_idx); - inc_depth(); inc_depth(); - print_depth(); n->in(1)->dump(); - dec_depth(); dec_depth(); - } -} - -void VPointer::Tracer::scaled_iv_8(Node* n, VPointer* tmp) { - if (_is_trace_alignment) { - print_depth(); tty->print(" %d VPointer::scaled_iv: Op_LShiftL, creating tmp VPointer: ", n->_idx); tmp->print(); - } -} - -void VPointer::Tracer::scaled_iv_9(Node* n, int scale, int offset, Node* invar) { - if (_is_trace_alignment) { - print_depth(); tty->print_cr(" %d VPointer::scaled_iv: Op_LShiftL PASSED, setting _scale = %d, _offset = %d", n->_idx, scale, offset); - print_depth(); tty->print_cr(" \\ VPointer::scaled_iv: in(1) [%d] is scaled_iv_plus_offset, in(2) [%d] used to scale: _scale = %d, _offset = %d", - n->in(1)->_idx, n->in(2)->_idx, scale, offset); - if (invar != nullptr) { - print_depth(); tty->print_cr(" \\ VPointer::scaled_iv: scaled invariant: [%d]", invar->_idx); - } - inc_depth(); inc_depth(); - print_depth(); n->in(1)->dump(); - print_depth(); n->in(2)->dump(); - if (invar != nullptr) { - print_depth(); invar->dump(); - } - dec_depth(); dec_depth(); - } -} - -void VPointer::Tracer::scaled_iv_10(Node* n) { - if (_is_trace_alignment) { - print_depth(); tty->print_cr(" %d VPointer::scaled_iv: FAILED", n->_idx); - } -} - -void VPointer::Tracer::offset_plus_k_1(Node* n) { - if (_is_trace_alignment) { - print_depth(); tty->print(" %d VPointer::offset_plus_k: testing node: ", n->_idx); n->dump(); - } -} - -void VPointer::Tracer::offset_plus_k_2(Node* n, int _offset) { - if (_is_trace_alignment) { - print_depth(); tty->print_cr(" %d VPointer::offset_plus_k: Op_ConI PASSED, setting _offset = %d", n->_idx, _offset); - } -} - -void VPointer::Tracer::offset_plus_k_3(Node* n, int _offset) { - if (_is_trace_alignment) { - print_depth(); tty->print_cr(" %d VPointer::offset_plus_k: Op_ConL PASSED, setting _offset = %d", n->_idx, _offset); - } -} - -void VPointer::Tracer::offset_plus_k_4(Node* n) { - if (_is_trace_alignment) { - print_depth(); tty->print_cr(" %d VPointer::offset_plus_k: FAILED", n->_idx); - print_depth(); tty->print_cr(" \\ " JLONG_FORMAT " VPointer::offset_plus_k: Op_ConL FAILED, k is too big", n->get_long()); - } -} - -void VPointer::Tracer::offset_plus_k_5(Node* n, Node* _invar) { - if (_is_trace_alignment) { - print_depth(); tty->print_cr(" %d VPointer::offset_plus_k: FAILED since another invariant has been detected before", n->_idx); - print_depth(); tty->print(" \\ %d VPointer::offset_plus_k: _invar is not null: ", _invar->_idx); _invar->dump(); - } -} - -void VPointer::Tracer::offset_plus_k_6(Node* n, Node* _invar, bool _negate_invar, int _offset) { - if (_is_trace_alignment) { - print_depth(); tty->print_cr(" %d VPointer::offset_plus_k: Op_AddI PASSED, setting _debug_negate_invar = %d, _invar = %d, _offset = %d", - n->_idx, _negate_invar, _invar->_idx, _offset); - print_depth(); tty->print(" \\ %d VPointer::offset_plus_k: in(2) is Con: ", n->in(2)->_idx); n->in(2)->dump(); - print_depth(); tty->print(" \\ %d VPointer::offset_plus_k: in(1) is invariant: ", _invar->_idx); _invar->dump(); - } -} - -void VPointer::Tracer::offset_plus_k_7(Node* n, Node* _invar, bool _negate_invar, int _offset) { - if (_is_trace_alignment) { - print_depth(); tty->print_cr(" %d VPointer::offset_plus_k: Op_AddI PASSED, setting _debug_negate_invar = %d, _invar = %d, _offset = %d", - n->_idx, _negate_invar, _invar->_idx, _offset); - print_depth(); tty->print(" \\ %d VPointer::offset_plus_k: in(1) is Con: ", n->in(1)->_idx); n->in(1)->dump(); - print_depth(); tty->print(" \\ %d VPointer::offset_plus_k: in(2) is invariant: ", _invar->_idx); _invar->dump(); - } -} - -void VPointer::Tracer::offset_plus_k_8(Node* n, Node* _invar, bool _negate_invar, int _offset) { - if (_is_trace_alignment) { - print_depth(); tty->print_cr(" %d VPointer::offset_plus_k: Op_SubI is PASSED, setting _debug_negate_invar = %d, _invar = %d, _offset = %d", - n->_idx, _negate_invar, _invar->_idx, _offset); - print_depth(); tty->print(" \\ %d VPointer::offset_plus_k: in(2) is Con: ", n->in(2)->_idx); n->in(2)->dump(); - print_depth(); tty->print(" \\ %d VPointer::offset_plus_k: in(1) is invariant: ", _invar->_idx); _invar->dump(); - } -} - -void VPointer::Tracer::offset_plus_k_9(Node* n, Node* _invar, bool _negate_invar, int _offset) { - if (_is_trace_alignment) { - print_depth(); tty->print_cr(" %d VPointer::offset_plus_k: Op_SubI PASSED, setting _debug_negate_invar = %d, _invar = %d, _offset = %d", n->_idx, _negate_invar, _invar->_idx, _offset); - print_depth(); tty->print(" \\ %d VPointer::offset_plus_k: in(1) is Con: ", n->in(1)->_idx); n->in(1)->dump(); - print_depth(); tty->print(" \\ %d VPointer::offset_plus_k: in(2) is invariant: ", _invar->_idx); _invar->dump(); - } -} - -void VPointer::Tracer::offset_plus_k_10(Node* n, Node* _invar, bool _negate_invar, int _offset) { - if (_is_trace_alignment) { - print_depth(); tty->print_cr(" %d VPointer::offset_plus_k: PASSED, setting _debug_negate_invar = %d, _invar = %d, _offset = %d", n->_idx, _negate_invar, _invar->_idx, _offset); - print_depth(); tty->print_cr(" \\ %d VPointer::offset_plus_k: is invariant", n->_idx); - } -} - -void VPointer::Tracer::offset_plus_k_11(Node* n) { - if (_is_trace_alignment) { - print_depth(); tty->print_cr(" %d VPointer::offset_plus_k: FAILED", n->_idx); - } + st->print(")]"); + if (end_with_cr) { st->cr(); } } #endif - AlignmentSolution* AlignmentSolver::solve() const { DEBUG_ONLY( trace_start_solve(); ) @@ -1667,9 +435,9 @@ AlignmentSolution* AlignmentSolver::solve() const { assert(is_power_of_2(abs(_main_stride)), "main_stride is power of 2"); assert(_aw > 0 && is_power_of_2(_aw), "aw must be power of 2"); - // Out of simplicity: non power-of-2 scale not supported. - if (abs(_scale) == 0 || !is_power_of_2(abs(_scale))) { - return new EmptyAlignmentSolution("non power-of-2 scale not supported"); + // Out of simplicity: non power-of-2 iv_scale not supported. + if (abs(iv_scale()) == 0 || !is_power_of_2(abs(iv_scale()))) { + return new EmptyAlignmentSolution("non power-of-2 iv_scale not supported"); } // We analyze the address of mem_ref. The idea is to disassemble it into a linear @@ -1678,7 +446,7 @@ AlignmentSolution* AlignmentSolver::solve() const { // // The Simple form of the address is disassembled by VPointer into: // - // adr = base + offset + invar + scale * iv + // adr = base + invar + iv_scale * iv + con // // Where the iv can be written as: // @@ -1694,14 +462,14 @@ AlignmentSolution* AlignmentSolver::solve() const { // expanding the iv variable. In a second step, we reshape the expression again, and // state it as a linear expression, consisting of 6 terms. // - // Simple form Expansion of iv variable Reshaped with constants Comments for terms - // ----------- ------------------------ ----------------------- ------------------ - // adr = base = base = base (base % aw = 0) - // + offset + offset + C_const (sum of constant terms) - // + invar + invar_factor * var_invar + C_invar * var_invar (term for invariant) - // / + scale * init + C_init * var_init (term for variable init) - // + scale * iv -> | + scale * pre_stride * pre_iter + C_pre * pre_iter (adjustable pre-loop term) - // \ + scale * main_stride * main_iter + C_main * main_iter (main-loop term) + // Simple form Expansion of iv variable Reshaped with constants Comments for terms + // ----------- ------------------------ ----------------------- ------------------ + // adr = base = base = base (assume: base % aw = 0) + // + invar + invar_factor * var_invar + C_invar * var_invar (term for invariant) + // / + iv_scale * init + C_init * var_init (term for variable init) + // + iv_scale * iv -> | + iv_scale * pre_stride * pre_iter + C_pre * pre_iter (adjustable pre-loop term) + // \ + iv_scale * main_stride * main_iter + C_main * main_iter (main-loop term) + // + con + con + C_const (sum of constant terms) // // We describe the 6 terms: // 1) The "base" of the address is the address of a Java object (e.g. array), @@ -1711,19 +479,22 @@ AlignmentSolution* AlignmentSolver::solve() const { // // base % ObjectAlignmentInBytes = 0 ==> base % aw = 0 // - // 2) The "C_const" term is the sum of all constant terms. This is "offset", - // plus "scale * init" if it is constant. + // TODO: Note: we have been assuming that this also holds for native memory base + // addresses. This is incorrect, see JDK-8323582. + // + // 2) The "C_const" term is the sum of all constant terms. This is "con", + // plus "iv_scale * init" if it is constant. // 3) The "C_invar * var_invar" is the factorization of "invar" into a constant // and variable term. If there is no invariant, then "C_invar" is zero. // // invar = C_invar * var_invar (FAC_INVAR) // - // 4) The "C_init * var_init" is the factorization of "scale * init" into a + // 4) The "C_init * var_init" is the factorization of "iv_scale * init" into a // constant and a variable term. If "init" is constant, then "C_init" is // zero, and "C_const" accounts for "init" instead. // - // scale * init = C_init * var_init + scale * C_const_init (FAC_INIT) - // C_init = (init is constant) ? 0 : scale + // iv_scale * init = C_init * var_init + iv_scale * C_const_init (FAC_INIT) + // C_init = (init is constant) ? 0 : iv_scale // C_const_init = (init is constant) ? init : 0 // // 5) The "C_pre * pre_iter" term represents how much the iv is incremented @@ -1736,20 +507,21 @@ AlignmentSolution* AlignmentSolver::solve() const { // Attribute init (i.e. _init_node) either to C_const or to C_init term. const int C_const_init = _init_node->is_ConI() ? _init_node->as_ConI()->get_int() : 0; - const int C_const = _offset + C_const_init * _scale; + const int C_const = _vpointer.con() + C_const_init * iv_scale(); // Set C_invar depending on if invar is present - const int C_invar = (_invar == nullptr) ? 0 : abs(_invar_factor); + const int C_invar = _vpointer.compute_invar_factor(); - const int C_init = _init_node->is_ConI() ? 0 : _scale; - const int C_pre = _scale * _pre_stride; - const int C_main = _scale * _main_stride; + const int C_init = _init_node->is_ConI() ? 0 : iv_scale(); + const int C_pre = iv_scale() * _pre_stride; + const int C_main = iv_scale() * _main_stride; DEBUG_ONLY( trace_reshaped_form(C_const, C_const_init, C_invar, C_init, C_pre, C_main); ) // We must find a pre_iter, such that adr is aw aligned: adr % aw = 0. Note, that we are defining the // modulo operator "%" such that the remainder is always positive, see AlignmentSolution::mod(i, q). // + // TODO: Note: the following assumption is incorrect for native memory bases, see JDK-8323582. // Since "base % aw = 0", we only need to ensure alignment of the other 5 terms: // // (C_const + C_invar * var_invar + C_init * var_init + C_pre * pre_iter + C_main * main_iter) % aw = 0 (1) @@ -2028,7 +800,7 @@ AlignmentSolution* AlignmentSolver::solve() const { // pre_iter_C_const = mx2 * q - sign(C_pre) * X // = mx2 * q - sign(C_pre) * C_const / abs(C_pre) // = mx2 * q - C_const / C_pre - // = mx2 * q - C_const / (scale * pre_stride) (11a) + // = mx2 * q - C_const / (iv_scale * pre_stride) (11a) // // If there is an invariant: // @@ -2036,19 +808,19 @@ AlignmentSolution* AlignmentSolver::solve() const { // = my2 * q - sign(C_pre) * C_invar * var_invar / abs(C_pre) // = my2 * q - sign(C_pre) * invar / abs(C_pre) // = my2 * q - invar / C_pre - // = my2 * q - invar / (scale * pre_stride) (11b, with invar) + // = my2 * q - invar / (iv_scale * pre_stride) (11b, with invar) // // If there is no invariant (i.e. C_invar = 0 ==> Y = 0): // // pre_iter_C_invar = my2 * q (11b, no invar) // - // If init is variable (i.e. C_init = scale, init = var_init): + // If init is variable (i.e. C_init = iv_scale, init = var_init): // - // pre_iter_C_init = mz2 * q - sign(C_pre) * Z * var_init - // = mz2 * q - sign(C_pre) * C_init * var_init / abs(C_pre) - // = mz2 * q - sign(C_pre) * scale * init / abs(C_pre) - // = mz2 * q - scale * init / C_pre - // = mz2 * q - scale * init / (scale * pre_stride) + // pre_iter_C_init = mz2 * q - sign(C_pre) * Z * var_init + // = mz2 * q - sign(C_pre) * C_init * var_init / abs(C_pre) + // = mz2 * q - sign(C_pre) * iv_scale * init / abs(C_pre) + // = mz2 * q - iv_scale * init / C_pre + // = mz2 * q - iv_scale * init / (iv_scale * pre_stride) // = mz2 * q - init / pre_stride (11c, variable init) // // If init is constant (i.e. C_init = 0 ==> Z = 0): @@ -2059,35 +831,35 @@ AlignmentSolution* AlignmentSolver::solve() const { // with m = mx2 + my2 + mz2: // // pre_iter = pre_iter_C_const + pre_iter_C_invar + pre_iter_C_init - // = mx2 * q - C_const / (scale * pre_stride) - // + my2 * q [- invar / (scale * pre_stride) ] - // + mz2 * q [- init / pre_stride ] + // = mx2 * q - C_const / (iv_scale * pre_stride) + // + my2 * q [- invar / (iv_scale * pre_stride) ] + // + mz2 * q [- init / pre_stride ] // // = m * q (periodic part) - // - C_const / (scale * pre_stride) (align constant term) - // [- invar / (scale * pre_stride) ] (align invariant term, if present) - // [- init / pre_stride ] (align variable init term, if present) (12) + // - C_const / (iv_scale * pre_stride) (align constant term) + // [- invar / (iv_scale * pre_stride) ] (align invariant term, if present) + // [- init / pre_stride ] (align variable init term, if present) (12) // // We can further simplify this solution by introducing integer 0 <= r < q: // - // r = (-C_const / (scale * pre_stride)) % q (13) + // r = (-C_const / (iv_scale * pre_stride)) % q (13) // - const int r = AlignmentSolution::mod(-C_const / (_scale * _pre_stride), q); + const int r = AlignmentSolution::mod(-C_const / (iv_scale() * _pre_stride), q); // // pre_iter = m * q + r - // [- invar / (scale * pre_stride) ] - // [- init / pre_stride ] (14) + // [- invar / (iv_scale * pre_stride) ] + // [- init / pre_stride ] (14) // // We thus get a solution that can be stated in terms of: // - // q (periodicity), r (constant alignment), invar, scale, pre_stride, init + // q (periodicity), r (constant alignment), invar, iv_scale, pre_stride, init // // However, pre_stride and init are shared by all mem_ref in the loop, hence we do not need to provide // them in the solution description. DEBUG_ONLY( trace_constrained_solution(C_const, C_invar, C_init, C_pre, q, r); ) - return new ConstrainedAlignmentSolution(_mem_ref, q, r, _invar, _scale); + return new ConstrainedAlignmentSolution(_mem_ref, q, r, _vpointer /* holds invar and iv_scale */); // APPENDIX: // We can now verify the success of the solution given by (12): @@ -2095,48 +867,49 @@ AlignmentSolution* AlignmentSolver::solve() const { // adr % aw = // // -> Simple form - // (base + offset + invar + scale * iv) % aw = + // (base + invar + iv_scale * iv + con) % aw = // // -> Expand iv - // (base + offset + invar + scale * (init + pre_stride * pre_iter + main_stride * main_iter)) % aw = + // (base + con + invar + iv_scale * (init + pre_stride * pre_iter + main_stride * main_iter)) % aw = // // -> Reshape - // (base + offset + invar - // + scale * init - // + scale * pre_stride * pre_iter - // + scale * main_stride * main_iter)) % aw = + // (base + con + invar + // + iv_scale * init + // + iv_scale * pre_stride * pre_iter + // + iv_scale * main_stride * main_iter)) % aw = // // -> base aligned: base % aw = 0 - // -> main-loop iterations aligned (2): C_main % aw = (scale * main_stride) % aw = 0 - // (offset + invar + scale * init + scale * pre_stride * pre_iter) % aw = + // TODO: Note: this assumption is incorrect for native memory bases, see JDK-8323582. + // -> main-loop iterations aligned (2): C_main % aw = (iv_scale * main_stride) % aw = 0 + // (con + invar + iv_scale * init + iv_scale * pre_stride * pre_iter) % aw = // // -> apply (12) - // (offset + invar + scale * init - // + scale * pre_stride * (m * q - C_const / (scale * pre_stride) - // [- invar / (scale * pre_stride) ] - // [- init / pre_stride ] + // (con + invar + iv_scale * init + // + iv_scale * pre_stride * (m * q - C_const / (iv_scale * pre_stride) + // [- invar / (iv_scale * pre_stride) ] + // [- init / pre_stride ] // ) // ) % aw = // - // -> expand C_const = offset [+ init * scale] (if init const) - // (offset + invar + scale * init - // + scale * pre_stride * (m * q - offset / (scale * pre_stride) - // [- init / pre_stride ] (if init constant) - // [- invar / (scale * pre_stride) ] (if invar present) - // [- init / pre_stride ] (if init variable) + // -> expand C_const = con [+ init * iv_scale] (if init const) + // (con + invar + iv_scale * init + // + iv_scale * pre_stride * (m * q - con / (iv_scale * pre_stride) + // [- init / pre_stride ] (if init constant) + // [- invar / (iv_scale * pre_stride) ] (if invar present) + // [- init / pre_stride ] (if init variable) // ) // ) % aw = // // -> assuming invar = 0 if it is not present // -> merge the two init terms (variable or constant) - // -> apply (8): q = aw / (abs(C_pre)) = aw / abs(scale * pre_stride) - // -> and hence: (scale * pre_stride * q) % aw = 0 + // -> apply (8): q = aw / (abs(C_pre)) = aw / abs(iv_scale * pre_stride) + // -> and hence: (iv_scale * pre_stride * q) % aw = 0 // -> all terms are canceled out - // (offset + invar + scale * init - // + scale * pre_stride * m * q -> aw aligned - // - scale * pre_stride * offset / (scale * pre_stride) -> = offset - // - scale * pre_stride * init / pre_stride -> = scale * init - // - scale * pre_stride * invar / (scale * pre_stride) -> = invar + // (con + invar + iv_scale * init + // + iv_scale * pre_stride * m * q -> aw aligned + // - iv_scale * pre_stride * con / (iv_scale * pre_stride) -> = con + // - iv_scale * pre_stride * init / pre_stride -> = iv_scale * init + // - iv_scale * pre_stride * invar / (iv_scale * pre_stride) -> = invar // ) % aw = 0 // // The solution given by (12) does indeed guarantee alignment. @@ -2147,8 +920,9 @@ void AlignmentSolver::trace_start_solve() const { if (is_trace()) { tty->print(" vector mem_ref:"); _mem_ref->dump(); - tty->print_cr(" vector_width = vector_length(%d) * element_size(%d) = %d", - _vector_length, _element_size, _vector_width); + tty->print(" VPointer: "); + _vpointer.print_on(tty); + tty->print_cr(" vector_width = %d", _vector_width); tty->print_cr(" aw = alignment_width = min(vector_width(%d), ObjectAlignmentInBytes(%d)) = %d", _vector_width, ObjectAlignmentInBytes, _aw); @@ -2157,25 +931,34 @@ void AlignmentSolver::trace_start_solve() const { _init_node->dump(); } - if (_invar != nullptr) { - tty->print(" invar:"); - _invar->dump(); + tty->print_cr(" invar = SUM(invar_summands), invar_summands:"); + int invar_count = 0; + _vpointer.for_each_invar_summand([&] (const MemPointerSummand& s) { + tty->print(" "); + s.print_on(tty); + tty->print(" -> "); + s.variable()->dump(); + invar_count++; + }); + if (invar_count == 0) { + tty->print_cr(" No invar_summands."); } - tty->print_cr(" invar_factor = %d", _invar_factor); + const jint invar_factor = _vpointer.compute_invar_factor(); + tty->print_cr(" invar_factor = %d", invar_factor); // iv = init + pre_iter * pre_stride + main_iter * main_stride tty->print(" iv = init"); - VPointer::print_con_or_idx(_init_node); + if (_init_node->is_ConI()) { + tty->print("(%4d)", _init_node->as_ConI()->get_int()); + } else { + tty->print("[%4d]", _init_node->_idx); + } tty->print_cr(" + pre_iter * pre_stride(%d) + main_iter * main_stride(%d)", _pre_stride, _main_stride); - - // adr = base + offset + invar + scale * iv - tty->print(" adr = base"); - VPointer::print_con_or_idx(_base); - tty->print(" + offset(%d) + invar", _offset); - VPointer::print_con_or_idx(_invar); - tty->print_cr(" + scale(%d) * iv", _scale); + // adr = base + con + invar + iv_scale * iv + tty->print(" adr = base[%d]", base().object_or_native()->_idx); + tty->print(" + invar + iv_scale(%d) * iv + con(%d)", iv_scale(), _vpointer.con()); } } @@ -2187,7 +970,7 @@ void AlignmentSolver::trace_reshaped_form(const int C_const, const int C_main) const { if (is_trace()) { - tty->print(" = base[%d] + ", _base->_idx); + tty->print(" = base[%d] + ", base().object_or_native()->_idx); tty->print_cr("C_const(%d) + C_invar(%d) * var_invar + C_init(%d) * var_init + C_pre(%d) * pre_iter + C_main(%d) * main_iter", C_const, C_invar, C_init, C_pre, C_main); if (_init_node->is_ConI()) { @@ -2197,21 +980,21 @@ void AlignmentSolver::trace_reshaped_form(const int C_const, } else { tty->print_cr(" init is variable:"); tty->print_cr(" C_const_init = %d", C_const_init); - tty->print_cr(" C_init = abs(scale)= %d", C_init); + tty->print_cr(" C_init = abs(iv_scale)= %d", C_init); } - if (_invar != nullptr) { + if (C_invar != 0) { tty->print_cr(" invariant present:"); - tty->print_cr(" C_invar = abs(invar_factor) = %d", C_invar); + tty->print_cr(" C_invar = invar_factor = %d", C_invar); } else { tty->print_cr(" no invariant:"); tty->print_cr(" C_invar = %d", C_invar); } - tty->print_cr(" C_const = offset(%d) + scale(%d) * C_const_init(%d) = %d", - _offset, _scale, C_const_init, C_const); - tty->print_cr(" C_pre = scale(%d) * pre_stride(%d) = %d", - _scale, _pre_stride, C_pre); - tty->print_cr(" C_main = scale(%d) * main_stride(%d) = %d", - _scale, _main_stride, C_main); + tty->print_cr(" C_const = con(%d) + iv_scale(%d) * C_const_init(%d) = %d", + _vpointer.con(), iv_scale(), C_const_init, C_const); + tty->print_cr(" C_pre = iv_scale(%d) * pre_stride(%d) = %d", + iv_scale(), _pre_stride, C_pre); + tty->print_cr(" C_main = iv_scale(%d) * main_stride(%d) = %d", + iv_scale(), _main_stride, C_main); } } @@ -2280,13 +1063,13 @@ void AlignmentSolver::trace_constrained_solution(const int C_const, tty->print_cr(" EQ(10b): pre_iter_C_invar = my2 * q(%d) - sign(C_pre) * Y(%d) * var_invar", q, Y); tty->print_cr(" EQ(10c): pre_iter_C_init = mz2 * q(%d) - sign(C_pre) * Z(%d) * var_init ", q, Z); - tty->print_cr(" r = (-C_const(%d) / (scale(%d) * pre_stride(%d)) %% q(%d) = %d", - C_const, _scale, _pre_stride, q, r); + tty->print_cr(" r = (-C_const(%d) / (iv_scale(%d) * pre_stride(%d)) %% q(%d) = %d", + C_const, iv_scale(), _pre_stride, q, r); tty->print_cr(" EQ(14): pre_iter = m * q(%3d) - r(%d)", q, r); - if (_invar != nullptr) { - tty->print_cr(" - invar / (scale(%d) * pre_stride(%d))", - _scale, _pre_stride); + if (C_invar != 0) { + tty->print_cr(" - invar / (iv_scale(%d) * pre_stride(%d))", + iv_scale(), _pre_stride); } if (!_init_node->is_ConI()) { tty->print_cr(" - init / pre_stride(%d)", diff --git a/src/hotspot/share/opto/vectorization.hpp b/src/hotspot/share/opto/vectorization.hpp index 98aa3336dedf2..cb1e8c4585675 100644 --- a/src/hotspot/share/opto/vectorization.hpp +++ b/src/hotspot/share/opto/vectorization.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2023, Arm Limited. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -28,6 +28,7 @@ #include "opto/matcher.hpp" #include "opto/loopnode.hpp" #include "opto/traceAutoVectorizationTag.hpp" +#include "opto/mempointer.hpp" #include "utilities/pair.hpp" // Code in this file and the vectorization.cpp contains shared logics and @@ -85,6 +86,7 @@ class VLoop : public StackObj { CountedLoopEndNode* _pre_loop_end; // cache access to pre-loop for main loops only NOT_PRODUCT(VTrace _vtrace;) + NOT_PRODUCT(TraceMemPointer _mptrace;) static constexpr char const* FAILURE_ALREADY_VECTORIZED = "loop already vectorized"; static constexpr char const* FAILURE_UNROLL_ONLY = "loop only wants to be unrolled"; @@ -102,7 +104,18 @@ class VLoop : public StackObj { _cl (nullptr), _cl_exit (nullptr), _iv (nullptr), - _pre_loop_end (nullptr) {} + _pre_loop_end (nullptr) +#ifndef PRODUCT + COMMA + _mptrace(TraceMemPointer( + _vtrace.is_trace(TraceAutoVectorizationTag::POINTER_PARSING), + _vtrace.is_trace(TraceAutoVectorizationTag::POINTER_ALIASING), + _vtrace.is_trace(TraceAutoVectorizationTag::POINTER_ADJACENCY), + _vtrace.is_trace(TraceAutoVectorizationTag::POINTER_OVERLAP) + )) +#endif + {} + NONCOPYABLE(VLoop); IdealLoopTree* lpt() const { return _lpt; }; @@ -133,7 +146,8 @@ class VLoop : public StackObj { static bool vectors_should_be_aligned() { return !Matcher::misaligned_vectors_ok() || AlignVector; } #ifndef PRODUCT - const VTrace& vtrace() const { return _vtrace; } + const VTrace& vtrace() const { return _vtrace; } + const TraceMemPointer& mptrace() const { return _mptrace; } bool is_trace_preconditions() const { return _vtrace.is_trace(TraceAutoVectorizationTag::PRECONDITIONS); @@ -162,10 +176,6 @@ class VLoop : public StackObj { bool is_trace_vpointers() const { return _vtrace.is_trace(TraceAutoVectorizationTag::POINTERS); } - - bool is_trace_pointer_analysis() const { - return _vtrace.is_trace(TraceAutoVectorizationTag::POINTER_ANALYSIS); - } #endif // Is the node in the basic block of the loop? @@ -175,6 +185,27 @@ class VLoop : public StackObj { return n != nullptr && n->outcnt() > 0 && ctrl == _cl; } + // Some nodes must be pre-loop invariant, so that they can be used for conditions + // before or inside the pre-loop. For example, alignment of main-loop vector + // memops must be achieved in the pre-loop, via the exit check in the pre-loop. + bool is_pre_loop_invariant(Node* n) const { + // Must be in the main-loop, otherwise we can't access the pre-loop. + // This fails during SuperWord::unrolling_analysis, but that is ok. + if (!cl()->is_main_loop()) { + return false; + } + + Node* ctrl = phase()->get_ctrl(n); + + // Quick test: is it in the main-loop? + if (lpt()->is_member(phase()->get_loop(ctrl))) { + return false; + } + + // Is it before the pre-loop? + return phase()->is_dominator(ctrl, pre_loop_head()); + } + // Check if the loop passes some basic preconditions for vectorization. // Return indicates if analysis succeeded. bool check_preconditions(); @@ -427,7 +458,7 @@ class VLoopTypes : public StackObj { return velt_type(n)->array_element_basic_type(); } - int data_size(Node* s) const { + int data_size(const Node* s) const { int bsize = type2aelembytes(velt_basic_type(s)); assert(bsize != 0, "valid size"); return bsize; @@ -667,340 +698,300 @@ class VLoopAnalyzer : StackObj { 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. +// Reminder: MemPointer have the form: // -// We parse and represent pointers of the simple form: +// pointer = SUM(summands) + con // -// pointer = adr + offset + invar + scale * ConvI2L(iv) +// Where every summand in summands has the form: // -// Where: -// -// adr: the base address of an array (base = adr) -// OR -// some address to off-heap memory (base = TOP) -// -// offset: a constant offset -// invar: a runtime variable, which is invariant during the loop -// scale: scaling factor -// iv: loop induction variable +// summand = scale * variable // -// But more precisely, we parse the composite-long-int form: +// The VPointer wraps a MemPointer for the use in loops. A "valid" VPointer has +// the form: // -// pointer = adr + long_offset + long_invar + long_scale * ConvI2L(int_offset + inv_invar + int_scale * iv) +// pointer = base + invar + iv_summand + con +// with +// invar = SUM(invar_summands) +// iv_summand = iv_scale * iv // -// pointer = adr + long_offset + long_invar + long_scale * ConvI2L(int_index) -// int_index = int_offset + int_invar + int_scale * iv -// -// However, for aliasing and adjacency checks (e.g. VPointer::cmp()) we always use the simple form to make -// decisions. Hence, we must make sure to only create a "valid" VPointer if the optimisations based on the -// simple form produce the same result as the compound-long-int form would. Intuitively, this depends on -// if the int_index overflows, but the precise conditions are given in VPointer::is_safe_to_use_as_simple_form(). -// -// ConvI2L(int_index) = ConvI2L(int_offset + int_invar + int_scale * iv) -// = Convi2L(int_offset) + ConvI2L(int_invar) + ConvI2L(int_scale) * ConvI2L(iv) +// Where: +// - base: is the known base of the MemPointer. +// on-heap (object base) or off-heap (native base address) +// - iv and iv_scale: i.e. the iv_summand = iv * iv_scale. +// If we find a summand where the variable is the iv, we set iv_scale to the +// corresponding scale. If there is no such summand, then we know that the +// pointer does not depend on the iv, since otherwise there would have to be +// a summand where its variable is main-loop variant. Note: MemPointer already +// ensures that there is at most one summand per variable, so there is at +// most one summand with iv. +// - invar_summands: all other summands except base and iv_summand. +// All variables must be pre-loop invariant. This is important when we need +// to memory align a pointer using the pre-loop limit. // -// scale = long_scale * ConvI2L(int_scale) -// offset = long_offset + long_scale * ConvI2L(int_offset) -// invar = long_invar + long_scale * ConvI2L(int_invar) +// These are examples where a VPointer becomes "invalid": +// - If the MemPointer does not have the required form for VPointer, +// i.e. if one of these conditions is not met (see init_is_valid): +// - Base must be known. +// - All summands except the iv-summand must be pre-loop invariant. +// - Some restrictions on iv_scale and iv_stride, to avoid overflow in +// alignment computations. +// - If the new con computed in make_with_iv_offset overflows. // -// pointer = adr + offset + invar + scale * ConvI2L(iv) +// If a VPointer is marked "invalid", it always returns conservative answers to +// aliasing queries, which means that we do not optimize in these cases. +// For example: +// - is_adjacent_to_and_before: returning true would allow optimizations such as +// packing into vectors. So for "invalid" VPointers, +// we always return false (i.e. unknown). +// - never_overlaps_with: returning true would allow optimizations such as +// swapping the order of memops. So for "invalid" VPointers, +// we always return false (i.e. unknown). // class VPointer : public ArenaObj { - protected: - MemNode* const _mem; // My memory reference node - const VLoop& _vloop; +private: + const VLoop& _vloop; + const MemPointer _mem_pointer; - // Components of the simple form: - Node* _base; // Base address of an array OR null if some off-heap memory. - Node* _adr; // Same as _base if an array pointer OR some off-heap memory pointer. - int _scale; // multiplier for iv (in bytes), 0 if no loop iv - int _offset; // constant offset (in bytes) + // Derived, for quicker use. + const jint _iv_scale; - Node* _invar; // invariant offset (in bytes), null if none -#ifdef ASSERT - Node* _debug_invar; - bool _debug_negate_invar; // if true then use: (0 - _invar) - Node* _debug_invar_scale; // multiplier for invariant -#endif + const bool _is_valid; - // The int_index components of the compound-long-int form. Used to decide if it is safe to use the - // simple form rather than the compound-long-int form that was parsed. - bool _has_int_index_after_convI2L; - int _int_index_after_convI2L_offset; - Node* _int_index_after_convI2L_invar; - int _int_index_after_convI2L_scale; - - Node_Stack* _nstack; // stack used to record a vpointer trace of variants - bool _analyze_only; // Used in loop unrolling only for vpointer trace - uint _stack_idx; // Used in loop unrolling only for vpointer trace - - 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; - - // Match: k*iv + offset - bool scaled_iv_plus_offset(Node* n); - // Match: k*iv where k is a constant that's not zero - bool scaled_iv(Node* n); - // Match: offset is (k [+/- invariant]) - bool offset_plus_k(Node* n, bool negate = false); - - public: - enum CMP { - Less = 1, - Greater = 2, - Equal = 4, - NotEqual = (Less | Greater), - NotComparable = (Less | Greater | Equal) - }; + VPointer(const VLoop& vloop, + const MemPointer& mem_pointer, + const bool must_be_invalid = false) : + _vloop(vloop), + _mem_pointer(mem_pointer), + _iv_scale(init_iv_scale()), + _is_valid(!must_be_invalid && init_is_valid()) {} - VPointer(MemNode* const mem, const VLoop& vloop) : - VPointer(mem, vloop, nullptr, false) {} - VPointer(MemNode* const mem, const VLoop& vloop, Node_Stack* nstack) : - VPointer(mem, vloop, nstack, true) {} - private: - VPointer(MemNode* const mem, const VLoop& vloop, - Node_Stack* nstack, bool analyze_only); - // Following is used to create a temporary object during - // the pattern match of an address expression. - VPointer(VPointer* p); - NONCOPYABLE(VPointer); - - bool is_safe_to_use_as_simple_form(Node* base, Node* adr) const; - - public: - bool valid() const { return _adr != nullptr; } - bool has_iv() const { return _scale != 0; } - - Node* base() const { return _base; } - Node* adr() const { return _adr; } - MemNode* mem() const { return _mem; } - int scale_in_bytes() const { return _scale; } - Node* invar() const { return _invar; } - int offset_in_bytes() const { return _offset; } - int memory_size() const { return _mem->memory_size(); } - Node_Stack* node_stack() const { return _nstack; } - - // Biggest detectable factor of the invariant. - int invar_factor() const; - - // Comparable? - bool invar_equals(const VPointer& q) const { - assert(_debug_invar == NodeSentinel || q._debug_invar == NodeSentinel || - (_invar == q._invar) == (_debug_invar == q._debug_invar && - _debug_invar_scale == q._debug_invar_scale && - _debug_negate_invar == q._debug_negate_invar), ""); - return _invar == q._invar; + VPointer make_invalid() const { + return VPointer(_vloop, mem_pointer(), true /* must be invalid*/); } - // We compute if and how two VPointers can alias at runtime, i.e. if the two addressed regions of memory can - // ever overlap. There are essentially 3 relevant return states: - // - NotComparable: Synonymous to "unknown aliasing". - // We have no information about how the two VPointers can alias. They could overlap, refer - // to another location in the same memory object, or point to a completely different object. - // -> Memory edge required. Aliasing unlikely but possible. - // - // - Less / Greater: Synonymous to "never aliasing". - // The two VPointers may point into the same memory object, but be non-aliasing (i.e. we - // know both address regions inside the same memory object, but these regions are non- - // overlapping), or the VPointers point to entirely different objects. - // -> No memory edge required. Aliasing impossible. - // - // - Equal: Synonymous to "overlap, or point to different memory objects". - // The two VPointers either overlap on the same memory object, or point to two different - // memory objects. - // -> Memory edge required. Aliasing likely. - // - // In a future refactoring, we can simplify to two states: - // - NeverAlias: instead of Less / Greater - // - MayAlias: instead of Equal / NotComparable - // - // Two VPointer are "comparable" (Less / Greater / Equal), iff all of these conditions apply: - // 1) Both are valid, i.e. expressible in the compound-long-int or simple form. - // 2) The adr are identical, or both are array bases of different arrays. - // 3) They have identical scale. - // 4) They have identical invar. - // 5) The difference in offsets is limited: abs(offset0 - offset1) < 2^31. - int cmp(const VPointer& q) const { - if (valid() && q.valid() && - (_adr == q._adr || (_base == _adr && q._base == q._adr)) && - _scale == q._scale && invar_equals(q)) { - jlong difference = abs(java_subtract((jlong)_offset, (jlong)q._offset)); - jlong max_diff = (jlong)1 << 31; - if (difference >= max_diff) { - return NotComparable; - } - bool overlap = q._offset < _offset + memory_size() && - _offset < q._offset + q.memory_size(); - return overlap ? Equal : (_offset < q._offset ? Less : Greater); - } else { - return NotComparable; +public: + VPointer(const MemNode* mem, + const VLoop& vloop, + MemPointerParserCallback& callback = MemPointerParserCallback::empty()) : + VPointer(vloop, + MemPointer(mem, + callback + NOT_PRODUCT(COMMA vloop.mptrace()))) + { +#ifndef PRODUCT + if (vloop.mptrace().is_trace_parsing()) { + tty->print_cr("VPointer::VPointer:"); + tty->print("mem: "); mem->dump(); + print_on(tty); } +#endif } - bool overlap_possible_with_any_in(const GrowableArray& nodes) const { - for (int i = 0; i < nodes.length(); i++) { - MemNode* mem = nodes.at(i)->as_Mem(); - 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. - if (!not_equal(p_mem)) { - return true; - } + VPointer make_with_size(const jint new_size) const { + const VPointer p(_vloop, mem_pointer().make_with_size(new_size)); +#ifndef PRODUCT + if (_vloop.mptrace().is_trace_parsing()) { + tty->print_cr("VPointer::make_with_size:"); + tty->print(" old: "); print_on(tty); + tty->print(" new: "); p.print_on(tty); } - return false; +#endif + return p; } - bool not_equal(const VPointer& q) const { return not_equal(cmp(q)); } - bool equal(const VPointer& q) const { return equal(cmp(q)); } - bool comparable(const VPointer& q) const { return comparable(cmp(q)); } - static bool not_equal(int cmp) { return cmp <= NotEqual; } - static bool equal(int cmp) { return cmp == Equal; } - static bool comparable(int cmp) { return cmp < NotComparable; } - - // We need to be able to sort the VPointer to efficiently group the - // memops into groups, and to find adjacent memops. - static int cmp_for_sort_by_group(const VPointer** p1, const VPointer** p2); - static int cmp_for_sort(const VPointer** p1, const VPointer** p2); - - NOT_PRODUCT( void print() const; ) - NOT_PRODUCT( static void print_con_or_idx(const Node* n); ) - + // old_pointer = base + invar + iv_scale * iv + con + // new_pointer = base + invar + iv_scale * (iv + iv_offset) + con + // = base + invar + iv_scale * iv + (con + iv_scale * iv_offset) + VPointer make_with_iv_offset(const jint iv_offset) const { + NoOverflowInt new_con = NoOverflowInt(con()) + NoOverflowInt(iv_scale()) * NoOverflowInt(iv_offset); + if (new_con.is_NaN()) { #ifndef PRODUCT - class Tracer { - friend class VPointer; - bool _is_trace_alignment; - static int _depth; - int _depth_save; - void print_depth() const; - int depth() const { return _depth; } - void set_depth(int d) { _depth = d; } - void inc_depth() { _depth++; } - void dec_depth() { if (_depth > 0) _depth--; } - void store_depth() { _depth_save = _depth; } - void restore_depth() { _depth = _depth_save; } - - class Depth { - friend class VPointer; - Depth() { ++_depth; } - Depth(int x) { _depth = 0; } - ~Depth() { if (_depth > 0) --_depth; } - }; - Tracer(bool is_trace_alignment) : _is_trace_alignment(is_trace_alignment) {} - - // tracing functions - void ctor_1(const Node* mem); - void ctor_2(Node* adr); - void ctor_3(Node* adr, int i); - void ctor_4(Node* adr, int i); - void ctor_5(Node* adr, Node* base, int i); - void ctor_6(const Node* mem); - - void scaled_iv_plus_offset_1(Node* n); - void scaled_iv_plus_offset_2(Node* n); - void scaled_iv_plus_offset_3(Node* n); - void scaled_iv_plus_offset_4(Node* n); - void scaled_iv_plus_offset_5(Node* n); - void scaled_iv_plus_offset_6(Node* n); - void scaled_iv_plus_offset_7(Node* n); - void scaled_iv_plus_offset_8(Node* n); - - void scaled_iv_1(Node* n); - void scaled_iv_2(Node* n, int scale); - void scaled_iv_3(Node* n, int scale); - void scaled_iv_4(Node* n, int scale); - void scaled_iv_5(Node* n, int scale); - void scaled_iv_6(Node* n, int scale); - void scaled_iv_7(Node* n); - void scaled_iv_8(Node* n, VPointer* tmp); - void scaled_iv_9(Node* n, int _scale, int _offset, Node* _invar); - void scaled_iv_10(Node* n); - - void offset_plus_k_1(Node* n); - void offset_plus_k_2(Node* n, int _offset); - void offset_plus_k_3(Node* n, int _offset); - void offset_plus_k_4(Node* n); - void offset_plus_k_5(Node* n, Node* _invar); - void offset_plus_k_6(Node* n, Node* _invar, bool _negate_invar, int _offset); - void offset_plus_k_7(Node* n, Node* _invar, bool _negate_invar, int _offset); - void offset_plus_k_8(Node* n, Node* _invar, bool _negate_invar, int _offset); - void offset_plus_k_9(Node* n, Node* _invar, bool _negate_invar, int _offset); - void offset_plus_k_10(Node* n, Node* _invar, bool _negate_invar, int _offset); - void offset_plus_k_11(Node* n); - } _tracer; // Tracer + if (_vloop.mptrace().is_trace_parsing()) { + tty->print_cr("VPointer::make_with_iv_offset:"); + tty->print(" old: "); print_on(tty); + tty->print_cr(" new con overflow (iv_offset: %d) -> invalid VPointer.", iv_offset); + } #endif + return make_invalid(); + } + const VPointer p(_vloop, mem_pointer().make_with_con(new_con)); +#ifndef PRODUCT + if (_vloop.mptrace().is_trace_parsing()) { + tty->print_cr("VPointer::make_with_iv_offset:"); + tty->print(" old: "); print_on(tty); + tty->print(" new: "); p.print_on(tty); + } +#endif + return p; + } - Node* maybe_negate_invar(bool negate, Node* invar); + // Accessors + bool is_valid() const { return _is_valid; } + const MemPointer& mem_pointer() const { assert(_is_valid, "must be valid"); return _mem_pointer; } + jint size() const { assert(_is_valid, "must be valid"); return mem_pointer().size(); } + jint iv_scale() const { assert(_is_valid, "must be valid"); return _iv_scale; } + jint con() const { return mem_pointer().con().value(); } - void maybe_add_to_invar(Node* new_invar, bool negate); + template + void for_each_invar_summand(Callback callback) const { + mem_pointer().for_each_non_empty_summand([&] (const MemPointerSummand& s) { + Node* variable = s.variable(); + if (variable != mem_pointer().base().object_or_native() && + _vloop.is_pre_loop_invariant(variable)) { + callback(s); + } + }); + } - static bool try_AddI_no_overflow(int offset1, int offset2, int& result); - static bool try_SubI_no_overflow(int offset1, int offset2, int& result); - static bool try_AddSubI_no_overflow(int offset1, int offset2, bool is_sub, int& result); - static bool try_LShiftI_no_overflow(int offset1, int offset2, int& result); - static bool try_MulI_no_overflow(int offset1, int offset2, int& result); + // Greatest common factor among the scales of the invar_summands. + // Out of simplicity, we only factor out positive powers-of-2, + // between (inclusive) 1 and ObjectAlignmentInBytes. If the invar + // is empty, i.e. there is no summand in invar_summands, we return 0. + jint compute_invar_factor() const { + jint factor = ObjectAlignmentInBytes; + int invar_count = 0; + for_each_invar_summand([&] (const MemPointerSummand& s) { + invar_count++; + while (!s.scale().is_multiple_of(NoOverflowInt(factor))) { + factor = factor / 2; + } + }); + return invar_count > 0 ? factor : 0; + } - Node* register_if_new(Node* n) const; -}; + bool has_invar_summands() const { + int invar_count = 0; + for_each_invar_summand([&] (const MemPointerSummand& s) { + invar_count++; + }); + return invar_count > 0; + } + + // If we have the same invar_summands, and the same iv summand with the same iv_scale, + // then all summands except the base must be the same. + bool has_same_invar_summands_and_iv_scale_as(const VPointer& other) const { + return mem_pointer().has_same_non_base_summands_as(other.mem_pointer()); + } -// Vector element size statistics for loop vectorization with vector masks -class VectorElementSizeStats { - private: - static const int NO_SIZE = -1; - static const int MIXED_SIZE = -2; - int* _stats; + // Delegate to MemPointer::is_adjacent_to_and_before, but guard for invalid cases + // where we must return a conservative answer: unknown adjacency, return false. + bool is_adjacent_to_and_before(const VPointer& other) const { + if (!is_valid() || !other.is_valid()) { +#ifndef PRODUCT + if (_vloop.mptrace().is_trace_overlap()) { + tty->print_cr("VPointer::is_adjacent_to_and_before: invalid VPointer, adjacency unknown."); + } +#endif + return false; + } + return mem_pointer().is_adjacent_to_and_before(other.mem_pointer()); + } - public: - VectorElementSizeStats(Arena* a) : _stats(NEW_ARENA_ARRAY(a, int, 4)) { - clear(); + // Delegate to MemPointer::never_overlaps_with, but guard for invalid cases + // where we must return a conservative answer: unknown overlap, return false. + bool never_overlaps_with(const VPointer& other) const { + if (!is_valid() || !other.is_valid()) { +#ifndef PRODUCT + if (_vloop.mptrace().is_trace_overlap()) { + tty->print_cr("VPointer::never_overlaps_with: invalid VPointer, overlap unknown."); + } +#endif + return false; + } + return mem_pointer().never_overlaps_with(other.mem_pointer()); } - void clear() { memset(_stats, 0, sizeof(int) * 4); } + NOT_PRODUCT( void print_on(outputStream* st, bool end_with_cr = true) const; ) - void record_size(int size) { - assert(1 <= size && size <= 8 && is_power_of_2(size), "Illegal size"); - _stats[exact_log2(size)]++; +private: + jint init_iv_scale() const { + for (uint i = 0; i < MemPointer::SUMMANDS_SIZE; i++) { + const MemPointerSummand& summand = _mem_pointer.summands_at(i); + Node* variable = summand.variable(); + if (variable == _vloop.iv()) { + return summand.scale().value(); + } + } + // No summand with variable == iv. + return 0; } - int count_size(int size) { - assert(1 <= size && size <= 8 && is_power_of_2(size), "Illegal size"); - return _stats[exact_log2(size)]; + // Check the conditions for a "valid" VPointer. + bool init_is_valid() const { + return init_is_base_known() && + init_are_non_iv_summands_pre_loop_invariant() && + init_are_scale_and_stride_not_too_large(); } - int smallest_size() { - for (int i = 0; i <= 3; i++) { - if (_stats[i] > 0) return (1 << i); + // VPointer needs to know if it is native (off-heap) or object (on-heap). + // We may, for example, have failed to fully decompose the MemPointer, + // possibly because such a decomposition is not considered safe. + bool init_is_base_known() const { + if (_mem_pointer.base().is_known()) { return true; } + +#ifndef PRODUCT + if (_vloop.mptrace().is_trace_parsing()) { + tty->print_cr("VPointer::init_is_valid: base not known."); } - return NO_SIZE; +#endif + return false; } - int largest_size() { - for (int i = 3; i >= 0; i--) { - if (_stats[i] > 0) return (1 << i); + // All summands, except the iv-summand, must be pre-loop invariant. This is necessary + // so that we can use the variables in checks inside or before the pre-loop, e.g. for + // alignment. + bool init_are_non_iv_summands_pre_loop_invariant() const { + for (uint i = 0; i < MemPointer::SUMMANDS_SIZE; i++) { + const MemPointerSummand& summand = _mem_pointer.summands_at(i); + Node* variable = summand.variable(); + if (variable != nullptr && variable != _vloop.iv() && !_vloop.is_pre_loop_invariant(variable)) { +#ifndef PRODUCT + if (_vloop.mptrace().is_trace_parsing()) { + tty->print("VPointer::init_is_valid: summand is not pre-loop invariant: "); + summand.print_on(tty); + tty->cr(); + } +#endif + return false; + } } - return NO_SIZE; + return true; } - int unique_size() { - int small = smallest_size(); - int large = largest_size(); - return (small == large) ? small : MIXED_SIZE; + // In the pointer analysis, and especially the AlignVector analysis, we assume that + // stride and scale are not too large. For example, we multiply "iv_scale * iv_stride", + // and assume that this does not overflow the int range. We also take "abs(iv_scale)" + // and "abs(iv_stride)", which would overflow for min_int = -(2^31). Still, we want + // to at least allow small and moderately large stride and scale. Therefore, we + // allow values up to 2^30, which is only a factor 2 smaller than the max/min int. + // Normal performance relevant code will have much lower values. And the restriction + // allows us to keep the rest of the autovectorization code much simpler, since we + // do not have to deal with overflows. + bool init_are_scale_and_stride_not_too_large() const { + jlong long_iv_scale = _iv_scale; + jlong long_iv_stride = _vloop.iv_stride(); + jlong max_val = 1 << 30; + if (abs(long_iv_scale) >= max_val || + abs(long_iv_stride) >= max_val || + abs(long_iv_scale * long_iv_stride) >= max_val) { +#ifndef PRODUCT + if (_vloop.mptrace().is_trace_parsing()) { + tty->print_cr("VPointer::init_is_valid: scale or stride too large."); + } +#endif + return false; + } + return true; } }; // When alignment is required, we must adjust the pre-loop iteration count pre_iter, // such that the address is aligned for any main_iter >= 0: // -// adr = base + offset + invar + scale * init -// + scale * pre_stride * pre_iter -// + scale * main_stride * main_iter +// adr = base + invar + iv_scale * init + con +// + iv_scale * pre_stride * pre_iter +// + iv_scale * main_stride * main_iter // // The AlignmentSolver generates solutions of the following forms: // 1. Empty: No pre_iter guarantees alignment. @@ -1009,9 +1000,9 @@ class VectorElementSizeStats { // // The Constrained solution is of the following form: // -// pre_iter = m * q + r (for any integer m) -// [- invar / (scale * pre_stride) ] (if there is an invariant) -// [- init / pre_stride ] (if init is variable) +// pre_iter = m * q + r (for any integer m) +// [- invar / (iv_scale * pre_stride) ] (if there is an invariant) +// [- init / pre_stride ] (if init is variable) // // The solution is periodic with periodicity q, which is guaranteed to be a power of 2. // This periodic solution is "rotated" by three alignment terms: one for constants (r), @@ -1037,7 +1028,7 @@ class AlignmentSolution : public ResourceObj { // Implemented by each subclass virtual const AlignmentSolution* filter(const AlignmentSolution* other) const = 0; - virtual void print() const = 0; + NOT_PRODUCT( virtual void print() const = 0; ) // Compute modulo and ensure that we get a positive remainder static int mod(int i, int q) { @@ -1071,9 +1062,11 @@ class EmptyAlignmentSolution : public AlignmentSolution { return new EmptyAlignmentSolution("empty solution input to filter"); } +#ifndef PRODUCT virtual void print() const override final { tty->print_cr("empty solution: %s", reason()); }; +#endif }; class TrivialAlignmentSolution : public AlignmentSolution { @@ -1094,9 +1087,11 @@ class TrivialAlignmentSolution : public AlignmentSolution { return other; } +#ifndef PRODUCT virtual void print() const override final { tty->print_cr("pre_iter >= 0 (trivial)"); }; +#endif }; class ConstrainedAlignmentSolution : public AlignmentSolution { @@ -1104,19 +1099,18 @@ class ConstrainedAlignmentSolution : public AlignmentSolution { const MemNode* _mem_ref; const int _q; const int _r; - const Node* _invar; - const int _scale; + // Use VPointer for invar and iv_scale + const VPointer& _vpointer; public: ConstrainedAlignmentSolution(const MemNode* mem_ref, const int q, const int r, - const Node* invar, - int scale) : + const VPointer& vpointer) : _mem_ref(mem_ref), _q(q), _r(r), - _invar(invar), - _scale(scale) { + _vpointer(vpointer) + { assert(q > 1 && is_power_of_2(q), "q must be power of 2"); assert(0 <= r && r < q, "r must be in modulo space of q"); assert(_mem_ref != nullptr, "must have mem_ref"); @@ -1127,6 +1121,7 @@ class ConstrainedAlignmentSolution : public AlignmentSolution { virtual bool is_constrained() const override final { return true; } const MemNode* mem_ref() const { return _mem_ref; } + const VPointer& vpointer() const { return _vpointer; } virtual const ConstrainedAlignmentSolution* as_constrained() const override final { return this; } @@ -1150,12 +1145,12 @@ class ConstrainedAlignmentSolution : public AlignmentSolution { // for any integers m1 and m2: // // pre_iter = m1 * q1 + r1 - // [- invar1 / (scale1 * pre_stride) ] - // [- init / pre_stride ] + // [- invar1 / (iv_scale1 * pre_stride) ] + // [- init / pre_stride ] // // pre_iter = m2 * q2 + r2 - // [- invar2 / (scale2 * pre_stride) ] - // [- init / pre_stride ] + // [- invar2 / (iv_scale2 * pre_stride) ] + // [- init / pre_stride ] // // Note: pre_stride and init are identical for all mem_refs in the loop. // @@ -1164,13 +1159,15 @@ class ConstrainedAlignmentSolution : public AlignmentSolution { // // The invar alignment term is identical if either: // - both mem_refs have no invariant. - // - both mem_refs have the same invariant and the same scale. + // - both mem_refs have the same invariant and the same iv_scale. // - if (s1->_invar != s2->_invar) { - return new EmptyAlignmentSolution("invar not identical"); - } - if (s1->_invar != nullptr && s1->_scale != s2->_scale) { - return new EmptyAlignmentSolution("has invar with different scale"); + // Use VPointer to do checks on invar and iv_scale: + const VPointer& p1 = s1->vpointer(); + const VPointer& p2 = s2->vpointer(); + bool both_no_invar = !p1.has_invar_summands() && + !p2.has_invar_summands(); + if(!both_no_invar && !p1.has_same_invar_summands_and_iv_scale_as(p2)) { + return new EmptyAlignmentSolution("invar alignment term not identical"); } // Now, we have reduced the problem to: @@ -1209,13 +1206,24 @@ class ConstrainedAlignmentSolution : public AlignmentSolution { return s2; // return the subset } +#ifndef PRODUCT virtual void print() const override final { tty->print("m * q(%d) + r(%d)", _q, _r); - if (_invar != nullptr) { - tty->print(" - invar[%d] / (scale(%d) * pre_stride)", _invar->_idx, _scale); + if (_vpointer.has_invar_summands()) { + tty->print(" - invar("); + int count = 0; + _vpointer.for_each_invar_summand([&] (const MemPointerSummand& s) { + if (count > 0) { + tty->print(" + "); + } + s.print_on(tty); + count++; + }); + tty->print(") / (iv_scale(%d) * pre_stride)", _vpointer.iv_scale()); } tty->print_cr(" [- init / pre_stride], mem_ref[%d]", mem_ref()->_idx); }; +#endif }; // When strict alignment is required (e.g. -XX:+AlignVector), then we must ensure @@ -1230,8 +1238,8 @@ class ConstrainedAlignmentSolution : public AlignmentSolution { // // pre-loop: // iv = init + i * pre_stride -// adr = base + offset + invar + scale * iv -// adr = base + offset + invar + scale * (init + i * pre_stride) +// adr = base + invar + iv_scale * iv + con +// adr = base + invar + iv_scale * (init + i * pre_stride) + con // iv += pre_stride // i++ // @@ -1245,7 +1253,7 @@ class ConstrainedAlignmentSolution : public AlignmentSolution { // i = pre_iter + main_iter * unroll_factor // iv = init + i * pre_stride = init + pre_iter * pre_stride + main_iter * unroll_factor * pre_stride // = init + pre_iter * pre_stride + main_iter * main_stride -// adr = base + offset + invar + scale * iv // must be aligned +// adr = base + invar + iv_scale * iv + con // must be aligned // iv += main_stride // i += unroll_factor // main_iter++ @@ -1257,15 +1265,15 @@ class ConstrainedAlignmentSolution : public AlignmentSolution { // a compatible solutions. class AlignmentSolver { private: + const VPointer& _vpointer; + const MemNode* _mem_ref; // first element - const uint _vector_length; // number of elements in vector - const int _element_size; const int _vector_width; // in bytes // All vector loads and stores need to be memory aligned. The alignment width (aw) in // principle is the vector_width. But when vector_width > ObjectAlignmentInBytes this is // too strict, since any memory object is only guaranteed to be ObjectAlignmentInBytes - // aligned. For example, the relative offset between two arrays is only guaranteed to + // aligned. For example, the relative distance between two arrays is only guaranteed to // be divisible by ObjectAlignmentInBytes. const int _aw; @@ -1275,7 +1283,7 @@ class AlignmentSolver { // // The Simple form of the address is disassembled by VPointer into: // - // adr = base + offset + invar + scale * iv + // adr = base + invar + iv_scale * iv + con // // Where the iv can be written as: // @@ -1284,11 +1292,6 @@ class AlignmentSolver { // pre_iter: number of pre-loop iterations (adjustable via pre-loop limit) // main_iter: number of main-loop iterations (main_iter >= 0) // - const Node* _base; // base of address (e.g. Java array object, aw-aligned) - const int _offset; - const Node* _invar; - const int _invar_factor; // known constant factor of invar - const int _scale; const Node* _init_node; // value of iv before pre-loop const int _pre_stride; // address increment per pre-loop iteration const int _main_stride; // address increment per main-loop iteration @@ -1301,28 +1304,18 @@ class AlignmentSolver { } public: - AlignmentSolver(const MemNode* mem_ref, + AlignmentSolver(const VPointer& vpointer, + const MemNode* mem_ref, const uint vector_length, - const Node* base, - const int offset, - const Node* invar, - const int invar_factor, - const int scale, const Node* init_node, const int pre_stride, const int main_stride DEBUG_ONLY( COMMA const bool is_trace) ) : + _vpointer( vpointer), _mem_ref( mem_ref_not_null(mem_ref)), - _vector_length( vector_length), - _element_size( _mem_ref->memory_size()), - _vector_width( _vector_length * _element_size), + _vector_width( vector_length * vpointer.size()), _aw( MIN2(_vector_width, ObjectAlignmentInBytes)), - _base( base), - _offset( offset), - _invar( invar), - _invar_factor( invar_factor), - _scale( scale), _init_node( init_node), _pre_stride( pre_stride), _main_stride( main_stride) @@ -1336,6 +1329,9 @@ class AlignmentSolver { AlignmentSolution* solve() const; private: + MemPointer::Base base() const { return _vpointer.mem_pointer().base();} + jint iv_scale() const { return _vpointer.iv_scale(); } + class EQ4 { private: const int _C_const; diff --git a/src/hotspot/share/opto/vectornode.cpp b/src/hotspot/share/opto/vectornode.cpp index 33429dfacad0c..4ef864fe9c445 100644 --- a/src/hotspot/share/opto/vectornode.cpp +++ b/src/hotspot/share/opto/vectornode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "memory/allocation.inline.hpp" #include "opto/connode.hpp" #include "opto/mulnode.hpp" @@ -666,7 +665,7 @@ VectorNode* VectorNode::make_mask_node(int vopc, Node* n1, Node* n2, uint vlen, } } -// Make a vector node for binary operation +// Make a vector node for unary or binary operation VectorNode* VectorNode::make(int vopc, Node* n1, Node* n2, const TypeVect* vt, bool is_mask, bool is_var_shift, bool is_unsigned) { // This method should not be called for unimplemented vectors. guarantee(vopc > 0, "vopc must be > 0"); @@ -747,6 +746,9 @@ VectorNode* VectorNode::make(int vopc, Node* n1, Node* n2, const TypeVect* vt, b case Op_URShiftVI: return new URShiftVINode(n1, n2, vt, is_var_shift); case Op_URShiftVL: return new URShiftVLNode(n1, n2, vt, is_var_shift); + case Op_LShiftCntV: return new LShiftCntVNode(n1, vt); + case Op_RShiftCntV: return new RShiftCntVNode(n1, vt); + case Op_AndV: return new AndVNode(n1, n2, vt); case Op_OrV: return new OrVNode (n1, n2, vt); case Op_XorV: return new XorVNode(n1, n2, vt); @@ -766,6 +768,18 @@ VectorNode* VectorNode::make(int vopc, Node* n1, Node* n2, const TypeVect* vt, b case Op_SaturatingAddV: return new SaturatingAddVNode(n1, n2, vt, is_unsigned); case Op_SaturatingSubV: return new SaturatingSubVNode(n1, n2, vt, is_unsigned); + case Op_VectorCastB2X: return new VectorCastB2XNode(n1, vt); + case Op_VectorCastS2X: return new VectorCastS2XNode(n1, vt); + case Op_VectorCastI2X: return new VectorCastI2XNode(n1, vt); + case Op_VectorCastL2X: return new VectorCastL2XNode(n1, vt); + case Op_VectorCastF2X: return new VectorCastF2XNode(n1, vt); + case Op_VectorCastD2X: return new VectorCastD2XNode(n1, vt); + case Op_VectorUCastB2X: return new VectorUCastB2XNode(n1, vt); + case Op_VectorUCastS2X: return new VectorUCastS2XNode(n1, vt); + case Op_VectorUCastI2X: return new VectorUCastI2XNode(n1, vt); + case Op_VectorCastHF2F: return new VectorCastHF2FNode(n1, vt); + case Op_VectorCastF2HF: return new VectorCastF2HFNode(n1, vt); + default: fatal("Missed vector creation for '%s'", NodeClassNames[vopc]); return nullptr; @@ -791,6 +805,7 @@ VectorNode* VectorNode::make(int vopc, Node* n1, Node* n2, Node* n3, const TypeV case Op_SelectFromTwoVector: return new SelectFromTwoVectorNode(n1, n2, n3, vt); case Op_SignumVD: return new SignumVDNode(n1, n2, n3, vt); case Op_SignumVF: return new SignumVFNode(n1, n2, n3, vt); + case Op_VectorBlend: return new VectorBlendNode(n1, n2, n3); default: fatal("Missed vector creation for '%s'", NodeClassNames[vopc]); return nullptr; @@ -818,22 +833,26 @@ VectorNode* VectorNode::scalar2vector(Node* s, uint vlen, BasicType bt, bool is_ } VectorNode* VectorNode::shift_count(int opc, Node* cnt, uint vlen, BasicType bt) { - // Match shift count type with shift vector type. + int vopc = VectorNode::shift_count_opcode(opc); const TypeVect* vt = TypeVect::make(bt, vlen); + return VectorNode::make(vopc, cnt, nullptr, vt); +} + +int VectorNode::shift_count_opcode(int opc) { switch (opc) { case Op_LShiftI: case Op_LShiftL: - return new LShiftCntVNode(cnt, vt); + return Op_LShiftCntV; case Op_RShiftI: case Op_RShiftL: case Op_URShiftB: case Op_URShiftS: case Op_URShiftI: case Op_URShiftL: - return new RShiftCntVNode(cnt, vt); + return Op_RShiftCntV; default: - fatal("Missed vector creation for '%s'", NodeClassNames[opc]); - return nullptr; + fatal("Node class '%s' is not supported for shift count", NodeClassNames[opc]); + return -1; } } @@ -1412,24 +1431,9 @@ VectorStoreMaskNode* VectorStoreMaskNode::make(PhaseGVN& gvn, Node* in, BasicTyp return new VectorStoreMaskNode(in, gvn.intcon(elem_size), vt); } -VectorCastNode* VectorCastNode::make(int vopc, Node* n1, BasicType bt, uint vlen) { +VectorNode* VectorCastNode::make(int vopc, Node* n1, BasicType bt, uint vlen) { const TypeVect* vt = TypeVect::make(bt, vlen); - switch (vopc) { - case Op_VectorCastB2X: return new VectorCastB2XNode(n1, vt); - case Op_VectorCastS2X: return new VectorCastS2XNode(n1, vt); - case Op_VectorCastI2X: return new VectorCastI2XNode(n1, vt); - case Op_VectorCastL2X: return new VectorCastL2XNode(n1, vt); - case Op_VectorCastF2X: return new VectorCastF2XNode(n1, vt); - case Op_VectorCastD2X: return new VectorCastD2XNode(n1, vt); - case Op_VectorUCastB2X: return new VectorUCastB2XNode(n1, vt); - case Op_VectorUCastS2X: return new VectorUCastS2XNode(n1, vt); - case Op_VectorUCastI2X: return new VectorUCastI2XNode(n1, vt); - case Op_VectorCastHF2F: return new VectorCastHF2FNode(n1, vt); - case Op_VectorCastF2HF: return new VectorCastF2HFNode(n1, vt); - default: - assert(false, "unknown node: %s", NodeClassNames[vopc]); - return nullptr; - } + return VectorNode::make(vopc, n1, nullptr, vt); } int VectorCastNode::opcode(int sopc, BasicType bt, bool is_signed) { diff --git a/src/hotspot/share/opto/vectornode.hpp b/src/hotspot/share/opto/vectornode.hpp index f5574ba79e3c5..0bd1c71d7e628 100644 --- a/src/hotspot/share/opto/vectornode.hpp +++ b/src/hotspot/share/opto/vectornode.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -95,6 +95,8 @@ class VectorNode : public TypeNode { static int opcode(int sopc, BasicType bt); // scalar_opc -> vector_opc static int scalar_opcode(int vopc, BasicType bt); // vector_opc -> scalar_opc + static int shift_count_opcode(int opc); + // Limits on vector size (number of elements) for auto-vectorization. static bool vector_size_supported_auto_vectorization(const BasicType bt, int size); static bool implemented(int opc, uint vlen, BasicType bt); @@ -1764,7 +1766,7 @@ class VectorCastNode : public VectorNode { VectorCastNode(Node* in, const TypeVect* vt) : VectorNode(in, vt) {} virtual int Opcode() const; - static VectorCastNode* make(int vopc, Node* n1, BasicType bt, uint vlen); + static VectorNode* make(int vopc, Node* n1, BasicType bt, uint vlen); static int opcode(int opc, BasicType bt, bool is_signed = true); static bool implemented(int opc, uint vlen, BasicType src_type, BasicType dst_type); diff --git a/src/hotspot/share/opto/vtransform.cpp b/src/hotspot/share/opto/vtransform.cpp index d09a4c899f685..4730f3ac1343b 100644 --- a/src/hotspot/share/opto/vtransform.cpp +++ b/src/hotspot/share/opto/vtransform.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "opto/vtransform.hpp" #include "opto/vectornode.hpp" #include "opto/convertnode.hpp" @@ -144,57 +143,47 @@ void VTransformApplyResult::trace(VTransformNode* vtnode) const { } #endif -// We use two comparisons, because a subtraction could underflow. -#define RETURN_CMP_VALUE_IF_NOT_EQUAL(a, b) \ - if (a < b) { return -1; } \ - if (a > b) { return 1; } - // Helper-class for VTransformGraph::has_store_to_load_forwarding_failure. -// It represents a memory region: [ptr, ptr + memory_size) -class VMemoryRegion : public StackObj { +// It wraps a VPointer. The VPointer has an iv_offset applied, which +// simulates a virtual unrolling. They represent the memory region: +// [adr, adr + size) +// adr = base + invar + iv_scale * (iv + iv_offset) + con +class VMemoryRegion : public ResourceObj { private: - Node* _base; // ptr = base + offset + invar + scale * iv - int _scale; - Node* _invar; - int _offset; - uint _memory_size; + // Note: VPointer has no default constructor, so we cannot use VMemoryRegion + // in-place in a GrowableArray. Hence, we make VMemoryRegion a resource + // allocated object, so the GrowableArray of VMemoryRegion* has a default + // nullptr element. + const VPointer _vpointer; bool _is_load; // load or store? uint _schedule_order; public: - VMemoryRegion() {} // empty constructor for GrowableArray - VMemoryRegion(const VPointer& vpointer, int iv_offset, int vector_length, uint schedule_order) : - _base(vpointer.base()), - _scale(vpointer.scale_in_bytes()), - _invar(vpointer.invar()), - _offset(vpointer.offset_in_bytes() + _scale * iv_offset), - _memory_size(vpointer.memory_size() * vector_length), - _is_load(vpointer.mem()->is_Load()), + VMemoryRegion(const VPointer& vpointer, bool is_load, uint schedule_order) : + _vpointer(vpointer), + _is_load(is_load), _schedule_order(schedule_order) {} - Node* base() const { return _base; } - int scale() const { return _scale; } - Node* invar() const { return _invar; } - int offset() const { return _offset; } - uint memory_size() const { return _memory_size; } + const VPointer& vpointer() const { return _vpointer; } bool is_load() const { return _is_load; } uint schedule_order() const { return _schedule_order; } static int cmp_for_sort_by_group(VMemoryRegion* r1, VMemoryRegion* r2) { - RETURN_CMP_VALUE_IF_NOT_EQUAL(r1->base()->_idx, r2->base()->_idx); - RETURN_CMP_VALUE_IF_NOT_EQUAL(r1->scale(), r2->scale()); - int r1_invar_idx = r1->invar() == nullptr ? 0 : r1->invar()->_idx; - int r2_invar_idx = r2->invar() == nullptr ? 0 : r2->invar()->_idx; - RETURN_CMP_VALUE_IF_NOT_EQUAL(r1_invar_idx, r2_invar_idx); - return 0; // equal + // Sort by mem_pointer (base, invar, iv_scale), except for the con. + return MemPointer::cmp_summands(r1->vpointer().mem_pointer(), + r2->vpointer().mem_pointer()); } - static int cmp_for_sort(VMemoryRegion* r1, VMemoryRegion* r2) { - int cmp_group = cmp_for_sort_by_group(r1, r2); + static int cmp_for_sort(VMemoryRegion** r1, VMemoryRegion** r2) { + int cmp_group = cmp_for_sort_by_group(*r1, *r2); if (cmp_group != 0) { return cmp_group; } - RETURN_CMP_VALUE_IF_NOT_EQUAL(r1->offset(), r2->offset()); - return 0; // equal + // We use two comparisons, because a subtraction could underflow. + jint con1 = (*r1)->vpointer().con(); + jint con2 = (*r2)->vpointer().con(); + if (con1 < con2) { return -1; } + if (con1 > con2) { return 1; } + return 0; } enum Aliasing { DIFFERENT_GROUP, BEFORE, EXACT_OVERLAP, PARTIAL_OVERLAP, AFTER }; @@ -204,26 +193,23 @@ class VMemoryRegion : public StackObj { VMemoryRegion* p2 = &other; if (cmp_for_sort_by_group(p1, p2) != 0) { return DIFFERENT_GROUP; } - jlong offset1 = p1->offset(); - jlong offset2 = p2->offset(); - jlong memory_size1 = p1->memory_size(); - jlong memory_size2 = p2->memory_size(); + jlong con1 = p1->vpointer().con(); + jlong con2 = p2->vpointer().con(); + jlong size1 = p1->vpointer().size(); + jlong size2 = p2->vpointer().size(); - if (offset1 >= offset2 + memory_size2) { return AFTER; } - if (offset2 >= offset1 + memory_size1) { return BEFORE; } - if (offset1 == offset2 && memory_size1 == memory_size2) { return EXACT_OVERLAP; } + if (con1 >= con2 + size2) { return AFTER; } + if (con2 >= con1 + size1) { return BEFORE; } + if (con1 == con2 && size1 == size2) { return EXACT_OVERLAP; } return PARTIAL_OVERLAP; } #ifndef PRODUCT void print() const { - tty->print("VMemoryRegion[%s %dbytes, schedule_order(%4d), base", - _is_load ? "load " : "store", _memory_size, _schedule_order); - VPointer::print_con_or_idx(_base); - tty->print(" + offset(%4d)", _offset); - tty->print(" + invar"); - VPointer::print_con_or_idx(_invar); - tty->print_cr(" + scale(%4d) * iv]", _scale); + tty->print("VMemoryRegion[%s schedule_order(%4d), ", + _is_load ? "load, " : "store,", _schedule_order); + vpointer().print_on(tty, false); + tty->print_cr("]"); } #endif }; @@ -329,7 +315,8 @@ bool VTransformGraph::has_store_to_load_forwarding_failure(const VLoopAnalyzer& // Collect all pointers for scalar and vector loads/stores. ResourceMark rm; - GrowableArray memory_regions; + // Use pointers because no default constructor for elements available. + GrowableArray memory_regions; // To detect store-to-load-forwarding failures at the iteration threshold or below, we // simulate a super-unrolling to reach SuperWordStoreToLoadForwardingFailureDetection @@ -351,10 +338,15 @@ bool VTransformGraph::has_store_to_load_forwarding_failure(const VLoopAnalyzer& VTransformNode* vtn = _schedule.at(i); if (vtn->is_load_or_store_in_loop()) { const VPointer& p = vtn->vpointer(vloop_analyzer); - if (p.valid()) { + if (p.is_valid()) { VTransformVectorNode* vector = vtn->isa_Vector(); - uint vector_length = vector != nullptr ? vector->nodes().length() : 1; - memory_regions.push(VMemoryRegion(p, iv_offset, vector_length, schedule_order++)); + bool is_load = vtn->is_load_in_loop(); + const VPointer iv_offset_p(p.make_with_iv_offset(iv_offset)); + if (iv_offset_p.is_valid()) { + // The iv_offset may lead to overflows. This is a heuristic, so we do not + // care too much about those edge cases. + memory_regions.push(new VMemoryRegion(iv_offset_p, is_load, schedule_order++)); + } } } } @@ -369,7 +361,7 @@ bool VTransformGraph::has_store_to_load_forwarding_failure(const VLoopAnalyzer& tty->print_cr(" simulated_unrolling_count = %d", simulated_unrolling_count); tty->print_cr(" simulated_super_unrolling_count = %d", simulated_super_unrolling_count); for (int i = 0; i < memory_regions.length(); i++) { - VMemoryRegion& region = memory_regions.at(i); + VMemoryRegion& region = *memory_regions.at(i); region.print(); } } @@ -377,10 +369,10 @@ bool VTransformGraph::has_store_to_load_forwarding_failure(const VLoopAnalyzer& // For all pairs of pointers in the same group, check if they have a partial overlap. for (int i = 0; i < memory_regions.length(); i++) { - VMemoryRegion& region1 = memory_regions.at(i); + VMemoryRegion& region1 = *memory_regions.at(i); for (int j = i + 1; j < memory_regions.length(); j++) { - VMemoryRegion& region2 = memory_regions.at(j); + VMemoryRegion& region2 = *memory_regions.at(j); const VMemoryRegion::Aliasing aliasing = region1.aliasing(region2); if (aliasing == VMemoryRegion::Aliasing::DIFFERENT_GROUP || @@ -575,12 +567,13 @@ VTransformApplyResult VTransformLoadVectorNode::apply(const VLoopAnalyzer& vloop // Set the memory dependency of the LoadVector as early as possible. // Walk up the memory chain, and ignore any StoreVector that provably // does not have any memory dependency. + const VPointer& load_p = vpointer(vloop_analyzer); while (mem->is_StoreVector()) { - VPointer p_store(mem->as_Mem(), vloop_analyzer.vloop()); - if (p_store.overlap_possible_with_any_in(nodes())) { - break; - } else { + VPointer store_p(mem->as_Mem(), vloop_analyzer.vloop()); + if (store_p.never_overlaps_with(load_p)) { mem = mem->in(MemNode::Memory); + } else { + break; } } diff --git a/src/hotspot/share/opto/vtransform.hpp b/src/hotspot/share/opto/vtransform.hpp index 8ceca318f4ae1..4fc68c7b4dfc2 100644 --- a/src/hotspot/share/opto/vtransform.hpp +++ b/src/hotspot/share/opto/vtransform.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -66,6 +66,7 @@ class VTransformVectorNode; class VTransformElementWiseVectorNode; class VTransformBoolVectorNode; class VTransformReductionVectorNode; +class VTransformMemVectorNode; class VTransformLoadVectorNode; class VTransformStoreVectorNode; @@ -314,9 +315,11 @@ class VTransformNode : public ArenaObj { virtual VTransformElementWiseVectorNode* isa_ElementWiseVector() { return nullptr; } virtual VTransformBoolVectorNode* isa_BoolVector() { return nullptr; } virtual VTransformReductionVectorNode* isa_ReductionVector() { return nullptr; } + virtual VTransformMemVectorNode* isa_MemVector() { return nullptr; } virtual VTransformLoadVectorNode* isa_LoadVector() { return nullptr; } virtual VTransformStoreVectorNode* isa_StoreVector() { return nullptr; } + virtual bool is_load_in_loop() const { return false; } virtual bool is_load_or_store_in_loop() const { return false; } virtual const VPointer& vpointer(const VLoopAnalyzer& vloop_analyzer) const { ShouldNotReachHere(); } @@ -342,6 +345,7 @@ class VTransformScalarNode : public VTransformNode { VTransformNode(vtransform, n->req()), _node(n) {} Node* node() const { return _node; } virtual VTransformScalarNode* isa_Scalar() override { return this; } + virtual bool is_load_in_loop() const override { return _node->is_Load(); } virtual bool is_load_or_store_in_loop() const override { return _node->is_Load() || _node->is_Store(); } virtual const VPointer& vpointer(const VLoopAnalyzer& vloop_analyzer) const override { return vloop_analyzer.vpointers().vpointer(node()->as_Mem()); } virtual VTransformApplyResult apply(const VLoopAnalyzer& vloop_analyzer, @@ -358,6 +362,7 @@ class VTransformInputScalarNode : public VTransformScalarNode { VTransformInputScalarNode(VTransform& vtransform, Node* n) : VTransformScalarNode(vtransform, n) {} virtual VTransformInputScalarNode* isa_InputScalar() override { return this; } + virtual bool is_load_in_loop() const override { return false; } virtual bool is_load_or_store_in_loop() const override { return false; } NOT_PRODUCT(virtual const char* name() const override { return "InputScalar"; };) }; @@ -478,28 +483,40 @@ class VTransformReductionVectorNode : public VTransformVectorNode { NOT_PRODUCT(virtual const char* name() const override { return "ReductionVector"; };) }; -class VTransformLoadVectorNode : public VTransformVectorNode { +class VTransformMemVectorNode : public VTransformVectorNode { +private: + const VPointer _vpointer; // with size of the vector + +public: + VTransformMemVectorNode(VTransform& vtransform, const uint req, uint number_of_nodes, const VPointer& vpointer) : + VTransformVectorNode(vtransform, req, number_of_nodes), + _vpointer(vpointer) {} + + virtual VTransformMemVectorNode* isa_MemVector() override { return this; } + virtual bool is_load_or_store_in_loop() const override { return true; } + virtual const VPointer& vpointer(const VLoopAnalyzer& vloop_analyzer) const override { return _vpointer; } +}; + +class VTransformLoadVectorNode : public VTransformMemVectorNode { public: // req = 3 -> [ctrl, mem, adr] - VTransformLoadVectorNode(VTransform& vtransform, uint number_of_nodes) : - VTransformVectorNode(vtransform, 3, number_of_nodes) {} + VTransformLoadVectorNode(VTransform& vtransform, uint number_of_nodes, const VPointer& vpointer) : + VTransformMemVectorNode(vtransform, 3, number_of_nodes, vpointer) {} LoadNode::ControlDependency control_dependency() const; virtual VTransformLoadVectorNode* isa_LoadVector() override { return this; } - virtual bool is_load_or_store_in_loop() const override { return true; } - virtual const VPointer& vpointer(const VLoopAnalyzer& vloop_analyzer) const override { return vloop_analyzer.vpointers().vpointer(nodes().at(0)->as_Mem()); } + virtual bool is_load_in_loop() const override { return true; } virtual VTransformApplyResult apply(const VLoopAnalyzer& vloop_analyzer, const GrowableArray& vnode_idx_to_transformed_node) const override; NOT_PRODUCT(virtual const char* name() const override { return "LoadVector"; };) }; -class VTransformStoreVectorNode : public VTransformVectorNode { +class VTransformStoreVectorNode : public VTransformMemVectorNode { public: // req = 4 -> [ctrl, mem, adr, val] - VTransformStoreVectorNode(VTransform& vtransform, uint number_of_nodes) : - VTransformVectorNode(vtransform, 4, number_of_nodes) {} + VTransformStoreVectorNode(VTransform& vtransform, uint number_of_nodes, const VPointer& vpointer) : + VTransformMemVectorNode(vtransform, 4, number_of_nodes, vpointer) {} virtual VTransformStoreVectorNode* isa_StoreVector() override { return this; } - virtual bool is_load_or_store_in_loop() const override { return true; } - virtual const VPointer& vpointer(const VLoopAnalyzer& vloop_analyzer) const override { return vloop_analyzer.vpointers().vpointer(nodes().at(0)->as_Mem()); } + virtual bool is_load_in_loop() const override { return false; } virtual VTransformApplyResult apply(const VLoopAnalyzer& vloop_analyzer, const GrowableArray& vnode_idx_to_transformed_node) const override; NOT_PRODUCT(virtual const char* name() const override { return "StoreVector"; };) diff --git a/src/hotspot/share/precompiled/precompiled.hpp b/src/hotspot/share/precompiled/precompiled.hpp index 07922d129697e..a5f42a0fe8688 100644 --- a/src/hotspot/share/precompiled/precompiled.hpp +++ b/src/hotspot/share/precompiled/precompiled.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ // Precompiled headers are turned off if the user passes // --disable-precompiled-headers to configure. -#ifndef DONT_USE_PRECOMPILED_HEADER - // These header files are included in at least 130 C++ files, as of // measurements made in November 2018. This list excludes files named // *.inline.hpp, since including them decreased build performance. @@ -77,5 +75,3 @@ #include "oops/oop.inline.hpp" #include "runtime/handles.inline.hpp" #endif // TARGET_COMPILER_visCPP - -#endif // !DONT_USE_PRECOMPILED_HEADER diff --git a/src/hotspot/share/prims/downcallLinker.cpp b/src/hotspot/share/prims/downcallLinker.cpp index 76a239a1017e4..3d9095f8e13a4 100644 --- a/src/hotspot/share/prims/downcallLinker.cpp +++ b/src/hotspot/share/prims/downcallLinker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "downcallLinker.hpp" #include "gc/shared/gcLocker.inline.hpp" #include "runtime/interfaceSupport.inline.hpp" diff --git a/src/hotspot/share/prims/foreignGlobals.cpp b/src/hotspot/share/prims/foreignGlobals.cpp index 9e74936a43168..d3d0c2cefae0c 100644 --- a/src/hotspot/share/prims/foreignGlobals.cpp +++ b/src/hotspot/share/prims/foreignGlobals.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * questions. */ -#include "precompiled.hpp" #include "foreignGlobals.hpp" #include "classfile/javaClasses.hpp" #include "memory/resourceArea.hpp" diff --git a/src/hotspot/share/prims/forte.cpp b/src/hotspot/share/prims/forte.cpp index a7f48faba137c..10e8b45dc75a2 100644 --- a/src/hotspot/share/prims/forte.cpp +++ b/src/hotspot/share/prims/forte.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "code/debugInfoRec.hpp" #include "code/pcDesc.hpp" #include "gc/shared/collectedHeap.inline.hpp" diff --git a/src/hotspot/share/prims/jni.cpp b/src/hotspot/share/prims/jni.cpp index 4787247d722a2..6de845202781e 100644 --- a/src/hotspot/share/prims/jni.cpp +++ b/src/hotspot/share/prims/jni.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2024 Red Hat, Inc. * Copyright (c) 2021, Azul Systems, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciReplay.hpp" #include "classfile/altHashing.hpp" #include "classfile/classFileStream.hpp" @@ -3790,11 +3789,12 @@ static jint attach_current_thread(JavaVM *vm, void **penv, void *_args, bool dae // be set in order for the Safepoint code to deal with it correctly. thread->set_thread_state(_thread_in_vm); thread->record_stack_base_and_size(); - thread->register_thread_stack_with_NMT(); thread->initialize_thread_current(); + thread->register_thread_stack_with_NMT(); MACOS_AARCH64_ONLY(thread->init_wx()); if (!os::create_attached_thread(thread)) { + thread->unregister_thread_stack_with_NMT(); thread->smr_delete(); return JNI_ERR; } @@ -3839,6 +3839,8 @@ static jint attach_current_thread(JavaVM *vm, void **penv, void *_args, bool dae if (attach_failed) { // Added missing cleanup thread->cleanup_failed_attach_current_thread(daemon); + thread->unregister_thread_stack_with_NMT(); + thread->smr_delete(); return JNI_ERR; } @@ -3935,6 +3937,7 @@ jint JNICALL jni_DetachCurrentThread(JavaVM *vm) { // (platform-dependent) methods where we do alternate stack // maintenance work?) thread->exit(false, JavaThread::jni_detach); + thread->unregister_thread_stack_with_NMT(); thread->smr_delete(); // Go to the execute mode, the initial state of the thread on creation. diff --git a/src/hotspot/share/prims/jniCheck.cpp b/src/hotspot/share/prims/jniCheck.cpp index 8c1f9f53b343d..aa158490eabdd 100644 --- a/src/hotspot/share/prims/jniCheck.cpp +++ b/src/hotspot/share/prims/jniCheck.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/javaClasses.inline.hpp" #include "classfile/vmClasses.hpp" #include "classfile/vmSymbols.hpp" diff --git a/src/hotspot/share/prims/jniFastGetField.cpp b/src/hotspot/share/prims/jniFastGetField.cpp index 7418458e3488d..59ff8a3216e96 100644 --- a/src/hotspot/share/prims/jniFastGetField.cpp +++ b/src/hotspot/share/prims/jniFastGetField.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "prims/jniFastGetField.hpp" address JNI_FastGetField::speculative_load_pclist [LIST_CAPACITY]; diff --git a/src/hotspot/share/prims/jvm.cpp b/src/hotspot/share/prims/jvm.cpp index 12c7898f4cf19..c4803fcfd4af9 100644 --- a/src/hotspot/share/prims/jvm.cpp +++ b/src/hotspot/share/prims/jvm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/cdsConfig.hpp" #include "cds/classListParser.hpp" #include "cds/classListWriter.hpp" @@ -1306,7 +1305,7 @@ JVM_ENTRY(jint, JVM_GetClassModifiers(JNIEnv *env, jclass cls)) } Klass* k = java_lang_Class::as_Klass(mirror); - debug_only(int computed_modifiers = k->compute_modifier_flags()); + debug_only(u2 computed_modifiers = k->compute_modifier_flags()); assert(k->modifier_flags() == computed_modifiers, "modifiers cache is OK"); return k->modifier_flags(); JVM_END @@ -1817,7 +1816,7 @@ JVM_ENTRY(jint, JVM_GetClassAccessFlags(JNIEnv *env, jclass cls)) } Klass* k = java_lang_Class::as_Klass(mirror); - return k->access_flags().as_int() & JVM_ACC_WRITTEN_FLAGS; + return k->access_flags().as_class_flags(); } JVM_END @@ -2460,14 +2459,14 @@ JVM_ENTRY(jint, JVM_GetMethodIxModifiers(JNIEnv *env, jclass cls, int method_ind Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls)); k = JvmtiThreadState::class_to_verify_considering_redefinition(k, thread); Method* method = InstanceKlass::cast(k)->methods()->at(method_index); - return method->access_flags().as_int() & JVM_RECOGNIZED_METHOD_MODIFIERS; + return method->access_flags().as_method_flags(); JVM_END JVM_ENTRY(jint, JVM_GetFieldIxModifiers(JNIEnv *env, jclass cls, int field_index)) Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls)); k = JvmtiThreadState::class_to_verify_considering_redefinition(k, thread); - return InstanceKlass::cast(k)->field_access_flags(field_index) & JVM_RECOGNIZED_FIELD_MODIFIERS; + return InstanceKlass::cast(k)->field_access_flags(field_index); JVM_END @@ -2657,7 +2656,7 @@ JVM_ENTRY(jint, JVM_GetCPFieldModifiers(JNIEnv *env, jclass cls, int cp_index, j InstanceKlass* ik = InstanceKlass::cast(k_called); for (JavaFieldStream fs(ik); !fs.done(); fs.next()) { if (fs.name() == name && fs.signature() == signature) { - return fs.access_flags().as_short() & JVM_RECOGNIZED_FIELD_MODIFIERS; + return fs.access_flags().as_field_flags(); } } return -1; @@ -2686,7 +2685,7 @@ JVM_ENTRY(jint, JVM_GetCPMethodModifiers(JNIEnv *env, jclass cls, int cp_index, for (int i = 0; i < methods_count; i++) { Method* method = methods->at(i); if (method->name() == name && method->signature() == signature) { - return method->access_flags().as_int() & JVM_RECOGNIZED_METHOD_MODIFIERS; + return method->access_flags().as_method_flags(); } } return -1; diff --git a/src/hotspot/share/prims/jvmti.xml b/src/hotspot/share/prims/jvmti.xml index 0afbf56b3fc97..4bff3230c9ee3 100644 --- a/src/hotspot/share/prims/jvmti.xml +++ b/src/hotspot/share/prims/jvmti.xml @@ -1,7 +1,7 @@ \n\n" + - "Java Platform, Standard Edition - TimeZone information based on "; - private static final String header3 = - "-->\n<TITLE>\n" + - "Java Platform, Standard Edition TimeZone - "; - private static final String header4 = - "\n" + - "\n\n"; - - private static final String body1 = - "\n"; - private static final String body2 = - "\n"; - - private static final String footer = - "\n"; - - - // list of time zone name and zonefile name/real time zone name - // e.g. - // key (String) : value (String) - // "America/Denver" : "America/Denver.html" (real time zone) - // "America/Shiprock" : "America/Denver" (alias) - TreeMap timezoneList = new TreeMap(); - - // list of time zone's display name and time zone name - // e.g. - // key (String) : value (String) - // "Tokyo, Asia" : "Asia/Tokyo" - // "Marengo, Indiana, America" : "America/Indiana/Marengo" - // (aliases included) - TreeMap displayNameList = new TreeMap(); - - // list of top level regions - // e.g. - // key (String) : value (String) - // "America" : "America.html" - // (including entries in America/Indiana/, America/Kentucky/, ...) - TreeMap regionList = new TreeMap(); - - // mapping list from zone name to latitude & longitude - // This list is generated from zone.tab. - // e.g. - // key (String) : value (LatitudeAndLongitude object) - // "Asia/Tokyo" : latitude=35.3916, longitude=13.9444 - // (aliases not included) - HashMap mapList = null; - - // SortedMap of zone IDs sorted by their GMT offsets. If zone's GMT - // offset will change in the future, its last known offset is - // used. - SortedMap> zonesByOffset = new TreeMap>(); - - /** - * Generates HTML document for each zone. - * @param Timezone - * @return 0 if no errors, or 1 if error occurred. - */ - int processZoneinfo(Timezone tz) { - try { - int size; - int index; - String outputDir = Main.getOutputDir(); - String zonename = tz.getName(); - String zonefile = ZoneInfoFile.getFileName(zonename) + ".html"; - List stz = tz.getLastRules(); - timezoneList.put(zonename, zonefile); - displayNameList.put(transform(zonename), zonename); - - // Populate zonesByOffset. (Zones that will change their - // GMT offsets are also added to zonesByOffset here.) - int lastKnownOffset = tz.getRawOffset(); - Set set = zonesByOffset.get(lastKnownOffset); - if (set == null) { - set = new TreeSet(); - zonesByOffset.put(lastKnownOffset, set); - } - set.add(zonename); - - /* If outputDir doesn't end with file-separator, adds it. */ - if (!outputDir.endsWith(File.separator)) { - outputDir += File.separatorChar; - } - outputDir += docDir + File.separatorChar; - - index = zonename.indexOf('/'); - if (index != -1) { - regionList.put(zonename.substring(0, index), - zonename.substring(0, index) + ".html"); - } - - /* If zonefile includes file-separator, it's treated as part of - * pathname. And make directory if necessary. - */ - index = zonefile.lastIndexOf('/'); - if (index != -1) { - zonefile.replace('/', File.separatorChar); - outputDir += zonefile.substring(0, index+1); - } - File outD = new File(outputDir); - outD.mkdirs(); - - /* If mapfile is available, add a link to the appropriate map */ - if (mapList == null && Main.getMapFile() != null) { - mapList = new HashMap(); - FileReader fr = new FileReader(Main.getMapFile()); - BufferedReader in = new BufferedReader(fr); - String line; - while ((line = in.readLine()) != null) { - // skip blank and comment lines - if (line.length() == 0 || line.charAt(0) == '#') { - continue; - } - StringTokenizer tokens = new StringTokenizer(line); - String token = tokens.nextToken(); /* We don't use the first token. */ - token = tokens.nextToken(); - LatitudeAndLongitude location = new LatitudeAndLongitude(token); - token = tokens.nextToken(); - mapList.put(token, location); - } - in.close(); - } - - /* Open zoneinfo file to write. */ - FileWriter fw = new FileWriter(outputDir + zonefile.substring(index+1)); - BufferedWriter out = new BufferedWriter(fw); - - out.write(header1 + new Date() + header3 + zonename + header4); - out.write(body1 + "" + zonename + ""); - LatitudeAndLongitude location = (mapList != null ? mapList.get(zonename) : null); - if (location != null) { - int deg, min, sec; - - deg = location.getLatDeg(); - min = location.getLatMin(); - sec = location.getLatSec(); - if (deg < 0) { - min = -min; - sec = -sec; - } else if (min < 0) { - sec = -sec; - } - out.write("   " + - "[map]"); - } - out.write("\n

\n"); - - List zone = tz.getZones(); - List rule = tz.getRules(); - if (rule != null && zone != null) { - out.write("\n" + - "\n" + - "\n" + - "\n" + - "\n

" + - "Rules
" + - "
Zone
\n"); - } - - /* Output Rule records. */ - if (rule != null) { - size = rule.size(); - out.write("

\n" + - "Rules\n" + - "\n" + - "\n" + - "" + - "" + - "\n\n"); - for (int i = 0; i < size; i++) { - out.write("\n"); - StringTokenizer st = new StringTokenizer(rule.get(i).getLine()); - String s; - if (st.hasMoreTokens()) { /* RULE - truncated */ - st.nextToken(); - } - if (st.hasMoreTokens()) { /* NAME */ - out.write(""); - } - if (st.hasMoreTokens()) { /* FROM */ - out.write(""); - } - if (st.hasMoreTokens()) { /* TO */ - s = st.nextToken(); - if (s.equals("min") || s.equals("max")) { - out.write(""); - } else { - out.write(""); - } - } - if (st.hasMoreTokens()) { /* TYPE */ - out.write(""); - } - if (st.hasMoreTokens()) { /* IN */ - out.write(""); - } - if (st.hasMoreTokens()) { /* ON */ - out.write(""); - } - if (st.hasMoreTokens()) { /* AT */ - out.write(""); - } - if (st.hasMoreTokens()) { /* SAVE */ - out.write(""); - } - if (st.hasMoreTokens()) { /* LETTER/S */ - out.write(""); - } - if (st.hasMoreTokens()) { /* NOTES */ - s = st.nextToken(); - while (st.hasMoreTokens()) { - s += " " + st.nextToken(); - } - index = s.indexOf('#'); - out.write("\n"); - } else { - out.write("\n"); - } - out.write("\n"); - } - out.write("
NAMEFROMTOTYPEINONATSAVELETTER/SNOTES
" + st.nextToken() + "" + st.nextToken() + "" + s + "" + s + "" + st.nextToken() + "" + st.nextToken() + "" + st.nextToken() + "" + st.nextToken() + "" + st.nextToken() + "" + st.nextToken() + "" + s.substring(index+1) + " 
\n

 

\n"); - } - - /* Output Zone records. */ - if (zone != null) { - size = zone.size(); - out.write("

\n" + - "Zone\n" + - "\n" + - "\n" + - "" + - "\n\n"); - for (int i = 0; i < size; i++) { - out.write("\n"); - StringTokenizer st = new StringTokenizer(zone.get(i).getLine()); - String s = st.nextToken(); - if (s.equals("Zone")) { /* NAME */ - s = st.nextToken(); - s = st.nextToken(); - } - out.write(""); /* GMTOFFSET */ - if (st.hasMoreTokens()) { /* RULES */ - out.write(""); - } - if (st.hasMoreTokens()) { /* FORMAT */ - s = st.nextToken(); - index = s.indexOf('#'); - if (index != -1) { - if (index != 0) { - out.write(""); /* FORMAT */ - s = s.substring(index+1); - } else { - out.write(""); /* FORMAT */ - } - while (st.hasMoreTokens()) { - s += " " + st.nextToken(); - } - out.write(""); /* UNTIL */ - out.write("\n\n"); /* NOTES */ - continue; - } else { - out.write(""); /* FORMAT */ - } - } - - if (st.hasMoreTokens()) { /* UNTIL */ - s = st.nextToken(); - while (st.hasMoreTokens()) { - s += " " + st.nextToken(); - } - index = s.indexOf('#'); - if (index != -1) { - if (index != 0) { - out.write(""); /* UNTIL */ - } else { - out.write(""); /* UNTIL */ - } - out.write("\n"); /* NOTES */ - } else { - out.write(""); /* UNTIL */ - out.write("\n"); /* NOTES */ - } - } else { - out.write(""); /* UNTIL */ - out.write("\n"); /* NOTES */ - } - out.write("\n"); - } - out.write("
GMTOFFRULESFORMATUNTILNOTES
" + s + "" + st.nextToken() + "" + s.substring(0, index-1) + - "  " + s + "
" + s + "" + s.substring(0, index-1) + - " " + s.substring(index+1) + - "" + s + "   
\n"); - } - out.write(body2 + footer); - - out.close(); - fw.close(); - } catch(IOException e) { - Main.panic("IO error: "+e.getMessage()); - return 1; - } - - return 0; - } - - /** - * Generates index.html and other top-level frame files. - * @param Mappings - * @return 0 if no errors, or 1 if error occurred. - */ - int generateSrc(Mappings map) { - try { - int len; - Object o[]; - String outputDir = Main.getOutputDir(); - FileWriter fw1, fw2; - BufferedWriter out1, out2; - - /* Whether alias list exists or not. */ - Map a = map.getAliases(); - if (a == null) { - Main.panic("Data not exist. (aliases)"); - return 1; - } - - timezoneList.putAll(a); - - /* If outputDir doesn't end with file-separator, adds it. */ - if (!outputDir.endsWith(File.separator)) { - outputDir += File.separatorChar; - } - outputDir += docDir + File.separatorChar; - - File outD = new File(outputDir); - outD.mkdirs(); - - /* Creates index.html */ - fw1 = new FileWriter(outputDir + "index.html", false); - out1 = new BufferedWriter(fw1); - - out1.write(header1 + new Date() + header2 + Main.getVersionName() + - header4 + - "\n" + - "\n" + - "\n" + - "\n" + - "" + - "\n" + - "\n" + - "\n" + - "<H2>\nFrame Alert\n</H2>\n\n" + - "<P>\n\n" + - "This document is designed to be viewed using the frames feature. If you see this\n" + - "message, you are using a non-frame-capable web client.\n" + - "<BR>\n" + - "Link to<A HREF=\"overview-summary.html\">Non-frame version.</A>\n" + - "\n" + footer); - - out1.close(); - fw1.close(); - - - /* Creates overview-frame.html */ - fw1 = new FileWriter(outputDir + "overview-frame.html", false); - out1 = new BufferedWriter(fw1); - - out1.write(header1 + new Date() + header2 + Main.getVersionName() + - header4 + body1 + - "\n\n" + - "\n" + - "\n
\n" + - "JavaTM Platform
Standard Ed.
\n\n" + - "\n\n\n
" + - "

\n\nAll Time Zones Sorted By:\n
\n" + - "  GMT offsets\n
\n" + - "  Zone names\n
" + - "  City names\n" + - "

\n\nContinents and Oceans\n
\n"); - - for (String regionKey : regionList.keySet()) { - out1.write("  " + regionKey + - "
\n"); - - fw2 = new FileWriter(outputDir + regionList.get(regionKey), - false); - out2 = new BufferedWriter(fw2); - - out2.write(header1 + new Date() + header3 + regionKey + - header4 + body1 + "" + - regionKey + "\n
\n\n\n\n\n
"); - - boolean found = false; - for (String timezoneKey : timezoneList.keySet()) { - int regionIndex = timezoneKey.indexOf('/'); - if (regionIndex == -1 || - !regionKey.equals(timezoneKey.substring(0, regionIndex))) { - if (found) { - break; - } else { - continue; - } - } - - found = true; - if (a.containsKey(timezoneKey)) { - Object realName = a.get(timezoneKey); - while (a.containsKey(realName)) { - realName = a.get(realName); - } - out2.write(timezoneKey + - " (alias for " + "" + - realName + ")"); - } else { - out2.write("" + timezoneKey + - ""); - } - out2.write("
\n"); - } - out2.write("
\n" + body2 + footer); - - out2.close(); - fw2.close(); - } - out1.write("

\n" + body2 + footer); - - out1.close(); - fw1.close(); - - - /* Creates allTimeZone-frame1.html (Sorted by GMT offsets) */ - fw1 = new FileWriter(outputDir + "allTimeZone-frame1.html", false); - out1 = new BufferedWriter(fw1); - - out1.write(header1 + new Date() + header2 + Main.getVersionName() + - header4 + body1 + - "Sorted by GMT offsets\n" + - "
\n\n" + "\n" + - "\n\n\n\n\n"); - } - } - out1.write("\n\n
\n"); - - List roi = map.getRawOffsetsIndex(); - List> roit = map.getRawOffsetsIndexTable(); - - int index = 0; - for (Integer offset : zonesByOffset.keySet()) { - int off = roi.get(index); - Set perRO = zonesByOffset.get(offset); - if (offset == off) { - // Merge aliases into zonesByOffset - perRO.addAll(roit.get(index)); - } - index++; - - for (String timezoneKey : perRO) { - out1.write("
(" + - Time.toGMTFormat(offset.toString()) + - ")"); - - if (a.containsKey(timezoneKey)) { - Object realName = a.get(timezoneKey); - while (a.containsKey(realName)) { - realName = a.get(realName); - } - out1.write(timezoneKey + - " (alias for " + "" + realName + - ")"); - } else { - out1.write("" + timezoneKey + - ""); - } - out1.write("
\n" + body2 + footer); - - out1.close(); - fw1.close(); - - - /* Creates allTimeZone-frame2.html (Sorted by zone names) */ - fw1 = new FileWriter(outputDir + "allTimeZone-frame2.html", false); - out1 = new BufferedWriter(fw1); - - out1.write(header1 + new Date() + header2 + Main.getVersionName() + - header4 + body1 + - "Sorted by zone names\n" + - "
\n\n" + "\n" + - "\n\n\n
\n"); - o = timezoneList.keySet().toArray(); - len = timezoneList.size(); - for (int i = 0; i < len; i++) { - Object timezoneKey = o[i]; - if (a.containsKey(timezoneKey)) { - Object realName = a.get(timezoneKey); - while (a.containsKey(realName)) { - realName = a.get(realName); - } - out1.write(timezoneKey + - " (alias for " + - "" + realName + - ")"); - } else { - out1.write("" + timezoneKey + - ""); - } - out1.write("
\n"); - } - out1.write("
\n" + body2 + footer); - - out1.close(); - fw1.close(); - - /* Creates allTimeZone-frame3.html (Sorted by city names) */ - fw1 = new FileWriter(outputDir + "allTimeZone-frame3.html", false); - out1 = new BufferedWriter(fw1); - - out1.write(header1 + new Date() + header2 + Main.getVersionName() + - header4 + body1 + - "Sorted by city names\n" + - "
\n\n" + "\n" + - "\n\n\n
\n"); - - Set aliasSet = a.keySet(); - len = aliasSet.size(); - String aliasNames[] = aliasSet.toArray(new String[0]); - for (int i = 0; i < len; i++) { - displayNameList.put(transform(aliasNames[i]), - aliasNames[i]); - } - - o = displayNameList.keySet().toArray(); - len = displayNameList.size(); - for (int i = 0; i < len; i++) { - Object displayName = o[i]; - Object timezoneKey = displayNameList.get(o[i]); - if (a.containsKey(timezoneKey)) { - Object realName = a.get(timezoneKey); - while (a.containsKey(realName)) { - realName = a.get(realName); - } - out1.write(displayName + - " (alias for " + - "" + realName + - ")"); - } else { - out1.write("" + displayName + - ""); - } - out1.write("
\n"); - } - - out1.write("
\n" + body2 + footer); - - out1.close(); - fw1.close(); - - /* Creates overview-summary.html */ - fw1 = new FileWriter(outputDir + "overview-summary.html", false); - out1 = new BufferedWriter(fw1); - - out1.write(header1 + new Date() + header2 + Main.getVersionName() + - header4 + body1 + - "

This is the list of time zones generated from " + - Main.getVersionName() + " for Java Platform, " + - "Standard Edition. The source code can be obtained " + - "from ftp site " + - "ftp://elsie.nci.nih.gov/pub/. A total of " + - len + - " time zones and aliases are supported " + - "in this edition. For the " + - "format of rules and zones, refer to the zic " + - "(zoneinfo compiler) man page on " + - "Solaris or Linux.

\n" + - "

Note that the time zone data is not " + - "a public interface of the Java Platform. No " + - "applications should rely on the time zone data of " + - "this document. Time zone names and data " + - "may change without any prior notice.

\n" + - body2 + footer); - - out1.close(); - fw1.close(); - } catch(IOException e) { - Main.panic("IO error: "+e.getMessage()); - return 1; - } - - return 0; - } - - String transform(String s) { - int index = s.lastIndexOf("/"); - - /* If the string doesn't include any delimiter, return */ - if (index == -1) { - return s; - } - - int lastIndex = index; - String str = s.substring(index+1); - do { - index = s.substring(0, lastIndex).lastIndexOf('/'); - str += ", " + s.substring(index+1, lastIndex); - lastIndex = index; - } while (index > -1); - - return str; - } - - static class LatitudeAndLongitude { - - private int latDeg, latMin, latSec, longDeg, longMin, longSec; - - LatitudeAndLongitude(String s) { - try { - // First of all, check the string has the correct format: - // either +-DDMM+-DDDMM or +-DDMMSS+-DDDMMSS - - if (!s.startsWith("+") && !s.startsWith("-")) { - Main.warning("Wrong latitude&longitude data: " + s); - return; - } - int index; - if (((index = s.lastIndexOf("+")) <= 0) && - ((index = s.lastIndexOf("-")) <= 0)) { - Main.warning("Wrong latitude&longitude data: " + s); - return; - } - - if (index == 5) { - latDeg = Integer.parseInt(s.substring(1, 3)); - latMin = Integer.parseInt(s.substring(3, 5)); - latSec = 0; - } else if (index == 7) { - latDeg = Integer.parseInt(s.substring(1, 3)); - latMin = Integer.parseInt(s.substring(3, 5)); - latSec = Integer.parseInt(s.substring(5, 7)); - } else { - Main.warning("Wrong latitude&longitude data: " + s); - return; - } - if (s.startsWith("-")){ - latDeg = -latDeg; - latMin = -latMin; - latSec = -latSec; - } - - int len = s.length(); - if (index == 5 && len == 11) { - longDeg = Integer.parseInt(s.substring(index+1, index+4)); - longMin = Integer.parseInt(s.substring(index+4, index+6)); - longSec = 0; - } else if (index == 7 && len == 15) { - longDeg = Integer.parseInt(s.substring(index+1, index+4)); - longMin = Integer.parseInt(s.substring(index+4, index+6)); - longSec = Integer.parseInt(s.substring(index+6, index+8)); - } else { - Main.warning("Wrong latitude&longitude data: " + s); - return; - } - if (s.charAt(index) == '-'){ - longDeg = -longDeg; - longMin = -longMin; - longSec = -longSec; - } - } catch(Exception e) { - Main.warning("LatitudeAndLongitude() Parse error: " + s); - } - } - - int getLatDeg() { - return latDeg; - } - - int getLatMin() { - return latMin; - } - - int getLatSec() { - return latSec; - } - - int getLongDeg() { - return longDeg; - } - - int getLongMin() { - return longMin; - } - - int getLongSec() { - return longSec; - } - } -} diff --git a/test/jdk/sun/util/calendar/zi/Main.java b/test/jdk/sun/util/calendar/zi/Main.java deleted file mode 100644 index 8078d7e2425d2..0000000000000 --- a/test/jdk/sun/util/calendar/zi/Main.java +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import java.util.ArrayList; -import java.util.List; - -/** - * Main class for the javazic time zone data compiler. - * - * @since 1.4 - */ -public class Main { - - private static boolean verbose = false; - static boolean outputDoc = false; - - private List ziFiles = new ArrayList(); - private static String zoneNamesFile = null; - private static String versionName = "unknown"; - private static String outputDir = "zoneinfo"; - private static String mapFile = null; - - /** - * Parses the specified arguments and sets up the variables. - * @param argv the arguments - */ - void processArgs(String[] argv) { - for (int i = 0; i < argv.length; i++) { - String arg = argv[i]; - if (arg.startsWith("-h")) { - usage(); - System.exit(0); - } else if (arg.equals("-d")) { - outputDir = argv[++i]; - } else if (arg.equals("-v")) { - verbose = true; - } else if (arg.equals("-V")) { - versionName = argv[++i]; - } else if (arg.equals("-doc")) { - outputDoc = true; - } else if (arg.equals("-map")) { - outputDoc = true; - mapFile = argv[++i]; - } else if (arg.equals("-f")) { - zoneNamesFile = argv[++i]; - } else if (arg.equals("-S")) { - try { - Zoneinfo.setYear(Integer.parseInt(argv[++i])); - } catch (Exception e) { - error("invalid year: " + argv[i]); - usage(); - System.exit(1); - } - } else { - boolean isStartYear = arg.equals("-s"); - if (isStartYear || arg.equals("-e")) { - try { - int year = Integer.parseInt(argv[++i]); - if (isStartYear) { - Zoneinfo.setStartYear(year); - } else { - Zoneinfo.setEndYear(year); - } - } catch (Exception e) { - error("invalid year: " + argv[i]); - usage(); - System.exit(1); - } - } else { - // the rest of args are zoneinfo source files - while (i < argv.length) { - ziFiles.add(argv[i++]); - } - } - } - } - } - - /** - * Parses zoneinfo source files - */ - int compile() { - int nFiles = ziFiles.size(); - int status = 0; - Mappings maps = new Mappings(); - BackEnd backend = BackEnd.getBackEnd(); - - for (int i = 0; i < nFiles; i++) { - Zoneinfo frontend = Zoneinfo.parse(ziFiles.get(i)); - - for (String key : frontend.getZones().keySet()) { - info(key); - - Timezone tz = frontend.phase2(key); - status |= backend.processZoneinfo(tz); - } - - maps.add(frontend); - } - - // special code for dealing with the conflicting name "MET" - Zone.addMET(); - - maps.resolve(); - - status |= backend.generateSrc(maps); - - return status; - } - - public static void main(String[] argv) { - Main zic = new Main(); - - /* - * Parse args - */ - zic.processArgs(argv); - - /* - * Read target zone names - */ - if (zoneNamesFile != null) { - Zone.readZoneNames(zoneNamesFile); - } - - zic.compile(); - } - - void usage() { - System.err.println("Usage: javazic [options] file...\n"+ - " -f namefile file containing zone names\n"+ - " to be generated (ie, generating subset)\n"+ - " -d dir output directory\n"+ - " -v verbose\n"+ - " -V datavers specifies the tzdata version string\n"+ - " (eg, \"tzdata2000g\")"+ - " -S year output only SimleTimeZone data of that year\n"+ - " -s year start year (default: 1900)\n"+ - " -e year end year (default: 2037)\n"+ - " -doc generates HTML documents\n"+ - " -map mapfile generates HTML documents with map information\n"+ - " file... zoneinfo source file(s)"); - } - - /** - * @return the output directory path name - */ - static String getOutputDir() { - return outputDir; - } - - /** - * @return the map file's path and name - */ - static String getMapFile() { - return mapFile; - } - - /** - * Returns the time zone data version string specified by the -V - * option. If it is not specified, "unknown" is returned. - * @return the time zone data version string - */ - static String getVersionName() { - return versionName; - } - - /** - * Prints out the specified fatal error message and calls {@link - * java.lang.System#exit System.exit(1)}. - * @param msg the fatal error message - */ - static void panic(String msg) { - printMessage("fatal error", msg); - System.exit(1); - } - - /** - * Prints out the specified error message. - * @param msg the error message - */ - static void error(String msg) { - printMessage("error", msg); - } - - /** - * Prints out the specified warning message. - * @param msg the warning message - */ - static void warning(String msg) { - printMessage("warning", msg); - } - - /** - * Prints out the informative message. - * @param msg the informative message - */ - static void info(String msg) { - if (verbose) { - printMessage(null, msg); - } - } - - private static void printMessage(String type, String msg) { - if (type != null) { - type += ": "; - } else { - type = ""; - } - System.err.println("javazic: " + type + msg); - } -} diff --git a/test/jdk/sun/util/calendar/zi/Mappings.java b/test/jdk/sun/util/calendar/zi/Mappings.java deleted file mode 100644 index 582a9509a51c8..0000000000000 --- a/test/jdk/sun/util/calendar/zi/Mappings.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; -import java.util.TreeSet; - -/** - * Mappings generates two Maps and a List which are used by - * javazic BackEnd. - * - * @since 1.4 - */ -class Mappings { - // All aliases specified by Link statements. It's alias name to - // real name mappings. - private Map aliases; - - private List rawOffsetsIndex; - - private List> rawOffsetsIndexTable; - - // Zone names to be excluded from rawOffset table. Those have GMT - // offsets to change some future time. - private List excludeList; - - /** - * Constructor creates some necessary instances. - */ - Mappings() { - aliases = new TreeMap(); - rawOffsetsIndex = new LinkedList(); - rawOffsetsIndexTable = new LinkedList>(); - } - - /** - * Generates aliases and rawOffsets tables. - * @param zi a Zoneinfo containing Zones - */ - void add(Zoneinfo zi) { - Map zones = zi.getZones(); - - for (String zoneName : zones.keySet()) { - Zone zone = zones.get(zoneName); - String zonename = zone.getName(); - int rawOffset = zone.get(zone.size()-1).getGmtOffset(); - - // If the GMT offset of this Zone will change in some - // future time, this Zone is added to the exclude list. - boolean isExcluded = false; - for (int i = 0; i < zone.size(); i++) { - ZoneRec zrec = zone.get(i); - if ((zrec.getGmtOffset() != rawOffset) - && (zrec.getUntilTime(0) > Time.getCurrentTime())) { - if (excludeList == null) { - excludeList = new ArrayList(); - } - excludeList.add(zone.getName()); - isExcluded = true; - break; - } - } - - if (!rawOffsetsIndex.contains(new Integer(rawOffset))) { - // Find the index to insert this raw offset zones - int n = rawOffsetsIndex.size(); - int i; - for (i = 0; i < n; i++) { - if (rawOffsetsIndex.get(i) > rawOffset) { - break; - } - } - rawOffsetsIndex.add(i, rawOffset); - - Set perRawOffset = new TreeSet(); - if (!isExcluded) { - perRawOffset.add(zonename); - } - rawOffsetsIndexTable.add(i, perRawOffset); - } else if (!isExcluded) { - int i = rawOffsetsIndex.indexOf(new Integer(rawOffset)); - Set perRawOffset = rawOffsetsIndexTable.get(i); - perRawOffset.add(zonename); - } - } - - Map a = zi.getAliases(); - // If there are time zone names which refer to any of the - // excluded zones, add those names to the excluded list. - if (excludeList != null) { - for (String zoneName : a.keySet()) { - String realname = a.get(zoneName); - if (excludeList.contains(realname)) { - excludeList.add(zoneName); - } - } - } - aliases.putAll(a); - } - - /** - * Adds valid aliases to one of per-RawOffset table and removes - * invalid aliases from aliases List. Aliases referring to - * excluded zones are not added to a per-RawOffset table. - */ - void resolve() { - int index = rawOffsetsIndexTable.size(); - List toBeRemoved = new ArrayList(); - for (String key : aliases.keySet()) { - boolean validname = false; - for (int j = 0; j < index; j++) { - Set perRO = rawOffsetsIndexTable.get(j); - boolean isExcluded = (excludeList == null) ? - false : excludeList.contains(key); - - if ((perRO.contains(aliases.get(key)) || isExcluded) - && Zone.isTargetZone(key)) { - validname = true; - if (!isExcluded) { - perRO.add(key); - Main.info("Alias <"+key+"> added to the list."); - } - break; - } - } - - if (!validname) { - Main.info("Alias <"+key+"> removed from the list."); - toBeRemoved.add(key); - } - } - - // Remove zones, if any, from the list. - for (String key : toBeRemoved) { - aliases.remove(key); - } - // Eliminate any alias-to-alias mappings. For example, if - // there are A->B and B->C, A->B is changed to A->C. - Map newMap = new HashMap(); - for (String key : aliases.keySet()) { - String realid = aliases.get(key); - String leaf = realid; - while (aliases.get(leaf) != null) { - leaf = aliases.get(leaf); - } - if (!realid.equals(leaf)) { - newMap.put(key, leaf); - } - } - aliases.putAll(newMap); - } - - Map getAliases() { - return(aliases); - } - - List getRawOffsetsIndex() { - return(rawOffsetsIndex); - } - - List> getRawOffsetsIndexTable() { - return(rawOffsetsIndexTable); - } - - List getExcludeList() { - return excludeList; - } -} diff --git a/test/jdk/sun/util/calendar/zi/Month.java b/test/jdk/sun/util/calendar/zi/Month.java deleted file mode 100644 index bab909f763787..0000000000000 --- a/test/jdk/sun/util/calendar/zi/Month.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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 - * 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. - */ - -/** - * Month enum handles month related manipulation. - * - * @since 1.4 - */ -enum Month { - JANUARY("Jan"), - FEBRUARY("Feb"), - MARCH("Mar"), - APRIL("Apr"), - MAY("May"), - JUNE("Jun"), - JULY("Jul"), - AUGUST("Aug"), - SEPTEMBER("Sep"), - OCTOBER("Oct"), - NOVEMBER("Nov"), - DECEMBER("Dec"); - - private final String abbr; - - private Month(String abbr) { - this.abbr = abbr; - } - - int value() { - return ordinal() + 1; - } - - /** - * Parses the specified string as a month abbreviation. - * @param name the month abbreviation - * @return the Month value - */ - static Month parse(String name) { - int len = name.length(); - - if (name.regionMatches(true, 0, "January", 0, len)) return Month.JANUARY; - if (name.regionMatches(true, 0, "February", 0, len)) return Month.FEBRUARY; - if (name.regionMatches(true, 0, "March", 0, len)) return Month.MARCH; - if (name.regionMatches(true, 0, "April", 0, len)) return Month.APRIL; - if (name.regionMatches(true, 0, "May", 0, len)) return Month.MAY; - if (name.regionMatches(true, 0, "June", 0, len)) return Month.JUNE; - if (name.regionMatches(true, 0, "July", 0, len)) return Month.JULY; - if (name.regionMatches(true, 0, "August", 0, len)) return Month.AUGUST; - if (name.regionMatches(true, 0, "September", 0, len)) return Month.SEPTEMBER; - if (name.regionMatches(true, 0, "October", 0, len)) return Month.OCTOBER; - if (name.regionMatches(true, 0, "November", 0, len)) return Month.NOVEMBER; - if (name.regionMatches(true, 0, "December", 0, len)) return Month.DECEMBER; - - throw new IllegalArgumentException("Unknown month: " + name); - } - - /** - * @param month the nunmth number (1-based) - * @return the month name in uppercase of the specified month - */ - static String toString(int month) { - if (month >= JANUARY.value() && month <= DECEMBER.value()) { - return "Calendar." + Month.values()[month - 1]; - } - throw new IllegalArgumentException("wrong month number: " + month); - } -} diff --git a/test/jdk/sun/util/calendar/zi/Rule.java b/test/jdk/sun/util/calendar/zi/Rule.java deleted file mode 100644 index 3098dc7e76651..0000000000000 --- a/test/jdk/sun/util/calendar/zi/Rule.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Comparator; -import java.util.List; -import java.util.StringTokenizer; - -/** - * Rule manipulates Rule records. - * - * @since 1.4 - */ -class Rule { - - private List list; - private String name; - - /** - * Constructs a Rule which consists of a Rule record list. The - * specified name is given to this Rule. - * @param name the Rule name - */ - Rule(String name) { - this.name = name; - list = new ArrayList(); - } - - /** - * Added a RuleRec to the Rule record list. - */ - void add(RuleRec rec) { - list.add(rec); - } - - /** - * @return the Rule name - */ - String getName() { - return name; - } - - /** - * Gets all rule records that cover the given year. - * - * @param year the year number for which the rule is applicable. - * @return rules in List that are collated in time. If no rule is found, an empty - * List is returned. - */ - List getRules(int year) { - List rules = new ArrayList(3); - for (RuleRec rec : list) { - if (year >= rec.getFromYear() && year <= rec.getToYear()) { - if ((rec.isOdd() && year % 2 == 0) || (rec.isEven() && year % 2 == 1)) - continue; - rules.add(rec); - } - } - int n = rules.size(); - if (n <= 1) { - return rules; - } - if (n == 2) { - RuleRec rec1 = rules.get(0); - RuleRec rec2 = rules.get(1); - if (rec1.getMonthNum() > rec2.getMonthNum()) { - rules.set(0, rec2); - rules.set(1, rec1); - } else if (rec1.getMonthNum() == rec2.getMonthNum()) { - // TODO: it's not accurate to ignore time types (STD, WALL, UTC) - long t1 = Time.getLocalTime(year, rec1.getMonth(), - rec1.getDay(), rec1.getTime().getTime()); - long t2 = Time.getLocalTime(year, rec2.getMonth(), - rec2.getDay(), rec2.getTime().getTime()); - if (t1 > t2) { - rules.set(0, rec2); - rules.set(1, rec1); - } - } - return rules; - } - - final int y = year; - RuleRec[] recs = new RuleRec[rules.size()]; - rules.toArray(recs); - - Arrays.sort(recs, new Comparator() { - public int compare(RuleRec r1, RuleRec r2) { - int n = r1.getMonthNum() - r2.getMonthNum(); - if (n != 0) { - return n; - } - // TODO: it's not accurate to ignore time types (STD, WALL, UTC) - long t1 = Time.getLocalTime(y, r1.getMonth(), - r1.getDay(), r1.getTime().getTime()); - long t2 = Time.getLocalTime(y, r2.getMonth(), - r2.getDay(), r2.getTime().getTime()); - return Long.compare(t1, t2); - } - public boolean equals(Object o) { - return this == o; - } - }); - rules.clear(); - for (int i = 0; i < n; i++) { - if (i != 0 && recs[i -1].getSave() == recs[i].getSave()) { - // we have two recs back to back with same saving for the same year. - if (recs[i].isLastRule()) { - continue; - } else if (recs[i - 1].isLastRule()) { - rules.remove(rules.size() - 1); - } - } - rules.add(recs[i]); - } - return rules; - } - - /** - * Gets rule records that have either "max" or cover the endYear - * value in its DST schedule. - * - * @return rules that contain last DST schedule. An empty - * ArrayList is returned if no last rules are found. - */ - List getLastRules() { - RuleRec start = null; - RuleRec end = null; - - for (int i = 0; i < list.size(); i++) { - RuleRec rec = list.get(i); - if (rec.isLastRule()) { - if (rec.getSave() > 0) { - start = rec; - } else { - end = rec; - } - } - } - if (start == null || end == null) { - int endYear = Zoneinfo.getEndYear(); - for (int i = 0; i < list.size(); i++) { - RuleRec rec = list.get(i); - if (endYear >= rec.getFromYear() && endYear <= rec.getToYear()) { - if (start == null && rec.getSave() > 0) { - start = rec; - } else { - if (end == null && rec.getSave() == 0) { - end = rec; - } - } - } - } - } - - List r = new ArrayList(2); - if (start == null || end == null) { - if (start != null || end != null) { - Main.warning("found last rules for "+name+" inconsistent."); - } - return r; - } - - r.add(start); - r.add(end); - return r; - } -} diff --git a/test/jdk/sun/util/calendar/zi/RuleDay.java b/test/jdk/sun/util/calendar/zi/RuleDay.java deleted file mode 100644 index 9cd81c1e5246f..0000000000000 --- a/test/jdk/sun/util/calendar/zi/RuleDay.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * 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 - * 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. - */ - -/** - * RuleDay class represents the value of the "ON" field. The day of - * week values start from 1 following the {@link java.util.Calendar} - * convention. - * - * @since 1.4 - */ -class RuleDay { - private String dayName = null; - private DayOfWeek dow; - private boolean lastOne = false; - private int soonerOrLater = 0; - private int thanDayOfMonth; // day of month (e.g., 8 for "Sun>=8") - - RuleDay() { - } - - RuleDay(int day) { - thanDayOfMonth = day; - } - - int getDay() { - return thanDayOfMonth; - } - - /** - * @return the day of week value (1-based) - */ - int getDayOfWeekNum() { - return dow.value(); - } - - /** - * @return true if this rule day represents the last day of - * week. (e.g., lastSun). - */ - boolean isLast() { - return lastOne; - } - - /** - * @return true if this rule day represents the day of week on or - * later than (after) the {@link #getDay}. (e.g., Sun>=1) - */ - boolean isLater() { - return soonerOrLater > 0; - } - - /** - * @return true if this rule day represents the day of week on or - * earlier than (before) the {@link #getDay}. (e.g., Sun<=15) - */ - boolean isEarlier() { - return soonerOrLater < 0; - } - - /** - * @return true if this rule day represents an exact day. - */ - boolean isExact() { - return soonerOrLater == 0; - } - - /** - * Parses the "ON" field and constructs a RuleDay. - * @param day an "ON" field string (e.g., "Sun>=1") - * @return a RuleDay representing the given "ON" field - */ - static RuleDay parse(String day) { - RuleDay d = new RuleDay(); - if (day.startsWith("last")) { - d.lastOne = true; - d.dayName = day.substring(4); - d.dow = getDOW(d.dayName); - } else { - int index; - if ((index = day.indexOf(">=")) != -1) { - d.dayName = day.substring(0, index); - d.dow = getDOW(d.dayName); - d.soonerOrLater = 1; // greater or equal - d.thanDayOfMonth = Integer.parseInt(day.substring(index+2)); - } else if ((index = day.indexOf("<=")) != -1) { - d.dayName = day.substring(0, index); - d.dow = getDOW(d.dayName); - d.soonerOrLater = -1; // less or equal - d.thanDayOfMonth = Integer.parseInt(day.substring(index+2)); - } else { - // it should be an integer value. - d.thanDayOfMonth = Integer.parseInt(day); - } - } - return d; - } - - /** - * Converts this RuleDay to the SimpleTimeZone day rule. - * @return the converted SimpleTimeZone day rule - */ - int getDayForSimpleTimeZone() { - if (isLast()) { - return -1; - } - return isEarlier() ? -getDay() : getDay(); - } - - /** - * Converts this RuleDay to the SimpleTimeZone day-of-week rule. - * @return the SimpleTimeZone day-of-week rule value - */ - int getDayOfWeekForSimpleTimeZoneInt() { - if (isEarlier() || isLater()) { - return -getDayOfWeekNum(); - } - return isLast() ? getDayOfWeekNum() : 0; - } - - /** - * @return the string representation of the {@link - * #getDayOfWeekForSimpleTimeZoneInt} value - */ - String getDayOfWeekForSimpleTimeZone() { - int d = getDayOfWeekForSimpleTimeZoneInt(); - if (d == 0) { - return "0"; - } - String sign = ""; - if (d < 0) { - sign = "-"; - d = -d; - } - return sign + toString(d); - } - - private static DayOfWeek getDOW(String name) { - int len = name.length(); - - if (name.regionMatches(true, 0, "Monday", 0, len)) return DayOfWeek.MONDAY; - if (name.regionMatches(true, 0, "Tuesday", 0, len)) return DayOfWeek.TUESDAY; - if (name.regionMatches(true, 0, "Wednesday", 0, len)) return DayOfWeek.WEDNESDAY; - if (name.regionMatches(true, 0, "Thursday", 0, len)) return DayOfWeek.THURSDAY; - if (name.regionMatches(true, 0, "Friday", 0, len)) return DayOfWeek.FRIDAY; - if (name.regionMatches(true, 0, "Saturday", 0, len)) return DayOfWeek.SATURDAY; - if (name.regionMatches(true, 0, "Sunday", 0, len)) return DayOfWeek.SUNDAY; - - throw new IllegalArgumentException("Unknown day-of-week: " + name); - } - - /** - * Converts the specified day of week value to the day-of-week - * name defined in {@link java.util.Calendar}. - * @param dow 1-based day of week value - * @return the Calendar day of week name with "Calendar." prefix. - * @throws IllegalArgumentException if the specified dow value is out of range. - */ - static String toString(int dow) { - if (dow >= DayOfWeek.SUNDAY.value() && dow <= DayOfWeek.SATURDAY.value()) { - return "Calendar." + DayOfWeek.values()[dow - 1]; - } - throw new IllegalArgumentException("wrong Day_of_Week number: " + dow); - } -} diff --git a/test/jdk/sun/util/calendar/zi/RuleRec.java b/test/jdk/sun/util/calendar/zi/RuleRec.java deleted file mode 100644 index e6e18773d1606..0000000000000 --- a/test/jdk/sun/util/calendar/zi/RuleRec.java +++ /dev/null @@ -1,229 +0,0 @@ -/* - * 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import java.util.StringTokenizer; - -/** - * RuleRec class represents one record of the Rule set. - * - * @since 1.4 - */ -class RuleRec { - private int fromYear; - private int toYear; - private String type; - private Month inMonth; - private RuleDay onDay; - private Time atTime; - private int save; - private String letters; - private String line; - private boolean isLastRule; - - int getFromYear() { - return fromYear; - } - - int getToYear() { - return toYear; - } - - Month getMonth() { - return inMonth; - } - - int getMonthNum() { - return inMonth.value(); - } - - RuleDay getDay() { - return onDay; - } - - Time getTime() { - return atTime; - } - - int getSave() { - return save; - } - - String getLine() { - return line; - } - - /** - * Sets the line from the text file. - * @param line the text of the line - */ - void setLine(String line) { - this.line = line; - } - - /** - * @return true if the rule type is "odd". - */ - boolean isOdd() { - return "odd".equals(type); - } - - /** - * @return true if the rule type is "even". - */ - boolean isEven() { - return "even".equals(type); - } - - /** - * Determines if this rule record is the last DST schedule rule. - * - * @return true if this rule record has "max" as TO (year). - */ - boolean isLastRule() { - return isLastRule; - } - - /** - * Determines if the unadjusted until time of the specified ZoneRec - * is the same as the transition time of this rule in the same - * year as the ZoneRec until year. - * - * @param zrec ZoneRec to compare to - * @param save the amount of daylight saving in milliseconds - * @param gmtOffset the GMT offset value in milliseconds - * @return true if the unadjusted until time is the same as rule's - * transition time. - */ - boolean isSameTransition(ZoneRec zrec, int save, int gmtOffset) { - long until, transition; - - if (zrec.getUntilTime().getType() != atTime.getType()) { - until = zrec.getLocalUntilTime(save, gmtOffset); - transition = Time.getLocalTime(zrec.getUntilYear(), - getMonth(), - getDay(), - save, - gmtOffset, - atTime); - } else { - until = zrec.getLocalUntilTime(); - transition = Time.getLocalTime(zrec.getUntilYear(), - getMonth(), - getDay(), - atTime.getTime()); - } - - return until == transition; - } - - /** - * Parses a Rule line and returns a RuleRec object. - * - * @param tokens a StringTokenizer object that should contain a - * token for the "FROM" field and the rest. - * @return a RuleRec object. - */ - static RuleRec parse(StringTokenizer tokens) { - RuleRec rec = new RuleRec(); - try { - // FROM - String token = tokens.nextToken(); - try { - rec.fromYear = Integer.parseInt(token); - } catch (NumberFormatException e) { - // it's not integer - if ("min".equals(token) || "minimum".equals(token)) { - rec.fromYear = Zoneinfo.getMinYear(); - } else if ("max".equals(token) || "maximum".equals(token)) { - rec.fromYear = Zoneinfo.getMaxYear(); - } else { - Main.panic("invalid year value: "+token); - } - } - - // TO - token = tokens.nextToken(); - rec.isLastRule = false; - try { - rec.toYear = Integer.parseInt(token); - } catch (NumberFormatException e) { - // it's not integer - int len = token.length(); - if (token.regionMatches(true, 0, "minimum", 0, len)) { - rec.fromYear = Zoneinfo.getMinYear(); - } else if (token.regionMatches(true, 0, "maximum", 0, len)) { - rec.toYear = Integer.MAX_VALUE; - rec.isLastRule = true; - } else if (token.regionMatches(true, 0, "only", 0, len)) { - rec.toYear = rec.fromYear; - } else { - Main.panic("invalid year value: "+token); - } - } - - // TYPE - rec.type = tokens.nextToken(); - - // IN - rec.inMonth = Month.parse(tokens.nextToken()); - - // ON - rec.onDay = RuleDay.parse(tokens.nextToken()); - - // AT - rec.atTime = Time.parse(tokens.nextToken()); - - // SAVE - rec.save = (int) Time.parse(tokens.nextToken()).getTime(); - - // LETTER/S - rec.letters = tokens.nextToken(); - } catch (Exception e) { - e.printStackTrace(); - } - return rec; - } - - /** - * Calculates the transition time of the given year under this rule. - * @param year the year value - * @param gmtOffset the GMT offset value in milliseconds - * @param save the amount of daylight save time - * @return the transition time in milliseconds of the given year in UTC. - */ - long getTransitionTime(int year, int gmtOffset, int save) { - long time = Time.getLocalTime(year, getMonth(), - getDay(), atTime.getTime()); - if (atTime.isSTD()) { - time -= gmtOffset; - } else if (atTime.isWall()) { - time -= gmtOffset + save; - } - return time; - } - - private static int getInt(StringTokenizer tokens) { - String token = tokens.nextToken(); - return Integer.parseInt(token); - } -} diff --git a/test/jdk/sun/util/calendar/zi/Simple.java b/test/jdk/sun/util/calendar/zi/Simple.java deleted file mode 100644 index 0889155a99e97..0000000000000 --- a/test/jdk/sun/util/calendar/zi/Simple.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.SortedMap; -import java.util.TreeMap; -import java.util.TreeSet; - -/** - * Simple generates TimeZoneData, which had been used as internal - * data of TimeZone before J2SDK1.3. - * Since J2SDK1.4 doesn't need TimeZoneData, this class is for maintenance - * of old JDK release. - */ -class Simple extends BackEnd { - - /** - * Zone records which are applied for given year. - */ - private static Map lastZoneRecs = new HashMap<>(); - - /** - * Rule records which are applied for given year. - */ - private static Map> lastRules = new TreeMap<>(); - - /** - * zone IDs sorted by their GMT offsets. If zone's GMT - * offset will change in the future, its last known offset is - * used. - */ - private SortedMap> zonesByOffset = new TreeMap<>(); - - /** - * Sets last Rule records and Zone records for given timezone to - * each Map. - * - * @param tz Timezone object for each zone - * @return always 0 - */ - int processZoneinfo(Timezone tz) { - String zonename = tz.getName(); - - lastRules.put(zonename, tz.getLastRules()); - lastZoneRecs.put(zonename, tz.getLastZoneRec()); - - // Populate zonesByOffset. (Zones that will change their - // GMT offsets are also added to zonesByOffset here.) - int lastKnownOffset = tz.getRawOffset(); - Set set = zonesByOffset.get(lastKnownOffset); - if (set == null) { - set = new TreeSet<>(); - zonesByOffset.put(lastKnownOffset, set); - } - set.add(zonename); - - return 0; - } - - /** - * Generates TimeZoneData to output SimpleTimeZone data. - * @param map Mappings object which is generated by {@link Main#compile}. - * @return 0 if no error occurred, otherwise 1. - */ - int generateSrc(Mappings map) { - try { - File outD = new File(Main.getOutputDir()); - outD.mkdirs(); - - FileWriter fw = - new FileWriter(new File(outD, "TimeZoneData.java"), false); - BufferedWriter out = new BufferedWriter(fw); - - out.write("import java.util.SimpleTimeZone;\n\n"); - out.write(" static SimpleTimeZone zones[] = {\n"); - - Map a = map.getAliases(); - List roi = map.getRawOffsetsIndex(); - List> roit = map.getRawOffsetsIndexTable(); - - int index = 0; - for (int offset : zonesByOffset.keySet()) { - int o = roi.get(index); - Set set = zonesByOffset.get(offset); - if (offset == o) { - // Merge aliases into zonesByOffset - set.addAll(roit.get(index)); - } - index++; - - for (String key : set) { - ZoneRec zrec; - String realname; - List stz; - if ((realname = a.get(key)) != null) { - // if this alias is not targeted, ignore it. - if (!Zone.isTargetZone(key)) { - continue; - } - stz = lastRules.get(realname); - zrec = lastZoneRecs.get(realname); - } else { - stz = lastRules.get(key); - zrec = lastZoneRecs.get(key); - } - - out.write("\t//--------------------------------------------------------------------\n"); - String s = Time.toFormedString(offset); - out.write("\tnew SimpleTimeZone(" + - Time.toFormedString(offset) + ", \"" + key + "\""); - if (realname != null) { - out.write(" /* " + realname + " */"); - } - - if (stz == null) { - out.write("),\n"); - } else { - RuleRec rr0 = stz.get(0); - RuleRec rr1 = stz.get(1); - - out.write(",\n\t " + Month.toString(rr0.getMonthNum()) + - ", " + rr0.getDay().getDayForSimpleTimeZone() + ", " + - rr0.getDay().getDayOfWeekForSimpleTimeZone() + ", " + - Time.toFormedString((int)rr0.getTime().getTime()) + ", " + - rr0.getTime().getTypeForSimpleTimeZone() + ",\n" + - - "\t " + Month.toString(rr1.getMonthNum()) + ", " + - rr1.getDay().getDayForSimpleTimeZone() + ", " + - rr1.getDay().getDayOfWeekForSimpleTimeZone() + ", " + - Time.toFormedString((int)rr1.getTime().getTime())+ ", " + - rr1.getTime().getTypeForSimpleTimeZone() + ",\n" + - - "\t " + Time.toFormedString(rr0.getSave()) + "),\n"); - - out.write("\t// " + rr0.getLine() + "\n"); - out.write("\t// " + rr1.getLine() + "\n"); - } - - String zline = zrec.getLine(); - if (zline.indexOf("Zone") == -1) { - zline = "Zone " + key + "\t" + zline.trim(); - } - out.write("\t// " + zline + "\n"); - } - } - out.write(" };\n"); - - out.close(); - fw.close(); - } catch(IOException e) { - Main.panic("IO error: "+e.getMessage()); - return 1; - } - - return 0; - } -} diff --git a/test/jdk/sun/util/calendar/zi/TestZoneInfo310.java b/test/jdk/sun/util/calendar/zi/TestZoneInfo310.java deleted file mode 100644 index 0b6570b74dc73..0000000000000 --- a/test/jdk/sun/util/calendar/zi/TestZoneInfo310.java +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Copyright (c) 2012, 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 8007572 8008161 8157792 8212970 8224560 8324065 - * @summary Test whether the TimeZone generated from JSR310 tzdb is the same - * as the one from the tz data from javazic - * @modules java.base/sun.util.calendar:+open - * @build BackEnd Checksum DayOfWeek Gen GenDoc Main Mappings Month - * Rule RuleDay RuleRec Simple TestZoneInfo310 Time Timezone - * TzIDOldMapping Zone ZoneInfoFile ZoneInfoOld ZoneRec Zoneinfo - * @run main TestZoneInfo310 - */ - -import java.io.File; -import java.lang.reflect.*; -import java.nio.file.*; -import java.util.*; -import java.util.regex.*; -import java.time.zone.*; -import java.time.ZoneId; - -public class TestZoneInfo310 { - - public static void main(String[] args) throws Throwable { - - String TESTDIR = System.getProperty("test.dir", "."); - Path tzdir = Paths.get(System.getProperty("test.root"), - "../../src/java.base/share/data/tzdata"); - String tzfiles = "africa antarctica asia australasia europe northamerica southamerica backward etcetera gmt"; - Path jdk_tzdir = Paths.get(System.getProperty("test.src"), "tzdata_jdk"); - String jdk_tzfiles = "jdk11_backward"; - String zidir = TESTDIR + File.separator + "zi"; - File fZidir = new File(zidir); - if (!fZidir.exists()) { - fZidir.mkdirs(); - } - Matcher m = Pattern.compile("tzdata(?[0-9]{4}[A-z])") - .matcher(new String(Files.readAllBytes(tzdir.resolve("VERSION")), "ascii")); - String ver = m.find() ? m.group("ver") : "NULL"; - - ArrayList alist = new ArrayList<>(); - alist.add("-V"); - alist.add(ver); - alist.add("-d"); - alist.add(zidir); - for (String f : tzfiles.split(" ")) { - alist.add(tzdir.resolve(f).toString()); - } - for (String f : jdk_tzfiles.split(" ")) { - alist.add(jdk_tzdir.resolve(f).toString()); - } - System.out.println("Compiling tz files!"); - Main.main(alist.toArray(new String[alist.size()])); - - ////////////////////////////////// - System.out.println("testing!"); - ZoneInfoFile.ziDir = zidir; - long t0, t1; - - t0 = System.nanoTime(); - ZoneInfoOld.getTimeZone("America/Los_Angeles"); - t1 = System.nanoTime(); - System.out.printf("OLD.getZoneInfoOld()[1]=%d%n", (t1 - t0) / 1000); - - t0 = System.nanoTime(); - ZoneInfoOld.getTimeZone("America/New_York"); - t1 = System.nanoTime(); - System.out.printf("OLD.getZoneInfoOld()[2]=%d%n", (t1 - t0) / 1000); - - t0 = System.nanoTime(); - ZoneInfoOld.getTimeZone("America/Denver"); - t1 = System.nanoTime(); - System.out.printf("OLD.getZoneInfoOld()[3]=%d%n", (t1 - t0) / 1000); - - t0 = System.nanoTime(); - String[] zids_old = ZoneInfoOld.getAvailableIDs(); - t1 = System.nanoTime(); - System.out.printf("OLD.getAvailableIDs()=%d, total=%d%n", - (t1 - t0) / 1000, zids_old.length); - Arrays.sort(zids_old); - - t0 = System.nanoTime(); - String[] alias_old = ZoneInfoOld.getAliasTable() - .keySet().toArray(new String[0]); - t1 = System.nanoTime(); - System.out.printf("OLD.getAliasTable()=%d, total=%d%n", - (t1 - t0) / 1000, alias_old.length); - Arrays.sort(alias_old); - - t0 = System.currentTimeMillis(); - for (String zid : zids_old) { - ZoneInfoOld.getTimeZone(zid); - } - t1 = System.currentTimeMillis(); - System.out.printf("OLD.TotalTZ()=%d (ms)%n", t1 - t0); - -/* - t0 = System.nanoTime(); - ZoneId.of("America/Los_Angeles").getRules(); - t1 = System.nanoTime(); - System.out.printf("NEW.ZoneId.of()[1]=%d%n", (t1 - t0) / 1000); -*/ - t0 = System.nanoTime(); - TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles"); - t1 = System.nanoTime(); - System.out.printf("NEW.getTimeZone()[1]=%d%n", (t1 - t0) / 1000); - - t0 = System.nanoTime(); - tz = TimeZone.getTimeZone("America/New_York"); - t1 = System.nanoTime(); - System.out.printf("NEW.getTimeZone()[2]=%d%n", (t1 - t0) / 1000); - - t0 = System.nanoTime(); - tz = TimeZone.getTimeZone("America/Denver"); - t1 = System.nanoTime(); - System.out.printf("NEW.getTimeZone()[3]=%d%n", (t1 - t0) / 1000); - - t0 = System.nanoTime(); - String[] zids_new = TimeZone.getAvailableIDs(); - t1 = System.nanoTime(); - System.out.printf("NEW.getAvailableIDs()=%d, total=%d%n", - (t1 - t0) / 1000, zids_new.length); - Arrays.sort(zids_new); - - t0 = System.nanoTime(); - String[] alias_new = sun.util.calendar.ZoneInfo.getAliasTable() - .keySet().toArray(new String[0]); - t1 = System.nanoTime(); - System.out.printf("NEW.getAliasTable()=%d, total=%d%n", - (t1 - t0) / 1000, alias_new.length); - Arrays.sort(alias_new); - - t0 = System.currentTimeMillis(); - for (String zid : zids_new) { - TimeZone.getTimeZone(zid); - } - t1 = System.currentTimeMillis(); - System.out.printf("NEW.TotalTZ()=%d (ms)%n", t1 - t0); - - if (!Arrays.equals(zids_old, zids_new)) { - throw new RuntimeException(" FAILED: availableIds don't match"); - } - - if (!Arrays.equals(alias_old, alias_new)) { - throw new RuntimeException(" FAILED: aliases don't match"); - } - - for (String zid : zids_new) { - ZoneInfoOld zi = toZoneInfoOld(TimeZone.getTimeZone(zid)); - ZoneInfoOld ziOLD = (ZoneInfoOld)ZoneInfoOld.getTimeZone(zid); - /* - * Ignoring the failing TimeZones which have negative DST - * save time in IANA tzdata, as javazic/ZoneInfoOld cannot - * handle the negative DST. - * - * These are the zones/rules that employ negative DST in vanguard - * format (as of 2019a), Palestine added in 2022d: - * - * - Rule "Eire" - * - Rule "Morocco" - * - Rule "Namibia" - * - Rule "Palestine" - * - Zone "Europe/Prague" - */ - if (zid.equals("Africa/Casablanca") || // uses "Morocco" rule - zid.equals("Africa/El_Aaiun") || // uses "Morocco" rule - zid.equals("Africa/Windhoek") || // uses "Namibia" rule - zid.equals("Eire") || - zid.equals("Europe/Bratislava") || // link to "Europe/Prague" - zid.equals("Europe/Dublin") || // uses "Eire" rule - zid.equals("Europe/Prague") || - zid.equals("Asia/Gaza") || // uses "Palestine" rule - zid.equals("Asia/Hebron")) { // uses "Palestine" rule - continue; - } - if (! zi.equalsTo(ziOLD)) { - System.out.println(zi.diffsTo(ziOLD)); - throw new RuntimeException(" FAILED: " + zid); - } - } - delete(fZidir); - - // test tzdb version - if (!ver.equals(sun.util.calendar.ZoneInfoFile.getVersion())) { - System.out.printf(" FAILED: ver=%s, expected=%s%n", - sun.util.calendar.ZoneInfoFile.getVersion(), ver); - throw new RuntimeException("Version test failed"); - } - - // test getAvailableIDs(raw); - zids_new = TimeZone.getAvailableIDs(-8 * 60 * 60 * 1000); - Arrays.sort(zids_new); - zids_old = ZoneInfoOld.getAvailableIDs(-8 * 60 * 60 * 1000); - Arrays.sort(zids_old); - if (!Arrays.equals(zids_new, zids_old)) { - System.out.println("------------------------"); - System.out.println("NEW.getAvailableIDs(-8:00)"); - for (String zid : zids_new) { - System.out.println(zid); - } - System.out.println("------------------------"); - System.out.println("OLD.getAvailableIDs(-8:00)"); - for (String zid : zids_old) { - System.out.println(zid); - } - throw new RuntimeException(" FAILED: availableIds(offset) don't match"); - } - } - - private static void delete(File f) { - if (f.isDirectory()) { - for (File f0 : f.listFiles()) { - delete(f0); - } - } - f.delete(); - } - - // to access sun.util.calendar.ZoneInfo's private fields - static Class ziClz; - static Field rawOffset; - static Field checksum; - static Field dstSavings; - static Field transitions; - static Field offsets; - static Field simpleTimeZoneParams; - static Field willGMTOffsetChange; - static { - try { - ziClz = Class.forName("sun.util.calendar.ZoneInfo"); - rawOffset = ziClz.getDeclaredField("rawOffset"); - checksum = ziClz.getDeclaredField("checksum"); - dstSavings = ziClz.getDeclaredField("dstSavings"); - transitions = ziClz.getDeclaredField("transitions"); - offsets = ziClz.getDeclaredField("offsets"); - simpleTimeZoneParams = ziClz.getDeclaredField("simpleTimeZoneParams"); - willGMTOffsetChange = ziClz.getDeclaredField("willGMTOffsetChange"); - rawOffset.setAccessible(true); - checksum.setAccessible(true); - dstSavings.setAccessible(true); - transitions.setAccessible(true); - offsets.setAccessible(true); - simpleTimeZoneParams.setAccessible(true); - willGMTOffsetChange.setAccessible(true); - } catch (Exception x) { - throw new RuntimeException(x); - } - } - - private static ZoneInfoOld toZoneInfoOld(TimeZone tz) throws Exception { - return new ZoneInfoOld(tz.getID(), - rawOffset.getInt(tz), - dstSavings.getInt(tz), - checksum.getInt(tz), - (long[])transitions.get(tz), - (int[])offsets.get(tz), - (int[])simpleTimeZoneParams.get(tz), - willGMTOffsetChange.getBoolean(tz)); - } - -} diff --git a/test/jdk/sun/util/calendar/zi/Time.java b/test/jdk/sun/util/calendar/zi/Time.java deleted file mode 100644 index 66379d29d28ee..0000000000000 --- a/test/jdk/sun/util/calendar/zi/Time.java +++ /dev/null @@ -1,339 +0,0 @@ -/* - * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import java.util.Locale; -import sun.util.calendar.CalendarDate; -import sun.util.calendar.CalendarSystem; -import sun.util.calendar.Gregorian; - -/** - * Time class represents the "AT" field and other time related information. - * - * @since 1.4 - */ -class Time { - - static final Gregorian gcal = CalendarSystem.getGregorianCalendar(); - - // type is wall clock time - private static final int WALL = 1; - - // type is standard time - private static final int STD = 2; - - // type is UTC - private static final int UTC = 3; - - // type of representing time - private int type; - - /** - * Time from the EPOCH in milliseconds - */ - private long time; - - /** - * Current time in milliseconds - */ - private static final long currentTime = System.currentTimeMillis(); - - Time() { - time = 0L; - } - - Time(long time) { - this.time = time; - } - - void setType(int type) { - this.type = type; - } - - long getTime() { - return time; - } - - int getType() { - return type; - } - - static long getCurrentTime() { - return currentTime; - } - - /** - * @return true if the time is represented in wall-clock time. - */ - boolean isWall() { - return type == WALL; - } - - /** - * @return true if the time is represented in standard time. - */ - boolean isSTD() { - return type == STD; - } - - /** - * @return true if the time is represented in UTC time. - */ - boolean isUTC() { - return type == UTC; - } - - /** - * Converts the type to a string that represents the type in the - * SimpleTimeZone time mode. (e.g., "SimpleTimeZone.WALL_TIME"). - * @return the converted string or null if the type is undefined. - */ - String getTypeForSimpleTimeZone() { - String stz = "SimpleTimeZone."; - if (isWall()) { - return stz+"WALL_TIME"; - } - else if (isSTD()) { - return stz+"STANDARD_TIME"; - } - else if (isUTC()) { - return stz+"UTC_TIME"; - } - else { - return null; - } - } - - /** - * Converts the given Gregorian calendar field values to local time. - * Local time is represented by the amount of milliseconds from - * January 1, 1970 0:00 GMT. - * @param year the year value - * @param month the Month value - * @param day the day represented by {@link RuleDay} - * @param save the amount of daylight time in milliseconds - * @param gmtOffset the GMT offset in milliseconds - * @param time the time of the day represented by {@link Time} - * @return local time - */ - static long getLocalTime(int year, Month month, RuleDay day, int save, - int gmtOffset, Time time) { - long t = time.getTime(); - - if (time.isSTD()) - t = time.getTime() + save; - else if (time.isUTC()) - t = time.getTime() + save + gmtOffset; - - return getLocalTime(year, month, day, t); - } - - /** - * Converts the given Gregorian calendar field values to local time. - * Local time is represented by the amount of milliseconds from - * January 1, 1970 0:00 GMT. - * @param year the year value - * @param month the Month value - * @param day the day value - * @param time the time of the day in milliseconds - * @return local time - */ - static long getLocalTime(int year, Month month, int day, long time) { - CalendarDate date = gcal.newCalendarDate(null); - date.setDate(year, month.value(), day); - long millis = gcal.getTime(date); - return millis + time; - } - - /** - * Equivalent to getLocalTime(year, month, day, (long)time). - * @param year the year value - * @param month the Month value - * @param day the day value - * @param time the time of the day in milliseconds - * @return local time - */ - static long getLocalTime(int year, Month month, int day, int time) { - return getLocalTime(year, month, day, (long)time); - } - - /** - * Equivalent to {@link #getLocalTime(int, Month, RuleDay, int) - * getLocalTime(year, month, day, (int) time)}. - * @param year the year value - * @param month the Month value - * @param day the day represented by {@link RuleDay} - * @param time the time of the day represented by {@link Time} - * @return local time - */ - static long getLocalTime(int year, Month month, RuleDay day, long time) { - return getLocalTime(year, month, day, (int) time); - } - - /** - * Converts the given Gregorian calendar field values to local time. - * Local time is represented by the amount of milliseconds from - * January 1, 1970 0:00 GMT. - * @param year the year value - * @param month the Month value - * @param day the day represented by {@link RuleDay} - * @param time the time of the day represented by {@link Time} - * @return local time - */ - static long getLocalTime(int year, Month month, RuleDay day, int time) { - CalendarDate cdate = gcal.newCalendarDate(null); - int monthValue = month.value(); - - if (day.isLast()) { // e.g., "lastSun" - cdate.setDate(year, monthValue, 1); - cdate.setDayOfMonth(gcal.getMonthLength(cdate)); - cdate = gcal.getNthDayOfWeek(-1, day.getDayOfWeekNum(), cdate); - } else if (day.isLater()) { // e.g., "Sun>=1" - cdate.setDate(year, monthValue, day.getDay()); - cdate = gcal.getNthDayOfWeek(1, day.getDayOfWeekNum(), cdate); - } else if (day.isExact()) { - cdate.setDate(year, monthValue, day.getDay()); - } else if (day.isEarlier()) { // e.g., "Sun<=15" - cdate.setDate(year, monthValue, day.getDay()); - cdate = gcal.getNthDayOfWeek(-1, day.getDayOfWeekNum(), cdate); - } else { - Main.panic("invalid day type: " + day); - } - return gcal.getTime(cdate) + time; - } - - /** - * Parses the given "AT" field and constructs a Time object. - * @param the "AT" field string - * @return the Time object - */ - static Time parse(String time) { - int sign; - int index = 0; - Time tm; - - if (time.charAt(0) == '-') { - sign = -1; - index++; - } else { - sign = 1; - } - int val = 0; - int num = 0; - int countDelim = 0; - while (index < time.length()) { - char c = time.charAt(index++); - if (c == ':') { - val = val * 60 + num; - countDelim++; - num = 0; - continue; - } - int d = Character.digit(c, 10); - if (d == -1) { - --index; - break; - } - num = num * 10 + d; - } - val = val * 60 + num; - // convert val to second - for (; countDelim < 2; countDelim++) { - val *= 60; - } - tm = new Time((long)val * 1000 * sign); - if (index < time.length()) { - char c = time.charAt(index++); - if (c == 's') { - tm.setType(Time.STD); - } else if (c == 'u' || c == 'g' || c == 'z') { - tm.setType(Time.UTC); - } else if (c == 'w') { - tm.setType(Time.WALL); - } else { - Main.panic("unknown time mode: "+c); - } - } else { - tm.setType(Time.WALL); - } - return tm; - } - - /** - * Converts the given milliseconds string to a "[+-]hh:mm" string. - * @param ms the milliseconds string - */ - static String toGMTFormat(String ms) { - long sec = Long.parseLong(ms) / 1000; - char sign; - if (sec < 0) { - sign = '-'; - sec = -sec; - } else { - sign = '+'; - } - return String.format((Locale)null, "%c%02d:%02d", - sign, sec/3600, (sec%3600)/60); - } - - /** - * Converts the given millisecond value to a string for a - * SimpleTimeZone parameter. - * @param ms the millisecond value - * @return the string in a human readable form - */ - static String toFormedString(int ms) { - StringBuilder s = new StringBuilder(); - boolean minus = false; - - if (ms < 0) { - s.append("-"); - minus = true; - ms = -ms; - } else if (ms == 0) { - return "0"; - } - - int hour = ms / (60 * 60 * 1000); - ms %= (60 * 60 * 1000); - int minute = ms / (60 * 1000); - - if (hour != 0) { - if (minus && minute != 0) { - s.append("("); - } - s.append(Integer.toString(hour) + "*ONE_HOUR"); - } - - if (minute != 0) { - if (hour != 0) { - s.append("+"); - } - s.append(Integer.toString(minute) + "*ONE_MINUTE"); - if (minus && hour != 0) { - s.append(")"); - } - } - - return s.toString(); - } -} diff --git a/test/jdk/sun/util/calendar/zi/Timezone.java b/test/jdk/sun/util/calendar/zi/Timezone.java deleted file mode 100644 index d4890e8f58b55..0000000000000 --- a/test/jdk/sun/util/calendar/zi/Timezone.java +++ /dev/null @@ -1,450 +0,0 @@ -/* - * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import java.util.ArrayList; -import java.util.List; - -/** - * Timezone represents all information of a single point of time to - * generate its time zone database. - * - * @since 1.4 - */ -class Timezone { - /** - * zone name of this time zone - */ - private String name; - - /** - * transition time values in UTC (millisecond) - */ - private List transitions; - - /** - * All offset values in millisecond - * @see sun.util.calendar.ZoneInfo - */ - private List offsets; - - /** - * Indices of GMT offset values (both raw and raw+saving) - * at transitions - */ - private List gmtOffsets; - - /** - * Indices of regular or "direct" saving time values - * at transitions - */ - private List dstOffsets; - - /** - * Zone records of this time zone - */ - private List usedZoneRecs; - - /** - * Rule records referred to by this time zone - */ - private List usedRuleRecs; - - /** - * Type of DST rules in this time zone - */ - private int dstType; - static final int UNDEF_DST = 0; // DST type not set yet - static final int NO_DST = 1; // never observed DST - static final int LAST_DST = 2; // last rule ends in DST (all year round DST-only) - static final int X_DST = 3; // used to observe DST - static final int DST = 4; // observing DST regularly - - /** - * Raw GMT offset of this time zone in the last rule - */ - private int rawOffset; - - /** - * The CRC32 value of the transitions data - */ - private int crc32; - - /** - * The last ZoneRec - */ - private ZoneRec lastZoneRec; - - /** - * The last DST rules. lastRules[0] is the DST start - * rule. lastRules[1] is the DST end rules. - */ - private List lastRules; - - /** - * The amount of DST saving value (millisecond) in the last DST - * rule. - */ - private int lastSaving; - - /** - * true if the raw offset will change in the future time. - */ - private boolean willRawOffsetChange = false; - - - /** - * Constracts a Timezone object with the given zone name. - * @param name the zone name - */ - Timezone(String name) { - this.name = name; - } - - /** - * @return the number of transitions - */ - int getNTransitions() { - if (transitions == null) { - return 0; - } - return transitions.size(); - } - - /** - * @return the zone name - */ - String getName() { - return name; - } - - /** - * Returns the list of all rule records that have been referred to - * by this time zone. - * @return the rule records list - */ - List getRules() { - return usedRuleRecs; - } - - /** - * Returns the list of all zone records that have been referred to - * by this time zone. - * @return the zone records list - */ - List getZones() { - return usedZoneRecs; - } - - /** - * @return the transition table (list) - */ - List getTransitions() { - return transitions; - } - - /** - * @return the offsets list - */ - List getOffsets() { - return offsets; - } - - /** - * @return the DST saving offsets list - */ - List getDstOffsets() { - return dstOffsets; - } - - /** - * @return the GMT offsets list - */ - List getGmtOffsets() { - return gmtOffsets; - } - - /** - * @return the checksum (crc32) value of the trasition table - */ - int getCRC32() { - return crc32; - } - - /** - * @return true if the GMT offset of this time zone would change - * after the time zone database has been generated, false, otherwise. - */ - boolean willGMTOffsetChange() { - return willRawOffsetChange; - } - - /** - * @return the last known GMT offset value in milliseconds - */ - int getRawOffset() { - return rawOffset; - } - - /** - * Sets time zone's GMT offset to offset. - * @param offset the GMT offset value in milliseconds - */ - void setRawOffset(int offset) { - rawOffset = offset; - } - - /** - * Sets time zone's GMT offset value to offset. If - * startTime is future time, then the {@link - * #willRawOffsetChange} value is set to true. - * @param offset the GMT offset value in milliseconds - * @param startTime the UTC time at which the GMT offset is in effective - */ - void setRawOffset(int offset, long startTime) { - // if this rawOffset is for the future time, let the run-time - // look for the current GMT offset. - if (startTime > Time.getCurrentTime()) { - willRawOffsetChange = true; - } - setRawOffset(offset); - } - - /** - * Adds the specified transition information to the end of the transition table. - * @param time the UTC time at which this transition happens - * @param offset the total amount of the offset from GMT in milliseconds - * @param dstOffset the amount of time in milliseconds saved at this transition - */ - void addTransition(long time, int offset, int dstOffset) { - if (transitions == null) { - transitions = new ArrayList(); - offsets = new ArrayList(); - dstOffsets = new ArrayList(); - } - transitions.add(time); - offsets.add(offset); - dstOffsets.add(dstOffset); - } - - /** - * Sets the type of historical daylight saving time - * observation. For example, China used to observed daylight - * saving time, but it no longer does. Then, X_DST is set to the - * China time zone. - * @param type the type of daylight saving time - */ - void setDSTType(int type) { - dstType = type; - } - - /** - * @return the type of historical daylight saving time - * observation. - */ - int getDSTType() { - return dstType; - } - - /** - * Adds the specified zone record to the zone records list. - * @param rec the zone record - */ - void addUsedRec(ZoneRec rec) { - if (usedZoneRecs == null) { - usedZoneRecs = new ArrayList(); - } - usedZoneRecs.add(rec); - } - - /** - * Adds the specified rule record to the rule records list. - * @param rec the rule record - */ - void addUsedRec(RuleRec rec) { - if (usedRuleRecs == null) { - usedRuleRecs = new ArrayList(); - } - // if the last used rec is the same as the given rec, avoid - // putting the same rule. - int n = usedRuleRecs.size(); - for (int i = 0; i < n; i++) { - if (usedRuleRecs.get(i).equals(rec)) { - return; - } - } - usedRuleRecs.add(rec); - } - - /** - * Sets the last zone record for this time zone. - * @param the last zone record - */ - void setLastZoneRec(ZoneRec zrec) { - lastZoneRec = zrec; - } - - /** - * @return the last zone record for this time zone. - */ - ZoneRec getLastZoneRec() { - return lastZoneRec; - } - - /** - * Sets the last rule records for this time zone. Those are used - * for generating SimpleTimeZone parameters. - * @param rules the last rule records - */ - void setLastRules(List rules) { - int n = rules.size(); - if (n > 0) { - lastRules = rules; - RuleRec rec = rules.get(0); - int offset = rec.getSave(); - if (offset > 0) { - setLastDSTSaving(offset); - } else { - System.err.println("\t No DST starting rule in the last rules."); - } - } - } - - /** - * @return the last rule records for this time zone. - */ - List getLastRules() { - return lastRules; - } - - /** - * Sets the last daylight saving amount. - * @param the daylight saving amount - */ - void setLastDSTSaving(int offset) { - lastSaving = offset; - } - - /** - * @return the last daylight saving amount. - */ - int getLastDSTSaving() { - return lastSaving; - } - - /** - * Calculates the CRC32 value from the transition table and sets - * the value to crc32. - */ - void checksum() { - if (transitions == null) { - crc32 = 0; - return; - } - Checksum sum = new Checksum(); - for (int i = 0; i < transitions.size(); i++) { - int offset = offsets.get(i); - // adjust back to make the transition in local time - sum.update(transitions.get(i) + offset); - sum.update(offset); - sum.update(dstOffsets.get(i)); - } - crc32 = (int)sum.getValue(); - } - - /** - * Removes unnecessary transitions for Java time zone support. - */ - void optimize() { - // if there is only one offset, delete all transitions. This - // could happen if only time zone abbreviations changed. - if (gmtOffsets.size() == 1) { - transitions = null; - usedRuleRecs = null; - setDSTType(NO_DST); - return; - } - for (int i = 0; i < (transitions.size() - 2); i++) { // don't remove the last one - if (transitions.get(i) == transitions.get(i+1)) { - transitions.remove(i); - offsets.remove(i); - dstOffsets.remove(i); - i--; - } - } - - for (int i = 0; i < (transitions.size() - 2); i++) { // don't remove the last one - if (offsets.get(i) == offsets.get(i+1) - && dstOffsets.get(i) == dstOffsets.get(i+1)) { - transitions.remove(i+1); - offsets.remove(i+1); - dstOffsets.remove(i+1); - i--; - } - } - } - - /** - * Stores the specified offset value from GMT in the GMT offsets - * table and returns its index. The offset value includes the base - * GMT offset and any additional daylight saving if applicable. If - * the same value as the specified offset is already in the table, - * its index is returned. - * @param offset the offset value in milliseconds - * @return the index to the offset value in the GMT offsets table. - */ - int getOffsetIndex(int offset) { - return getOffsetIndex(offset, 0); - } - - /** - * Stores the specified daylight saving value in the GMT offsets - * table and returns its index. If the same value as the specified - * offset is already in the table, its index is returned. If 0 is - * specified, it's not stored in the table and -1 is returned. - * @param offset the offset value in milliseconds - * @return the index to the specified offset value in the GMT - * offsets table, or -1 if 0 is specified. - */ - int getDstOffsetIndex(int offset) { - if (offset == 0) { - return -1; - } - return getOffsetIndex(offset, 1); - } - - private int getOffsetIndex(int offset, int index) { - if (gmtOffsets == null) { - gmtOffsets = new ArrayList(); - } - for (int i = index; i < gmtOffsets.size(); i++) { - if (offset == gmtOffsets.get(i)) { - return i; - } - } - if (gmtOffsets.size() < index) { - gmtOffsets.add(0); - } - gmtOffsets.add(offset); - return gmtOffsets.size() - 1; - } -} diff --git a/test/jdk/sun/util/calendar/zi/TzIDOldMapping.java b/test/jdk/sun/util/calendar/zi/TzIDOldMapping.java deleted file mode 100644 index 7e8ce63644991..0000000000000 --- a/test/jdk/sun/util/calendar/zi/TzIDOldMapping.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import java.util.Map; -import java.util.HashMap; - -class TzIDOldMapping { - static final Map MAP = new HashMap(); - static { - String[][] oldmap = { - { "ACT", "Australia/Darwin" }, - { "AET", "Australia/Sydney" }, - { "AGT", "America/Argentina/Buenos_Aires" }, - { "ART", "Africa/Cairo" }, - { "AST", "America/Anchorage" }, - { "BET", "America/Sao_Paulo" }, - { "BST", "Asia/Dhaka" }, - { "CAT", "Africa/Harare" }, - { "CNT", "America/St_Johns" }, - { "CST", "America/Chicago" }, - { "CTT", "Asia/Shanghai" }, - { "EAT", "Africa/Addis_Ababa" }, - { "ECT", "Europe/Paris" }, - { "EST", "America/New_York" }, - { "HST", "Pacific/Honolulu" }, - { "IET", "America/Indianapolis" }, - { "IST", "Asia/Calcutta" }, - { "JST", "Asia/Tokyo" }, - { "MIT", "Pacific/Apia" }, - { "MST", "America/Denver" }, - { "NET", "Asia/Yerevan" }, - { "NST", "Pacific/Auckland" }, - { "PLT", "Asia/Karachi" }, - { "PNT", "America/Phoenix" }, - { "PRT", "America/Puerto_Rico" }, - { "PST", "America/Los_Angeles" }, - { "SST", "Pacific/Guadalcanal" }, - { "VST", "Asia/Saigon" }, - }; - for (String[] pair : oldmap) { - MAP.put(pair[0], pair[1]); - } - } -} diff --git a/test/jdk/sun/util/calendar/zi/Zone.java b/test/jdk/sun/util/calendar/zi/Zone.java deleted file mode 100644 index f1adbf6f938dd..0000000000000 --- a/test/jdk/sun/util/calendar/zi/Zone.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import java.io.BufferedReader; -import java.io.FileReader; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.StringTokenizer; - -/** - * Zone holds information corresponding to a "Zone" part of a time - * zone definition file. - * - * @since 1.4 - */ -class Zone { - // zone name (e.g., "America/Los_Angeles") - private String name; - - // zone records - private List list; - - // target zone names for this compilation - private static Set targetZones; - - /** - * Constructs a Zone with the specified zone name. - * @param name the zone name - */ - Zone(String name) { - this.name = name; - list = new ArrayList(); - } - - /** - * Reads time zone names to be generated, called "target zone - * name", from the specified text file and creats an internal hash - * table to keep those names. It's assumed that one text line - * contains a zone name or comments if it starts with - * '#'. Comments can't follow a zone name in a single line. - * @param fileName the text file name - */ - static void readZoneNames(String fileName) { - if (fileName == null) { - return; - } - BufferedReader in = null; - try { - FileReader fr = new FileReader(fileName); - in = new BufferedReader(fr); - } catch (FileNotFoundException e) { - Main.panic("can't open file: " + fileName); - } - targetZones = new HashSet(); - String line; - - try { - while ((line = in.readLine()) != null) { - line = line.trim(); - if (line.length() == 0 || line.charAt(0) == '#') { - continue; - } - if (!targetZones.add(line)) { - Main.warning("duplicated target zone name: " + line); - } - } - in.close(); - } catch (IOException e) { - Main.panic("IO error: "+e.getMessage()); - } - } - - /** - * Determines whether the specified zone is one of the target zones. - * If no target zones are specified, this method always returns - * true for any zone name. - * @param zoneName the zone name - * @return true if the specified name is a target zone. - */ - static boolean isTargetZone(String zoneName) { - if (targetZones == null) { - return true; - } - return targetZones.contains(zoneName); - } - - /** - * Forces to add "MET" to the target zone table. This is because - * there is a conflict between Java zone name "WET" and Olson zone - * name. - */ - static void addMET() { - if (targetZones != null) { - targetZones.add("MET"); - } - } - - /** - * @return the zone name - */ - String getName() { - return name; - } - - /** - * Adds the specified zone record to the zone record list. - */ - void add(ZoneRec rec) { - list.add(rec); - } - - /** - * @param index the index at which the zone record in the list is returned. - * @return the zone record specified by the index. - */ - ZoneRec get(int index) { - return list.get(index); - } - - /** - * @return the size of the zone record list - */ - int size() { - return list.size(); - } - - /** - * Resolves the reference to a rule in each zone record. - * @param zi the Zoneinfo object with which the rule reference is - * resolved. - */ - void resolve(Zoneinfo zi) { - for (int i = 0; i < list.size(); i++) { - ZoneRec rec = list.get(i); - rec.resolve(zi); - } - } -} diff --git a/test/jdk/sun/util/calendar/zi/ZoneInfoFile.java b/test/jdk/sun/util/calendar/zi/ZoneInfoFile.java deleted file mode 100644 index 3134a517979bc..0000000000000 --- a/test/jdk/sun/util/calendar/zi/ZoneInfoFile.java +++ /dev/null @@ -1,1049 +0,0 @@ -/* - * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.lang.ref.SoftReference; -import java.nio.file.FileSystems; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import sun.util.calendar.*; - -/** - * ZoneInfoFile reads Zone information files in the - * <java.home>/lib/zi directory and provides time zone - * information in the form of a {@link ZoneInfo} object. Also, it - * reads the ZoneInfoMappings file to obtain time zone IDs information - * that is used by the {@link ZoneInfo} class. The directory layout - * and data file formats are as follows. - * - *

Directory layout

- * - * All zone data files and ZoneInfoMappings are put under the - * <java.home>/lib/zi directory. A path name for a given time - * zone ID is a concatenation of <java.home>/lib/zi/ and the - * time zone ID. (The file separator is replaced with the platform - * dependent value. e.g., '\' for Win32.) An example layout will look - * like as follows. - *

- *
- * <java.home>/lib/zi/Africa/Addis_Ababa
- *                   /Africa/Dakar
- *                   /America/Los_Angeles
- *                   /Asia/Singapore
- *                   /EET
- *                   /Europe/Oslo
- *                   /GMT
- *                   /Pacific/Galapagos
- *                       ...
- *                   /ZoneInfoMappings
- * 
- *
- * - * A zone data file has specific information of each zone. - * ZoneInfoMappings has global information of zone IDs so - * that the information can be obtained without instantiating all time - * zones. - * - *

File format

- * - * Two binary-file formats based on a simple Tag-Length-Value format are used - * to describe TimeZone information. The generic format of a data file is: - *

- *
- *    DataFile {
- *      u1              magic[7];
- *      u1              version;
- *      data_item       data[];
- *    }
- * 
- *
- * where magic is a magic number identifying a file - * format, version is the format version number, and - * data is one or more data_items. The - * data_item structure is: - *
- *
- *    data_item {
- *      u1              tag;
- *      u2              length;
- *      u1              value[length];
- *    }
- * 
- *
- * where tag indicates the data type of the item, - * length is a byte count of the following - * value that is the content of item data. - *

- * All data is stored in the big-endian order. There is no boundary - * alignment between date items. - * - *

1. ZoneInfo data file

- * - * Each ZoneInfo data file consists of the following members. - *
- *

- *
- *    ZoneInfoDataFile {
- *      u1              magic[7];
- *      u1              version;
- *      SET OF1 {
- *        transition            transitions2;
- *        offset_table          offsets2;
- *        simpletimezone        stzparams2;
- *        raw_offset            rawoffset;
- *        dstsaving             dst;
- *        checksum              crc32;
- *        gmtoffsetwillchange   gmtflag2;
- *      }
- *   }
- *   1: an unordered collection of zero or one occurrences of each item
- *   2: optional item
- * 
- *
- * magic is a byte-string constant identifying the - * ZoneInfo data file. This field must be "javazi\0" - * defined as {@link #JAVAZI_LABEL}. - *

- * version is the version number of the file format. This - * will be used for compatibility check. This field must be - * 0x01 in this version. - *

- * transition, offset_table and - * simpletimezone have information of time transition - * from the past to the future. Therefore, these structures don't - * exist if the zone didn't change zone names and haven't applied DST in - * the past, and haven't planned to apply it. (e.g. Asia/Tokyo zone) - *

- * raw_offset, dstsaving and checksum - * exist in every zoneinfo file. They are used by TimeZone.class indirectly. - * - *

1.1 transition structure

- *

- *
- *    transition {
- *      u1      tag;              // 0x04 : constant
- *      u2      length;           // byte length of whole values
- *      s8      value[length/8];  // transitions in `long'
- *    }
- * 
- *
- * See {@link ZoneInfo#transitions ZoneInfo.transitions} about the value. - * - *

1.2 offset_table structure

- *

- *
- *    offset_table {
- *      u1      tag;              // 0x05 : constant
- *      u2      length;           // byte length of whole values
- *      s4      value[length/4];  // offset values in `int'
- *    }
- * 
- *
- * - *

1.3 simpletimezone structure

- * See {@link ZoneInfo#simpleTimeZoneParams ZoneInfo.simpleTimeZoneParams} - * about the value. - *

- *
- *    simpletimezone {
- *      u1      tag;              // 0x06 : constant
- *      u2      length;           // byte length of whole values
- *      s4      value[length/4];  // SimpleTimeZone parameters
- *    }
- * 
- *
- * See {@link ZoneInfo#offsets ZoneInfo.offsets} about the value. - * - *

1.4 raw_offset structure

- *

- *
- *    raw_offset {
- *      u1      tag;              // 0x01 : constant
- *      u2      length;           // must be 4.
- *      s4      value;            // raw GMT offset [millisecond]
- *    }
- * 
- *
- * See {@link ZoneInfo#rawOffset ZoneInfo.rawOffset} about the value. - * - *

1.5 dstsaving structure

- * Value has dstSaving in seconds. - *

- *
- *    dstsaving {
- *      u1      tag;              // 0x02 : constant
- *      u2      length;           // must be 2.
- *      s2      value;            // DST save value [second]
- *    }
- * 
- *
- * See {@link ZoneInfo#dstSavings ZoneInfo.dstSavings} about value. - * - *

1.6 checksum structure

- *

- *
- *    checksum {
- *      u1      tag;              // 0x03 : constant
- *      u2      length;           // must be 4.
- *      s4      value;            // CRC32 value of transitions
- *    }
- * 
- *
- * See {@link ZoneInfo#checksum ZoneInfo.checksum}. - * - *

1.7 gmtoffsetwillchange structure

- * This record has a flag value for {@link ZoneInfo#rawOffsetWillChange}. - * If this record is not present in a zoneinfo file, 0 is assumed for - * the value. - *

- *
- *    gmtoffsetwillchange {
- *      u1      tag;             // 0x07 : constant
- *      u2      length;          // must be 1.
- *      u1      value;           // 1: if the GMT raw offset will change
- *                               // in the future, 0, otherwise.
- *     }
- * 
- *
- * - * - *

2. ZoneInfoMappings file

- * - * The ZoneInfoMappings file consists of the following members. - *
- *

- *
- *    ZoneInfoMappings {
- *      u1      magic[7];
- *      u1      version;
- *      SET OF {
- *        versionName                   version;
- *        zone_id_table                 zoneIDs;
- *        raw_offset_table              rawoffsets;
- *        raw_offset_index_table        rawoffsetindices;
- *        alias_table                   aliases;
- *        excluded_list                 excludedList;
- *      }
- *   }
- * 
- *
- * - * magic is a byte-string constant which has the file type. - * This field must be "javazm\0" defined as {@link #JAVAZM_LABEL}. - *

- * version is the version number of this file - * format. This will be used for compatibility check. This field must - * be 0x01 in this version. - *

- * versionName shows which version of Olson's data has been used - * to generate this ZoneInfoMappings. (e.g. tzdata2000g)
- * This field is for trouble-shooting and isn't usually used in runtime. - *

- * zone_id_table, raw_offset_index_table and - * alias_table are general information of supported - * zones. - * - *

2.1 zone_id_table structure

- * The list of zone IDs included in the zi database. The list does - * not include zone IDs, if any, listed in excludedList. - *
- *

- *
- *    zone_id_table {
- *      u1      tag;              // 0x40 : constant
- *      u2      length;           // byte length of whole values
- *      u2      zone_id_count;
- *      zone_id value[zone_id_count];
- *    }
- *
- *    zone_id {
- *      u1      byte_length;      // byte length of id
- *      u1      id[byte_length];  // zone name string
- *    }
- * 
- *
- * - *

2.2 raw_offset_table structure

- *
- *

- *
- *    raw_offset_table {
- *      u1      tag;              // 0x41 : constant
- *      u2      length;           // byte length of whole values
- *      s4      value[length/4];  // raw GMT offset in milliseconds
- *   }
- * 
- *
- * - *

2.3 raw_offset_index_table structure

- *
- *

- *
- *    raw_offset_index_table {
- *      u1      tag;              // 0x42 : constant
- *      u2      length;           // byte length of whole values
- *      u1      value[length];
- *    }
- * 
- *
- * - *

2.4 alias_table structure

- *
- *

- *
- *   alias_table {
- *      u1      tag;              // 0x43 : constant
- *      u2      length;           // byte length of whole values
- *      u2      nentries;         // number of id-pairs
- *      id_pair value[nentries];
- *   }
- *
- *   id_pair {
- *      zone_id aliasname;
- *      zone_id ID;
- *   }
- * 
- *
- * - *

2.5 versionName structure

- *
- *

- *
- *   versionName {
- *      u1      tag;              // 0x44 : constant
- *      u2      length;           // byte length of whole values
- *      u1      value[length];
- *   }
- * 
- *
- * - *

2.6 excludeList structure

- * The list of zone IDs whose zones will change their GMT offsets - * (a.k.a. raw offsets) some time in the future. Those IDs must be - * added to the list of zone IDs for getAvailableIDs(). Also they must - * be examined for getAvailableIDs(int) to determine the - * current GMT offsets. - *
- *

- *
- *   excluded_list {
- *      u1      tag;              // 0x45 : constant
- *      u2      length;           // byte length of whole values
- *      u2      nentries;         // number of zone_ids
- *      zone_id value[nentries];  // excluded zone IDs
- *   }
- * 
- *
- * - * @since 1.4 - */ - -public class ZoneInfoFile { - - /** - * The magic number for the ZoneInfo data file format. - */ - public static final byte[] JAVAZI_LABEL = { - (byte)'j', (byte)'a', (byte)'v', (byte)'a', (byte)'z', (byte)'i', (byte)'\0' - }; - private static final int JAVAZI_LABEL_LENGTH = JAVAZI_LABEL.length; - - /** - * The ZoneInfo data file format version number. Must increase - * one when any incompatible change has been made. - */ - public static final byte JAVAZI_VERSION = 0x01; - - /** - * Raw offset data item tag. - */ - public static final byte TAG_RawOffset = 1; - - /** - * Known last Daylight Saving Time save value data item tag. - */ - public static final byte TAG_LastDSTSaving = 2; - - /** - * Checksum data item tag. - */ - public static final byte TAG_CRC32 = 3; - - /** - * Transition data item tag. - */ - public static final byte TAG_Transition = 4; - - /** - * Offset table data item tag. - */ - public static final byte TAG_Offset = 5; - - /** - * SimpleTimeZone parameters data item tag. - */ - public static final byte TAG_SimpleTimeZone = 6; - - /** - * Raw GMT offset will change in the future. - */ - public static final byte TAG_GMTOffsetWillChange = 7; - - - /** - * The ZoneInfoMappings file name. - */ - public static final String JAVAZM_FILE_NAME = "ZoneInfoMappings"; - - /** - * The magic number for the ZoneInfoMappings file format. - */ - public static final byte[] JAVAZM_LABEL = { - (byte)'j', (byte)'a', (byte)'v', (byte)'a', (byte)'z', (byte)'m', (byte)'\0' - }; - private static final int JAVAZM_LABEL_LENGTH = JAVAZM_LABEL.length; - - /** - * The ZoneInfoMappings file format version number. Must increase - * one when any incompatible change has been made. - */ - public static final byte JAVAZM_VERSION = 0x01; - - /** - * Time zone IDs data item tag. - */ - public static final byte TAG_ZoneIDs = 64; - - /** - * Raw GMT offsets table data item tag. - */ - public static final byte TAG_RawOffsets = 65; - - /** - * Indices to the raw GMT offset table data item tag. - */ - public static final byte TAG_RawOffsetIndices = 66; - - /** - * Time zone aliases table data item tag. - */ - public static final byte TAG_ZoneAliases = 67; - - /** - * Olson's public zone information version tag. - */ - public static final byte TAG_TZDataVersion = 68; - - /** - * Excluded zones item tag. (Added in Mustang) - */ - public static final byte TAG_ExcludedZones = 69; - - private static Map zoneInfoObjects = null; - - private static final ZoneInfoOld GMT = new ZoneInfoOld("GMT", 0); - - static String ziDir; - - /** - * Converts the given time zone ID to a platform dependent path - * name. For example, "America/Los_Angeles" is converted to - * "America\Los_Angeles" on Win32. - * @return a modified ID replacing '/' with {@link - * java.io.File#separatorChar File.separatorChar} if needed. - */ - public static String getFileName(String ID) { - if (File.separatorChar == '/') { - return ID; - } - return ID.replace('/', File.separatorChar); - } - - /** - * Gets a ZoneInfo with the given GMT offset. The object - * has its ID in the format of GMT{+|-}hh:mm. - * - * @param originalId the given custom id (before normalized such as "GMT+9") - * @param gmtOffset GMT offset in milliseconds - * @return a ZoneInfo constructed with the given GMT offset - */ - public static ZoneInfoOld getCustomTimeZone(String originalId, int gmtOffset) { - String id = toCustomID(gmtOffset); - - ZoneInfoOld zi = getFromCache(id); - if (zi == null) { - zi = new ZoneInfoOld(id, gmtOffset); - zi = addToCache(id, zi); - if (!id.equals(originalId)) { - zi = addToCache(originalId, zi); - } - } - return (ZoneInfoOld) zi.clone(); - } - - public static String toCustomID(int gmtOffset) { - char sign; - int offset = gmtOffset / 60000; - - if (offset >= 0) { - sign = '+'; - } else { - sign = '-'; - offset = -offset; - } - int hh = offset / 60; - int mm = offset % 60; - - char[] buf = new char[] { 'G', 'M', 'T', sign, '0', '0', ':', '0', '0' }; - if (hh >= 10) { - buf[4] += hh / 10; - } - buf[5] += hh % 10; - if (mm != 0) { - buf[7] += mm / 10; - buf[8] += mm % 10; - } - return new String(buf); - } - - /** - * @return a ZoneInfo instance created for the specified id, or - * null if there is no time zone data file found for the specified - * id. - */ - public static ZoneInfoOld getZoneInfoOld(String id) { - //treat GMT zone as special - if ("GMT".equals(id)) - return (ZoneInfoOld) GMT.clone(); - ZoneInfoOld zi = getFromCache(id); - if (zi == null) { - Map aliases = ZoneInfoOld.getCachedAliasTable(); - if (aliases != null && aliases.get(id) != null) { - return null; - } - zi = createZoneInfoOld(id); - if (zi == null) { - return null; - } - zi = addToCache(id, zi); - } - return (ZoneInfoOld) zi.clone(); - } - - synchronized static ZoneInfoOld getFromCache(String id) { - if (zoneInfoObjects == null) { - return null; - } - return zoneInfoObjects.get(id); - } - - synchronized static ZoneInfoOld addToCache(String id, ZoneInfoOld zi) { - if (zoneInfoObjects == null) { - zoneInfoObjects = new HashMap<>(); - } else { - ZoneInfoOld zone = zoneInfoObjects.get(id); - if (zone != null) { - return zone; - } - } - zoneInfoObjects.put(id, zi); - return zi; - } - - private static ZoneInfoOld createZoneInfoOld(String id) { - byte[] buf = readZoneInfoFile(getFileName(id)); - if (buf == null) { - return null; - } - - int index = 0; - int filesize = buf.length; - int rawOffset = 0; - int dstSavings = 0; - int checksum = 0; - boolean willGMTOffsetChange = false; - long[] transitions = null; - int[] offsets = null; - int[] simpleTimeZoneParams = null; - - try { - for (index = 0; index < JAVAZI_LABEL.length; index++) { - if (buf[index] != JAVAZI_LABEL[index]) { - System.err.println("ZoneInfoOld: wrong magic number: " + id); - return null; - } - } - if (buf[index++] > JAVAZI_VERSION) { - System.err.println("ZoneInfo: incompatible version (" - + buf[index - 1] + "): " + id); - return null; - } - - while (index < filesize) { - byte tag = buf[index++]; - int len = ((buf[index++] & 0xFF) << 8) + (buf[index++] & 0xFF); - - if (filesize < index+len) { - break; - } - - switch (tag) { - case TAG_CRC32: - { - int val = buf[index++] & 0xff; - val = (val << 8) + (buf[index++] & 0xff); - val = (val << 8) + (buf[index++] & 0xff); - val = (val << 8) + (buf[index++] & 0xff); - checksum = val; - } - break; - - case TAG_LastDSTSaving: - { - short val = (short)(buf[index++] & 0xff); - val = (short)((val << 8) + (buf[index++] & 0xff)); - dstSavings = val * 1000; - } - break; - - case TAG_RawOffset: - { - int val = buf[index++] & 0xff; - val = (val << 8) + (buf[index++] & 0xff); - val = (val << 8) + (buf[index++] & 0xff); - val = (val << 8) + (buf[index++] & 0xff); - rawOffset = val; - } - break; - - case TAG_Transition: - { - int n = len / 8; - transitions = new long[n]; - for (int i = 0; i < n; i ++) { - long val = buf[index++] & 0xff; - val = (val << 8) + (buf[index++] & 0xff); - val = (val << 8) + (buf[index++] & 0xff); - val = (val << 8) + (buf[index++] & 0xff); - val = (val << 8) + (buf[index++] & 0xff); - val = (val << 8) + (buf[index++] & 0xff); - val = (val << 8) + (buf[index++] & 0xff); - val = (val << 8) + (buf[index++] & 0xff); - transitions[i] = val; - } - } - break; - - case TAG_Offset: - { - int n = len / 4; - offsets = new int[n]; - for (int i = 0; i < n; i ++) { - int val = buf[index++] & 0xff; - val = (val << 8) + (buf[index++] & 0xff); - val = (val << 8) + (buf[index++] & 0xff); - val = (val << 8) + (buf[index++] & 0xff); - offsets[i] = val; - } - } - break; - - case TAG_SimpleTimeZone: - { - if (len != 32 && len != 40) { - System.err.println("ZoneInfo: wrong SimpleTimeZone parameter size"); - return null; - } - int n = len / 4; - simpleTimeZoneParams = new int[n]; - for (int i = 0; i < n; i++) { - int val = buf[index++] & 0xff; - val = (val << 8) + (buf[index++] & 0xff); - val = (val << 8) + (buf[index++] & 0xff); - val = (val << 8) + (buf[index++] & 0xff); - simpleTimeZoneParams[i] = val; - } - } - break; - - case TAG_GMTOffsetWillChange: - { - if (len != 1) { - System.err.println("ZoneInfo: wrong byte length for TAG_GMTOffsetWillChange"); - } - willGMTOffsetChange = buf[index++] == 1; - } - break; - - default: - System.err.println("ZoneInfo: unknown tag < " + tag + ">. ignored."); - index += len; - break; - } - } - } catch (Exception e) { - System.err.println("ZoneInfo: corrupted zoneinfo file: " + id); - return null; - } - - if (index != filesize) { - System.err.println("ZoneInfo: wrong file size: " + id); - return null; - } - - return new ZoneInfoOld(id, rawOffset, dstSavings, checksum, - transitions, offsets, simpleTimeZoneParams, - willGMTOffsetChange); - } - - private volatile static SoftReference> zoneIDs = null; - - static List getZoneIDs() { - List ids = null; - SoftReference> cache = zoneIDs; - if (cache != null) { - ids = cache.get(); - if (ids != null) { - return ids; - } - } - byte[] buf = null; - buf = getZoneInfoOldMappings(); - int index = JAVAZM_LABEL_LENGTH + 1; - int filesize = buf.length; - try { - loop: - while (index < filesize) { - byte tag = buf[index++]; - int len = ((buf[index++] & 0xFF) << 8) + (buf[index++] & 0xFF); - - switch (tag) { - case TAG_ZoneIDs: - { - int n = (buf[index++] << 8) + (buf[index++] & 0xFF); - ids = new ArrayList<>(n); - - for (int i = 0; i < n; i++) { - byte m = buf[index++]; - ids.add(new String(buf, index, m, "UTF-8")); - index += m; - } - } - break loop; - - default: - index += len; - break; - } - } - } catch (Exception e) { - System.err.println("ZoneInfoOld: corrupted " + JAVAZM_FILE_NAME); - } - - zoneIDs = new SoftReference<>(ids); - return ids; - } - - /** - * @return an alias table in HashMap where a key is an alias ID - * (e.g., "PST") and its value is a real time zone ID (e.g., - * "America/Los_Angeles"). - */ - static Map getZoneAliases() { - byte[] buf = getZoneInfoOldMappings(); - int index = JAVAZM_LABEL_LENGTH + 1; - int filesize = buf.length; - Map aliases = null; - - try { - loop: - while (index < filesize) { - byte tag = buf[index++]; - int len = ((buf[index++] & 0xFF) << 8) + (buf[index++] & 0xFF); - - switch (tag) { - case TAG_ZoneAliases: - { - int n = (buf[index++] << 8) + (buf[index++] & 0xFF); - aliases = new HashMap<>(n); - for (int i = 0; i < n; i++) { - byte m = buf[index++]; - String name = new String(buf, index, m, "UTF-8"); - index += m; - m = buf[index++]; - String realName = new String(buf, index, m, "UTF-8"); - index += m; - aliases.put(name, realName); - } - } - break loop; - - default: - index += len; - break; - } - } - } catch (Exception e) { - System.err.println("ZoneInfoOld: corrupted " + JAVAZM_FILE_NAME); - return null; - } - return aliases; - } - - private volatile static SoftReference> excludedIDs = null; - private volatile static boolean hasNoExcludeList = false; - - /** - * @return a List of zone IDs for zones that will change their GMT - * offsets in some future time. - * - * @since 1.6 - */ - static List getExcludedZones() { - if (hasNoExcludeList) { - return null; - } - - List excludeList = null; - - SoftReference> cache = excludedIDs; - if (cache != null) { - excludeList = cache.get(); - if (excludeList != null) { - return excludeList; - } - } - - byte[] buf = getZoneInfoOldMappings(); - int index = JAVAZM_LABEL_LENGTH + 1; - int filesize = buf.length; - - try { - loop: - while (index < filesize) { - byte tag = buf[index++]; - int len = ((buf[index++] & 0xFF) << 8) + (buf[index++] & 0xFF); - - switch (tag) { - case TAG_ExcludedZones: - { - int n = (buf[index++] << 8) + (buf[index++] & 0xFF); - excludeList = new ArrayList<>(); - for (int i = 0; i < n; i++) { - byte m = buf[index++]; - String name = new String(buf, index, m, "UTF-8"); - index += m; - excludeList.add(name); - } - } - break loop; - - default: - index += len; - break; - } - } - } catch (Exception e) { - System.err.println("ZoneInfoOld: corrupted " + JAVAZM_FILE_NAME); - return null; - } - - if (excludeList != null) { - excludedIDs = new SoftReference<>(excludeList); - } else { - hasNoExcludeList = true; - } - return excludeList; - } - - private volatile static SoftReference rawOffsetIndices = null; - - static byte[] getRawOffsetIndices() { - byte[] indices = null; - - SoftReference cache = rawOffsetIndices; - if (cache != null) { - indices = cache.get(); - if (indices != null) { - return indices; - } - } - - byte[] buf = getZoneInfoOldMappings(); - int index = JAVAZM_LABEL_LENGTH + 1; - int filesize = buf.length; - - try { - loop: - while (index < filesize) { - byte tag = buf[index++]; - int len = ((buf[index++] & 0xFF) << 8) + (buf[index++] & 0xFF); - - switch (tag) { - case TAG_RawOffsetIndices: - { - indices = new byte[len]; - for (int i = 0; i < len; i++) { - indices[i] = buf[index++]; - } - } - break loop; - - default: - index += len; - break; - } - } - } catch (ArrayIndexOutOfBoundsException e) { - System.err.println("ZoneInfoOld: corrupted " + JAVAZM_FILE_NAME); - } - - rawOffsetIndices = new SoftReference<>(indices); - return indices; - } - - private volatile static SoftReference rawOffsets = null; - - static int[] getRawOffsets() { - int[] offsets = null; - - SoftReference cache = rawOffsets; - if (cache != null) { - offsets = cache.get(); - if (offsets != null) { - return offsets; - } - } - - byte[] buf = getZoneInfoOldMappings(); - int index = JAVAZM_LABEL_LENGTH + 1; - int filesize = buf.length; - - try { - loop: - while (index < filesize) { - byte tag = buf[index++]; - int len = ((buf[index++] & 0xFF) << 8) + (buf[index++] & 0xFF); - - switch (tag) { - case TAG_RawOffsets: - { - int n = len/4; - offsets = new int[n]; - for (int i = 0; i < n; i++) { - int val = buf[index++] & 0xff; - val = (val << 8) + (buf[index++] & 0xff); - val = (val << 8) + (buf[index++] & 0xff); - val = (val << 8) + (buf[index++] & 0xff); - offsets[i] = val; - } - } - break loop; - - default: - index += len; - break; - } - } - } catch (ArrayIndexOutOfBoundsException e) { - System.err.println("ZoneInfoOld: corrupted " + JAVAZM_FILE_NAME); - } - - rawOffsets = new SoftReference<>(offsets); - return offsets; - } - - private volatile static SoftReference zoneInfoMappings = null; - - private static byte[] getZoneInfoOldMappings() { - byte[] data; - SoftReference cache = zoneInfoMappings; - if (cache != null) { - data = cache.get(); - if (data != null) { - return data; - } - } - data = readZoneInfoFile(JAVAZM_FILE_NAME); - if (data == null) { - throw new RuntimeException("ZoneInfoOldMapping " + - JAVAZM_FILE_NAME + " either doesn't exist or doesn't have data"); - } - - int index; - for (index = 0; index < JAVAZM_LABEL.length; index++) { - if (data[index] != JAVAZM_LABEL[index]) { - System.err.println("ZoneInfoOld: wrong magic number: " + JAVAZM_FILE_NAME); - return null; - } - } - if (data[index++] > JAVAZM_VERSION) { - System.err.println("ZoneInfoOld: incompatible version (" - + data[index - 1] + "): " + JAVAZM_FILE_NAME); - return null; - } - - zoneInfoMappings = new SoftReference<>(data); - return data; - } - - /** - * Reads the specified file under <java.home>/lib/zi into a buffer. - * @return the buffer, or null if any I/O error occurred. - */ - private static byte[] readZoneInfoFile(final String fileName) { - if (fileName.indexOf("..") >= 0) { - return null; - } - byte[] buffer = null; - File file = new File(ziDir, fileName); - try { - int filesize = (int)file.length(); - if (filesize > 0) { - FileInputStream fis = new FileInputStream(file); - buffer = new byte[filesize]; - try { - if (fis.read(buffer) != filesize) { - throw new IOException("read error on " + fileName); - } - } finally { - fis.close(); - } - } - } catch (Exception ex) { - if (!(ex instanceof FileNotFoundException) || JAVAZM_FILE_NAME.equals(fileName)) { - System.err.println("ZoneInfoOld: " + ex.getMessage()); - } - } - return buffer; - } - - private ZoneInfoFile() { - } -} diff --git a/test/jdk/sun/util/calendar/zi/ZoneInfoOld.java b/test/jdk/sun/util/calendar/zi/ZoneInfoOld.java deleted file mode 100644 index 300b7f13dddd7..0000000000000 --- a/test/jdk/sun/util/calendar/zi/ZoneInfoOld.java +++ /dev/null @@ -1,1022 +0,0 @@ -/* - * 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.lang.ref.SoftReference; -import java.time.ZoneOffset; -import java.time.LocalDateTime; -import java.util.Arrays; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.SimpleTimeZone; -import java.util.TimeZone; - -import sun.util.calendar.CalendarSystem; -import sun.util.calendar.CalendarDate; - -/** - * ZoneInfoOld is an implementation subclass of {@link - * java.util.TimeZone TimeZone} that represents GMT offsets and - * daylight saving time transitions of a time zone. - *

- * The daylight saving time transitions are described in the {@link - * #transitions transitions} table consisting of a chronological - * sequence of transitions of GMT offset and/or daylight saving time - * changes. Since all transitions are represented in UTC, in theory, - * ZoneInfoOld can be used with any calendar systems except - * for the {@link #getOffset(int,int,int,int,int,int) getOffset} - * method that takes Gregorian calendar date fields. - *

- * This table covers transitions from 1900 until 2100 (as of version - * 23), Before 1900, it assumes that there was no daylight saving - * time and the getOffset methods always return the - * {@link #getRawOffset} value. No Local Mean Time is supported. If a - * specified date is beyond the transition table and this time zone is - * supposed to observe daylight saving time in 2100, it delegates - * operations to a {@link java.util.SimpleTimeZone SimpleTimeZone} - * object created using the daylight saving time schedule as of 2100. - *

- * The date items, transitions, GMT offset(s), etc. are read from a database - * file. See {@link ZoneInfoFile} for details. - * @see java.util.SimpleTimeZone - * @since 1.4 - */ - -public class ZoneInfoOld extends TimeZone { - - // The constants assume no leap seconds support. - static final int SECOND_IN_MILLIS = 1000; - static final int MINUTE_IN_MILLIS = SECOND_IN_MILLIS * 60; - static final int HOUR_IN_MILLIS = MINUTE_IN_MILLIS * 60; - static final int DAY_IN_MILLIS = HOUR_IN_MILLIS * 24; - - private static final int UTC_TIME = 0; - private static final int STANDARD_TIME = 1; - private static final int WALL_TIME = 2; - - private static final long OFFSET_MASK = 0x0fL; - private static final long DST_MASK = 0xf0L; - private static final int DST_NSHIFT = 4; - // this bit field is reserved for abbreviation support - private static final long ABBR_MASK = 0xf00L; - private static final int TRANSITION_NSHIFT = 12; - - // IDs having conflicting data between Olson and JDK 1.1 - static final Map conflictingIDs = Map.of( - "EST", "America/Panama", - "MST", "America/Phoenix"); - - private static final CalendarSystem gcal = CalendarSystem.getGregorianCalendar(); - - /** - * The raw GMT offset in milliseconds between this zone and GMT. - * Negative offsets are to the west of Greenwich. To obtain local - * standard time, add the offset to GMT time. - * @serial - */ - int rawOffset; - - /** - * Difference in milliseconds from the original GMT offset in case - * the raw offset value has been modified by calling {@link - * #setRawOffset}. The initial value is 0. - * @serial - */ - int rawOffsetDiff = 0; - - /** - * A CRC32 value of all pairs of transition time (in milliseconds - * in long) in local time and its GMT offset (in - * seconds in int) in the chronological order. Byte - * values of each long and int are taken - * in the big endian order (i.e., MSB to LSB). - * @serial - */ - int checksum; - - /** - * The amount of time in milliseconds saved during daylight saving - * time. If useDaylight is false, this value is 0. - * @serial - */ - int dstSavings; - - /** - * This array describes transitions of GMT offsets of this time - * zone, including both raw offset changes and daylight saving - * time changes. - * A long integer consists of four bit fields. - *

    - *
  • The most significant 52-bit field represents transition - * time in milliseconds from Gregorian January 1 1970, 00:00:00 - * GMT.
  • - *
  • The next 4-bit field is reserved and must be 0.
  • - *
  • The next 4-bit field is an index value to {@link #offsets - * offsets[]} for the amount of daylight saving at the - * transition. If this value is zero, it means that no daylight - * saving, not the index value zero.
  • - *
  • The least significant 4-bit field is an index value to - * {@link #offsets offsets[]} for total GMT offset at the - * transition.
  • - *
- * If this time zone doesn't observe daylight saving time and has - * never changed any GMT offsets in the past, this value is null. - * @serial - */ - long[] transitions; - - /** - * This array holds all unique offset values in - * milliseconds. Index values to this array are stored in the - * transitions array elements. - * @serial - */ - int[] offsets; - - /** - * SimpleTimeZone parameter values. It has to have either 8 for - * {@link java.util.SimpleTimeZone#SimpleTimeZone(int, String, - * int, int , int , int , int , int , int , int , int) the - * 11-argument SimpleTimeZone constructor} or 10 for {@link - * java.util.SimpleTimeZone#SimpleTimeZone(int, String, int, int, - * int , int , int , int , int , int , int, int, int) the - * 13-argument SimpleTimeZone constructor} parameters. - * @serial - */ - int[] simpleTimeZoneParams; - - /** - * True if the raw GMT offset value would change after the time - * zone data has been generated; false, otherwise. The default - * value is false. - * @serial - */ - boolean willGMTOffsetChange = false; - - /** - * True if the object has been modified after its instantiation. - */ - transient private boolean dirty = false; - - private static final long serialVersionUID = 2653134537216586139L; - - /** - * A constructor. - */ - public ZoneInfoOld() { - } - - /** - * A Constructor for CustomID. - */ - public ZoneInfoOld(String ID, int rawOffset) { - this(ID, rawOffset, 0, 0, null, null, null, false); - } - - /** - * Constructs a ZoneInfoOld instance. - * - * @param ID time zone name - * @param rawOffset GMT offset in milliseconds - * @param dstSavings daylight saving value in milliseconds or 0 - * (zero) if this time zone doesn't observe Daylight Saving Time. - * @param checksum CRC32 value with all transitions table entry - * values - * @param transitions transition table - * @param offsets offset value table - * @param simpleTimeZoneParams parameter values for constructing - * SimpleTimeZone - * @param willGMTOffsetChange the value of willGMTOffsetChange - */ - ZoneInfoOld(String ID, - int rawOffset, - int dstSavings, - int checksum, - long[] transitions, - int[] offsets, - int[] simpleTimeZoneParams, - boolean willGMTOffsetChange) { - setID(ID); - this.rawOffset = rawOffset; - this.dstSavings = dstSavings; - this.checksum = checksum; - this.transitions = transitions; - this.offsets = offsets; - this.simpleTimeZoneParams = simpleTimeZoneParams; - this.willGMTOffsetChange = willGMTOffsetChange; - } - - /** - * Returns the difference in milliseconds between local time and UTC - * of given time, taking into account both the raw offset and the - * effect of daylight savings. - * - * @param date the milliseconds in UTC - * @return the milliseconds to add to UTC to get local wall time - */ - public int getOffset(long date) { - return getOffsets(date, null, UTC_TIME); - } - - public int getOffsets(long utc, int[] offsets) { - return getOffsets(utc, offsets, UTC_TIME); - } - - public int getOffsetsByStandard(long standard, int[] offsets) { - return getOffsets(standard, offsets, STANDARD_TIME); - } - - public int getOffsetsByWall(long wall, int[] offsets) { - return getOffsets(wall, offsets, WALL_TIME); - } - - private int getOffsets(long date, int[] offsets, int type) { - // if dst is never observed, there is no transition. - if (transitions == null) { - int offset = getLastRawOffset(); - if (offsets != null) { - offsets[0] = offset; - offsets[1] = 0; - } - return offset; - } - - date -= rawOffsetDiff; - int index = getTransitionIndex(date, type); - - // prior to the transition table, returns the raw offset. - // FIXME: should support LMT. - if (index < 0) { - int offset = getLastRawOffset(); - if (offsets != null) { - offsets[0] = offset; - offsets[1] = 0; - } - return offset; - } - - if (index < transitions.length) { - long val = transitions[index]; - int offset = this.offsets[(int)(val & OFFSET_MASK)] + rawOffsetDiff; - if (offsets != null) { - int dst = (int)((val >>> DST_NSHIFT) & 0xfL); - int save = (dst == 0) ? 0 : this.offsets[dst]; - offsets[0] = offset - save; - offsets[1] = save; - } - return offset; - } - - // beyond the transitions, delegate to SimpleTimeZone if there - // is a rule; otherwise, return rawOffset. - SimpleTimeZone tz = getLastRule(); - if (tz != null) { - int rawoffset = tz.getRawOffset(); - long msec = date; - if (type != UTC_TIME) { - msec -= rawOffset; - } - int dstoffset = tz.getOffset(msec) - rawOffset; - - // Check if it's in a standard-to-daylight transition. - if (dstoffset > 0 && tz.getOffset(msec - dstoffset) == rawoffset) { - dstoffset = 0; - } - - if (offsets != null) { - offsets[0] = rawoffset; - offsets[1] = dstoffset; - } - return rawoffset + dstoffset; - } - int offset = getLastRawOffset(); - if (offsets != null) { - offsets[0] = offset; - offsets[1] = 0; - } - return offset; - } - - private int getTransitionIndex(long date, int type) { - int low = 0; - int high = transitions.length - 1; - - while (low <= high) { - int mid = (low + high) / 2; - long val = transitions[mid]; - long midVal = val >> TRANSITION_NSHIFT; // sign extended - if (type != UTC_TIME) { - midVal += offsets[(int)(val & OFFSET_MASK)]; // wall time - } - if (type == STANDARD_TIME) { - int dstIndex = (int)((val >>> DST_NSHIFT) & 0xfL); - if (dstIndex != 0) { - midVal -= offsets[dstIndex]; // make it standard time - } - } - - if (midVal < date) { - low = mid + 1; - } else if (midVal > date) { - high = mid - 1; - } else { - return mid; - } - } - - // if beyond the transitions, returns that index. - if (low >= transitions.length) { - return low; - } - return low - 1; - } - - /** - * Returns the difference in milliseconds between local time and - * UTC, taking into account both the raw offset and the effect of - * daylight savings, for the specified date and time. This method - * assumes that the start and end month are distinct. This method - * assumes a Gregorian calendar for calculations. - *

- * Note: In general, clients should use - * {@link Calendar#ZONE_OFFSET Calendar.get(ZONE_OFFSET)} + - * {@link Calendar#DST_OFFSET Calendar.get(DST_OFFSET)} - * instead of calling this method. - * - * @param era The era of the given date. The value must be either - * GregorianCalendar.AD or GregorianCalendar.BC. - * @param year The year in the given date. - * @param month The month in the given date. Month is 0-based. e.g., - * 0 for January. - * @param day The day-in-month of the given date. - * @param dayOfWeek The day-of-week of the given date. - * @param millis The milliseconds in day in standard local time. - * @return The milliseconds to add to UTC to get local time. - */ - public int getOffset(int era, int year, int month, int day, - int dayOfWeek, int milliseconds) { - if (milliseconds < 0 || milliseconds >= DAY_IN_MILLIS) { - throw new IllegalArgumentException(); - } - - if (era == java.util.GregorianCalendar.BC) { // BC - year = 1 - year; - } else if (era != java.util.GregorianCalendar.AD) { - throw new IllegalArgumentException(); - } - - CalendarDate date = gcal.newCalendarDate(null); - date.setDate(year, month + 1, day); - if (gcal.validate(date) == false) { - throw new IllegalArgumentException(); - } - - // bug-for-bug compatible argument checking - if (dayOfWeek < java.util.GregorianCalendar.SUNDAY - || dayOfWeek > java.util.GregorianCalendar.SATURDAY) { - throw new IllegalArgumentException(); - } - - if (transitions == null) { - return getLastRawOffset(); - } - - long dateInMillis = gcal.getTime(date) + milliseconds; - dateInMillis -= (long) rawOffset; // make it UTC - return getOffsets(dateInMillis, null, UTC_TIME); - } - - /** - * Sets the base time zone offset from GMT. This operation - * modifies all the transitions of this ZoneInfoOld object, including - * historical ones, if applicable. - * - * @param offsetMillis the base time zone offset to GMT. - * @see getRawOffset - */ - public synchronized void setRawOffset(int offsetMillis) { - if (offsetMillis == rawOffset + rawOffsetDiff) { - return; - } - rawOffsetDiff = offsetMillis - rawOffset; - if (lastRule != null) { - lastRule.setRawOffset(offsetMillis); - } - dirty = true; - } - - /** - * Returns the GMT offset of the current date. This GMT offset - * value is not modified during Daylight Saving Time. - * - * @return the GMT offset value in milliseconds to add to UTC time - * to get local standard time - */ - public int getRawOffset() { - if (!willGMTOffsetChange) { - return rawOffset + rawOffsetDiff; - } - - int[] offsets = new int[2]; - getOffsets(System.currentTimeMillis(), offsets, UTC_TIME); - return offsets[0]; - } - - public boolean isDirty() { - return dirty; - } - - int getLastRawOffset() { - return rawOffset + rawOffsetDiff; - } - - /** - * Queries if this time zone uses Daylight Saving Time in the last known rule. - */ - public boolean useDaylightTime() { - return (simpleTimeZoneParams != null); - } - - @Override - public boolean observesDaylightTime() { - if (simpleTimeZoneParams != null) { - return true; - } - if (transitions == null) { - return false; - } - - // Look up the transition table to see if it's in DST right - // now or if there's any standard-to-daylight transition at - // any future. - long utc = System.currentTimeMillis() - rawOffsetDiff; - int index = getTransitionIndex(utc, UTC_TIME); - - // before transitions in the transition table - if (index < 0) { - return false; - } - - // the time is in the table range. - for (int i = index; i < transitions.length; i++) { - if ((transitions[i] & DST_MASK) != 0) { - return true; - } - } - // No further DST is observed. - return false; - } - - /** - * Queries if the specified date is in Daylight Saving Time. - */ - public boolean inDaylightTime(Date date) { - if (date == null) { - throw new NullPointerException(); - } - - if (transitions == null) { - return false; - } - - long utc = date.getTime() - rawOffsetDiff; - int index = getTransitionIndex(utc, UTC_TIME); - - // before transitions in the transition table - if (index < 0) { - return false; - } - - // the time is in the table range. - if (index < transitions.length) { - return (transitions[index] & DST_MASK) != 0; - } - - // beyond the transition table - SimpleTimeZone tz = getLastRule(); - if (tz != null) { - return tz.inDaylightTime(date); - } - return false; - } - - /** - * Returns the amount of time in milliseconds that the clock is advanced - * during daylight saving time is in effect in its last daylight saving time rule. - * - * @return the number of milliseconds the time is advanced with respect to - * standard time when daylight saving time is in effect. - */ - public int getDSTSavings() { - return dstSavings; - } - -// /** -// * @return the last year in the transition table or -1 if this -// * time zone doesn't observe any daylight saving time. -// */ -// public int getMaxTransitionYear() { -// if (transitions == null) { -// return -1; -// } -// long val = transitions[transitions.length - 1]; -// int offset = this.offsets[(int)(val & OFFSET_MASK)] + rawOffsetDiff; -// val = (val >> TRANSITION_NSHIFT) + offset; -// CalendarDate lastDate = Gregorian.getCalendarDate(val); -// return lastDate.getYear(); -// } - - /** - * Returns a string representation of this time zone. - * @return the string - */ - public String toString() { - return getClass().getName() + - "[id=\"" + getID() + "\"" + - ",offset=" + getLastRawOffset() + - ",dstSavings=" + dstSavings + - ",useDaylight=" + useDaylightTime() + - ",transitions=" + ((transitions != null) ? transitions.length : 0) + - ",lastRule=" + (lastRule == null ? getLastRuleInstance() : lastRule) + - "]"; - } - - /** - * Gets all available IDs supported in the Java run-time. - * - * @return an array of time zone IDs. - */ - public static String[] getAvailableIDs() { - List idList = ZoneInfoFile.getZoneIDs(); - List excluded = ZoneInfoFile.getExcludedZones(); - if (excluded != null) { - // List all zones from the idList and excluded lists - List list = new ArrayList<>(idList.size() + excluded.size()); - list.addAll(idList); - list.addAll(excluded); - idList = list; - } - String[] ids = new String[idList.size()]; - return idList.toArray(ids); - } - - /** - * Gets all available IDs that have the same value as the - * specified raw GMT offset. - * - * @param rawOffset the GMT offset in milliseconds. This - * value should not include any daylight saving time. - * - * @return an array of time zone IDs. - */ - public static String[] getAvailableIDs(int rawOffset) { - String[] result; - List matched = new ArrayList<>(); - List IDs = ZoneInfoFile.getZoneIDs(); - int[] rawOffsets = ZoneInfoFile.getRawOffsets(); - - loop: - for (int index = 0; index < rawOffsets.length; index++) { - if (rawOffsets[index] == rawOffset) { - byte[] indices = ZoneInfoFile.getRawOffsetIndices(); - for (int i = 0; i < indices.length; i++) { - if (indices[i] == index) { - matched.add(IDs.get(i++)); - while (i < indices.length && indices[i] == index) { - matched.add(IDs.get(i++)); - } - break loop; - } - } - } - } - - // We need to add any zones from the excluded zone list that - // currently have the same GMT offset as the specified - // rawOffset. The zones returned by this method may not be - // correct as of return to the caller if any GMT offset - // transition is happening during this GMT offset checking... - List excluded = ZoneInfoFile.getExcludedZones(); - if (excluded != null) { - for (String id : excluded) { - TimeZone zi = getTimeZone(id); - if (zi != null && zi.getRawOffset() == rawOffset) { - matched.add(id); - } - } - } - - result = new String[matched.size()]; - matched.toArray(result); - return result; - } - - /** - * Gets the ZoneInfoOld for the given ID. - * - * @param ID the ID for a ZoneInfoOld. See TimeZone for detail. - * - * @return the specified ZoneInfoOld object, or null if there is no - * time zone of the ID. - */ - public static TimeZone getTimeZone(String ID) { - String givenID = null; - - ZoneInfoOld zi = ZoneInfoFile.getZoneInfoOld(ID); - if (zi == null) { - // if we can't create an object for the ID, try aliases. - try { - Map map = getAliasTable(); - String alias = ID; - while ((alias = map.get(alias)) != null) { - zi = ZoneInfoFile.getZoneInfoOld(alias); - if (zi != null) { - zi.setID(ID); - zi = ZoneInfoFile.addToCache(ID, zi); - zi = (ZoneInfoOld) zi.clone(); - break; - } - } - } catch (Exception e) { - // ignore exceptions - } - } - - if (givenID != null && zi != null) { - zi.setID(givenID); - } - return zi; - } - - private transient SimpleTimeZone lastRule; - - /** - * Returns a SimpleTimeZone object representing the last GMT - * offset and DST schedule or null if this time zone doesn't - * observe DST. - */ - synchronized SimpleTimeZone getLastRule() { - if (lastRule == null) { - lastRule = getLastRuleInstance(); - } - return lastRule; - } - - /** - * Returns a SimpleTimeZone object that represents the last - * known daylight saving time rules. - * - * @return a SimpleTimeZone object or null if this time zone - * doesn't observe DST. - */ - public SimpleTimeZone getLastRuleInstance() { - if (simpleTimeZoneParams == null) { - return null; - } - if (simpleTimeZoneParams.length == 10) { - return new SimpleTimeZone(getLastRawOffset(), getID(), - simpleTimeZoneParams[0], - simpleTimeZoneParams[1], - simpleTimeZoneParams[2], - simpleTimeZoneParams[3], - simpleTimeZoneParams[4], - simpleTimeZoneParams[5], - simpleTimeZoneParams[6], - simpleTimeZoneParams[7], - simpleTimeZoneParams[8], - simpleTimeZoneParams[9], - dstSavings); - } - return new SimpleTimeZone(getLastRawOffset(), getID(), - simpleTimeZoneParams[0], - simpleTimeZoneParams[1], - simpleTimeZoneParams[2], - simpleTimeZoneParams[3], - simpleTimeZoneParams[4], - simpleTimeZoneParams[5], - simpleTimeZoneParams[6], - simpleTimeZoneParams[7], - dstSavings); - } - - /** - * Returns a copy of this ZoneInfoOld. - */ - public Object clone() { - ZoneInfoOld zi = (ZoneInfoOld) super.clone(); - zi.lastRule = null; - return zi; - } - - /** - * Returns a hash code value calculated from the GMT offset and - * transitions. - * @return a hash code of this time zone - */ - public int hashCode() { - return getLastRawOffset() ^ checksum; - } - - /** - * Compares the equity of two ZoneInfoOld objects. - * - * @param obj the object to be compared with - * @return true if given object is same as this ZoneInfoOld object, - * false otherwise. - */ - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (!(obj instanceof ZoneInfoOld)) { - return false; - } - ZoneInfoOld that = (ZoneInfoOld) obj; - return (getID().equals(that.getID()) - && (getLastRawOffset() == that.getLastRawOffset()) - && (checksum == that.checksum)); - } - - /** - * Returns true if this zone has the same raw GMT offset value and - * transition table as another zone info. If the specified - * TimeZone object is not a ZoneInfoOld instance, this method returns - * true if the specified TimeZone object has the same raw GMT - * offset value with no daylight saving time. - * - * @param other the ZoneInfoOld object to be compared with - * @return true if the given TimeZone has the same - * GMT offset and transition information; false, otherwise. - */ - public boolean hasSameRules(TimeZone other) { - if (this == other) { - return true; - } - if (other == null) { - return false; - } - if (!(other instanceof ZoneInfoOld)) { - if (getRawOffset() != other.getRawOffset()) { - return false; - } - // if both have the same raw offset and neither observes - // DST, they have the same rule. - if ((transitions == null) - && (useDaylightTime() == false) - && (other.useDaylightTime() == false)) { - return true; - } - return false; - } - if (getLastRawOffset() != ((ZoneInfoOld)other).getLastRawOffset()) { - return false; - } - return (checksum == ((ZoneInfoOld)other).checksum); - } - - private static SoftReference> aliasTable; - - static Map getCachedAliasTable() { - Map aliases = null; - - SoftReference> cache = aliasTable; - if (cache != null) { - aliases = cache.get(); - } - return aliases; - } - - /** - * Returns a Map from alias time zone IDs to their standard - * time zone IDs. - * - * @return the Map that holds the mappings from alias time zone IDs - * to their standard time zone IDs, or null if - * ZoneInfoOldMappings file is not available. - */ - public synchronized static Map getAliasTable() { - Map aliases = getCachedAliasTable(); - if (aliases == null) { - aliases = ZoneInfoFile.getZoneAliases(); - if (aliases != null) { - // Replace old mappings from `jdk11_backward` - aliases.putAll(conflictingIDs); - aliasTable = new SoftReference>(aliases); - } - } - return aliases; - } - - private void readObject(ObjectInputStream stream) - throws IOException, ClassNotFoundException { - stream.defaultReadObject(); - // We don't know how this object from 1.4.x or earlier has - // been mutated. So it should always be marked as `dirty'. - dirty = true; - } - - ////////////////////////////////////////////////////////////// - public boolean equalsTo(ZoneInfoOld other) { - return (getID().equals(other.getID()) - && (getLastRawOffset() == other.getLastRawOffset()) - && (dstSavings == other.dstSavings) - && (willGMTOffsetChange == other.willGMTOffsetChange) - && (checksum == other.checksum) - && equalsTransOffsets(other) - && (Arrays.equals(simpleTimeZoneParams, other.simpleTimeZoneParams) || - getLastRule().equals(other.getLastRule()))); - } - - private boolean equalsTransOffsets(ZoneInfoOld other) { - if (transitions == null) { - return (other.transitions == null && - Arrays.equals(offsets, other.offsets)); - } - if (other.transitions == null || - transitions.length != other.transitions.length) { - return false; - } - // if offsets and other.offsets have different order - // the last 4-bit in trans are different. - for (int i = 0; i < transitions.length; i++) { - long val = transitions[i]; - int dst = (int)((val >>> DST_NSHIFT) & 0xfL); - int save = (dst == 0) ? 0 : offsets[dst] / 1000; - int off = offsets[(int)(val & OFFSET_MASK)]/1000; - long second = (val >> TRANSITION_NSHIFT)/1000; - - val = other.transitions[i]; - int dstO = (int)((val >>> DST_NSHIFT) & 0xfL); - int saveO = (dstO == 0) ? 0 : other.offsets[dstO] / 1000; - int offO = other.offsets[(int)(val & OFFSET_MASK)]/1000; - long secondO = (val >> TRANSITION_NSHIFT)/1000; - if ((dst == 0) != (dstO == 0) || save != saveO || off != offO || second != secondO) - return false; - } - return true; - } - - private int transToString(long val, int off_old, int[] offsets, StringBuilder sb) { - int dst = (int)((val >>> DST_NSHIFT) & 0xfL); - int save = (dst == 0) ? 0 : offsets[dst] / 1000; - int off = offsets[(int)(val & OFFSET_MASK)]/1000; - long second = (val >> TRANSITION_NSHIFT)/1000; - ZoneOffset offset_old = ZoneOffset.ofTotalSeconds(off_old); - ZoneOffset offset = ZoneOffset.ofTotalSeconds(off); - sb.append(" " + LocalDateTime.ofEpochSecond(second, 0, offset_old)); - - sb.append(" [utc=" + second + - " raw=" + Long.toHexString(val >> TRANSITION_NSHIFT) + - ", offset=" + off + "/" + offset + ", saving=" + save + "]"); - return off; - } - - public String diffsTo(ZoneInfoOld other) { - - int rawOffset0 = other.rawOffset; - int checksum0 = other.checksum; - int dstSavings0 = other.dstSavings; - long[] transitions0 = other.transitions; - int[] offsets0 = other.offsets; - int[] simpleTimeZoneParams0 = other.simpleTimeZoneParams; - boolean willGMTOffsetChange0 = other.willGMTOffsetChange; - - - //return getClass().getName() + - StringBuilder sb = new StringBuilder(); - sb.append("******************************\n" + - getID() + " : " + other.getID()); - // ROC is excluded by ZoneInfoOld - if ("ROC".equals(getID())) { - return sb.toString(); - } - if (rawOffset != rawOffset0 || - dstSavings != dstSavings0 || - checksum != checksum0 || - willGMTOffsetChange != willGMTOffsetChange0 || - (simpleTimeZoneParams != null ) != (simpleTimeZoneParams0 != null) || - (transitions != null && transitions0 != null && - transitions.length != transitions0.length)) - { - sb.append("\n offset=" + getLastRawOffset() + - ",dstSavings=" + dstSavings + - ",useDaylight=" + useDaylightTime() + - ",transitions=" + ((transitions != null) ? transitions.length : 0) + - ",offsets=" + ((offsets != null) ? offsets.length : 0) + - ",checksum=" + checksum + - ",gmtChanged=" + willGMTOffsetChange) - .append("\n[NG]offset=" + rawOffset0 + - ",dstSavings=" + dstSavings0 + - ",useDaylight=" + (simpleTimeZoneParams != null) + - ",transitions=" + ((transitions0 != null) ? transitions0.length : 0) + - ",offsets=" + ((offsets0 != null) ? offsets0.length : 0) + - ",checksum=" + checksum0 + - ",gmtChanged=" + willGMTOffsetChange0 + - ""); - } - // offsets - if (!Arrays.equals(offsets, offsets0)) { - sb.append("\n offset.len=" + ((offsets != null)? offsets.length : "null") + - " " + ((offsets0 != null)? offsets0.length : "null")); - if (offsets != null && offsets0.length != 0) { - int len = Math.min(offsets.length, offsets0.length); - int i = 0; - for (i = 0; i < len; i++) { - sb.append("\n " + - ZoneOffset.ofTotalSeconds(offsets[i]/1000) + " " + - ZoneOffset.ofTotalSeconds(offsets0[i]/1000)); - } - for (; i < offsets0.length; i++) { - sb.append("\n " + ZoneOffset.ofTotalSeconds(offsets0[i]/1000)); - } - } - } - // trans - int offset = 0; - int offset0 = 0; - if (!equalsTransOffsets(other)) { - sb.append("\n -------------"); - if ((transitions == null) != (transitions0 == null)) { - sb.append("\n (NG) Different trans(null) :" + - transitions + ", " + transitions0); - if (transitions != null) { - for (int i = 0; i < transitions.length; i++) { - sb.append("\n (NG)"); - offset = transToString(transitions[i], offset, offsets, sb); - } - } - } else { - if (transitions.length != transitions0.length) { - sb.append("\n (NG) Different trans size :" + - transitions.length + ", " + transitions0.length); - } - int length = Math.min(transitions.length, transitions0.length); - for (int i = 0; i < length; i++) { - // sb.append("\n[" + i + "] "); - // offset = transToString(transitions[i], offset, offsets, sb); - long val = transitions[i]; - int dst = (int)((val >>> DST_NSHIFT) & 0xfL); - int save = (dst == 0) ? 0 : offsets[dst] / 1000; - int off = offsets[(int)(val & OFFSET_MASK)]/1000; - long second = (val >> TRANSITION_NSHIFT)/1000; - sb.append("\n "); - offset = transToString(transitions[i], offset, offsets, sb); - if (transitions0 == null || i >= transitions0.length) { - sb.append("\n "); - offset = transToString(transitions[i], offset, offsets, sb); - sb.append("\n (NG) trans0 is null or < trans.length"); - } else { - long val0 = transitions0[i]; - int dst0 = (int)((val0 >>> DST_NSHIFT) & 0xfL); - int save0 = (dst0 == 0) ? 0 : offsets0[dst0] / 1000; - int off0 = offsets0[(int)(val0 & OFFSET_MASK)]/1000; - long second0 = (val0 >> TRANSITION_NSHIFT)/1000; - if (save != save0 || off != off0 || second != second0) { - sb.append("\n (NG)"); - } else { - sb.append("\n (OK)"); - } - offset0 = transToString(transitions0[i], offset0, offsets0, sb); - sb.append("\n -----"); - } - } - } - } - SimpleTimeZone stz = getLastRuleInstance(); - if (stz != null) { - SimpleTimeZone stz0 = other.getLastRule(); - if (!stz.hasSameRules(stz0)) { - sb.append("\n -------------") - .append("\n SimpleTimeZone (NG)") - .append("\n stz=" + stz) - .append("\n stz0=" + stz0); - } - } - sb.append("\n -------------"); - return sb.toString(); - } -} diff --git a/test/jdk/sun/util/calendar/zi/ZoneRec.java b/test/jdk/sun/util/calendar/zi/ZoneRec.java deleted file mode 100644 index f6bbeb3a199db..0000000000000 --- a/test/jdk/sun/util/calendar/zi/ZoneRec.java +++ /dev/null @@ -1,248 +0,0 @@ -/* - * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import java.io.BufferedReader; -import java.io.FileReader; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.StringTokenizer; - -/** - * ZoneRec hold information of time zone corresponding to each text - * line of the "Zone" part. - * - * @since 1.4 - */ -class ZoneRec { - private int gmtOffset; - private String ruleName; - private int directSave; - private Rule ruleRef; - private String format; - private boolean hasUntil; - private int untilYear; - private Month untilMonth; - private RuleDay untilDay; - private Time untilTime; - private long untilInMillis; - private String line; - - /** - * @return the "UNTIL" value in milliseconds - */ - Time getUntilTime() { - return untilTime; - } - - /** - * @return the GMT offset value in milliseconds - */ - int getGmtOffset() { - return gmtOffset; - } - - /** - * @return the rule name to which this zone record refers - */ - String getRuleName() { - return ruleName; - } - - /** - * @return the amount of saving time directly defined in the - * "RULES/SAVE" field. - */ - int getDirectSave() { - return directSave; - } - - /** - * @return true if this zone record has a reference to a rule - */ - boolean hasRuleReference() { - return ruleRef != null; - } - - /** - * Returns the "FORMAT" field string of this zone record. This - * @return the "FORMAT" field - */ - String getFormat() { - return format; - } - - /** - * @return the year in the "UNTIL" field - */ - int getUntilYear() { - return untilYear; - } - - /** - * Returns the "UNTIL" field value in milliseconds from Janurary - * 1, 1970 0:00 GMT. - * @param currentSave the amount of daylight saving in - * milliseconds that is used to adjust wall-clock time. - * @return the milliseconds value of the "UNTIL" field - */ - long getUntilTime(int currentSave) { - if (untilTime.isWall()) { - return untilInMillis - currentSave; - } - return untilInMillis; - } - - /** - * Returns the "UNTIL" time in milliseconds without adjusting GMT - * offsets or daylight saving. - * @return local "UNTIL" time in milliseconds - */ - long getLocalUntilTime() { - return Time.getLocalTime(untilYear, - untilMonth, - untilDay, - untilTime.getTime()); - } - - /** - * Returns the "UNTIL" time in milliseconds with adjusting GMT offsets and daylight saving. - * @return the "UNTIL" time after the adjustment - */ - long getLocalUntilTime(int save, int gmtOffset) { - return Time.getLocalTime(untilYear, - untilMonth, - untilDay, - save, - gmtOffset, - untilTime); - } - - /** - * @return the text line of this zone record - */ - String getLine() { - return line; - } - - /** - * Sets the specified text line to this zone record - */ - void setLine(String line) { - this.line = line; - } - - /** - * @return true if this zone record has the "UNTIL" field - */ - boolean hasUntil() { - return this.hasUntil; - } - - /** - * Adjusts the "UNTIL" time to GMT offset if this zone record has - * it. untilTime is not adjusted to daylight saving - * in this method. - */ - void adjustTime() { - if (!hasUntil()) { - return; - } - if (untilTime.isSTD() || untilTime.isWall()) { - // adjust to gmt offset only here. adjust to real - // wall-clock time when tracking rules - untilInMillis -= gmtOffset; - } - } - - /** - * @return the reference to the Rule object - */ - Rule getRuleRef() { - return ruleRef; - } - - /** - * Resolves the reference to a Rule and adjusts its "UNTIL" time - * to GMT offset. - */ - void resolve(Zoneinfo zi) { - if (ruleName != null && (!"-".equals(ruleName))) { - ruleRef = zi.getRule(ruleName); - } - adjustTime(); - } - - /** - * Parses a Zone text line that is described by a StringTokenizer. - * @param tokens represents tokens of a Zone text line - * @return the zone record produced by parsing the text - */ - static ZoneRec parse(StringTokenizer tokens) { - ZoneRec rec = new ZoneRec(); - try { - rec.gmtOffset = (int) Time.parse(tokens.nextToken()).getTime(); - String token = tokens.nextToken(); - char c = token.charAt(0); - if (c >= '0' && c <= '9') { - rec.directSave = (int) Time.parse(token).getTime(); - } else { - rec.ruleName = token; - } - rec.format = tokens.nextToken(); - if (tokens.hasMoreTokens()) { - rec.hasUntil = true; - rec.untilYear = Integer.parseInt(tokens.nextToken()); - if (tokens.hasMoreTokens()) { - rec.untilMonth = Month.parse(tokens.nextToken()); - } else { - rec.untilMonth = Month.JANUARY; - } - if (tokens.hasMoreTokens()) { - rec.untilDay = RuleDay.parse(tokens.nextToken()); - } else { - rec.untilDay = new RuleDay(1); - } - if (tokens.hasMoreTokens()) { - rec.untilTime = Time.parse(tokens.nextToken()); - } else { - rec.untilTime = Time.parse("0:00"); - } - rec.untilInMillis = rec.getLocalUntilTime(); - } - } catch (Exception e) { - // TODO: error reporting - e.printStackTrace(); - } - return rec; - } - - private static void panic(String msg) { - Main.panic(msg); - } -} diff --git a/test/jdk/sun/util/calendar/zi/Zoneinfo.java b/test/jdk/sun/util/calendar/zi/Zoneinfo.java deleted file mode 100644 index e125ad2cb87d1..0000000000000 --- a/test/jdk/sun/util/calendar/zi/Zoneinfo.java +++ /dev/null @@ -1,579 +0,0 @@ -/* - * 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import java.io.BufferedReader; -import java.io.FileReader; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.StringTokenizer; - -/** - * Zoneinfo provides javazic compiler front-end functionality. - * @since 1.4 - */ -class Zoneinfo { - - private static final int minYear = 1900; - private static final int maxYear = 2100; - private static final long minTime = Time.getLocalTime(minYear, Month.JANUARY, 1, 0); - private static int startYear = minYear; - private static int endYear = maxYear; - - /** - * True if javazic should generate a list of SimpleTimeZone - * instances for the SimpleTimeZone-based time zone support. - */ - static boolean isYearForTimeZoneDataSpecified = false; - - /** - * Zone name to Zone mappings - */ - private Map zones; - - /** - * Rule name to Rule mappings - */ - private Map rules; - - /** - * Alias name to real name mappings - */ - private Map aliases; - - /** - * Constracts a Zoneinfo. - */ - Zoneinfo() { - zones = new HashMap(); - rules = new HashMap(); - aliases = new HashMap(); - } - - /** - * Adds the given zone to the list of Zones. - * @param zone Zone to be added to the list. - */ - void add(Zone zone) { - String name = zone.getName(); - zones.put(name, zone); - } - - /** - * Adds the given rule to the list of Rules. - * @param rule Rule to be added to the list. - */ - void add(Rule rule) { - String name = rule.getName(); - rules.put(name, rule); - } - - /** - * Puts the specifid name pair to the alias table. - * @param name1 an alias time zone name - * @param name2 the real time zone of the alias name - */ - void putAlias(String name1, String name2) { - aliases.put(name1, name2); - } - - /** - * Sets the given year for SimpleTimeZone list output. - * This method is called when the -S option is specified. - * @param year the year for which SimpleTimeZone list should be generated - */ - static void setYear(int year) { - setStartYear(year); - setEndYear(year); - isYearForTimeZoneDataSpecified = true; - } - - /** - * Sets the start year. - * @param year the start year value - * @throws IllegalArgumentException if the specified year value is - * smaller than the minimum year or greater than the end year. - */ - static void setStartYear(int year) { - if (year < minYear || year > endYear) { - throw new IllegalArgumentException("invalid start year specified: " + year); - } - startYear = year; - } - - /** - * @return the start year value - */ - static int getStartYear() { - return startYear; - } - - /** - * Sets the end year. - * @param year the end year value - * @throws IllegalArgumentException if the specified year value is - * smaller than the start year or greater than the maximum year. - */ - static void setEndYear(int year) { - if (year < startYear || year > maxYear) { - throw new IllegalArgumentException(); - } - endYear = year; - } - - /** - * @return the end year value - */ - static int getEndYear() { - return endYear; - } - - /** - * @return the minimum year value - */ - static int getMinYear() { - return minYear; - } - - /** - * @return the maximum year value - */ - static int getMaxYear() { - return maxYear; - } - - /** - * @return the alias table - */ - Map getAliases() { - return aliases; - } - - /** - * @return the Zone list - */ - Map getZones() { - return zones; - } - - /** - * @return a Zone specified by name. - * @param name a zone name - */ - Zone getZone(String name) { - return zones.get(name); - } - - /** - * @return a Rule specified by name. - * @param name a rule name - */ - Rule getRule(String name) { - return rules.get(name); - } - - private static String line; - - private static int lineNum; - - /** - * Parses the specified time zone data file and creates a Zoneinfo - * that has all Rules, Zones and Links (aliases) information. - * @param fname the time zone data file name - * @return a Zoneinfo object - */ - static Zoneinfo parse(String fname) { - BufferedReader in = null; - try { - FileReader fr = new FileReader(fname); - in = new BufferedReader(fr); - } catch (FileNotFoundException e) { - panic("can't open file: "+fname); - } - Zoneinfo zi = new Zoneinfo(); - boolean continued = false; - Zone zone = null; - String l; - lineNum = 0; - - try { - while ((line = in.readLine()) != null) { - lineNum++; - // skip blank and comment lines - if (line.length() == 0 || line.charAt(0) == '#') { - continue; - } - - // trim trailing comments - int rindex = line.lastIndexOf('#'); - if (rindex != -1) { - // take the data part of the line - l = line.substring(0, rindex); - } else { - l = line; - } - - StringTokenizer tokens = new StringTokenizer(l); - if (!tokens.hasMoreTokens()) { - continue; - } - String token = tokens.nextToken(); - int len = token.length(); - - if (continued || token.regionMatches(true, 0, "Zone", 0, len)){ - if (zone == null) { - if (!tokens.hasMoreTokens()) { - panic("syntax error: zone no more token"); - } - token = tokens.nextToken(); - // if the zone name is in "GMT+hh" or "GMT-hh" - // format, ignore it due to spec conflict. - if (token.startsWith("GMT+") || token.startsWith("GMT-")) { - continue; - } - zone = new Zone(token); - } else { - // no way to push the current token back... - tokens = new StringTokenizer(l); - } - - ZoneRec zrec = ZoneRec.parse(tokens); - zrec.setLine(line); - zone.add(zrec); - if ((continued = zrec.hasUntil()) == false) { - if (Zone.isTargetZone(zone.getName())) { - // zone.resolve(zi); - zi.add(zone); - } - zone = null; - } - } else if (token.regionMatches(true, 0, "Rule", 0, len)) { - if (!tokens.hasMoreTokens()) { - panic("syntax error: rule no more token"); - } - token = tokens.nextToken(); - Rule rule = zi.getRule(token); - if (rule == null) { - rule = new Rule(token); - zi.add(rule); - } - RuleRec rrec = RuleRec.parse(tokens); - rrec.setLine(line); - rule.add(rrec); - } else if (token.regionMatches(true, 0, "Link", 0, len)) { - // Link - try { - String name1 = tokens.nextToken(); - String name2 = tokens.nextToken(); - - // if the zone name is in "GMT+hh" or "GMT-hh" - // format, ignore it due to spec conflict with - // custom time zones. Also, ignore "ROC" for - // PC-ness. - if (name2.startsWith("GMT+") || name2.startsWith("GMT-") - || "ROC".equals(name2)) { - continue; - } - zi.putAlias(name2, name1); - } catch (Exception e) { - panic("syntax error: no more token for Link"); - } - } - } - in.close(); - } catch (IOException ex) { - panic("IO error: " + ex.getMessage()); - } - - return zi; - } - - /** - * Interprets a zone and constructs a Timezone object that - * contains enough information on GMT offsets and DST schedules to - * generate a zone info database. - * - * @param zoneName the zone name for which a Timezone object is - * constructed. - * - * @return a Timezone object that contains all GMT offsets and DST - * rules information. - */ - Timezone phase2(String zoneName) { - Timezone tz = new Timezone(zoneName); - Zone zone = getZone(zoneName); - zone.resolve(this); - - // TODO: merge phase2's for the regular and SimpleTimeZone ones. - if (isYearForTimeZoneDataSpecified) { - ZoneRec zrec = zone.get(zone.size()-1); - tz.setLastZoneRec(zrec); - tz.setRawOffset(zrec.getGmtOffset()); - if (zrec.hasRuleReference()) { - /* - * This part assumes that the specified year is covered by - * the rules referred to by the last zone record. - */ - List rrecs = zrec.getRuleRef().getRules(startYear); - - if (rrecs.size() == 2) { - // make sure that one is a start rule and the other is - // an end rule. - RuleRec r0 = rrecs.get(0); - RuleRec r1 = rrecs.get(1); - if (r0.getSave() == 0 && r1.getSave() > 0) { - rrecs.set(0, r1); - rrecs.set(1, r0); - } else if (!(r0.getSave() > 0 && r1.getSave() == 0)) { - rrecs = null; - Main.error(zoneName + ": rules for " + startYear + " not found."); - } - } else { - rrecs = null; - } - if (rrecs != null) { - tz.setLastRules(rrecs); - } - } - return tz; - } - - int gmtOffset; - int year = minYear; - int fromYear = year; - long fromTime = Time.getLocalTime(startYear, - Month.JANUARY, - 1, 0); - - // take the index 0 for the GMT offset of the last zone record - ZoneRec zrec = zone.get(zone.size()-1); - tz.getOffsetIndex(zrec.getGmtOffset()); - - int lastGmtOffsetValue = -1; - ZoneRec prevzrec = null; - int currentSave = 0; - boolean usedZone; - for (int zindex = 0; zindex < zone.size(); zindex++) { - zrec = zone.get(zindex); - usedZone = false; - gmtOffset = zrec.getGmtOffset(); - int stdOffset = zrec.getDirectSave(); - - if (gmtOffset != lastGmtOffsetValue) { - tz.setRawOffset(gmtOffset, fromTime); - lastGmtOffsetValue = gmtOffset; - } - // If this is the last zone record, take the last rule info. - if (!zrec.hasUntil()) { - if (zrec.hasRuleReference()) { - tz.setLastRules(zrec.getRuleRef().getLastRules()); - } else if (stdOffset != 0) { - // in case the last rule is all year round DST-only - // (Asia/Amman once announced this rule.) - tz.setLastDSTSaving(stdOffset); - } - } - if (!zrec.hasRuleReference()) { - if (!zrec.hasUntil() || zrec.getUntilTime(stdOffset) >= fromTime) { - tz.addTransition(fromTime, - tz.getOffsetIndex(gmtOffset+stdOffset), - tz.getDstOffsetIndex(stdOffset)); - usedZone = true; - } - currentSave = stdOffset; - // optimization in case the last rule is fixed. - if (!zrec.hasUntil()) { - if (tz.getNTransitions() > 0) { - if (stdOffset == 0) { - tz.setDSTType(Timezone.X_DST); - } else { - tz.setDSTType(Timezone.LAST_DST); - } - long time = Time.getLocalTime(maxYear, - Month.JANUARY, 1, 0); - time -= zrec.getGmtOffset(); - tz.addTransition(time, - tz.getOffsetIndex(gmtOffset+stdOffset), - tz.getDstOffsetIndex(stdOffset)); - tz.addUsedRec(zrec); - } else { - tz.setDSTType(Timezone.NO_DST); - } - break; - } - } else { - Rule rule = zrec.getRuleRef(); - boolean fromTimeUsed = false; - currentSave = 0; - year_loop: - for (year = getMinYear(); year <= endYear; year++) { - if (zrec.hasUntil() && year > zrec.getUntilYear()) { - break; - } - List rules = rule.getRules(year); - if (rules.size() > 0) { - for (int i = 0; i < rules.size(); i++) { - RuleRec rrec = rules.get(i); - long transition = rrec.getTransitionTime(year, - gmtOffset, - currentSave); - if (zrec.hasUntil()) { - if (transition >= zrec.getUntilTime(currentSave)) { - // If the GMT offset changed from the previous one, - // record fromTime as a transition. - if (!fromTimeUsed && prevzrec != null - && gmtOffset != prevzrec.getGmtOffset()) { - tz.addTransition(fromTime, - tz.getOffsetIndex(gmtOffset+currentSave), - tz.getDstOffsetIndex(currentSave)); - fromTimeUsed = true; // for consistency - } - break year_loop; - } - } - - if (fromTimeUsed == false) { - if (fromTime <= transition) { - fromTimeUsed = true; - - if (fromTime != minTime) { - int prevsave; - - // See if until time in the previous - // ZoneRec is the same thing as the - // local time in the next rule. - // (examples are Asia/Ashkhabad in 1991, - // Europe/Riga in 1989) - - if (i > 0) { - prevsave = rules.get(i-1).getSave(); - } else { - List prevrules = rule.getRules(year-1); - - if (prevrules.size() > 0) { - prevsave = prevrules.get(prevrules.size()-1).getSave(); - } else { - prevsave = 0; - } - } - - if (rrec.isSameTransition(prevzrec, prevsave, gmtOffset)) { - currentSave = rrec.getSave(); - tz.addTransition(fromTime, - tz.getOffsetIndex(gmtOffset+currentSave), - tz.getDstOffsetIndex(currentSave)); - tz.addUsedRec(rrec); - usedZone = true; - continue; - } - if (!prevzrec.hasRuleReference() - || rule != prevzrec.getRuleRef() - || (rule == prevzrec.getRuleRef() - && gmtOffset != prevzrec.getGmtOffset())) { - int save = (fromTime == transition) ? rrec.getSave() : currentSave; - tz.addTransition(fromTime, - tz.getOffsetIndex(gmtOffset+save), - tz.getDstOffsetIndex(save)); - tz.addUsedRec(rrec); - usedZone = true; - } - } else { // fromTime == minTime - int save = rrec.getSave(); - tz.addTransition(minTime, - tz.getOffsetIndex(gmtOffset), - tz.getDstOffsetIndex(0)); - - tz.addTransition(transition, - tz.getOffsetIndex(gmtOffset+save), - tz.getDstOffsetIndex(save)); - - tz.addUsedRec(rrec); - usedZone = true; - } - } else if (year == fromYear && i == rules.size()-1) { - int save = rrec.getSave(); - tz.addTransition(fromTime, - tz.getOffsetIndex(gmtOffset+save), - tz.getDstOffsetIndex(save)); - } - } - - currentSave = rrec.getSave(); - if (fromTime < transition) { - tz.addTransition(transition, - tz.getOffsetIndex(gmtOffset+currentSave), - tz.getDstOffsetIndex(currentSave)); - tz.addUsedRec(rrec); - usedZone = true; - } - } - } else { - if (year == fromYear) { - tz.addTransition(fromTime, - tz.getOffsetIndex(gmtOffset+currentSave), - tz.getDstOffsetIndex(currentSave)); - fromTimeUsed = true; - } - if (year == endYear && !zrec.hasUntil()) { - if (tz.getNTransitions() > 0) { - // Assume that this Zone stopped DST - tz.setDSTType(Timezone.X_DST); - long time = Time.getLocalTime(maxYear, Month.JANUARY, - 1, 0); - time -= zrec.getGmtOffset(); - tz.addTransition(time, - tz.getOffsetIndex(gmtOffset), - tz.getDstOffsetIndex(0)); - usedZone = true; - } else { - tz.setDSTType(Timezone.NO_DST); - } - } - } - } - } - if (usedZone) { - tz.addUsedRec(zrec); - } - if (zrec.hasUntil() && zrec.getUntilTime(currentSave) > fromTime) { - fromTime = zrec.getUntilTime(currentSave); - fromYear = zrec.getUntilYear(); - year = zrec.getUntilYear(); - } - prevzrec = zrec; - } - - if (tz.getDSTType() == Timezone.UNDEF_DST) { - tz.setDSTType(Timezone.DST); - } - tz.optimize(); - tz.checksum(); - return tz; - } - - private static void panic(String msg) { - Main.panic(msg); - } -} diff --git a/test/jdk/sun/util/calendar/zi/tzdata_jdk/jdk11_backward b/test/jdk/sun/util/calendar/zi/tzdata_jdk/jdk11_backward deleted file mode 100644 index e480a0083bef6..0000000000000 --- a/test/jdk/sun/util/calendar/zi/tzdata_jdk/jdk11_backward +++ /dev/null @@ -1,78 +0,0 @@ -# -# Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# JDK 1.1.x compatible time zone IDs -# - -Link Australia/Darwin ACT -Link Australia/Sydney AET -Link America/Argentina/Buenos_Aires AGT -Link Africa/Cairo ART -Link America/Anchorage AST -Link America/Sao_Paulo BET -Link Asia/Dhaka BST -Link Africa/Harare CAT -Link America/St_Johns CNT -Link America/Chicago CST -Link Asia/Shanghai CTT -Link Africa/Addis_Ababa EAT -Link Europe/Paris ECT -Link America/New_York EST -Link Pacific/Honolulu HST -Link America/Indianapolis IET -Link Asia/Calcutta IST -Link Asia/Tokyo JST -Link Pacific/Apia MIT -Link America/Denver MST -Link Asia/Yerevan NET -Link Pacific/Auckland NST -Link Asia/Karachi PLT -Link America/Phoenix PNT -Link America/Puerto_Rico PRT -Link America/Los_Angeles PST -Link Pacific/Guadalcanal SST -Link Asia/Saigon VST - -# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule SystemV min 1973 - Apr lastSun 2:00 1:00 D -Rule SystemV min 1973 - Oct lastSun 2:00 0 S -Rule SystemV 1974 only - Jan 6 2:00 1:00 D -Rule SystemV 1974 only - Nov lastSun 2:00 0 S -Rule SystemV 1975 only - Feb 23 2:00 1:00 D -Rule SystemV 1975 only - Oct lastSun 2:00 0 S -Rule SystemV 1976 max - Apr lastSun 2:00 1:00 D -Rule SystemV 1976 max - Oct lastSun 2:00 0 S - -# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL] -Zone SystemV/AST4ADT -4:00 SystemV A%sT -Zone SystemV/EST5EDT -5:00 SystemV E%sT -Zone SystemV/CST6CDT -6:00 SystemV C%sT -Zone SystemV/MST7MDT -7:00 SystemV M%sT -Zone SystemV/PST8PDT -8:00 SystemV P%sT -Zone SystemV/YST9YDT -9:00 SystemV Y%sT -Zone SystemV/AST4 -4:00 - AST -Zone SystemV/EST5 -5:00 - EST -Zone SystemV/CST6 -6:00 - CST -Zone SystemV/MST7 -7:00 - MST -Zone SystemV/PST8 -8:00 - PST -Zone SystemV/YST9 -9:00 - YST -Zone SystemV/HST10 -10:00 - HST diff --git a/test/jdk/sun/util/resources/TimeZone/Bug4640234.java b/test/jdk/sun/util/resources/TimeZone/Bug4640234.java index da555bbf040a1..954932003afa8 100644 --- a/test/jdk/sun/util/resources/TimeZone/Bug4640234.java +++ b/test/jdk/sun/util/resources/TimeZone/Bug4640234.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /** * @test - * @bug 4640234 4946057 4938151 4873691 5023181 + * @bug 4640234 4946057 4938151 4873691 5023181 8347841 * @summary Verifies the translation of time zone names, this test will catch * presence of country name for english and selected locales for all * ISO country codes. @@ -42,6 +42,8 @@ import java.text.MessageFormat; import java.text.SimpleDateFormat; +import java.time.ZoneId; +import java.util.Arrays; import java.util.Date; import java.util.Locale; import java.util.Enumeration; @@ -49,6 +51,7 @@ import java.util.Map; import java.util.ResourceBundle; import java.util.TimeZone; +import java.util.function.Predicate; import sun.util.resources.LocaleData; @@ -83,7 +86,9 @@ public static void main(String[] args) throws Exception { StringBuffer errors = new StringBuffer(""); StringBuffer warnings = new StringBuffer(""); - String[] timezones = TimeZone.getAvailableIDs(); + String[] timezones = Arrays.stream(TimeZone.getAvailableIDs()) + .filter(Predicate.not(ZoneId.SHORT_IDS::containsKey)) + .toArray(String[]::new); String[] countries = locEn.getISOCountries(); String[] languages = locEn.getISOLanguages(); diff --git a/test/jdk/sun/util/resources/cldr/Bug8134384.java b/test/jdk/sun/util/resources/cldr/Bug8134384.java index eac8238bdd28a..f27b587ca9838 100644 --- a/test/jdk/sun/util/resources/cldr/Bug8134384.java +++ b/test/jdk/sun/util/resources/cldr/Bug8134384.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 8134384 8234347 8236548 + * @bug 8134384 8234347 8236548 8347841 * @summary Tests CLDR TimeZoneNames has English names for all tzids * @run main/othervm -Djava.locale.providers=CLDR Bug8134384 */ @@ -38,6 +38,9 @@ public static void main(String [] args) { try { for (String tz : TimeZone.getAvailableIDs() ) { + if (ZoneId.SHORT_IDS.containsKey(tz)) { + continue; + } TimeZone.setDefault(TimeZone.getTimeZone(tz)); // Summer solstice String date1 = Date.from(Instant.parse("2015-06-21T00:00:00.00Z")).toString(); diff --git a/test/jdk/sun/util/resources/cldr/Bug8202764.java b/test/jdk/sun/util/resources/cldr/Bug8202764.java index f2c614b6df0be..6f3e40e620121 100644 --- a/test/jdk/sun/util/resources/cldr/Bug8202764.java +++ b/test/jdk/sun/util/resources/cldr/Bug8202764.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 8202764 + * @bug 8202764 8347841 * @modules jdk.localedata * @summary Checks time zone names are consistent with aliased ids, * between DateFormatSymbols.getZoneStrings() and getDisplayName() @@ -49,6 +49,7 @@ public class Bug8202764 { public void testAliasedTZs() { Set zoneIds = ZoneId.getAvailableZoneIds(); Arrays.stream(DateFormatSymbols.getInstance(Locale.US).getZoneStrings()) + .filter(zone -> !ZoneId.SHORT_IDS.containsKey(zone[0])) .forEach(zone -> { System.out.println(zone[0]); TimeZone tz = TimeZone.getTimeZone(zone[0]); diff --git a/test/jdk/tools/jimage/JImageToolTest.java b/test/jdk/tools/jimage/JImageToolTest.java index b1006c896794b..d7d1ee35ba1e0 100644 --- a/test/jdk/tools/jimage/JImageToolTest.java +++ b/test/jdk/tools/jimage/JImageToolTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,6 +23,7 @@ /* * @test * @library /test/lib + * @requires vm.flagless * @build jdk.test.lib.process.ProcessTools * @summary Test to check if jimage tool exists and is working * @run main/timeout=360 JImageToolTest diff --git a/test/jdk/tools/jlink/JLink20000Packages.java b/test/jdk/tools/jlink/JLink20000Packages.java new file mode 100644 index 0000000000000..865cf7ca98c2f --- /dev/null +++ b/test/jdk/tools/jlink/JLink20000Packages.java @@ -0,0 +1,129 @@ +/* + * 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. + */ + +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Arrays; +import java.util.StringJoiner; +import java.util.spi.ToolProvider; + +import tests.JImageGenerator; + +/* + * @test + * @summary Make sure that ~20000 packages in a uber jar can be linked using jlink. Now that + * pagination is in place, the limitation is on the constant pool size, not number + * of packages. + * @bug 8321413 + * @library ../lib + * @enablePreview + * @modules java.base/jdk.internal.jimage + * jdk.jlink/jdk.tools.jlink.internal + * jdk.jlink/jdk.tools.jlink.plugin + * jdk.jlink/jdk.tools.jmod + * jdk.jlink/jdk.tools.jimage + * jdk.compiler + * @build tests.* + * @run main/othervm -Xmx1g -Xlog:init=debug -XX:+UnlockDiagnosticVMOptions -XX:+BytecodeVerificationLocal JLink20000Packages + */ +public class JLink20000Packages { + private static final ToolProvider JAVAC_TOOL = ToolProvider.findFirst("javac") + .orElseThrow(() -> new RuntimeException("javac tool not found")); + + static void report(String command, String[] args) { + System.out.println(command + " " + String.join(" ", Arrays.asList(args))); + } + + static void javac(String[] args) { + report("javac", args); + JAVAC_TOOL.run(System.out, System.err, args); + } + + public static void main(String[] args) throws Exception { + Path src = Paths.get("bug8321413"); + Path imageDir = src.resolve("out-jlink"); + Path mainModulePath = src.resolve("bug8321413x"); + + StringJoiner mainModuleInfoContent = new StringJoiner(";\n exports ", "module bug8321413x {\n exports ", ";\n}"); + + for (int i = 0; i < 20000; i++) { + String packageName = "p" + i; + String className = "C" + i; + + Path packagePath = Files.createDirectories(mainModulePath.resolve(packageName)); + + StringBuilder classContent = new StringBuilder("package "); + classContent.append(packageName).append(";\n"); + classContent.append("class ").append(className).append(" {}\n"); + Files.writeString(packagePath.resolve(className + ".java"), classContent.toString()); + + mainModuleInfoContent.add(packageName); + } + + // create module reading the generated modules + Path mainModuleInfo = mainModulePath.resolve("module-info.java"); + Files.writeString(mainModuleInfo, mainModuleInfoContent.toString()); + + Path mainClassDir = mainModulePath.resolve("testpackage"); + Files.createDirectories(mainClassDir); + + Files.writeString(mainClassDir.resolve("JLink20000PackagesTest.java"), """ + package testpackage; + + public class JLink20000PackagesTest { + public static void main(String[] args) throws Exception { + System.out.println("JLink20000PackagesTest started."); + } + } + """); + + String out = src.resolve("out").toString(); + javac(new String[]{ + "-d", out, + "--module-source-path", src.toString(), + "--module", "bug8321413x" + }); + + JImageGenerator.getJLinkTask() + .modulePath(out) + .output(imageDir) + .addMods("bug8321413x") + .call() + .assertSuccess(); + + Path binDir = imageDir.resolve("bin").toAbsolutePath(); + Path bin = binDir.resolve("java"); + + ProcessBuilder processBuilder = new ProcessBuilder(bin.toString(), + "-XX:+UnlockDiagnosticVMOptions", + "-XX:+BytecodeVerificationLocal", + "-m", "bug8321413x/testpackage.JLink20000PackagesTest"); + processBuilder.inheritIO(); + processBuilder.directory(binDir.toFile()); + Process process = processBuilder.start(); + int exitCode = process.waitFor(); + if (exitCode != 0) + throw new AssertionError("JLink20000PackagesTest failed to launch"); + } +} diff --git a/test/jdk/tools/jlink/SnippetsTest.java b/test/jdk/tools/jlink/SnippetsTest.java new file mode 100644 index 0000000000000..ec0c94e3d264b --- /dev/null +++ b/test/jdk/tools/jlink/SnippetsTest.java @@ -0,0 +1,271 @@ +/* + * 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. 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. + */ + +import java.io.IOException; +import java.lang.classfile.ClassBuilder; +import java.lang.classfile.ClassFile; +import static java.lang.classfile.ClassFile.ACC_PUBLIC; +import java.lang.constant.ClassDesc; +import static java.lang.constant.ConstantDescs.CD_Integer; +import static java.lang.constant.ConstantDescs.CD_Object; +import static java.lang.constant.ConstantDescs.CD_String; +import static java.lang.constant.ConstantDescs.INIT_NAME; +import static java.lang.constant.ConstantDescs.MTD_void; +import java.lang.constant.MethodTypeDesc; +import static java.lang.invoke.MethodHandles.lookup; +import java.lang.invoke.MethodType; +import java.lang.module.ModuleDescriptor; +import java.lang.reflect.AccessFlag; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.*; +import java.util.function.Function; +import java.util.function.Supplier; +import java.util.stream.IntStream; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; +import static org.junit.jupiter.api.Assertions.*; + +import jdk.tools.jlink.internal.Snippets.*; + +/* + * @test + * @summary Test snippets generation for array and set. + * @bug 8321413 + * @enablePreview + * @modules jdk.jlink/jdk.tools.jlink.internal + * @run junit SnippetsTest + */ +public class SnippetsTest { + private static final boolean WRITE_CLASS_FILE = Boolean.parseBoolean(System.getProperty("DumpArraySnippetsTestClasses", "false")); + + @ParameterizedTest + @ValueSource(ints = { 10, 75, 90, 120, 200, 399, 400, 401}) + void testLoad400StringsArray(int pageSize) { + testPaginatedArray(400, pageSize); + } + + @Test + void testStringArrayLimitsWithPagination() { + // Each string takes 2 constant pool slot, one for String, another for Utf8 + testPaginatedArray(31_000, 8000); + try { + testPaginatedArray(32_000, 8000); + } catch (IllegalArgumentException iae) { + // expected constant pool explode + } + } + + @Test + void testStringArrayLimitsWithoutPagination() { + // each string array assignment takes ~8 bytes + testSimpleArray(8200); + try { + testSimpleArray(8300); + fail(); + } catch (IllegalArgumentException iae) { + // expected code size explode + } + } + + @Test + void testLoadableEnum() { + Enum[] enums = { + AccessFlag.FINAL, + ModuleDescriptor.Requires.Modifier.MANDATED, + ModuleDescriptor.Opens.Modifier.SYNTHETIC, + ModuleDescriptor.Requires.Modifier.TRANSITIVE + }; + + Snippet[] elementSnippets = Snippet.buildAll(Arrays.asList(enums), Snippet::loadEnum); + + var loadable = new ArraySnippetBuilder(Enum.class.describeConstable().get()) + .build(elementSnippets); + + Supplier[]> supplier = generateSupplier("LoadableEnumTest", clb -> loadable); + assertArrayEquals(enums, supplier.get()); + } + + @Test + void testArraySnippetBuilder() { + Integer[] expected = IntStream.range(0, 200) + .boxed() + .toArray(Integer[]::new); + var className = "LoadableArrayOf200Paged"; + var elementSnippets = Snippet.buildAll(Arrays.asList(expected), Snippet::loadInteger); + var instance = new ArraySnippetBuilder(CD_Integer) + .ownerClassDesc(ClassDesc.of(className)) + .enablePagination("page", 100); + + try { + instance.build(elementSnippets); + fail("Should throw NPE without ClassBuilder"); + } catch (NullPointerException npe) { + // expected + } + + Supplier supplier = generateSupplier(className, clb -> instance.classBuilder(clb).build(elementSnippets)); + verifyPaginationMethods(supplier.getClass(), Integer.class, "page", 2); + assertArrayEquals(expected, supplier.get()); + + var loadable = instance.disablePagination() + .ownerClassDesc(ClassDesc.of("LoadableArrayOf200NotPaged")) + .build(elementSnippets); + + // SimpleArray generate bytecode inline, so can be generated in any class + supplier = generateSupplier("TestLoadableArrayFactory", clb -> loadable); + verifyPaginationMethods(supplier.getClass(), Integer.class, "page", 0); + assertArrayEquals(expected, supplier.get()); + } + + @Test + void testSetSnippetBuilder() { + String[] data = IntStream.range(0, 100) + .mapToObj(i -> "SetData" + i) + .toArray(String[]::new); + + var tiny = Set.of(data[0], data[1], data[2]); + var all = Set.of(data); + var setBuilder = new SetSnippetBuilder(CD_String); + + Supplier> supplier = generateSupplier("TinySetTest", clb -> + setBuilder.build(Snippet.buildAll(tiny, Snippet::loadConstant))); + // Set does not guarantee ordering, so not assertIterableEquals + assertEquals(tiny, supplier.get()); + + var allSnippets = Snippet.buildAll(all, Snippet::loadConstant); + + supplier = generateSupplier("AllSetTestNoPage", clb -> + setBuilder.build(allSnippets)); + assertEquals(all, supplier.get()); + + var className = "AllSetTestPageNotActivated"; + var methodNamePrefix = "page"; + var loadable = setBuilder.disablePagination() + .ownerClassDesc(ClassDesc.of(className)) + .build(allSnippets); + supplier = generateSupplier(className, clb -> loadable); + assertEquals(all, supplier.get()); + + className = "AllSetTestPageSize20"; + setBuilder.ownerClassDesc(ClassDesc.of(className)); + supplier = generateSupplier(className, clb -> setBuilder.classBuilder(clb) + .enablePagination(methodNamePrefix, 20) + .build(allSnippets)); + verifyPaginationMethods(supplier.getClass(), String.class, methodNamePrefix, 5); + assertEquals(all, supplier.get()); + } + + void testPaginatedArray(int elementCount, int pageSize) { + String[] expected = IntStream.range(0, elementCount) + .mapToObj(i -> "Package" + i) + .toArray(String[]::new); + var className = String.format("SnippetArrayProviderTest%dPagedBy%d", elementCount, pageSize); + ClassDesc testClassDesc = ClassDesc.of(className); + var builder = new ArraySnippetBuilder(CD_String) + .enablePagination("ArrayPage", pageSize, 1) + .ownerClassDesc(testClassDesc); + var snippets = Snippet.buildAll(Arrays.asList(expected), Snippet::loadConstant); + var pagingContext = new PagingContext(expected.length, pageSize); + + Supplier supplier = generateSupplier(className, clb -> builder.classBuilder(clb).build(snippets)); + verifyPaginationMethods(supplier.getClass(), String.class, "ArrayPage", pagingContext.pageCount()); + assertEquals((elementCount % pageSize) != 0, pagingContext.isLastPagePartial()); + assertArrayEquals(expected, supplier.get()); + } + + void testSimpleArray(int elementCount) { + String[] expected = IntStream.range(0, elementCount) + .mapToObj(i -> "NoPage" + i) + .toArray(String[]::new); + String className = "SnippetArrayProviderTest" + elementCount; + var array = new ArraySnippetBuilder(CD_String) + .disablePagination() + .build(Snippet.buildAll(Arrays.asList(expected), Snippet::loadConstant)); + + Supplier supplier = generateSupplier(className, clb -> array); + verifyPaginationMethods(supplier.getClass(), String.class, "page", 0); + assertArrayEquals(expected, supplier.get()); + } + + Supplier generateSupplier(String className, Function builder) { + var testClassDesc = ClassDesc.of(className); + byte[] classBytes = generateSupplierClass(testClassDesc, builder); + try { + writeClassFile(className, classBytes); + var testClass = lookup().defineClass(classBytes); + lookup().findVirtual(testClass, "get", MethodType.methodType(Object.class)); + return (Supplier) testClass.getDeclaredConstructor().newInstance(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + void verifyPaginationMethods(Class testClass, Class elementType, String methodNamePrefix, int pageCount) { + var methodType = MethodType.methodType(elementType.arrayType(), elementType.arrayType()); + if (pageCount <= 0) { + try { + lookup().findStatic(testClass, methodNamePrefix + "_0", methodType); + fail("Unexpected paginate helper function"); + } catch (Exception ex) {} + } + + for (int i = 0; i < pageCount; i++) { + try { + lookup().findStatic(testClass, methodNamePrefix + "_" + i, methodType); + } catch (Exception ex) { + throw new RuntimeException(ex); + } + } + } + + byte[] generateSupplierClass(ClassDesc testClassDesc, Function builder) { + return ClassFile.of().build(testClassDesc, + clb -> { + clb.withSuperclass(CD_Object); + clb.withInterfaceSymbols(ClassDesc.ofInternalName("java/util/function/Supplier")); + clb.withMethodBody(INIT_NAME, MTD_void, ACC_PUBLIC, cob -> { + cob.aload(0); + cob.invokespecial(CD_Object, INIT_NAME, MTD_void); + cob.return_(); + }); + + var loadable = builder.apply(clb); + + clb.withMethodBody("get", MethodTypeDesc.of(CD_Object), ACC_PUBLIC, cob -> { + loadable.emit(cob); + cob.areturn(); + }); + }); + } + + void writeClassFile(String className, byte[] classBytes) throws IOException { + if (WRITE_CLASS_FILE) { + Files.write(Path.of(className + ".class"), classBytes); + } + } +} \ No newline at end of file diff --git a/test/jdk/tools/jlink/TaskHelperTest.java b/test/jdk/tools/jlink/TaskHelperTest.java new file mode 100644 index 0000000000000..51dea8de24a9a --- /dev/null +++ b/test/jdk/tools/jlink/TaskHelperTest.java @@ -0,0 +1,220 @@ +/* + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.IOException; +import java.util.*; +import java.util.stream.Stream; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +import jdk.tools.jlink.internal.PluginRepository; +import jdk.tools.jlink.internal.TaskHelper; +import jdk.tools.jlink.internal.TaskHelper.Option; +import jdk.tools.jlink.internal.TaskHelper.OptionsHelper; +import jdk.tools.jlink.plugin.Plugin; +import jdk.tools.jlink.plugin.ResourcePool; +import jdk.tools.jlink.plugin.ResourcePoolBuilder; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; + +import jdk.tools.jlink.internal.TaskHelper.BadArgs; + +/* + * @test + * @summary Test TaskHelper option parsing + * @bug 8303884 + * @modules jdk.jlink/jdk.tools.jlink.internal + * jdk.jlink/jdk.tools.jlink.plugin + * @run junit TaskHelperTest + */ +public class TaskHelperTest { + private static TaskHelper taskHelper; + private static OptionsHelper optionsHelper; + + private static final List> OPTIONS = List.of( + new Option<>(true, (task, opt, arg) -> { + System.out.println(arg); + mainArgValue = arg; + }, true, "--main-expecting"), + new Option<>(false, (task, opt, arg) -> { + mainFlag = true; + }, true, "--main-no-arg") + ); + + private static String argValue; + private static String mainArgValue; + private static boolean mainFlag = false; + + public record ArgTestCase(String cmdLine, String[] tokens, String pluginArgValue, String mainArgValue, boolean mainFlagSet) {}; + + public static class TestPluginWithRawOption implements Plugin { + @Override + public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) { + return out.build(); + } + + @Override + public boolean hasArguments() { + return true; + } + + @Override + public boolean hasRawArgument() { + return true; + } + + @Override + public String getName() { + return "raw-arg-plugin"; + } + + @Override + public void configure(Map config) { + config.forEach((k, v) -> { + System.out.println(k + " -> " + v); + }); + var v = config.get(getName()); + if (v == null) + throw new AssertionError(); + argValue = v; + } + } + + @BeforeAll + public static void setup() { + taskHelper = new TaskHelper(TaskHelper.JLINK_BUNDLE); + optionsHelper = taskHelper.newOptionsHelper(TaskHelperTest.class, OPTIONS.toArray(Option[]::new)); + PluginRepository.registerPlugin(new TestPluginWithRawOption()); + } + + @BeforeEach + public void reset() { + argValue = null; + mainArgValue = null; + mainFlag = false; + } + + public static Stream gnuStyleUsages() { + return Stream.of( + new ArgTestCase( + "--main-expecting=--main-no-arg --main-no-arg", + new String[] { "--main-expecting=--main-no-arg", "--main-no-arg" }, + null, + "--main-no-arg", + true + ), + new ArgTestCase( + "--main-expecting ' --main-no-arg' --main-no-arg", + new String[] { "--main-expecting", " --main-no-arg", "--main-no-arg" }, + null, + " --main-no-arg", + true + ), + new ArgTestCase( + "--raw-arg-plugin=--main-no-arg --main-no-arg", + new String[] { "--raw-arg-plugin=--main-no-arg", "--main-no-arg" }, + "--main-no-arg", + null, + true + ), + new ArgTestCase( + "--raw-arg-plugin ' --main-no-arg' --main-no-arg", + new String[] { "--raw-arg-plugin", " --main-no-arg", "--main-no-arg" }, + " --main-no-arg", + null, + true + ), + new ArgTestCase( + "--raw-arg-plugin=--main-expecting=value --main-no-arg", + new String[] { "--raw-arg-plugin=--main-expecting=value", "--main-no-arg" }, + "--main-expecting=value", + null, + true + ), + new ArgTestCase( + "--raw-arg-plugin='--main-expecting value' --main-no-arg", + new String[] { "--raw-arg-plugin=--main-expecting value", "--main-no-arg" }, + "--main-expecting value", + null, + true + ), + new ArgTestCase( + "--raw-arg-plugin='--main-expecting value' --main-expecting realValue", + new String[] { "--raw-arg-plugin=--main-expecting value", "--main-expecting", "realValue" }, + "--main-expecting value", + "realValue", + false + )); + } + + @ParameterizedTest + @MethodSource("gnuStyleUsages") + public void testGnuStyleOptionAsArgValue(ArgTestCase testCase) throws TaskHelper.BadArgs { + System.out.println("Test cmdline: " + testCase.cmdLine()); + var args = testCase.tokens(); + var remaining = optionsHelper.handleOptions(this, args); + try { + // trigger Plugin::configure + taskHelper.getPluginsConfig(null, null, null); + } catch (IOException ex) { + fail("Unexpected IOException"); + } + assertTrue(remaining.isEmpty()); + assertEquals(testCase.mainFlagSet(), mainFlag); + assertEquals(testCase.pluginArgValue(), argValue); + assertEquals(testCase.mainArgValue(), mainArgValue); + } + + @Test + public void testGnuStyleOptionAsArgValueMissing() { + var invalidFormat = new String[][] { + { "--main-expecting", "--main-no-arg --list", "--main-no-arg" }, + { "--main-expecting", "--main-no-arg", "--main-no-arg" }, + { "--raw-arg-plugin", "--main-no-arg --list", "--main-no-arg" }, + { "--raw-arg-plugin", "--main-no-arg", "--main-no-arg" }, + { "--raw-arg-plugin", "--main-expecting", "value", "--main-no-arg" } + }; + + for (var args: invalidFormat) { + try { + optionsHelper.handleOptions(this, args); + fail("Should get an ambiguous error"); + } catch (BadArgs ex) { + // expected + } + } + } + + @Test + public void testRemaining() throws BadArgs { + String[] args = { "--raw-arg-plugin=--main-expecting", "value", "--main-no-arg" }; + var remaining = optionsHelper.handleOptions(this, args); + assertEquals(2, remaining.size()); + } +} \ No newline at end of file diff --git a/test/jdk/tools/jlink/plugins/IncludeLocalesPluginTest.java b/test/jdk/tools/jlink/plugins/IncludeLocalesPluginTest.java index f0fe3149247ea..f30adee80a3c6 100644 --- a/test/jdk/tools/jlink/plugins/IncludeLocalesPluginTest.java +++ b/test/jdk/tools/jlink/plugins/IncludeLocalesPluginTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * 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,32 +21,43 @@ * questions. */ +import java.io.IOException; import java.nio.file.Path; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Locale; import java.util.stream.Collectors; +import java.util.stream.Stream; import jdk.tools.jlink.internal.LinkableRuntimeImage; import jdk.tools.jlink.internal.TaskHelper; import jdk.tools.jlink.internal.plugins.PluginsResourceBundle; import jdk.tools.jlink.plugin.PluginException; +import jdk.test.lib.Platform; import tests.Helper; import tests.JImageGenerator; import tests.JImageValidator; import tests.Result; +import org.junit.jupiter.api.BeforeAll; +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.fail; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; /* * @test * @bug 8152143 8152704 8155649 8165804 8185841 8176841 8190918 * 8179071 8202537 8221432 8222098 8251317 8258794 8265315 - * 8296248 8306116 8174269 + * 8296248 8306116 8174269 8347146 * @summary IncludeLocalesPlugin tests * @author Naoto Sato * @requires (vm.compMode != "Xcomp" & os.maxMemory >= 2g) - * @library ../../lib + * @library ../../lib /test/lib * @modules java.base/jdk.internal.jimage * jdk.jlink/jdk.tools.jlink.internal * jdk.jlink/jdk.tools.jlink.internal.plugins @@ -55,365 +66,346 @@ * jdk.jlink/jdk.tools.jimage * jdk.compiler * @build tests.* + * @build jdk.test.lib.Platform * @build tools.jlink.plugins.GetAvailableLocales - * @run main/othervm/timeout=180 -Xmx1g IncludeLocalesPluginTest + * @run junit/othervm/timeout=180 -Xmx1g IncludeLocalesPluginTest */ + public class IncludeLocalesPluginTest { - private static final String moduleName = "IncludeLocalesTest"; + private static final String MODULE_NAME = "IncludeLocalesTest"; private static Helper helper; - private static final int INCLUDE_LOCALES_OPTION = 0; - private static final int ADDMODS_OPTION = 1; - private static final int EXPECTED_LOCATIONS = 2; - private static final int UNEXPECTED_PATHS = 3; - private static final int AVAILABLE_LOCALES = 4; - private static final int ERROR_MESSAGE = 5; - - private static int errors; - - private final static Object[][] testData = { - // Test data should include: - // - --include-locales command line option - // - --add-modules command line option values - // - List of required resources in the result image - // - List of resources that should not exist in the result image - // - List of available locales in the result image - // - Error message - - // without --include-locales option: should include all locales - { - "", - "jdk.localedata", - List.of( - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_zh.class"), - List.of(), - Arrays.stream(Locale.getAvailableLocales()) - // "(root)" for Locale.ROOT rather than "" - .map(loc -> loc.equals(Locale.ROOT) ? "(root)" : loc.toString()) - .collect(Collectors.toList()), - "", - }, - - // Asterisk works exactly the same as above - { - "--include-locales=*", - "jdk.localedata", - List.of( - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_zh.class"), - List.of(), - Arrays.stream(Locale.getAvailableLocales()) - // "(root)" for Locale.ROOT rather than "" - .map(loc -> loc.equals(Locale.ROOT) ? "(root)" : loc.toString()) - .collect(Collectors.toList()), - "", - }, - - // World English/Spanish in Latin America - { - "--include-locales=en-001,es-419", - "jdk.localedata", - List.of( - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_150.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_AT.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_es.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_es_419.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_es_AR.class"), - List.of( - "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th", - "/jdk.localedata/sun/text/resources/ext/thai_dict", - "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th", - "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class"), - List.of( - "(root)", "en", "en_001", "en_150", "en_AG", "en_AI", - "en_AT", "en_AU", "en_BB", "en_BE", "en_BM", "en_BS", "en_BW", "en_BZ", - "en_CC", "en_CH", "en_CK", "en_CM", "en_CX", "en_CY", "en_DE", - "en_DG", "en_DK", "en_DM", "en_ER", "en_FI", "en_FJ", "en_FK", "en_FM", - "en_GB", "en_GD", "en_GG", "en_GH", "en_GI", "en_GM", "en_GY", "en_HK", "en_ID", - "en_IE", "en_IL", "en_IM", "en_IN", "en_IO", "en_JE", "en_JM", "en_KE", - "en_KI", "en_KN", "en_KY", "en_LC", "en_LR", "en_LS", "en_MG", "en_MO", - "en_MS", "en_MT", "en_MU", "en_MV", "en_MW", "en_MY", "en_NA", "en_NF", "en_NG", - "en_NL", "en_NR", "en_NU", "en_NZ", "en_PG", "en_PK", "en_PN", - "en_PW", "en_RW", "en_SB", "en_SC", "en_SD", "en_SE", "en_SG", "en_SH", - "en_SI", "en_SL", "en_SS", "en_SX", "en_SZ", "en_TC", "en_TK", "en_TO", - "en_TT", "en_TV", "en_TZ", "en_UG", "en_US", "en_US_#Latn", "en_US_POSIX", "en_VC", "en_VG", "en_VU", "en_WS", - "en_ZA", "en_ZM", "en_ZW", "es", "es_419", "es_AR", "es_BO", "es_BR", "es_BZ", - "es_CL", "es_CO", "es_CR", "es_CU", "es_DO", "es_EC", "es_GT", "es_HN", - "es_MX", "es_NI", "es_PA", "es_PE", "es_PR", "es_PY", "es_SV", "es_US", - "es_UY", "es_VE", - // CLDR's "hi-Latn" falls back to "en-001", "hi-Latn"/"hi-Latn-IN" are added - // here. Since Locale.Matcher cannot handle such exceptional inheritance, - // allowing to include "hi"/"hi-IN" resource files. - "hi", "hi__#Latn", "hi_IN", "hi_IN_#Latn"), - "", - }, - - // All English and Japanese locales - { - "--include-locales=en,ja", - "jdk.localedata", - List.of( - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class"), - List.of( - "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th", - "/jdk.localedata/sun/text/resources/ext/thai_dict", - "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th", - "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_zh.class"), - List.of( - "(root)", "en", "en_001", "en_150", "en_AE", "en_AG", "en_AI", "en_AS", "en_AT", - "en_AU", "en_BB", "en_BE", "en_BI", "en_BM", "en_BS", "en_BW", "en_BZ", - "en_CA", "en_CC", "en_CH", "en_CK", "en_CM", "en_CX", "en_CY", "en_DE", - "en_DG", "en_DK", "en_DM", "en_ER", "en_FI", "en_FJ", "en_FK", "en_FM", - "en_GB", "en_GD", "en_GG", "en_GH", "en_GI", "en_GM", "en_GU", "en_GY", - "en_HK", "en_ID", "en_IE", "en_IL", "en_IM", "en_IN", "en_IO", "en_JE", "en_JM", - "en_KE", "en_KI", "en_KN", "en_KY", "en_LC", "en_LR", "en_LS", "en_MG", - "en_MH", "en_MO", "en_MP", "en_MS", "en_MT", "en_MU", "en_MV", "en_MW", "en_MY", - "en_NA", "en_NF", "en_NG", "en_NL", "en_NR", "en_NU", "en_NZ", "en_PG", - "en_PH", "en_PK", "en_PN", "en_PR", "en_PW", "en_RW", "en_SB", "en_SC", - "en_SD", "en_SE", "en_SG", "en_SH", "en_SI", "en_SL", "en_SS", "en_SX", - "en_SZ", "en_TC", "en_TK", "en_TO", "en_TT", "en_TV", "en_TZ", "en_UG", - "en_UM", "en_US", "en_US_#Latn", "en_US_POSIX", "en_VC", "en_VG", "en_VI", "en_VU", - "en_WS", "en_ZA", "en_ZM", "en_ZW", "ja", "ja_JP", "ja_JP_#Jpan", - "ja_JP_JP_#u-ca-japanese"), - "", - }, - - // All locales in Austria - { - "--include-locales=*-AT", - "jdk.localedata", - List.of( - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_de.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_de_AT.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_150.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_AT.class"), - List.of( - "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th", - "/jdk.localedata/sun/text/resources/ext/thai_dict", - "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th", - "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class"), - List.of( - "(root)", "en", "en_001", "en_150", "en_AT", "en_US", "en_US_#Latn", "en_US_POSIX", - "de", "de_AT"), - "", - }, - - // All locales in India - { - "--include-locales=*-IN", - "jdk.localedata", - List.of( - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_IN.class"), - List.of( - "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th", - "/jdk.localedata/sun/text/resources/ext/thai_dict", - "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th", - "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class", - "/jdk.localedata/sun/text/resources/ext/BreakIteratorResources_th.class", - "/jdk.localedata/sun/util/resources/cldr/ext/CalendarData_as_IN.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_zh.class"), - List.of( - "(root)", "as", "as_IN", "as_IN_#Beng", "bgc", "bgc_IN", "bgc_IN_#Deva", "bho", "bho_IN", "bho_IN_#Deva", - "bn", "bn_IN", "bo", "bo_IN", "brx", "brx_IN", "brx_IN_#Deva", "ccp", "ccp_IN", "doi", "doi_IN", - "doi_IN_#Deva", "en", "en_001", "en_IN", "en_US", "en_US_#Latn", "en_US_POSIX", "gu", "gu_IN", - "gu_IN_#Gujr", "hi", "hi__#Latn", "hi_IN", "hi_IN_#Deva", "hi_IN_#Latn", "kn", "kn_IN", "kn_IN_#Knda", - "kok", "kok__#Deva", "kok__#Latn", "kok_IN", "kok_IN_#Deva", "kok_IN_#Latn", "ks", "ks__#Arab", - "ks__#Deva", "ks_IN", "ks_IN_#Arab", "ks_IN_#Deva", "kxv", "kxv_IN", "kxv_IN_#Deva", "kxv_IN_#Latn", - "kxv_IN_#Orya", "kxv_IN_#Telu", "kxv__#Deva", "kxv__#Latn", "kxv__#Orya", "kxv__#Telu", - "mai", "mai_IN", "mai_IN_#Deva", "mni", "mni__#Beng", "mni_IN", "mni_IN_#Beng", "ml", "ml_IN", - "ml_IN_#Mlym", "mr", "mr_IN", "mr_IN_#Deva", "ne", "ne_IN", "or", "or_IN", "or_IN_#Orya", "pa", - "pa__#Guru", "pa_IN", "pa_IN_#Guru", "raj", "raj_IN", "raj_IN_#Deva", "sa", "sa_IN", "sa_IN_#Deva", - "sat", "sat__#Olck", "sat_IN", "sat_IN_#Olck", "sd", "sd__#Deva", "sd_IN", "sd_IN_#Deva", "ta", "ta_IN", - "ta_IN_#Taml", "te", "te_IN", "te_IN_#Telu", "ur_IN", "ur", "xnr", "xnr_IN", "xnr_IN_#Deva"), - "", - }, - - // Thai - { - "--include-locales=th", - "jdk.localedata", - List.of( - "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th", - "/jdk.localedata/sun/text/resources/ext/thai_dict", - "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th", - "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class", - "/jdk.localedata/sun/text/resources/ext/BreakIteratorResources_th.class"), - List.of( - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_zh.class"), - List.of( - "(root)", "en", "en_US", "en_US_#Latn", "en_US_POSIX", "th", "th_TH", - "th_TH_#Thai", "th_TH_TH_#u-nu-thai"), - "", - }, - - // Hong Kong - { - "--include-locales=zh-HK", - "jdk.localedata", - List.of( - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_zh.class"), - List.of( - "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th", - "/jdk.localedata/sun/text/resources/ext/thai_dict", - "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th", - "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class"), - List.of( - "(root)", "en", "en_US", "en_US_#Latn", "en_US_POSIX", "zh", "zh__#Hans", "zh__#Hant", - "zh_HK", "zh_HK_#Hans", "zh_HK_#Hant"), - "", - }, - - // Simplified Chinese - { - "--include-locales=zh-Hans", - "jdk.localedata", - List.of( - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_zh.class"), - List.of( - "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th", - "/jdk.localedata/sun/text/resources/ext/thai_dict", - "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th", - "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class"), - List.of( - "(root)", "en", "en_US", "en_US_#Latn", "en_US_POSIX", "zh", "zh__#Latn", "zh__#Hans", "zh_CN", - "zh_CN_#Latn", "zh_CN_#Hans", "zh_HK", "zh_HK_#Hans", "zh_MO", "zh_MO_#Hans", "zh_MY_#Hans", "zh_SG", - "zh_SG_#Hans"), - "", - }, - - // Norwegian - { - "--include-locales=nb,nn,no", - "jdk.localedata", - List.of( - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_nb.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_nn.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_no.class"), - List.of( - "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th", - "/jdk.localedata/sun/text/resources/ext/thai_dict", - "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th", - "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class"), - List.of( - "(root)", "en", "en_US", "en_US_#Latn", "en_US_POSIX", "nb", "nb_NO", - "nb_NO_#Latn", "nb_SJ", "nn", "nn_NO", "nn_NO_#Latn", "no", "no_NO", "no_NO_NY", - "no_NO_#Latn"), - "", - }, - - // Hebrew/Indonesian/Yiddish - { - "--include-locales=he,id,yi", - "jdk.localedata", - List.of( - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_he.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_id.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_yi.class"), - List.of( - "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th", - "/jdk.localedata/sun/text/resources/ext/thai_dict", - "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th", - "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class", - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class"), - List.of( - "(root)", "en", "en_US", "en_US_#Latn", "en_US_POSIX", "id", "id_ID", - "id_ID_#Latn", "he", "he_IL", "he_IL_#Hebr", "yi", "yi_UA", "yi_UA_#Hebr"), - "", - }, - - // Langtag including extensions. Should be ignored. - { - "--include-locales=en,ja-u-nu-thai", - "jdk.localedata", - List.of( - "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class"), - List.of(), - List.of( - "(root)", "en", "en_001", "en_150", "en_AE", "en_AG", "en_AI", "en_AS", "en_AT", - "en_AU", "en_BB", "en_BE", "en_BI", "en_BM", "en_BS", "en_BW", "en_BZ", - "en_CA", "en_CC", "en_CH", "en_CK", "en_CM", "en_CX", "en_CY", "en_DE", - "en_DG", "en_DK", "en_DM", "en_ER", "en_FI", "en_FJ", "en_FK", "en_FM", - "en_GB", "en_GD", "en_GG", "en_GH", "en_GI", "en_GM", "en_GU", "en_GY", - "en_HK", "en_ID", "en_IE", "en_IL", "en_IM", "en_IN", "en_IO", "en_JE", "en_JM", - "en_KE", "en_KI", "en_KN", "en_KY", "en_LC", "en_LR", "en_LS", "en_MG", - "en_MH", "en_MO", "en_MP", "en_MS", "en_MT", "en_MU", "en_MV", "en_MW", "en_MY", - "en_NA", "en_NF", "en_NG", "en_NL", "en_NR", "en_NU", "en_NZ", "en_PG", - "en_PH", "en_PK", "en_PN", "en_PR", "en_PW", "en_RW", "en_SB", "en_SC", - "en_SD", "en_SE", "en_SG", "en_SH", "en_SI", "en_SL", "en_SS", "en_SX", - "en_SZ", "en_TC", "en_TK", "en_TO", "en_TT", "en_TV", "en_TZ", "en_UG", - "en_UM", "en_US", "en_US_#Latn", "en_US_POSIX", "en_VC", "en_VG", "en_VI", "en_VU", - "en_WS", "en_ZA", "en_ZM", "en_ZW"), - "", - }, - - // Error case: No matching locales - { - "--include-locales=xyz", - "jdk.localedata", - null, - null, - null, - new PluginException(String.format( - PluginsResourceBundle.getMessage("include-locales.nomatchinglocales"), "xyz")) - .getMessage(), - }, - - // Error case: Invalid argument - { - "--include-locales=en,zh_HK", - "jdk.localedata", - null, - null, - null, - new PluginException(String.format( - PluginsResourceBundle.getMessage("include-locales.invalidtag"), "zh_hk")) - .getMessage(), - }, - - // Error case: jdk.localedata is not added - { - "--include-locales=en-US", - "java.base", - null, - null, - null, - new PluginException( - PluginsResourceBundle.getMessage("include-locales.localedatanotfound")) - .getMessage(), - }, - }; - - public static void main(String[] args) throws Exception { + + // Test data should include: + // - --include-locales command line option + // - --add-modules command line option values + // - List of required resources in the result image + // - List of resources that should not exist in the result image + // - List of available locales in the result image + // - Error message + private static Stream testData() { + return Stream.of( + // without --include-locales option: should include all locales + Arguments.of( + "", + "jdk.localedata", + List.of( + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_zh.class"), + List.of(), + Arrays.stream(Locale.getAvailableLocales()) + // "(root)" for Locale.ROOT rather than "" + .map(loc -> loc.equals(Locale.ROOT) ? "(root)" : loc.toString()) + .collect(Collectors.toList()), + ""), + + // Asterisk works exactly the same as above + Arguments.of( + "--include-locales=*", + "jdk.localedata", + List.of( + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_zh.class"), + List.of(), + Arrays.stream(Locale.getAvailableLocales()) + // "(root)" for Locale.ROOT rather than "" + .map(loc -> loc.equals(Locale.ROOT) ? "(root)" : loc.toString()) + .collect(Collectors.toList()), + ""), + + // World English/Spanish in Latin America + Arguments.of( + "--include-locales=en-001,es-419", + "jdk.localedata", + List.of( + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_150.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_AT.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_es.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_es_419.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_es_AR.class"), + List.of( + "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th", + "/jdk.localedata/sun/text/resources/ext/thai_dict", + "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th", + "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class"), + List.of( + "(root)", "en", "en_001", "en_150", "en_AG", "en_AI", + "en_AT", "en_AU", "en_BB", "en_BE", "en_BM", "en_BS", "en_BW", "en_BZ", + "en_CC", "en_CH", "en_CK", "en_CM", "en_CX", "en_CY", "en_DE", + "en_DG", "en_DK", "en_DM", "en_ER", "en_FI", "en_FJ", "en_FK", "en_FM", + "en_GB", "en_GD", "en_GG", "en_GH", "en_GI", "en_GM", "en_GY", "en_HK", "en_ID", + "en_IE", "en_IL", "en_IM", "en_IN", "en_IO", "en_JE", "en_JM", "en_KE", + "en_KI", "en_KN", "en_KY", "en_LC", "en_LR", "en_LS", "en_MG", "en_MO", + "en_MS", "en_MT", "en_MU", "en_MV", "en_MW", "en_MY", "en_NA", "en_NF", "en_NG", + "en_NL", "en_NR", "en_NU", "en_NZ", "en_PG", "en_PK", "en_PN", + "en_PW", "en_RW", "en_SB", "en_SC", "en_SD", "en_SE", "en_SG", "en_SH", + "en_SI", "en_SL", "en_SS", "en_SX", "en_SZ", "en_TC", "en_TK", "en_TO", + "en_TT", "en_TV", "en_TZ", "en_UG", "en_US", "en_US_#Latn", "en_US_POSIX", "en_VC", "en_VG", "en_VU", "en_WS", + "en_ZA", "en_ZM", "en_ZW", "es", "es_419", "es_AR", "es_BO", "es_BR", "es_BZ", + "es_CL", "es_CO", "es_CR", "es_CU", "es_DO", "es_EC", "es_GT", "es_HN", + "es_MX", "es_NI", "es_PA", "es_PE", "es_PR", "es_PY", "es_SV", "es_US", + "es_UY", "es_VE", + // CLDR's "hi-Latn" falls back to "en-001", "hi-Latn"/"hi-Latn-IN" are added + // here. Since Locale.Matcher cannot handle such exceptional inheritance, + // allowing to include "hi"/"hi-IN" resource files. + "hi", "hi__#Latn", "hi_IN", "hi_IN_#Latn"), + ""), + + // All English and Japanese locales + Arguments.of( + "--include-locales=en,ja", + "jdk.localedata", + List.of( + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class"), + List.of( + "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th", + "/jdk.localedata/sun/text/resources/ext/thai_dict", + "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th", + "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_zh.class"), + List.of( + "(root)", "en", "en_001", "en_150", "en_AE", "en_AG", "en_AI", "en_AS", "en_AT", + "en_AU", "en_BB", "en_BE", "en_BI", "en_BM", "en_BS", "en_BW", "en_BZ", + "en_CA", "en_CC", "en_CH", "en_CK", "en_CM", "en_CX", "en_CY", "en_DE", + "en_DG", "en_DK", "en_DM", "en_ER", "en_FI", "en_FJ", "en_FK", "en_FM", + "en_GB", "en_GD", "en_GG", "en_GH", "en_GI", "en_GM", "en_GU", "en_GY", + "en_HK", "en_ID", "en_IE", "en_IL", "en_IM", "en_IN", "en_IO", "en_JE", "en_JM", + "en_KE", "en_KI", "en_KN", "en_KY", "en_LC", "en_LR", "en_LS", "en_MG", + "en_MH", "en_MO", "en_MP", "en_MS", "en_MT", "en_MU", "en_MV", "en_MW", "en_MY", + "en_NA", "en_NF", "en_NG", "en_NL", "en_NR", "en_NU", "en_NZ", "en_PG", + "en_PH", "en_PK", "en_PN", "en_PR", "en_PW", "en_RW", "en_SB", "en_SC", + "en_SD", "en_SE", "en_SG", "en_SH", "en_SI", "en_SL", "en_SS", "en_SX", + "en_SZ", "en_TC", "en_TK", "en_TO", "en_TT", "en_TV", "en_TZ", "en_UG", + "en_UM", "en_US", "en_US_#Latn", "en_US_POSIX", "en_VC", "en_VG", "en_VI", "en_VU", + "en_WS", "en_ZA", "en_ZM", "en_ZW", "ja", "ja_JP", "ja_JP_#Jpan", + "ja_JP_JP_#u-ca-japanese"), + ""), + + // All locales in Austria + Arguments.of( + "--include-locales=*-AT", + "jdk.localedata", + List.of( + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_de.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_de_AT.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_150.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_AT.class"), + List.of( + "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th", + "/jdk.localedata/sun/text/resources/ext/thai_dict", + "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th", + "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class"), + List.of( + "(root)", "en", "en_001", "en_150", "en_AT", "en_US", "en_US_#Latn", "en_US_POSIX", + "de", "de_AT"), + ""), + + // All locales in India + Arguments.of( + "--include-locales=*-IN", + "jdk.localedata", + List.of( + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_IN.class"), + List.of( + "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th", + "/jdk.localedata/sun/text/resources/ext/thai_dict", + "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th", + "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class", + "/jdk.localedata/sun/text/resources/ext/BreakIteratorResources_th.class", + "/jdk.localedata/sun/util/resources/cldr/ext/CalendarData_as_IN.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_zh.class"), + List.of( + "(root)", "as", "as_IN", "as_IN_#Beng", "bgc", "bgc_IN", "bgc_IN_#Deva", "bho", "bho_IN", "bho_IN_#Deva", + "bn", "bn_IN", "bo", "bo_IN", "brx", "brx_IN", "brx_IN_#Deva", "ccp", "ccp_IN", "doi", "doi_IN", + "doi_IN_#Deva", "en", "en_001", "en_IN", "en_US", "en_US_#Latn", "en_US_POSIX", "gu", "gu_IN", + "gu_IN_#Gujr", "hi", "hi__#Latn", "hi_IN", "hi_IN_#Deva", "hi_IN_#Latn", "kn", "kn_IN", "kn_IN_#Knda", + "kok", "kok__#Deva", "kok__#Latn", "kok_IN", "kok_IN_#Deva", "kok_IN_#Latn", "ks", "ks__#Arab", + "ks__#Deva", "ks_IN", "ks_IN_#Arab", "ks_IN_#Deva", "kxv", "kxv_IN", "kxv_IN_#Deva", "kxv_IN_#Latn", + "kxv_IN_#Orya", "kxv_IN_#Telu", "kxv__#Deva", "kxv__#Latn", "kxv__#Orya", "kxv__#Telu", + "mai", "mai_IN", "mai_IN_#Deva", "mni", "mni__#Beng", "mni_IN", "mni_IN_#Beng", "ml", "ml_IN", + "ml_IN_#Mlym", "mr", "mr_IN", "mr_IN_#Deva", "ne", "ne_IN", "or", "or_IN", "or_IN_#Orya", "pa", + "pa__#Guru", "pa_IN", "pa_IN_#Guru", "raj", "raj_IN", "raj_IN_#Deva", "sa", "sa_IN", "sa_IN_#Deva", + "sat", "sat__#Olck", "sat_IN", "sat_IN_#Olck", "sd", "sd__#Deva", "sd_IN", "sd_IN_#Deva", "ta", "ta_IN", + "ta_IN_#Taml", "te", "te_IN", "te_IN_#Telu", "ur_IN", "ur", "xnr", "xnr_IN", "xnr_IN_#Deva"), + ""), + + // Thai + Arguments.of( + "--include-locales=th", + "jdk.localedata", + List.of( + "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th", + "/jdk.localedata/sun/text/resources/ext/thai_dict", + "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th", + "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class", + "/jdk.localedata/sun/text/resources/ext/BreakIteratorResources_th.class"), + List.of( + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_zh.class"), + List.of( + "(root)", "en", "en_US", "en_US_#Latn", "en_US_POSIX", "th", "th_TH", + "th_TH_#Thai", "th_TH_TH_#u-nu-thai"), + ""), + + // Hong Kong + Arguments.of( + "--include-locales=zh-HK", + "jdk.localedata", + List.of( + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_zh.class"), + List.of( + "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th", + "/jdk.localedata/sun/text/resources/ext/thai_dict", + "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th", + "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class"), + List.of( + "(root)", "en", "en_US", "en_US_#Latn", "en_US_POSIX", "zh", "zh__#Hans", "zh__#Hant", + "zh_HK", "zh_HK_#Hans", "zh_HK_#Hant"), + ""), + + // Simplified Chinese + Arguments.of( + "--include-locales=zh-Hans", + "jdk.localedata", + List.of( + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_zh.class"), + List.of( + "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th", + "/jdk.localedata/sun/text/resources/ext/thai_dict", + "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th", + "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class"), + List.of( + "(root)", "en", "en_US", "en_US_#Latn", "en_US_POSIX", "zh", "zh__#Latn", "zh__#Hans", "zh_CN", + "zh_CN_#Latn", "zh_CN_#Hans", "zh_HK", "zh_HK_#Hans", "zh_MO", "zh_MO_#Hans", "zh_MY_#Hans", "zh_SG", + "zh_SG_#Hans"), + ""), + + // Norwegian + Arguments.of( + "--include-locales=nb,nn,no", + "jdk.localedata", + List.of( + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_nb.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_nn.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_no.class"), + List.of( + "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th", + "/jdk.localedata/sun/text/resources/ext/thai_dict", + "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th", + "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class"), + List.of( + "(root)", "en", "en_US", "en_US_#Latn", "en_US_POSIX", "nb", "nb_NO", + "nb_NO_#Latn", "nb_SJ", "nn", "nn_NO", "nn_NO_#Latn", "no", "no_NO", "no_NO_NY", + "no_NO_#Latn"), + ""), + + // Hebrew/Indonesian/Yiddish + Arguments.of( + "--include-locales=he,id,yi", + "jdk.localedata", + List.of( + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_he.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_id.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_yi.class"), + List.of( + "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th", + "/jdk.localedata/sun/text/resources/ext/thai_dict", + "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th", + "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class", + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class"), + List.of( + "(root)", "en", "en_US", "en_US_#Latn", "en_US_POSIX", "id", "id_ID", + "id_ID_#Latn", "he", "he_IL", "he_IL_#Hebr", "yi", "yi_UA", "yi_UA_#Hebr"), + ""), + + // Langtag including extensions. Should be ignored. + Arguments.of( + "--include-locales=en,ja-u-nu-thai", + "jdk.localedata", + List.of( + "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class"), + List.of(), + List.of( + "(root)", "en", "en_001", "en_150", "en_AE", "en_AG", "en_AI", "en_AS", "en_AT", + "en_AU", "en_BB", "en_BE", "en_BI", "en_BM", "en_BS", "en_BW", "en_BZ", + "en_CA", "en_CC", "en_CH", "en_CK", "en_CM", "en_CX", "en_CY", "en_DE", + "en_DG", "en_DK", "en_DM", "en_ER", "en_FI", "en_FJ", "en_FK", "en_FM", + "en_GB", "en_GD", "en_GG", "en_GH", "en_GI", "en_GM", "en_GU", "en_GY", + "en_HK", "en_ID", "en_IE", "en_IL", "en_IM", "en_IN", "en_IO", "en_JE", "en_JM", + "en_KE", "en_KI", "en_KN", "en_KY", "en_LC", "en_LR", "en_LS", "en_MG", + "en_MH", "en_MO", "en_MP", "en_MS", "en_MT", "en_MU", "en_MV", "en_MW", "en_MY", + "en_NA", "en_NF", "en_NG", "en_NL", "en_NR", "en_NU", "en_NZ", "en_PG", + "en_PH", "en_PK", "en_PN", "en_PR", "en_PW", "en_RW", "en_SB", "en_SC", + "en_SD", "en_SE", "en_SG", "en_SH", "en_SI", "en_SL", "en_SS", "en_SX", + "en_SZ", "en_TC", "en_TK", "en_TO", "en_TT", "en_TV", "en_TZ", "en_UG", + "en_UM", "en_US", "en_US_#Latn", "en_US_POSIX", "en_VC", "en_VG", "en_VI", "en_VU", + "en_WS", "en_ZA", "en_ZM", "en_ZW"), + ""), + + // Error case: No matching locales + Arguments.of( + "--include-locales=xyz", + "jdk.localedata", + null, + null, + null, + new PluginException(String.format( + PluginsResourceBundle.getMessage("include-locales.nomatchinglocales"), "xyz")) + .getMessage()), + + // Error case: Invalid argument + Arguments.of( + "--include-locales=en,zh_HK", + "jdk.localedata", + null, + null, + null, + new PluginException(String.format( + PluginsResourceBundle.getMessage("include-locales.invalidtag"), "zh_hk")) + .getMessage()), + + // Error case: jdk.localedata is not added + Arguments.of( + "--include-locales=en-US", + "java.base", + null, + null, + null, + new PluginException( + PluginsResourceBundle.getMessage("include-locales.localedatanotfound")) + .getMessage()) + ); + } + + @BeforeAll + public static void setup() throws IOException { boolean isLinkableRuntime = LinkableRuntimeImage.isLinkableRuntime(); System.out.println("Running test on " + (isLinkableRuntime ? "enabled" : "disabled") + @@ -423,48 +415,42 @@ public static void main(String[] args) throws Exception { "present."); helper = Helper.newHelper(isLinkableRuntime); - if (helper == null) { - throw new RuntimeException("Helper could not be initialized"); - } + assertNotNull(helper, "Helper could not be initialized"); + } - for (Object[] data : testData) { - // create image for each test data - Result result; - if (data[INCLUDE_LOCALES_OPTION].toString().isEmpty()) { - System.out.println("Invoking jlink with no --include-locales option"); - result = JImageGenerator.getJLinkTask() - .output(helper.createNewImageDir(moduleName)) - .addMods((String) data[ADDMODS_OPTION]) - .call(); - } else { - System.out.println("Invoking jlink with \"" + data[INCLUDE_LOCALES_OPTION] + "\""); - result = JImageGenerator.getJLinkTask() - .output(helper.createNewImageDir(moduleName)) - .addMods((String) data[ADDMODS_OPTION]) - .option((String) data[INCLUDE_LOCALES_OPTION]) - .call(); - } - - String errorMsg = (String) data[ERROR_MESSAGE]; - if (errorMsg.isEmpty()) { - Path image = result.assertSuccess(); - - // test locale data entries - testLocaleDataEntries(image, - (List) data[EXPECTED_LOCATIONS], - (List) data[UNEXPECTED_PATHS]); - - // test available locales - testAvailableLocales(image, (List) data[AVAILABLE_LOCALES]); - } else { - result.assertFailure(new TaskHelper(TaskHelper.JLINK_BUNDLE) - .getMessage("error.prefix") + " " +errorMsg); - System.out.println("\tExpected failure: " + result.getMessage()); - } + @ParameterizedTest + @MethodSource("testData") + public void launch(String optIncludeLocales, String optAddModules, List requiredRes, + List shouldNotExistRes, List availableLocs, String errorMsg) throws Exception { + // create image for each test data + Result result; + if (optIncludeLocales.isEmpty()) { + System.out.println("Invoking jlink with no --include-locales option"); + result = JImageGenerator.getJLinkTask() + .output(helper.createNewImageDir(MODULE_NAME)) + .addMods(optAddModules) + .call(); + } else { + System.out.println("Invoking jlink with \"" + optIncludeLocales + "\""); + result = JImageGenerator.getJLinkTask() + .output(helper.createNewImageDir(MODULE_NAME)) + .addMods(optAddModules) + .option(optIncludeLocales) + .call(); } - if (errors > 0) { - throw new RuntimeException("Test failed"); + if (errorMsg.isEmpty()) { + Path image = result.assertSuccess(); + + // test locale data entries + testLocaleDataEntries(image, requiredRes, shouldNotExistRes); + + // test available locales + testAvailableLocales(image, availableLocs); + } else { + result.assertFailure(new TaskHelper(TaskHelper.JLINK_BUNDLE) + .getMessage("error.prefix") + " " +errorMsg); + System.out.println("\tExpected failure: " + result.getMessage()); } } @@ -476,16 +462,13 @@ private static void testLocaleDataEntries(Path image, List expectedLocat image.resolve("lib").resolve("modules"), expectedLocations, unexpectedPaths); } catch (Exception e) { - System.out.println("\tFailed with: " + e); - e.printStackTrace(); - errors++; + fail("\tFailed with: " + e); } } private static void testAvailableLocales(Path image, List availableLocales) throws Exception { System.out.println("testAvailableLocales:"); - Path launcher = image.resolve("bin/java" + - (System.getProperty("os.name").startsWith("Windows") ? ".exe" : "")); + Path launcher = image.resolve("bin/java" + (Platform.isWindows() ? ".exe" : "")); List args = new ArrayList<>(availableLocales.size() + 2); args.add(launcher.toString()); args.add("GetAvailableLocales"); @@ -497,12 +480,8 @@ private static void testAvailableLocales(Path image, List availableLocal + (len < availableLocales.size() ? " ..." : ""); int status = proc.waitFor(); - if (status == 0) { - System.out.println("\tDone\t" + command); - } else { - System.out.println("\tExit " + status + "\t" + command); - errors++; - } + assertTrue(status == 0, "\tExit " + status + "\t" + command); + System.out.println("\tDone\t" + command); System.out.println(); } } diff --git a/test/jdk/tools/jlink/runtimeImage/AddOptionsTest.java b/test/jdk/tools/jlink/runtimeImage/AddOptionsTest.java index 827f7da624d30..1ffe1240d07e7 100644 --- a/test/jdk/tools/jlink/runtimeImage/AddOptionsTest.java +++ b/test/jdk/tools/jlink/runtimeImage/AddOptionsTest.java @@ -40,7 +40,7 @@ * jdk.jlink/jdk.tools.jimage * @build tests.* jdk.test.lib.process.OutputAnalyzer * jdk.test.lib.process.ProcessTools - * @run main/othervm -Xmx1400m AddOptionsTest + * @run main/othervm -Xmx1g AddOptionsTest */ public class AddOptionsTest extends AbstractLinkableRuntimeTest { diff --git a/test/jdk/tools/jlink/runtimeImage/BasicJlinkMissingJavaBase.java b/test/jdk/tools/jlink/runtimeImage/BasicJlinkMissingJavaBase.java index ebf5b060665fc..b0d2a2d66f5b3 100644 --- a/test/jdk/tools/jlink/runtimeImage/BasicJlinkMissingJavaBase.java +++ b/test/jdk/tools/jlink/runtimeImage/BasicJlinkMissingJavaBase.java @@ -41,7 +41,7 @@ * jdk.jlink/jdk.tools.jimage * @build tests.* jdk.test.lib.process.OutputAnalyzer * jdk.test.lib.process.ProcessTools - * @run main/othervm -Xmx1400m BasicJlinkMissingJavaBase + * @run main/othervm -Xmx1g BasicJlinkMissingJavaBase */ public class BasicJlinkMissingJavaBase extends AbstractLinkableRuntimeTest { diff --git a/test/jdk/tools/jlink/runtimeImage/BasicJlinkTest.java b/test/jdk/tools/jlink/runtimeImage/BasicJlinkTest.java index 8cbd74e5ed1cb..b97ebff9b4906 100644 --- a/test/jdk/tools/jlink/runtimeImage/BasicJlinkTest.java +++ b/test/jdk/tools/jlink/runtimeImage/BasicJlinkTest.java @@ -39,7 +39,7 @@ * jdk.jlink/jdk.tools.jimage * @build tests.* jdk.test.lib.process.OutputAnalyzer * jdk.test.lib.process.ProcessTools - * @run main/othervm -Xmx1400m BasicJlinkTest false + * @run main/othervm -Xmx1g BasicJlinkTest false */ public class BasicJlinkTest extends AbstractLinkableRuntimeTest { diff --git a/test/jdk/tools/jlink/runtimeImage/CustomModuleJlinkTest.java b/test/jdk/tools/jlink/runtimeImage/CustomModuleJlinkTest.java index d6c237a173b72..369bccfecfce4 100644 --- a/test/jdk/tools/jlink/runtimeImage/CustomModuleJlinkTest.java +++ b/test/jdk/tools/jlink/runtimeImage/CustomModuleJlinkTest.java @@ -39,7 +39,7 @@ * jdk.jlink/jdk.tools.jimage * @build tests.* jdk.test.lib.process.OutputAnalyzer * jdk.test.lib.process.ProcessTools - * @run main/othervm -Xmx1400m CustomModuleJlinkTest + * @run main/othervm -Xmx1g CustomModuleJlinkTest */ public class CustomModuleJlinkTest extends AbstractLinkableRuntimeTest { diff --git a/test/jdk/tools/jlink/runtimeImage/GenerateJLIClassesTest.java b/test/jdk/tools/jlink/runtimeImage/GenerateJLIClassesTest.java index e59d18bd6f05c..533a8db30d0cc 100644 --- a/test/jdk/tools/jlink/runtimeImage/GenerateJLIClassesTest.java +++ b/test/jdk/tools/jlink/runtimeImage/GenerateJLIClassesTest.java @@ -39,7 +39,7 @@ * jdk.jlink/jdk.tools.jimage * @build tests.* jdk.test.lib.process.OutputAnalyzer * jdk.test.lib.process.ProcessTools - * @run main/othervm -Xmx1400m GenerateJLIClassesTest + * @run main/othervm -Xmx1g GenerateJLIClassesTest */ public class GenerateJLIClassesTest extends AbstractLinkableRuntimeTest { diff --git a/test/jdk/tools/jlink/runtimeImage/JavaSEReproducibleTest.java b/test/jdk/tools/jlink/runtimeImage/JavaSEReproducibleTest.java index a376d075ecd07..d923358aed90d 100644 --- a/test/jdk/tools/jlink/runtimeImage/JavaSEReproducibleTest.java +++ b/test/jdk/tools/jlink/runtimeImage/JavaSEReproducibleTest.java @@ -40,7 +40,7 @@ * jdk.jlink/jdk.tools.jimage * @build tests.* jdk.test.lib.process.OutputAnalyzer * jdk.test.lib.process.ProcessTools - * @run main/othervm -Xmx1400m JavaSEReproducibleTest + * @run main/othervm -Xmx1g JavaSEReproducibleTest */ public class JavaSEReproducibleTest extends AbstractLinkableRuntimeTest { diff --git a/test/jdk/tools/jlink/runtimeImage/JimageDiffGeneratorTest.java b/test/jdk/tools/jlink/runtimeImage/JimageDiffGeneratorTest.java new file mode 100644 index 0000000000000..0176e6d07a19d --- /dev/null +++ b/test/jdk/tools/jlink/runtimeImage/JimageDiffGeneratorTest.java @@ -0,0 +1,327 @@ +/* + * Copyright (c) 2025, Red Hat, Inc. + * 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 static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.util.List; + +import org.testng.annotations.Test; + +import jdk.tools.jlink.internal.runtimelink.JimageDiffGenerator; +import jdk.tools.jlink.internal.runtimelink.JimageDiffGenerator.ImageResource; +import jdk.tools.jlink.internal.runtimelink.ResourceDiff; + +/* + * @test + * @summary Unit test the diff generator logic for JEP 493 + * @modules java.base/jdk.internal.jimage + * jdk.jlink/jdk.tools.jlink.internal.runtimelink + * @run testng JimageDiffGeneratorTest + */ +public class JimageDiffGeneratorTest { + + /* + * Expect a resource diff since the "b" item is removed in + * the optimized image. + */ + @Test + public void testItemsRemovedInOpt() throws Exception { + List entriesOpt = List.of("a", "c", "d"); + byte[][] bytesOpt = new byte[][] { + { 0x01, 0x03, 0x03 }, /* a */ + { 0x09, 0x11, 0x11 }, /* c */ + { 0x22, 0x22, 0x30 }, /* d */ + }; + ImageResource opt = new BasicImageResource(entriesOpt, bytesOpt); + List entriesBase = List.of("a", "b", "c", "d"); + byte[][] bytesBase = new byte[][] { + { 0x01, 0x03, 0x03 }, /* a */ + { 0x08, 0x04, 0x04 }, /* b */ + { 0x09, 0x11, 0x11 }, /* c */ + { 0x22, 0x22, 0x30 }, /* d */ + }; + ImageResource base = new BasicImageResource(entriesBase, bytesBase); + JimageDiffGenerator gen = new JimageDiffGenerator(); + List result = gen.generateDiff(base, opt); + assertEquals(result.size(), 1); + assertEquals(result.get(0).getKind(), ResourceDiff.Kind.REMOVED); + assertEquals(result.get(0).getName(), "b"); + assertEquals(result.get(0).getResourceBytes(), bytesBase[1]); + } + + /* + * Expect no difference as streams are the same + */ + @Test + public void testNoDiff() throws Exception { + List entriesBase = List.of("a", "b", "c", "d"); + byte[][] bytesBase = new byte[][] { + { 0x01, 0x03, 0x03 }, /* a */ + { 0x08, 0x04, 0x04 }, /* b */ + { 0x09, 0x11, 0x11 }, /* c */ + { 0x22, 0x22, 0x30 }, /* d */ + }; + ImageResource base = new BasicImageResource(entriesBase, bytesBase); + ImageResource opt = new BasicImageResource(entriesBase, bytesBase); + JimageDiffGenerator gen = new JimageDiffGenerator(); + List result = gen.generateDiff(base, opt); + assertTrue(result.isEmpty()); + } + + /* + * Expect a resource diff since the "b" item has been added in + * the optimized image. + */ + @Test + public void testItemsAddedInOpt() throws Exception { + List entriesBase = List.of("a", "c", "d"); + byte[][] bytesBase = new byte[][] { + { 0x01, 0x03, 0x03 }, /* a */ + { 0x09, 0x11, 0x11 }, /* c */ + { 0x22, 0x22, 0x30 }, /* d */ + }; + ImageResource base = new BasicImageResource(entriesBase, bytesBase); + List entriesOpt = List.of("a", "b", "c", "d"); + byte[][] bytesOpt = new byte[][] { + { 0x01, 0x03, 0x03 }, /* a */ + { 0x08, 0x04, 0x04 }, /* b */ + { 0x09, 0x11, 0x11 }, /* c */ + { 0x22, 0x22, 0x30 }, /* d */ + }; + ImageResource opt = new BasicImageResource(entriesOpt, bytesOpt); + JimageDiffGenerator gen = new JimageDiffGenerator(); + List result = gen.generateDiff(base, opt); + assertEquals(result.size(), 1); + assertEquals(result.get(0).getKind(), ResourceDiff.Kind.ADDED); + assertEquals(result.get(0).getName(), "b"); + assertEquals(result.get(0).getResourceBytes(), null, "Added entries in opt don't have resource bytes"); + } + + /* + * Expect a resource diff since the "d" item has modified bytes in the + * optimized image resource. + */ + @Test + public void testBytesDiffer() throws Exception { + List entriesBase = List.of("a", "b", "c", "d"); + byte[][] bytesBase = new byte[][] { + { 0x01, 0x03, 0x03 }, /* a */ + { 0x08, 0x04, 0x04 }, /* b */ + { 0x09, 0x11, 0x11 }, /* c */ + { 0x11, 0x12, 0x31 }, /* d */ + }; + ImageResource base = new BasicImageResource(entriesBase, bytesBase); + List entriesOpt = List.of("a", "b", "c", "d"); + byte[][] bytesOpt = new byte[][] { + { 0x01, 0x03, 0x03 }, /* a */ + { 0x08, 0x04, 0x04 }, /* b */ + { 0x09, 0x11, 0x11 }, /* c */ + { 0x22, 0x22, 0x30 }, /* d - differs to base! */ + }; + ImageResource opt = new BasicImageResource(entriesOpt, bytesOpt); + JimageDiffGenerator gen = new JimageDiffGenerator(); + List result = gen.generateDiff(base, opt); + assertEquals(result.size(), 1); + assertEquals(result.get(0).getKind(), ResourceDiff.Kind.MODIFIED); + assertEquals(result.get(0).getName(), "d"); + assertEquals(result.get(0).getResourceBytes(), bytesBase[3]); + } + + /* + * Expect a resource diff since an item has modified bytes. Test + * for a resource that has more than 1K bytes (the buffer size used + * internally). + */ + @Test + public void testBytesDifferLarge() throws Exception { + List entriesBase = List.of("a", "b", "c", "d"); + byte[][] bytesBase = new byte[][] { + { 0x01, 0x03, 0x03 }, /* a */ + { 0x08, 0x04, 0x04 }, /* b */ + { }, /* c */ + { 0x11, 0x12, 0x31 }, /* d */ + }; + bytesBase[2] = generateBytes(); + ImageResource base = new BasicImageResource(entriesBase, bytesBase); + List entriesOpt = List.of("a", "b", "c", "d"); + byte[][] bytesOpt = new byte[][] { + { 0x01, 0x03, 0x03 }, /* a */ + { 0x08, 0x04, 0x04 }, /* b */ + { }, /* c */ + { 0x22, 0x22, 0x30 }, /* d */ + }; + bytesOpt[2] = generateBytes(); + // Change the first byte of 'c' in the opt bytes + bytesOpt[2][0] = -1; + // assert pre-condition + assertTrue(bytesOpt[2][0] != bytesBase[2][0]); + + ImageResource opt = new BasicImageResource(entriesOpt, bytesOpt); + JimageDiffGenerator gen = new JimageDiffGenerator(); + List result = gen.generateDiff(base, opt); + assertEquals(result.size(), 2); + // assertions for 'c' differences + assertEquals(result.get(0).getKind(), ResourceDiff.Kind.MODIFIED); + assertEquals(result.get(0).getName(), "c"); + assertEquals(result.get(0).getResourceBytes(), bytesBase[2]); + + // assertion for 'd' differences + assertEquals(result.get(1).getKind(), ResourceDiff.Kind.MODIFIED); + assertEquals(result.get(1).getName(), "d"); + assertEquals(result.get(1).getResourceBytes(), bytesBase[3]); + } + + /* + * Expect a no resource difference since the steams are both empty + */ + @Test + public void testEmptyStreams() throws Exception { + List entriesBase = List.of("a", "b", "c", "d"); + byte[][] bytesBase = new byte[][] { + { }, /* a */ + { }, /* b */ + { }, /* c */ + { }, /* d */ + }; + ImageResource base = new BasicImageResource(entriesBase, bytesBase); + ImageResource opt = new BasicImageResource(entriesBase, bytesBase); + JimageDiffGenerator gen = new JimageDiffGenerator(); + List result = gen.generateDiff(base, opt); + assertTrue(result.isEmpty()); + } + + /* + * Expect a difference since entry 'a' has zero bytes in opt. + */ + @Test + public void testNotEqualLength() throws Exception { + List entriesBase = List.of("a", "b", "c", "d"); + byte[][] bytesBase = new byte[][] { + { 0x01, 0x03, 0x03 }, /* a */ + { 0x08, 0x04, 0x04 }, /* b */ + { 0x09, 0x11, 0x11 }, /* c */ + { 0x11, 0x12, 0x31 }, /* d */ + }; + byte[][] bytesOpt = new byte[][] { + { }, /* a */ + { 0x08, 0x04, 0x04 }, /* b */ + { 0x09, 0x11, 0x11 }, /* c */ + { 0x11, 0x12, 0x31 }, /* d */ + }; + ImageResource base = new BasicImageResource(entriesBase, bytesBase); + ImageResource opt = new BasicImageResource(entriesBase, bytesOpt); + JimageDiffGenerator gen = new JimageDiffGenerator(); + List result = gen.generateDiff(base, opt); + assertEquals(result.size(), 1); + assertEquals(result.get(0).getKind(), ResourceDiff.Kind.MODIFIED); + assertEquals(result.get(0).getName(), "a"); + assertEquals(result.get(0).getResourceBytes(), bytesBase[0]); + } + + /* + * Expect a difference since entry 'a' on the optimized version is + * one byte longer. + */ + @Test + public void testBytesDifferExactBufferSize() throws Exception { + List entriesBase = List.of("a", "b", "c", "d"); + byte[][] bytesBase = new byte[][] { + { }, /* a */ + { 0x08, 0x04, 0x04 }, /* b */ + { 0x09, 0x11, 0x11 }, /* c */ + { 0x11, 0x12, 0x31 }, /* d */ + }; + byte[][] bytesOpt = new byte[][] { + { }, /* a */ + { 0x08, 0x04, 0x04 }, /* b */ + { 0x09, 0x11, 0x11 }, /* c */ + { 0x11, 0x12, 0x31 }, /* d */ + }; + bytesBase[0] = genBytesOfSize(1024); // exact buffer size + bytesOpt[0] = genBytesOfSize(1024 + 1); // buffer size + 1 + + ImageResource base = new BasicImageResource(entriesBase, bytesBase); + ImageResource opt = new BasicImageResource(entriesBase, bytesOpt); + JimageDiffGenerator gen = new JimageDiffGenerator(); + List result = gen.generateDiff(base, opt); + assertEquals(result.size(), 1); + assertEquals(result.get(0).getKind(), ResourceDiff.Kind.MODIFIED); + assertEquals(result.get(0).getName(), "a"); + assertEquals(result.get(0).getResourceBytes(), bytesBase[0]); + } + + private byte[] generateBytes() { + int size = 1024 + 254; + return genBytesOfSize(size); + } + + private byte[] genBytesOfSize(int size) { + byte[] result = new byte[size]; + for (int i = 0; i < size; i++) { + result[i] = (byte)(i % Byte.MAX_VALUE); + } + return result; + } + + // Simple stub ImageResource for test purposes + static class BasicImageResource implements ImageResource { + + private final List entries; + private final byte[][] entryBytes; + + public BasicImageResource(List entries, byte[][] entryBytes) { + this.entries = entries; + this.entryBytes = entryBytes; + } + + @Override + public void close() throws Exception { + // nothing + } + + @Override + public List getEntries() { + return entries; + } + + @Override + public byte[] getResourceBytes(String name) { + for (int i = 0; i < entries.size(); i++) { + if (entries.get(i).equals(name)) { + return entryBytes[i]; + } + } + return null; + } + + @Override + public InputStream getResource(String name) { + byte[] bytes = getResourceBytes(name); + return new ByteArrayInputStream(bytes); + } + + } +} diff --git a/test/jdk/tools/jlink/runtimeImage/KeepPackagedModulesFailTest.java b/test/jdk/tools/jlink/runtimeImage/KeepPackagedModulesFailTest.java index 6fdaf5a9824b8..8094579ecd505 100644 --- a/test/jdk/tools/jlink/runtimeImage/KeepPackagedModulesFailTest.java +++ b/test/jdk/tools/jlink/runtimeImage/KeepPackagedModulesFailTest.java @@ -41,7 +41,7 @@ * jdk.jlink/jdk.tools.jimage * @build tests.* jdk.test.lib.process.OutputAnalyzer * jdk.test.lib.process.ProcessTools - * @run main/othervm -Xmx1400m KeepPackagedModulesFailTest + * @run main/othervm -Xmx1g KeepPackagedModulesFailTest */ public class KeepPackagedModulesFailTest extends AbstractLinkableRuntimeTest { diff --git a/test/jdk/tools/jlink/runtimeImage/ModifiedFilesExitTest.java b/test/jdk/tools/jlink/runtimeImage/ModifiedFilesExitTest.java index 777ce302ce799..443cbbaec3c9d 100644 --- a/test/jdk/tools/jlink/runtimeImage/ModifiedFilesExitTest.java +++ b/test/jdk/tools/jlink/runtimeImage/ModifiedFilesExitTest.java @@ -40,7 +40,7 @@ * jdk.jlink/jdk.tools.jimage * @build tests.* jdk.test.lib.process.OutputAnalyzer * jdk.test.lib.process.ProcessTools - * @run main/othervm -Xmx1400m ModifiedFilesExitTest + * @run main/othervm -Xmx1g ModifiedFilesExitTest */ public class ModifiedFilesExitTest extends ModifiedFilesTest { diff --git a/test/jdk/tools/jlink/runtimeImage/ModifiedFilesWarningTest.java b/test/jdk/tools/jlink/runtimeImage/ModifiedFilesWarningTest.java index c871024f37cfa..619c67e01b4b4 100644 --- a/test/jdk/tools/jlink/runtimeImage/ModifiedFilesWarningTest.java +++ b/test/jdk/tools/jlink/runtimeImage/ModifiedFilesWarningTest.java @@ -39,7 +39,7 @@ * jdk.jlink/jdk.tools.jimage * @build tests.* jdk.test.lib.process.OutputAnalyzer * jdk.test.lib.process.ProcessTools - * @run main/othervm -Xmx1400m ModifiedFilesWarningTest + * @run main/othervm -Xmx1g ModifiedFilesWarningTest */ public class ModifiedFilesWarningTest extends ModifiedFilesTest { diff --git a/test/jdk/tools/jlink/runtimeImage/MultiHopTest.java b/test/jdk/tools/jlink/runtimeImage/MultiHopTest.java index 0e2cabe7425c8..88f91f238bd87 100644 --- a/test/jdk/tools/jlink/runtimeImage/MultiHopTest.java +++ b/test/jdk/tools/jlink/runtimeImage/MultiHopTest.java @@ -40,7 +40,7 @@ * jdk.jlink/jdk.tools.jimage * @build tests.* jdk.test.lib.process.OutputAnalyzer * jdk.test.lib.process.ProcessTools - * @run main/othervm -Xmx1400m MultiHopTest + * @run main/othervm -Xmx1g MultiHopTest */ public class MultiHopTest extends AbstractLinkableRuntimeTest { diff --git a/test/jdk/tools/jlink/runtimeImage/PackagedModulesVsRuntimeImageLinkTest.java b/test/jdk/tools/jlink/runtimeImage/PackagedModulesVsRuntimeImageLinkTest.java index d276e80702b40..ef7030d2e62fa 100644 --- a/test/jdk/tools/jlink/runtimeImage/PackagedModulesVsRuntimeImageLinkTest.java +++ b/test/jdk/tools/jlink/runtimeImage/PackagedModulesVsRuntimeImageLinkTest.java @@ -49,7 +49,7 @@ * jdk.jlink/jdk.tools.jimage * @build tests.* jdk.test.lib.process.OutputAnalyzer * jdk.test.lib.process.ProcessTools - * @run main/othervm/timeout=1200 -Xmx1400m PackagedModulesVsRuntimeImageLinkTest + * @run main/othervm/timeout=1200 -Xmx1g PackagedModulesVsRuntimeImageLinkTest */ public class PackagedModulesVsRuntimeImageLinkTest extends AbstractLinkableRuntimeTest { @@ -76,7 +76,6 @@ void runTest(Helper helper, boolean isLinkableRuntime) throws Exception { .output(helper.createNewImageDir("java-se-jmodfull")) .addMods("java.se").call().assertSuccess(); - System.out.println("Now comparing jmod-less and jmod-full) images"); compareRecursively(javaSEruntimeLink, javaSEJmodFull); } diff --git a/test/jdk/tools/jlink/runtimeImage/PatchedJDKModuleJlinkTest.java b/test/jdk/tools/jlink/runtimeImage/PatchedJDKModuleJlinkTest.java index d4654ec98bdc3..81579e0754bca 100644 --- a/test/jdk/tools/jlink/runtimeImage/PatchedJDKModuleJlinkTest.java +++ b/test/jdk/tools/jlink/runtimeImage/PatchedJDKModuleJlinkTest.java @@ -42,7 +42,7 @@ * jdk.jlink/jdk.tools.jimage * @build tests.* jdk.test.lib.process.OutputAnalyzer * jdk.test.lib.process.ProcessTools - * @run main/othervm -Xmx1400m PatchedJDKModuleJlinkTest + * @run main/othervm -Xmx1g PatchedJDKModuleJlinkTest */ public class PatchedJDKModuleJlinkTest extends AbstractLinkableRuntimeTest { diff --git a/test/jdk/tools/jlink/runtimeImage/SystemModulesTest.java b/test/jdk/tools/jlink/runtimeImage/SystemModulesTest.java index d0a6234eec0ce..fac8cac112d14 100644 --- a/test/jdk/tools/jlink/runtimeImage/SystemModulesTest.java +++ b/test/jdk/tools/jlink/runtimeImage/SystemModulesTest.java @@ -41,7 +41,7 @@ * jdk.jlink/jdk.tools.jimage * @build tests.* jdk.test.lib.process.OutputAnalyzer * jdk.test.lib.process.ProcessTools - * @run main/othervm -Xmx1400m SystemModulesTest + * @run main/othervm -Xmx1g SystemModulesTest */ public class SystemModulesTest extends AbstractLinkableRuntimeTest { diff --git a/test/jdk/tools/jlink/runtimeImage/SystemModulesTest2.java b/test/jdk/tools/jlink/runtimeImage/SystemModulesTest2.java index ee22a55f3a751..6be4ad7321cea 100644 --- a/test/jdk/tools/jlink/runtimeImage/SystemModulesTest2.java +++ b/test/jdk/tools/jlink/runtimeImage/SystemModulesTest2.java @@ -42,7 +42,7 @@ * jdk.jlink/jdk.tools.jimage * @build tests.* jdk.test.lib.process.OutputAnalyzer * jdk.test.lib.process.ProcessTools - * @run main/othervm -Xmx1400m SystemModulesTest2 + * @run main/othervm -Xmx1g SystemModulesTest2 */ public class SystemModulesTest2 extends AbstractLinkableRuntimeTest { diff --git a/test/jdk/tools/jpackage/TEST.properties b/test/jdk/tools/jpackage/TEST.properties index a34532d6695c6..78f5fc88bc32d 100644 --- a/test/jdk/tools/jpackage/TEST.properties +++ b/test/jdk/tools/jpackage/TEST.properties @@ -14,4 +14,5 @@ exclusiveAccess.dirs=share windows modules=jdk.jpackage/jdk.jpackage.internal:+open \ jdk.jpackage/jdk.jpackage.internal.util \ jdk.jpackage/jdk.jpackage.internal.util.function \ - java.base/jdk.internal.util + java.base/jdk.internal.util \ + jdk.jlink/jdk.tools.jlink.internal diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/Executor.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/Executor.java index 7a0878d826b43..706e26668b191 100644 --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/Executor.java +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/Executor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -53,7 +53,6 @@ public static Executor of(String... cmdline) { public Executor() { saveOutputType = new HashSet<>(Set.of(SaveOutputType.NONE)); - removePathEnvVar = false; winEnglishOutput = false; } @@ -86,8 +85,8 @@ public Executor setExecutable(JavaTool v) { return setExecutable(v.getPath()); } - public Executor setRemovePathEnvVar(boolean value) { - removePathEnvVar = value; + public Executor removeEnvVar(String envVarName) { + removeEnvVars.add(Objects.requireNonNull(envVarName)); return this; } @@ -372,10 +371,12 @@ private Result runExecutable() throws IOException, InterruptedException { builder.directory(directory.toFile()); sb.append(String.format("; in directory [%s]", directory)); } - if (removePathEnvVar) { - // run this with cleared Path in Environment - TKit.trace("Clearing PATH in environment"); - builder.environment().remove("PATH"); + if (!removeEnvVars.isEmpty()) { + final var envComm = Comm.compare(builder.environment().keySet(), removeEnvVars); + builder.environment().keySet().removeAll(envComm.common()); + envComm.common().forEach(envVar -> { + TKit.trace(String.format("Clearing %s in environment", envVar)); + }); } trace("Execute " + sb.toString() + "..."); @@ -504,7 +505,7 @@ private static void trace(String msg) { private Path executable; private Set saveOutputType; private Path directory; - private boolean removePathEnvVar; + private Set removeEnvVars = new HashSet<>(); private boolean winEnglishOutput; private String winTmpDir = null; diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/HelloApp.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/HelloApp.java index 0c7476e863dc4..15fb41ca1e243 100644 --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/HelloApp.java +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/HelloApp.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -472,14 +472,14 @@ private Executor getExecutor(String...args) { } } - final List launcherArgs = List.of(args); - return new Executor() + final var executor = new Executor() .setDirectory(outputFile.getParent()) .saveOutput(saveOutput) .dumpOutput() - .setRemovePathEnvVar(removePathEnvVar) .setExecutable(executablePath) - .addArguments(launcherArgs); + .addArguments(List.of(args)); + + return configureEnvironment(executor); } private boolean launcherNoExit; @@ -496,6 +496,14 @@ public static AppOutputVerifier assertApp(Path helloAppLauncher) { return new AppOutputVerifier(helloAppLauncher); } + public static Executor configureEnvironment(Executor executor) { + if (CLEAR_JAVA_ENV_VARS) { + executor.removeEnvVar("JAVA_TOOL_OPTIONS"); + executor.removeEnvVar("_JAVA_OPTIONS"); + } + return executor; + } + static final String OUTPUT_FILENAME = "appOutput.txt"; private final JavaAppDesc appDesc; @@ -505,4 +513,7 @@ public static AppOutputVerifier assertApp(Path helloAppLauncher) { private static final String CLASS_NAME = HELLO_JAVA.getFileName().toString().split( "\\.", 2)[0]; + + private static final boolean CLEAR_JAVA_ENV_VARS = Optional.ofNullable( + TKit.getConfigProperty("clear-app-launcher-java-env-vars")).map(Boolean::parseBoolean).orElse(false); } diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JPackageCommand.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JPackageCommand.java index 68f26bfb261f1..bbf7d429f08cf 100644 --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JPackageCommand.java +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JPackageCommand.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -593,7 +593,7 @@ public Path appLauncherCfgPath(String launcherName) { } public boolean isFakeRuntime(String msg) { - if (isFakeRuntime()) { + if (isFakeRuntime(appRuntimeDirectory())) { // Fake runtime Path runtimeDir = appRuntimeDirectory(); TKit.trace(String.format( @@ -604,7 +604,7 @@ public boolean isFakeRuntime(String msg) { return false; } - private boolean isFakeRuntime() { + private static boolean isFakeRuntime(Path runtimeDir) { final Collection criticalRuntimeFiles; if (TKit.isWindows()) { criticalRuntimeFiles = WindowsHelper.CRITICAL_RUNTIME_FILES; @@ -616,7 +616,6 @@ private boolean isFakeRuntime() { throw TKit.throwUnknownPlatformError(); } - Path runtimeDir = appRuntimeDirectory(); return !criticalRuntimeFiles.stream().map(runtimeDir::resolve).allMatch( Files::exists); } @@ -690,10 +689,8 @@ public JPackageCommand ignoreDefaultRuntime(boolean v) { } public JPackageCommand ignoreFakeRuntime() { - if (isFakeRuntime()) { - ignoreDefaultRuntime(true); - } - return this; + return ignoreDefaultRuntime(Optional.ofNullable(DEFAULT_RUNTIME_IMAGE) + .map(JPackageCommand::isFakeRuntime).orElse(false)); } public JPackageCommand ignoreDefaultVerbose(boolean v) { diff --git a/test/jdk/tools/jpackage/share/AppLauncherEnvTest.java b/test/jdk/tools/jpackage/share/AppLauncherEnvTest.java index a16ff9c18f96d..52016e6f4ab6a 100644 --- a/test/jdk/tools/jpackage/share/AppLauncherEnvTest.java +++ b/test/jdk/tools/jpackage/share/AppLauncherEnvTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,7 @@ import jdk.jpackage.test.JPackageCommand; import jdk.jpackage.test.Annotations.Test; import jdk.jpackage.test.Executor; +import static jdk.jpackage.test.HelloApp.configureEnvironment; import jdk.jpackage.test.TKit; /** @@ -53,6 +54,7 @@ public static void test() throws Exception { JPackageCommand cmd = JPackageCommand .helloAppImage(TEST_APP_JAVA + "*Hello") + .ignoreFakeRuntime() .addArguments("--java-options", "-D" + testAddDirProp + "=$APPDIR"); @@ -62,7 +64,7 @@ public static void test() throws Exception { final int attempts = 3; final int waitBetweenAttemptsSeconds = 5; - List output = new Executor() + List output = configureEnvironment(new Executor()) .saveOutput() .setExecutable(cmd.appLauncherPath().toAbsolutePath()) .addArguments("--print-env-var=" + envVarName) diff --git a/test/jdk/tools/jpackage/share/BasicTest.java b/test/jdk/tools/jpackage/share/BasicTest.java index c6e4e93015519..d479f4a35d084 100644 --- a/test/jdk/tools/jpackage/share/BasicTest.java +++ b/test/jdk/tools/jpackage/share/BasicTest.java @@ -27,6 +27,8 @@ import java.nio.file.Path; import java.util.List; import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; import java.util.Optional; import java.util.function.Function; import java.util.function.Predicate; @@ -41,7 +43,9 @@ import jdk.jpackage.test.JavaTool; import jdk.jpackage.test.Annotations.Test; import jdk.jpackage.test.Annotations.Parameter; +import jdk.jpackage.test.Annotations.ParameterSupplier; import jdk.jpackage.internal.util.function.ThrowingConsumer; +import jdk.tools.jlink.internal.LinkableRuntimeImage; import static jdk.jpackage.test.RunnablePackageTest.Action.CREATE_AND_UNPACK; /* @@ -55,6 +59,32 @@ */ public final class BasicTest { + + public static Collection addModulesParams() { + List params = new ArrayList<>(); + params.add(new Object[][] { new String[] { "--add-modules", "ALL-DEFAULT" } }); + params.add(new Object[][] { new String[] { "--add-modules", "java.desktop" } }); + params.add(new Object[][] { new String[] { "--add-modules", "java.desktop,jdk.jartool" } }); + params.add(new Object[][] { new String[] { "--add-modules", "java.desktop", "--add-modules", "jdk.jartool" } }); + if (isAllModulePathCapable()) { + final Path jmods = Path.of(System.getProperty("java.home"), "jmods"); + params.add(new Object[][] { new String[] { "--add-modules", "ALL-MODULE-PATH", + // Since JDK-8345259 ALL-MODULE-PATH requires --module-path arg + "--module-path", jmods.toString() } }); + } + return Collections.unmodifiableList(params); + } + + private static boolean isAllModulePathCapable() { + Path jmods = Path.of(System.getProperty("java.home"), "jmods"); + boolean noJmods = Files.notExists(jmods); + if (LinkableRuntimeImage.isLinkableRuntime() && noJmods) { + TKit.trace("ALL-MODULE-PATH test skipped for linkable run-time image"); + return false; + } + return true; + } + @Test public void testNoArgs() { List output = @@ -306,17 +336,12 @@ public void testNoOutputDir(boolean appImage) throws Throwable { } @Test - @Parameter("ALL-MODULE-PATH") - @Parameter("ALL-DEFAULT") - @Parameter("java.desktop") - @Parameter("java.desktop,jdk.jartool") - @Parameter({ "java.desktop", "jdk.jartool" }) - public void testAddModules(String... addModulesArg) { + @ParameterSupplier("addModulesParams") + public void testAddModules(String[] addModulesArg) { JPackageCommand cmd = JPackageCommand .helloAppImage("goodbye.jar:com.other/com.other.Hello") .ignoreDefaultRuntime(true); // because of --add-modules - Stream.of(addModulesArg).map(v -> Stream.of("--add-modules", v)).flatMap( - s -> s).forEachOrdered(cmd::addArgument); + Stream.of(addModulesArg).forEachOrdered(cmd::addArgument); cmd.executeAndAssertHelloAppImageCreated(); } diff --git a/test/jdk/tools/jpackage/share/JLinkOptionsTest.java b/test/jdk/tools/jpackage/share/JLinkOptionsTest.java index d4f7bca2ae42c..08d336ecf696e 100644 --- a/test/jdk/tools/jpackage/share/JLinkOptionsTest.java +++ b/test/jdk/tools/jpackage/share/JLinkOptionsTest.java @@ -58,24 +58,26 @@ public static Collection input() { "--jlink-options", "--strip-debug --no-man-pages --no-header-files", "--jlink-options", - "--bind-services", + "--verbose --bind-services --limit-modules java.smartcardio,jdk.crypto.cryptoki,java.desktop", }, - // with bind-services should have some services + // with limit-modules and bind-services should have them in the result new String[]{"java.smartcardio", "jdk.crypto.cryptoki"}, null, }, // bind-services {"Hello", new String[]{ - "--jlink-options", "--bind-services", + "--jlink-options", + "--bind-services --limit-modules jdk.jartool,jdk.unsupported,java.desktop", }, - // non modular should have everything + // non modular should have at least the module limits new String[]{"jdk.jartool", "jdk.unsupported"}, null, }, // jlink-options --bind-services {"com.other/com.other.Hello", new String[]{ - "--jlink-options", "--bind-services", + "--jlink-options", + "--bind-services --limit-modules java.smartcardio,jdk.crypto.cryptoki,java.desktop", }, // with bind-services should have some services new String[]{"java.smartcardio", "jdk.crypto.cryptoki"}, diff --git a/test/jdk/tools/jpackage/share/LicenseTest.java b/test/jdk/tools/jpackage/share/LicenseTest.java index b0eef94fa7c57..66cda39eec288 100644 --- a/test/jdk/tools/jpackage/share/LicenseTest.java +++ b/test/jdk/tools/jpackage/share/LicenseTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,6 +29,8 @@ import java.util.Arrays; import java.util.function.Function; import java.util.stream.Collectors; +import static jdk.internal.util.OperatingSystem.LINUX; +import jdk.jpackage.test.Annotations.Test; import jdk.jpackage.test.JPackageCommand; import jdk.jpackage.test.PackageType; import jdk.jpackage.test.PackageTest; @@ -67,6 +69,7 @@ * @key jpackagePlatformPackage * @build jdk.jpackage.test.* * @compile LicenseTest.java + * @requires (jpackage.test.SQETest != null) * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main * --jpt-run=LicenseTest.testCommon */ @@ -78,18 +81,14 @@ * @key jpackagePlatformPackage * @build jdk.jpackage.test.* * @compile LicenseTest.java - * @requires (os.family == "linux") * @requires (jpackage.test.SQETest == null) * @run main/othervm/timeout=1440 -Xmx512m jdk.jpackage.test.Main - * --jpt-run=LicenseTest.testCustomDebianCopyright - * --jpt-run=LicenseTest.testCustomDebianCopyrightSubst - * --jpt-run=LicenseTest.testLinuxLicenseInUsrTree - * --jpt-run=LicenseTest.testLinuxLicenseInUsrTree2 - * --jpt-run=LicenseTest.testLinuxLicenseInUsrTree3 - * --jpt-run=LicenseTest.testLinuxLicenseInUsrTree4 + * --jpt-run=LicenseTest */ public class LicenseTest { + + @Test public static void testCommon() { PackageTest test = new PackageTest().configureHelloApp() .addInitializer(cmd -> { @@ -102,26 +101,32 @@ public static void testCommon() { test.run(); } + @Test(ifOS = LINUX) public static void testLinuxLicenseInUsrTree() { testLinuxLicenseInUsrTree("/usr"); } + @Test(ifOS = LINUX) public static void testLinuxLicenseInUsrTree2() { testLinuxLicenseInUsrTree("/usr/local"); } + @Test(ifOS = LINUX) public static void testLinuxLicenseInUsrTree3() { testLinuxLicenseInUsrTree("/usr/foo"); } + @Test(ifOS = LINUX) public static void testLinuxLicenseInUsrTree4() { testLinuxLicenseInUsrTree("/usrbuz"); } + @Test(ifOS = LINUX) public static void testCustomDebianCopyright() { new CustomDebianCopyrightTest().run(); } + @Test(ifOS = LINUX) public static void testCustomDebianCopyrightSubst() { new CustomDebianCopyrightTest().withSubstitution(true).run(); } diff --git a/test/jdk/tools/jpackage/share/RuntimeImageSymbolicLinksTest.java b/test/jdk/tools/jpackage/share/RuntimeImageSymbolicLinksTest.java index db74e3456c4ee..75ad34807fdc0 100644 --- a/test/jdk/tools/jpackage/share/RuntimeImageSymbolicLinksTest.java +++ b/test/jdk/tools/jpackage/share/RuntimeImageSymbolicLinksTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,6 +23,7 @@ import java.nio.file.Files; import java.nio.file.Path; +import static jdk.internal.util.OperatingSystem.WINDOWS; import jdk.jpackage.test.ApplicationLayout; import jdk.jpackage.test.TKit; import jdk.jpackage.test.Annotations.Test; @@ -49,9 +50,8 @@ public class RuntimeImageSymbolicLinksTest { - @Test + @Test(ifNotOS = WINDOWS) public static void test() throws Exception { - final Path jmods = Path.of(System.getProperty("java.home"), "jmods"); final Path workDir = TKit.createTempDirectory("runtime").resolve("data"); final Path jlinkOutputDir = workDir.resolve("temp.runtime"); Files.createDirectories(jlinkOutputDir.getParent()); @@ -61,8 +61,7 @@ public static void test() throws Exception { .dumpOutput() .addArguments( "--output", jlinkOutputDir.toString(), - "--add-modules", "ALL-MODULE-PATH", - "--module-path", jmods.toString(), + "--add-modules", "java.desktop", "--strip-debug", "--no-header-files", "--no-man-pages", diff --git a/test/jdk/tools/jpackage/share/RuntimeImageTest.java b/test/jdk/tools/jpackage/share/RuntimeImageTest.java index 65e8c448d39a6..a80018603bf4e 100644 --- a/test/jdk/tools/jpackage/share/RuntimeImageTest.java +++ b/test/jdk/tools/jpackage/share/RuntimeImageTest.java @@ -44,7 +44,6 @@ public class RuntimeImageTest { @Test public static void test() throws Exception { - final Path jmods = Path.of(System.getProperty("java.home"), "jmods"); final Path workDir = TKit.createTempDirectory("runtime").resolve("data"); final Path jlinkOutputDir = workDir.resolve("temp.runtime"); Files.createDirectories(jlinkOutputDir.getParent()); @@ -54,8 +53,7 @@ public static void test() throws Exception { .dumpOutput() .addArguments( "--output", jlinkOutputDir.toString(), - "--add-modules", "ALL-MODULE-PATH", - "--module-path", jmods.toString(), + "--add-modules", "java.desktop", "--strip-debug", "--no-header-files", "--no-man-pages", diff --git a/test/jdk/tools/jpackage/share/RuntimePackageTest.java b/test/jdk/tools/jpackage/share/RuntimePackageTest.java index 73f1c5256543d..9c892bb9b1646 100644 --- a/test/jdk/tools/jpackage/share/RuntimePackageTest.java +++ b/test/jdk/tools/jpackage/share/RuntimePackageTest.java @@ -101,7 +101,6 @@ private static PackageTest init(Set types) { .forTypes(types) .addInitializer(cmd -> { final Path runtimeImageDir; - final Path jmods = Path.of(System.getProperty("java.home"), "jmods"); if (JPackageCommand.DEFAULT_RUNTIME_IMAGE != null) { runtimeImageDir = JPackageCommand.DEFAULT_RUNTIME_IMAGE; @@ -113,8 +112,7 @@ private static PackageTest init(Set types) { .dumpOutput() .addArguments( "--output", runtimeImageDir.toString(), - "--add-modules", "ALL-MODULE-PATH", - "--module-path", jmods.toString(), + "--add-modules", "java.desktop", "--strip-debug", "--no-header-files", "--no-man-pages") diff --git a/test/jdk/tools/jpackage/windows/WinChildProcessTest.java b/test/jdk/tools/jpackage/windows/WinChildProcessTest.java index 5565d3dc50352..5b0ff9b1f01b4 100644 --- a/test/jdk/tools/jpackage/windows/WinChildProcessTest.java +++ b/test/jdk/tools/jpackage/windows/WinChildProcessTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * 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 @@ import java.nio.file.Path; import jdk.jpackage.test.JPackageCommand; +import static jdk.jpackage.test.HelloApp.configureEnvironment; import jdk.jpackage.test.Annotations.Test; import jdk.jpackage.test.Executor; import jdk.jpackage.test.TKit; @@ -54,14 +55,15 @@ public static void test() { long childPid = 0; try { JPackageCommand cmd = JPackageCommand - .helloAppImage(TEST_APP_JAVA + "*Hello"); + .helloAppImage(TEST_APP_JAVA + "*Hello") + .ignoreFakeRuntime(); // Create the image of the third party application launcher cmd.executeAndAssertImageCreated(); // Start the third party application launcher and dump and save the // output of the application - List output = new Executor().saveOutput().dumpOutput() + List output = configureEnvironment(new Executor()).saveOutput().dumpOutput() .setExecutable(cmd.appLauncherPath().toAbsolutePath()) .execute(0).getOutput(); String pidStr = output.get(0); diff --git a/test/jdk/tools/jpackage/windows/WinInstallerUiTest.java b/test/jdk/tools/jpackage/windows/WinInstallerUiTest.java index c6489ab68cf4c..7dcf025a506ce 100644 --- a/test/jdk/tools/jpackage/windows/WinInstallerUiTest.java +++ b/test/jdk/tools/jpackage/windows/WinInstallerUiTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * 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,13 +122,13 @@ private void setPackageName(JPackageCommand cmd) { StringBuilder sb = new StringBuilder(cmd.name()); sb.append("With"); if (withDirChooser) { - sb.append("DirChooser"); + sb.append("Dc"); // DirChooser } if (withShortcutPrompt) { - sb.append("ShortcutPrompt"); + sb.append("Sp"); // ShortcutPrompt } if (withLicense) { - sb.append("License"); + sb.append("L"); // License } cmd.setArgumentValue("--name", sb.toString()); } diff --git a/test/jdk/tools/jpackage/windows/WinLongPathTest.java b/test/jdk/tools/jpackage/windows/WinLongPathTest.java index e9e5ef8ce038e..10e713f02a8cf 100644 --- a/test/jdk/tools/jpackage/windows/WinLongPathTest.java +++ b/test/jdk/tools/jpackage/windows/WinLongPathTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,7 @@ import jdk.jpackage.test.PackageTest; import jdk.jpackage.test.PackageType; import jdk.jpackage.test.Annotations.Test; +import jdk.jpackage.test.Executor; import jdk.jpackage.test.JPackageCommand; import jdk.jpackage.test.RunnablePackageTest.Action; import jdk.jpackage.test.TKit; @@ -39,8 +40,10 @@ * @bug 8289771 * @summary jpackage with long paths on windows * @library /test/jdk/tools/jpackage/helpers + * @library /test/lib * @key jpackagePlatformPackage * @build jdk.jpackage.test.* + * @build jtreg.SkippedException * @requires (os.family == "windows") * @compile WinLongPathTest.java * @run main/othervm/timeout=540 -Xmx512m jdk.jpackage.test.Main @@ -64,6 +67,8 @@ public static List input() { @Test public void test() throws IOException { + verifyDosNamesSupported(); + if (appImage) { var cmd = JPackageCommand.helloAppImage(); setOptionLongPath(cmd, optionName); @@ -84,4 +89,23 @@ private static void setOptionLongPath(JPackageCommand cmd, String option) throws Files.createDirectories(longPath); cmd.setArgumentValue(option, longPath); } + + private static void verifyDosNamesSupported() throws IOException { + // Pick the file's name long enough to make Windows shorten it. + final var probeDosNameFile = TKit.createTempFile(Path.of("probeDosName")); + + // The output should be a DOS variant of the `probeDosNameFile` path. + // The filename should differ if the volume owning `probeDosNameFile` file supports DOS names. + final var dosPath = new Executor() + .addArguments("/c", String.format("for %%P in (\"%s\") do @echo %%~sP", probeDosNameFile)) + .setExecutable("cmd") + .dumpOutput() + .executeAndGetFirstLineOfOutput(); + + if (Path.of(dosPath).getFileName().equals(probeDosNameFile.getFileName())) { + TKit.throwSkippedException(String.format("The volume %s owning the test work directory doesn't support DOS paths", + probeDosNameFile.toAbsolutePath().getRoot())); + } + } + } diff --git a/test/jdk/tools/jpackage/windows/WinResourceTest.java b/test/jdk/tools/jpackage/windows/WinResourceTest.java index 72e805d0a48b5..db897e1aa694d 100644 --- a/test/jdk/tools/jpackage/windows/WinResourceTest.java +++ b/test/jdk/tools/jpackage/windows/WinResourceTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * 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,8 @@ import jdk.jpackage.test.Annotations.Test; import jdk.jpackage.test.Annotations.Parameters; import java.util.List; +import static jdk.jpackage.test.WindowsHelper.WixType.WIX3; +import static jdk.jpackage.test.WindowsHelper.getWixTypeFromVerboseJPackageOutput; /** * Test --resource-dir option. The test should set --resource-dir to point to @@ -83,11 +85,18 @@ public void test() throws IOException { .addBundleVerifier((cmd, result) -> { // Assert jpackage picked custom main.wxs and failed as expected by // examining its output + final String expectedWixErrorMsg; + if (getWixTypeFromVerboseJPackageOutput(result) == WIX3) { + expectedWixErrorMsg = "error CNDL0104 : Not a valid source file"; + } else { + expectedWixErrorMsg = "error WIX0104: Not a valid source file"; + } + TKit.assertTextStream(expectedLogMessage) .predicate(String::startsWith) .apply(JPackageCommand.stripTimestamps( result.getOutput().stream())); - TKit.assertTextStream("error CNDL0104 : Not a valid source file") + TKit.assertTextStream(expectedWixErrorMsg) .apply(result.getOutput().stream()); }) .setExpectedExitCode(1) diff --git a/test/jdk/tools/launcher/SourceMode.java b/test/jdk/tools/launcher/SourceMode.java index 20e8822856362..23f0b12e9b491 100644 --- a/test/jdk/tools/launcher/SourceMode.java +++ b/test/jdk/tools/launcher/SourceMode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,12 @@ * @bug 8192920 8204588 8210275 8286571 * @summary Test source mode * @modules jdk.compiler jdk.jlink - * @run main SourceMode + * @comment Test is being run in othervm to support JEP 493 enabled + * JDKs which don't allow patched modules. Note that jtreg patches + * module java.base to add java.lang.JTRegModuleHelper. If then a + * jlink run is attempted in-process - using the ToolProvider API - + * on a JEP 493 enabled JDK, the test fails. + * @run main/othervm SourceMode */ diff --git a/test/langtools/tools/javac/6304921/T6304921.java b/test/langtools/tools/javac/6304921/T6304921.java index 51967b6903374..feaf568ee90a9 100644 --- a/test/langtools/tools/javac/6304921/T6304921.java +++ b/test/langtools/tools/javac/6304921/T6304921.java @@ -1,7 +1,7 @@ /* * @test (important: no SCCS keywords to affect offsets in golden file.) /nodynamiccopyright/ * @bug 6304921 - * @compile/fail/ref=T6304921.out -XDcompilePolicy=bytodo -XDrawDiagnostics -Xjcov -Xlint:all,-path -Werror T6304921.java + * @compile/fail/ref=T6304921.out -XDcompilePolicy=bytodo -XDrawDiagnostics -Xjcov -Xlint:all -Werror T6304921.java */ import java.util.ArrayList; diff --git a/test/langtools/tools/javac/6734819/T6734819a.out b/test/langtools/tools/javac/6734819/T6734819a.out index a3ccb07e67e0a..c29dbde637b29 100644 --- a/test/langtools/tools/javac/6734819/T6734819a.out +++ b/test/langtools/tools/javac/6734819/T6734819a.out @@ -1,9 +1,12 @@ [attribute Y] [flow Y] +[warn Y] [attribute W] [flow W] +[warn W] [attribute Z] [flow Z] +[warn Z] [desugar Z] [desugar W] [desugar Y] diff --git a/test/langtools/tools/javac/6734819/T6734819b.out b/test/langtools/tools/javac/6734819/T6734819b.out index 0c9629006df19..61c1f31f179b6 100644 --- a/test/langtools/tools/javac/6734819/T6734819b.out +++ b/test/langtools/tools/javac/6734819/T6734819b.out @@ -1,7 +1,9 @@ [attribute A] [flow A] +[warn A] [attribute B] [flow B] +[warn B] [desugar B] [desugar A] [generate code A] diff --git a/test/langtools/tools/javac/6734819/T6734819c.out b/test/langtools/tools/javac/6734819/T6734819c.out index 1d4cff3212fd8..6ae56176acba4 100644 --- a/test/langtools/tools/javac/6734819/T6734819c.out +++ b/test/langtools/tools/javac/6734819/T6734819c.out @@ -1,7 +1,9 @@ [attribute Y] [flow Y] +[warn Y] [attribute W] [flow W] +[warn W] [attribute Z] [flow Z] T6734819c.java:15:11: compiler.err.unreachable.stmt diff --git a/test/langtools/tools/javac/ImportModule.java b/test/langtools/tools/javac/ImportModule.java index ac00ea823f134..a53bc92f1b03f 100644 --- a/test/langtools/tools/javac/ImportModule.java +++ b/test/langtools/tools/javac/ImportModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /** * @test - * @bug 8328481 8332236 8332890 8344647 + * @bug 8328481 8332236 8332890 8344647 8347646 * @summary Check behavior of module imports. * @library /tools/lib * @modules java.logging @@ -39,6 +39,7 @@ import com.sun.source.util.TaskEvent; import com.sun.source.util.TaskEvent.Kind; import com.sun.source.util.TaskListener; +import java.lang.classfile.ClassFile; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -966,4 +967,84 @@ public class Object {} .run(Task.Expect.SUCCESS) .writeAll(); } + + @Test //JDK-8347646 + public void testRequiresTransitiveJavaBase(Path base) throws Exception { + Path current = base.resolve("."); + Path src = current.resolve("src"); + Path classes = current.resolve("classes"); + Path ma = src.resolve("ma"); + Path maClasses = classes.resolve("ma"); + tb.writeJavaFiles(ma, + """ + module ma { + requires transitive java.base; + } + """); + Path test = src.resolve("test"); + tb.writeJavaFiles(test, + """ + module test { + requires ma; + } + """, + """ + package test; + import module ma; + public class Test { + public static void main(String... args) { + System.out.println(List.of("Hello")); + } + } + """); + + Files.createDirectories(maClasses); + + List actualErrors = new JavacTask(tb) + .options("-XDrawDiagnostics") + .outdir(maClasses) + .files(tb.findJavaFiles(ma)) + .run(Task.Expect.FAIL) + .writeAll() + .getOutputLines(Task.OutputKind.DIRECT); + + List expectedErrors = List.of( + "module-info.java:2:4: compiler.err.preview.feature.disabled.plural: (compiler.misc.feature.java.base.transitive)", + "1 error" + ); + + if (!Objects.equals(expectedErrors, actualErrors)) { + throw new AssertionError("Incorrect Output, expected: " + expectedErrors + + ", actual: " + actualErrors); + + } + + new JavacTask(tb) + .options("-XDrawDiagnostics", + "--source", "9") + .outdir(maClasses) + .files(tb.findJavaFiles(ma)) + .run() + .writeAll(); + + Path maModuleInfo = maClasses.resolve("module-info.class"); + + if (ClassFile.of().parse(maModuleInfo).minorVersion() == ClassFile.PREVIEW_MINOR_VERSION) { + throw new AssertionError("wrong minor version"); + } + + new JavacTask(tb) + .options("-XDrawDiagnostics", + "--enable-preview", "--release", SOURCE_VERSION) + .outdir(maClasses) + .files(tb.findJavaFiles(ma)) + .run() + .writeAll(); + + Path maModuleInfo2 = maClasses.resolve("module-info.class"); + + if (ClassFile.of().parse(maModuleInfo2).minorVersion() != ClassFile.PREVIEW_MINOR_VERSION) { + throw new AssertionError("wrong minor version"); + } + } } diff --git a/test/langtools/tools/javac/T5048776.java b/test/langtools/tools/javac/T5048776.java index ff3305a9b346c..30795020c5a9c 100644 --- a/test/langtools/tools/javac/T5048776.java +++ b/test/langtools/tools/javac/T5048776.java @@ -1,8 +1,8 @@ /* * @test /nodynamiccopyright/ * @bug 5048776 - * @compile/ref=T5048776a.out -XDrawDiagnostics T5048776.java - * @compile/ref=T5048776b.out -XDrawDiagnostics -Xlint:all,-path T5048776.java + * @compile/ref=T5048776a.out -XDrawDiagnostics T5048776.java + * @compile/ref=T5048776b.out -XDrawDiagnostics -Xlint:all T5048776.java */ class A1 { void foo(Object[] args) { } diff --git a/test/langtools/tools/javac/T6245591.java b/test/langtools/tools/javac/T6245591.java index 7e51e37eab880..8b190dfcdc14e 100644 --- a/test/langtools/tools/javac/T6245591.java +++ b/test/langtools/tools/javac/T6245591.java @@ -1,7 +1,7 @@ /* * @test /nodynamiccopyright/ * @bug 6245591 - * @compile/ref=T6245591.out -XDrawDiagnostics -Xlint:all,-path T6245591.java + * @compile/ref=T6245591.out -XDrawDiagnostics -Xlint:all T6245591.java */ enum Season { /** @deprecated */ diff --git a/test/langtools/tools/javac/T6247324.java b/test/langtools/tools/javac/T6247324.java index ae971350c4760..264827d6dc00e 100644 --- a/test/langtools/tools/javac/T6247324.java +++ b/test/langtools/tools/javac/T6247324.java @@ -1,7 +1,7 @@ /* * @test /nodynamiccopyright/ * @bug 6247324 - * @compile/fail/ref=T6247324.out -XDrawDiagnostics -Xlint -Xlint:-path T6247324.java + * @compile/fail/ref=T6247324.out -XDrawDiagnostics -Xlint T6247324.java */ class Pair { private X x; diff --git a/test/langtools/tools/javac/diags/examples/ModifierNotAllowed/module-info.java b/test/langtools/tools/javac/diags/examples/ModifierNotAllowed/module-info.java index 8eb25a864d7d2..02cb11f5ac257 100644 --- a/test/langtools/tools/javac/diags/examples/ModifierNotAllowed/module-info.java +++ b/test/langtools/tools/javac/diags/examples/ModifierNotAllowed/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * 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. */ -// key: compiler.err.feature.not.supported.in.source.plural +// key: compiler.err.preview.feature.disabled.plural // key: compiler.misc.feature.java.base.transitive module m { diff --git a/test/langtools/tools/javac/implicitCompile/SkipAttrFlowGenForImplicits.out b/test/langtools/tools/javac/implicitCompile/SkipAttrFlowGenForImplicits.out index 11cc81304f034..e240208da72c1 100644 --- a/test/langtools/tools/javac/implicitCompile/SkipAttrFlowGenForImplicits.out +++ b/test/langtools/tools/javac/implicitCompile/SkipAttrFlowGenForImplicits.out @@ -1,4 +1,5 @@ [attribute Explicit] [flow Explicit] +[warn Explicit] [desugar Explicit] [generate code Explicit] diff --git a/test/langtools/tools/javac/launcher/ModuleSourceLauncherTests.java b/test/langtools/tools/javac/launcher/ModuleSourceLauncherTests.java index 42bed1d1e4765..44ae29dccaab9 100644 --- a/test/langtools/tools/javac/launcher/ModuleSourceLauncherTests.java +++ b/test/langtools/tools/javac/launcher/ModuleSourceLauncherTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 8304400 8332226 + * @bug 8304400 8332226 8346778 * @summary Test source launcher running Java programs contained in one module * @modules jdk.compiler/com.sun.tools.javac.launcher * @run junit ModuleSourceLauncherTests @@ -192,6 +192,8 @@ public record Foo() {} class Prog1 { public static void main(String... args) { System.out.println(new foo.Foo()); + System.out.println("bar=" + Prog1.class.getModule().isNativeAccessEnabled()); + System.out.println("foo=" + foo.Foo.class.getModule().isNativeAccessEnabled()); } } """); @@ -199,6 +201,7 @@ public static void main(String... args) { var command = List.of( Path.of(System.getProperty("java.home"), "bin", "java").toString(), "-p", ".", + "--enable-native-access", "foo,bar,baz,ALL-UNNAMED", "bar/bar/Prog1.java"); var redirectedOut = base.resolve("out.redirected"); var redirectedErr = base.resolve("err.redirected"); @@ -212,12 +215,17 @@ public static void main(String... args) { var err = Files.readAllLines(redirectedErr); assertAll( - () -> assertEquals(0, code), + () -> assertEquals(0, code, out.toString()), () -> assertLinesMatch( """ Foo[] + bar=true + foo=true """.lines(), out.stream()), - () -> assertTrue(err.isEmpty()) + () -> assertLinesMatch( + """ + WARNING: Unknown module: baz specified to --enable-native-access + """.lines(), err.stream()) ); } diff --git a/test/langtools/tools/javac/modules/JavaBaseTest.java b/test/langtools/tools/javac/modules/JavaBaseTest.java index 935ddfa1d437f..a888c430f5369 100644 --- a/test/langtools/tools/javac/modules/JavaBaseTest.java +++ b/test/langtools/tools/javac/modules/JavaBaseTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -166,7 +166,7 @@ void testSource(Path base, List mods, String target) throws Exception { for (String mod : mods) { String key = mod.equals("static") ? "compiler.err.mod.not.allowed.here: " + mod - : "compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.java.base.transitive)"; + : "compiler.err.preview.feature.disabled.plural: (compiler.misc.feature.java.base.transitive)"; String message = "module-info.java:1:12: " + key; if (log.contains(message)) { foundErrorMessage = true; diff --git a/test/langtools/tools/javac/options/JavadocIgnoreSymbolFile.java b/test/langtools/tools/javac/options/JavadocIgnoreSymbolFile.java new file mode 100644 index 0000000000000..24c24bc3eeee8 --- /dev/null +++ b/test/langtools/tools/javac/options/JavadocIgnoreSymbolFile.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * 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 8348038 + * @summary Verify use of "-XDignore.symbol.file=true" doesn't cause assertion failure + * @modules jdk.javadoc/jdk.javadoc.internal.tool + */ + +import java.io.File; +import java.io.PrintWriter; +import java.io.StringWriter; + +public class JavadocIgnoreSymbolFile { + + public static void main(String[] args) { + String[] javadocArgs = new String[] { + "-XDignore.symbol.file=true" + }; + StringWriter buf = new StringWriter(); + try (PrintWriter pw = new PrintWriter(buf)) { + jdk.javadoc.internal.tool.Main.execute(javadocArgs, pw); + } + String expected = "error: No modules, packages or classes specified. 1 error"; + String actual = buf.toString().trim().replaceAll("\\s+", " "); + if (!actual.equals(expected)) + throw new AssertionError("unexpected output:\n" + actual); + } +} diff --git a/test/langtools/tools/javac/options/OptionsOrderingTest.java b/test/langtools/tools/javac/options/OptionsOrderingTest.java new file mode 100644 index 0000000000000..c1ba021525cf8 --- /dev/null +++ b/test/langtools/tools/javac/options/OptionsOrderingTest.java @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * 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 8347474 + * @summary Verify -XDrawDiagnostics flag is picked up by JavacMessages singleton + * @library /tools/lib + * @modules + * jdk.compiler/com.sun.tools.javac.api + * jdk.compiler/com.sun.tools.javac.file + * jdk.compiler/com.sun.tools.javac.main + * jdk.compiler/com.sun.tools.javac.util:+open + */ + +import java.io.PrintWriter; +import java.io.Writer; +import java.lang.reflect.Field; +import java.net.URI; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Objects; + +import com.sun.tools.javac.file.JavacFileManager; +import com.sun.tools.javac.main.Main; +import com.sun.tools.javac.util.Context; +import com.sun.tools.javac.util.JavacMessages; +import com.sun.tools.javac.util.RawDiagnosticFormatter; + +import toolbox.JavacTask; +import toolbox.TestRunner; +import toolbox.ToolBox; + +public class OptionsOrderingTest extends TestRunner { + + protected final ToolBox tb; + + public OptionsOrderingTest() { + super(System.err); + tb = new ToolBox(); + } + + public void testJavacMessagesDiagFormatter() throws Exception { + + // Write source file + Path dir = Paths.get(getClass().getSimpleName()); + tb.writeJavaFiles(dir, "class Test { }"); + + // Run the compiler where we supply the Context + Context context = new Context(); + JavacFileManager.preRegister(context); + Main compiler = new Main("javac", new PrintWriter(Writer.nullWriter())); + String[] args = new String[] { + "-XDrawDiagnostics", + tb.findJavaFiles(dir)[0].toString() + }; + Main.Result result = compiler.compile(args, context); + + // Verify field JavacMessages.diagFormatter is a RawDiagnosticFormatter + JavacMessages messages = JavacMessages.instance(context); + Field diagFormatterField = messages.getClass().getDeclaredField("diagFormatter"); + diagFormatterField.setAccessible(true); + Class diagFormatterClass = diagFormatterField.get(messages).getClass(); + if (!Objects.equals(diagFormatterClass, RawDiagnosticFormatter.class)) { + throw new AssertionError(String.format( + "diagFormatter: expected %s but found %s", + RawDiagnosticFormatter.class, diagFormatterClass)); + } + } + + public static void main(String... args) throws Exception { + new OptionsOrderingTest().testJavacMessagesDiagFormatter(); + } +} diff --git a/test/langtools/tools/javac/policy/test1/byfile.ABD.out b/test/langtools/tools/javac/policy/test1/byfile.ABD.out index dfa86a4413294..0710de49c867d 100644 --- a/test/langtools/tools/javac/policy/test1/byfile.ABD.out +++ b/test/langtools/tools/javac/policy/test1/byfile.ABD.out @@ -4,6 +4,9 @@ [flow A] [flow A1] [flow A2] +[warn A] +[warn A1] +[warn A2] [desugar A] [desugar A1] [desugar A2] diff --git a/test/langtools/tools/javac/policy/test1/byfile.ACD.out b/test/langtools/tools/javac/policy/test1/byfile.ACD.out index 66534ce00c5f8..70cc4856557c7 100644 --- a/test/langtools/tools/javac/policy/test1/byfile.ACD.out +++ b/test/langtools/tools/javac/policy/test1/byfile.ACD.out @@ -4,6 +4,9 @@ [flow A] [flow A1] [flow A2] +[warn A] +[warn A1] +[warn A2] [desugar A] [desugar A1] [desugar A2] diff --git a/test/langtools/tools/javac/policy/test1/bytodo.ABD.out b/test/langtools/tools/javac/policy/test1/bytodo.ABD.out index 5b3b8faace742..3296547f0ffec 100644 --- a/test/langtools/tools/javac/policy/test1/bytodo.ABD.out +++ b/test/langtools/tools/javac/policy/test1/bytodo.ABD.out @@ -1,17 +1,21 @@ [attribute A] [flow A] +[warn A] [desugar A] [generate code A] [attribute A1] [flow A1] +[warn A1] [desugar A1] [generate code A1] [attribute A2] [flow A2] +[warn A2] [desugar A2] [generate code A2] [attribute B] [flow B] +[warn B] [desugar B] [generate code B] [attribute B1] diff --git a/test/langtools/tools/javac/policy/test1/bytodo.ACD.out b/test/langtools/tools/javac/policy/test1/bytodo.ACD.out index a29c0880de96c..767a9912a05e8 100644 --- a/test/langtools/tools/javac/policy/test1/bytodo.ACD.out +++ b/test/langtools/tools/javac/policy/test1/bytodo.ACD.out @@ -1,17 +1,21 @@ [attribute A] [flow A] +[warn A] [desugar A] [generate code A] [attribute A1] [flow A1] +[warn A1] [desugar A1] [generate code A1] [attribute A2] [flow A2] +[warn A2] [desugar A2] [generate code A2] [attribute C] [flow C] +[warn C] [desugar C] [generate code C] [attribute C1] diff --git a/test/langtools/tools/javac/policy/test2/byfile.AB.out b/test/langtools/tools/javac/policy/test2/byfile.AB.out index 6d152c873aabe..63a51108f3646 100644 --- a/test/langtools/tools/javac/policy/test2/byfile.AB.out +++ b/test/langtools/tools/javac/policy/test2/byfile.AB.out @@ -1,7 +1,9 @@ [attribute A] [flow A] +[warn A] [attribute B] [flow B] +[warn B] [desugar B] [desugar A] [generate code A.A1] diff --git a/test/langtools/tools/javac/policy/test2/byfile.BA.out b/test/langtools/tools/javac/policy/test2/byfile.BA.out index 565ad13861529..3c3567043a0f1 100644 --- a/test/langtools/tools/javac/policy/test2/byfile.BA.out +++ b/test/langtools/tools/javac/policy/test2/byfile.BA.out @@ -1,10 +1,12 @@ [attribute B] [flow B] +[warn B] [desugar B] [generate code B.Inner] [generate code B] [attribute A] [flow A] +[warn A] [desugar A] [generate code A.A1] [generate code A.A2] diff --git a/test/langtools/tools/javac/policy/test2/bytodo.AB.out b/test/langtools/tools/javac/policy/test2/bytodo.AB.out index 6d152c873aabe..63a51108f3646 100644 --- a/test/langtools/tools/javac/policy/test2/bytodo.AB.out +++ b/test/langtools/tools/javac/policy/test2/bytodo.AB.out @@ -1,7 +1,9 @@ [attribute A] [flow A] +[warn A] [attribute B] [flow B] +[warn B] [desugar B] [desugar A] [generate code A.A1] diff --git a/test/langtools/tools/javac/policy/test2/bytodo.BA.out b/test/langtools/tools/javac/policy/test2/bytodo.BA.out index 565ad13861529..3c3567043a0f1 100644 --- a/test/langtools/tools/javac/policy/test2/bytodo.BA.out +++ b/test/langtools/tools/javac/policy/test2/bytodo.BA.out @@ -1,10 +1,12 @@ [attribute B] [flow B] +[warn B] [desugar B] [generate code B.Inner] [generate code B] [attribute A] [flow A] +[warn A] [desugar A] [generate code A.A1] [generate code A.A2] diff --git a/test/langtools/tools/javac/processing/TestWarnErrorCount.java b/test/langtools/tools/javac/processing/TestWarnErrorCount.java index 1ea2b803609c4..957bafdab7f17 100644 --- a/test/langtools/tools/javac/processing/TestWarnErrorCount.java +++ b/test/langtools/tools/javac/processing/TestWarnErrorCount.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -161,7 +161,7 @@ void test(ErrorKind ek, WarnKind mwk, WarnKind jwk) { "-d", testDir.getPath(), "-processor", myName, // "-XprintRounds", - "-Xlint:all,-path", + "-Xlint:all", "-AerrKind=" + ek, "-AmsgrWarnKind=" + mwk, "-AjavaWarnKind=" + jwk)); diff --git a/test/langtools/tools/javac/recovery/AttrRecovery.java b/test/langtools/tools/javac/recovery/AttrRecovery.java index db679915e08b2..c5d393a23b323 100644 --- a/test/langtools/tools/javac/recovery/AttrRecovery.java +++ b/test/langtools/tools/javac/recovery/AttrRecovery.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * 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 @@ public void overridable(C c) {} Path curPath = Path.of("."); List actual = new JavacTask(tb) .options("-XDrawDiagnostics", "-XDdev", - "-XDshould-stop.at=FLOW", "-Xlint:this-escape") + "-XDshould-stop.at=WARN", "-Xlint:this-escape") .sources(code) .outdir(curPath) .run(Expect.FAIL) diff --git a/test/langtools/tools/javac/sealed/SealedCompilationTests.java b/test/langtools/tools/javac/sealed/SealedCompilationTests.java index dee64fd0865aa..7cf63f5b2d5fd 100644 --- a/test/langtools/tools/javac/sealed/SealedCompilationTests.java +++ b/test/langtools/tools/javac/sealed/SealedCompilationTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * SealedCompilationTests * * @test - * @bug 8246353 8273257 8294550 + * @bug 8246353 8273257 8294550 8347562 * @summary Negative compilation tests, and positive compilation (smoke) tests for sealed classes * @library /lib/combo /tools/lib * @modules @@ -41,6 +41,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.Collections; import java.util.List; import java.util.Set; import java.util.stream.Collectors; @@ -61,6 +62,7 @@ import toolbox.Task; import toolbox.Task.OutputKind; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.fail; class SealedCompilationTests extends CompilationTestCase { @@ -560,6 +562,13 @@ sealed class C permits T {} """)) { assertFail("compiler.err.invalid.permits.clause", s); } + assertFail("compiler.err.illegal.forward.ref", _ -> { + assertEquals(Collections.nCopies(2, "compiler.err.illegal.forward.ref"), diags.keys()); + }, + """ + sealed class Permits permits X, Y {} + """ + ); } @Test diff --git a/test/langtools/tools/javac/warnings/DivZero.java b/test/langtools/tools/javac/warnings/DivZero.java index 2a965f3fbaf2c..3df7db166d7a4 100644 --- a/test/langtools/tools/javac/warnings/DivZero.java +++ b/test/langtools/tools/javac/warnings/DivZero.java @@ -3,7 +3,7 @@ * @bug 4759494 4986256 * @compile/ref=DivZero.noLint.out -XDrawDiagnostics DivZero.java * @compile/ref=DivZero.lint.out -Xlint:divzero -XDrawDiagnostics DivZero.java - * @compile/ref=DivZero.lint.out -Xlint:all,-path -XDrawDiagnostics DivZero.java + * @compile/ref=DivZero.lint.out -Xlint:all -XDrawDiagnostics DivZero.java */ class DivZero diff --git a/test/langtools/tools/javac/warnings/FallThrough.java b/test/langtools/tools/javac/warnings/FallThrough.java index 6e5a5eb8bc914..6185c3e0df92f 100644 --- a/test/langtools/tools/javac/warnings/FallThrough.java +++ b/test/langtools/tools/javac/warnings/FallThrough.java @@ -2,7 +2,7 @@ * @test /nodynamiccopyright/ * @bug 4986256 * @compile/ref=FallThrough.noLint.out -XDrawDiagnostics FallThrough.java - * @compile/ref=FallThrough.lintAll.out -Xlint:all,-path -XDrawDiagnostics FallThrough.java + * @compile/ref=FallThrough.lintAll.out -Xlint:all -XDrawDiagnostics FallThrough.java * @compile/ref=FallThrough.lintFallThrough.out -Xlint:fallthrough -XDrawDiagnostics FallThrough.java */ diff --git a/test/langtools/tools/javac/warnings/Unchecked.java b/test/langtools/tools/javac/warnings/Unchecked.java index e64fd760a0764..7cd8cbfdfd049 100644 --- a/test/langtools/tools/javac/warnings/Unchecked.java +++ b/test/langtools/tools/javac/warnings/Unchecked.java @@ -3,7 +3,7 @@ * @bug 4986256 * @compile/ref=Unchecked.noLint.out -XDrawDiagnostics Unchecked.java * @compile/ref=Unchecked.lintUnchecked.out -Xlint:unchecked -XDrawDiagnostics Unchecked.java - * @compile/ref=Unchecked.lintAll.out -Xlint:all,-path -XDrawDiagnostics Unchecked.java + * @compile/ref=Unchecked.lintAll.out -Xlint:all -XDrawDiagnostics Unchecked.java */ import java.util.ArrayList; diff --git a/test/lib/jdk/test/lib/Asserts.java b/test/lib/jdk/test/lib/Asserts.java index 1f23a64f811ac..e7228ace7be16 100644 --- a/test/lib/jdk/test/lib/Asserts.java +++ b/test/lib/jdk/test/lib/Asserts.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -638,7 +638,7 @@ public static T assertThrows(Class expected, TestMethod testMethod.execute(); } catch (Throwable exc) { if (expected.isInstance(exc)) { - return (T) exc; + return expected.cast(exc); } else { fail(Objects.toString(msg, "An unexpected exception was thrown.") + " Expected " + expected.getName(), exc); diff --git a/test/lib/jdk/test/lib/NetworkConfiguration.java b/test/lib/jdk/test/lib/NetworkConfiguration.java index 3532bb1a3ee20..a9e6821b2e698 100644 --- a/test/lib/jdk/test/lib/NetworkConfiguration.java +++ b/test/lib/jdk/test/lib/NetworkConfiguration.java @@ -39,8 +39,6 @@ import java.util.function.Predicate; import java.util.stream.Collectors; import java.util.stream.Stream; -import java.security.AccessController; -import java.security.PrivilegedAction; import static java.net.NetworkInterface.getNetworkInterfaces; import static java.util.Collections.list; @@ -111,7 +109,7 @@ private static boolean isIPv6LinkLocal(InetAddress a) { * was looked up. * * @param ni1 A network interface, may be {@code null} - * @param ni2 An other network interface, may be {@code null} + * @param ni2 Another network interface, may be {@code null} * @return {@code true} if the two network interfaces have the same name * and index, {@code false} otherwise. */ @@ -447,19 +445,15 @@ public static String interfaceInformation(NetworkInterface nif) { } /** Prints all the system interface information to the give stream. */ - @SuppressWarnings("removal") public static void printSystemConfiguration(PrintStream out) { - PrivilegedAction pa = () -> { try { out.println("*** all system network interface configuration ***"); for (NetworkInterface nif : list(getNetworkInterfaces())) { out.print(interfaceInformation(nif)); } out.println("*** end ***"); - return null; } catch (IOException e) { throw new UncheckedIOException(e); - }}; - AccessController.doPrivileged(pa); + } } } diff --git a/test/lib/jdk/test/lib/Platform.java b/test/lib/jdk/test/lib/Platform.java index 4a4b164cd17ee..682d9c906858b 100644 --- a/test/lib/jdk/test/lib/Platform.java +++ b/test/lib/jdk/test/lib/Platform.java @@ -30,33 +30,25 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.security.AccessController; -import java.security.PrivilegedAction; import java.util.concurrent.TimeUnit; import java.util.regex.Matcher; import java.util.regex.Pattern; import static java.util.Locale.ROOT; public class Platform { - public static final String vmName = privilegedGetProperty("java.vm.name"); - public static final String vmInfo = privilegedGetProperty("java.vm.info"); - private static final String osVersion = privilegedGetProperty("os.version"); + public static final String vmName = System.getProperty("java.vm.name"); + public static final String vmInfo = System.getProperty("java.vm.info"); + private static final String osVersion = System.getProperty("os.version"); private static int osVersionMajor = -1; private static int osVersionMinor = -1; - private static final String osName = privilegedGetProperty("os.name"); - private static final String dataModel = privilegedGetProperty("sun.arch.data.model"); - private static final String vmVersion = privilegedGetProperty("java.vm.version"); - private static final String jdkDebug = privilegedGetProperty("jdk.debug"); - private static final String osArch = privilegedGetProperty("os.arch"); - private static final String userName = privilegedGetProperty("user.name"); - private static final String compiler = privilegedGetProperty("sun.management.compiler"); - private static final String testJdk = privilegedGetProperty("test.jdk"); - - @SuppressWarnings("removal") - private static String privilegedGetProperty(String key) { - return AccessController.doPrivileged(( - PrivilegedAction) () -> System.getProperty(key)); - } + private static final String osName = System.getProperty("os.name"); + private static final String dataModel = System.getProperty("sun.arch.data.model"); + private static final String vmVersion = System.getProperty("java.vm.version"); + private static final String jdkDebug = System.getProperty("jdk.debug"); + private static final String osArch = System.getProperty("os.arch"); + private static final String userName = System.getProperty("user.name"); + private static final String compiler = System.getProperty("sun.management.compiler"); + private static final String testJdk = System.getProperty("test.jdk"); public static boolean isClient() { return vmName.endsWith(" Client VM"); diff --git a/test/lib/jdk/test/lib/SA/SATestUtils.java b/test/lib/jdk/test/lib/SA/SATestUtils.java index 82629c1a49d8b..cdb0caf84d4a9 100644 --- a/test/lib/jdk/test/lib/SA/SATestUtils.java +++ b/test/lib/jdk/test/lib/SA/SATestUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, 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 @@ -29,9 +29,6 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; -import java.security.AccessController; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; import java.util.ArrayList; import java.util.Arrays; import java.util.concurrent.TimeUnit; @@ -203,23 +200,16 @@ public static void addPrivilegesIfNeeded(ProcessBuilder pb) { * if we are root, so return true. Then return false for an expected denial * if "ptrace_scope" is 1, and true otherwise. */ - @SuppressWarnings("removal") private static boolean canPtraceAttachLinux() throws IOException { // SELinux deny_ptrace: var deny_ptrace = Paths.get("/sys/fs/selinux/booleans/deny_ptrace"); if (Files.exists(deny_ptrace)) { - try { - var bb = AccessController.doPrivileged( - (PrivilegedExceptionAction) () -> Files.readAllBytes(deny_ptrace)); - if (bb.length == 0) { - throw new Error("deny_ptrace is empty"); - } - if (bb[0] != '0') { - return false; - } - } catch (PrivilegedActionException e) { - IOException t = (IOException) e.getException(); - throw t; + var bb = Files.readAllBytes(deny_ptrace); + if (bb.length == 0) { + throw new Error("deny_ptrace is empty"); + } + if (bb[0] != '0') { + return false; } } @@ -230,23 +220,17 @@ private static boolean canPtraceAttachLinux() throws IOException { // 3 - no attach: no processes may use ptrace with PTRACE_ATTACH var ptrace_scope = Paths.get("/proc/sys/kernel/yama/ptrace_scope"); if (Files.exists(ptrace_scope)) { - try { - var bb = AccessController.doPrivileged( - (PrivilegedExceptionAction) () -> Files.readAllBytes(ptrace_scope)); - if (bb.length == 0) { - throw new Error("ptrace_scope is empty"); - } - byte yama_scope = bb[0]; - if (yama_scope == '3') { - return false; - } + var bb = Files.readAllBytes(ptrace_scope); + if (bb.length == 0) { + throw new Error("ptrace_scope is empty"); + } + byte yama_scope = bb[0]; + if (yama_scope == '3') { + return false; + } - if (!Platform.isRoot() && yama_scope != '0') { - return false; - } - } catch (PrivilegedActionException e) { - IOException t = (IOException) e.getException(); - throw t; + if (!Platform.isRoot() && yama_scope != '0') { + return false; } } // Otherwise expect to be permitted: diff --git a/test/lib/jdk/test/lib/apps/LingeredApp.java b/test/lib/jdk/test/lib/apps/LingeredApp.java index 73904b81848a3..13008e68c5477 100644 --- a/test/lib/jdk/test/lib/apps/LingeredApp.java +++ b/test/lib/jdk/test/lib/apps/LingeredApp.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -429,7 +429,7 @@ public void stopApp() throws IOException { } } - /** + /* * High level interface for test writers */ @@ -599,6 +599,7 @@ protected static boolean isReady() { * This part is the application itself. First arg is optional "forceCrash". * Following arg is the lock file name. */ + @SuppressWarnings("restricted") public static void main(String args[]) { boolean forceCrash = false; diff --git a/test/lib/jdk/test/lib/artifacts/ArtifactResolver.java b/test/lib/jdk/test/lib/artifacts/ArtifactResolver.java index d8be12d86c2ef..cac371b482b02 100644 --- a/test/lib/jdk/test/lib/artifacts/ArtifactResolver.java +++ b/test/lib/jdk/test/lib/artifacts/ArtifactResolver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ private static ArtifactManager getManager() throws ArtifactResolverException { try { String managerName = System.getProperty("jdk.test.lib.artifacts.artifactmanager"); if (managerName != null) { - manager = (ArtifactManager) Class.forName(managerName).newInstance(); + manager = (ArtifactManager) Class.forName(managerName).getDeclaredConstructor().newInstance(); } else if (System.getenv().containsKey(JibArtifactManager.JIB_HOME_ENV_NAME)) { manager = JibArtifactManager.newInstance(); } else { diff --git a/test/lib/jdk/test/lib/artifacts/ArtifactResolverException.java b/test/lib/jdk/test/lib/artifacts/ArtifactResolverException.java index c06f5d7b70fea..6cc010f3b637b 100644 --- a/test/lib/jdk/test/lib/artifacts/ArtifactResolverException.java +++ b/test/lib/jdk/test/lib/artifacts/ArtifactResolverException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,10 +23,14 @@ package jdk.test.lib.artifacts; +import java.io.Serial; + /** * Thrown by the ArtifactResolver when failing to resolve an Artifact. */ public class ArtifactResolverException extends Exception { + @Serial + private static final long serialVersionUID = 8341884506180926911L; public ArtifactResolverException(String message) { super(message); diff --git a/test/lib/jdk/test/lib/artifacts/JibArtifactManager.java b/test/lib/jdk/test/lib/artifacts/JibArtifactManager.java index a66be9b482629..3d27709ce0306 100644 --- a/test/lib/jdk/test/lib/artifacts/JibArtifactManager.java +++ b/test/lib/jdk/test/lib/artifacts/JibArtifactManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -75,7 +75,7 @@ public static JibArtifactManager newInstance() throws ClassNotFoundException { ClassLoader oldContextLoader = currentThread.getContextClassLoader(); currentThread.setContextClassLoader(classLoader); - Class jibServiceFactory = classLoader.loadClass(JIB_SERVICE_FACTORY); + Class jibServiceFactory = classLoader.loadClass(JIB_SERVICE_FACTORY); try { Object jibArtifactInstaller = jibServiceFactory.getMethod("createJibArtifactInstaller").invoke(null); return new JibArtifactManager(jibArtifactInstaller, classLoader); diff --git a/test/lib/jdk/test/lib/classloader/ClassUnloadCommon.java b/test/lib/jdk/test/lib/classloader/ClassUnloadCommon.java index 11bea44fa33ae..89c1ea9e4ac63 100644 --- a/test/lib/jdk/test/lib/classloader/ClassUnloadCommon.java +++ b/test/lib/jdk/test/lib/classloader/ClassUnloadCommon.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved. * 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 @@ import jdk.test.whitebox.WhiteBox; import java.io.File; +import java.io.Serial; import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; @@ -45,6 +46,9 @@ public class ClassUnloadCommon { public static class TestFailure extends RuntimeException { + @Serial + private static final long serialVersionUID = -8108935949624559549L; + TestFailure(String msg) { super(msg); } diff --git a/test/lib/jdk/test/lib/classloader/GeneratingClassLoader.java b/test/lib/jdk/test/lib/classloader/GeneratingClassLoader.java index ee1089bac4d32..19dd4df959150 100644 --- a/test/lib/jdk/test/lib/classloader/GeneratingClassLoader.java +++ b/test/lib/jdk/test/lib/classloader/GeneratingClassLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * 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,13 @@ class TemplateClass { public class GeneratingClassLoader extends ClassLoader { - public synchronized Class loadClass(String name) throws ClassNotFoundException { + public synchronized Class loadClass(String name) throws ClassNotFoundException { return loadClass(name, false); } - public synchronized Class loadClass(String name, boolean resolve) + public synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException { - Class c = findLoadedClass(name); + Class c = findLoadedClass(name); if (c != null) { return c; } @@ -129,7 +129,7 @@ private byte[] getByteCode() throws ClassNotFoundException { throw new RuntimeException("Class name not found in template class file"); } } - return (byte[]) bytecode.clone(); + return bytecode.clone(); } private void readByteCode() throws ClassNotFoundException { diff --git a/test/lib/jdk/test/lib/classloader/GeneratingCompilingClassLoader.java b/test/lib/jdk/test/lib/classloader/GeneratingCompilingClassLoader.java index 34e3a250cdd25..5e040b689f0ea 100644 --- a/test/lib/jdk/test/lib/classloader/GeneratingCompilingClassLoader.java +++ b/test/lib/jdk/test/lib/classloader/GeneratingCompilingClassLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -202,7 +202,7 @@ public Class generateClass(int sizeFactor) throws IOException { */ public Class[] getGeneratedClasses(int sizeFactor, int numClasses) throws IOException { GeneratedClass[] gc = getGeneratedClass(sizeFactor, numClasses); - Class[] classes = new Class[numClasses]; + Class[] classes = new Class[numClasses]; for (int i = 0; i < numClasses; ++i) { classes[i] = defineClass(gc[i].name, gc[i].bytes, 0 , gc[i].bytes.length); } diff --git a/test/lib/jdk/test/lib/format/ArrayDiff.java b/test/lib/jdk/test/lib/format/ArrayDiff.java index 1e0aedad94b19..67b75ef3dce67 100644 --- a/test/lib/jdk/test/lib/format/ArrayDiff.java +++ b/test/lib/jdk/test/lib/format/ArrayDiff.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -107,7 +107,7 @@ public static ArrayDiff of(Object first, Object second) { * @throws NullPointerException if at least one of the arrays is null * @return an ArrayDiff instance for the two arrays and formatting parameters provided */ - @SuppressWarnings("rawtypes") + @SuppressWarnings({"rawtypes", "unchecked"}) public static ArrayDiff of(Object first, Object second, int width, int contextBefore) { Objects.requireNonNull(first); Objects.requireNonNull(second); diff --git a/test/lib/jdk/test/lib/helpers/ClassFileInstaller.java b/test/lib/jdk/test/lib/helpers/ClassFileInstaller.java index d344344601d9c..72038191d79c1 100644 --- a/test/lib/jdk/test/lib/helpers/ClassFileInstaller.java +++ b/test/lib/jdk/test/lib/helpers/ClassFileInstaller.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2022, 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 @@ -33,6 +33,7 @@ import java.nio.file.Paths; import java.nio.file.StandardCopyOption; import java.util.ArrayList; +import java.util.Arrays; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; @@ -86,46 +87,19 @@ public static void main(String... args) throws Exception { " -jar Write to the JAR file "); } String jarFile = args[1]; - String[] classes = addInnerClasses(args, 2); + String[] classes = Arrays.copyOfRange(args, 2, args.length); writeJar_impl(jarFile, null, classes); } else { if (DEBUG) { System.out.println("ClassFileInstaller: Writing to " + System.getProperty("user.dir")); } - String[] classes = addInnerClasses(args, 0); + String[] classes = Arrays.copyOfRange(args, 0, args.length); for (String cls : classes) { writeClassToDisk(cls); } } } - // Add commonly used inner classes that are often omitted by mistake. Currently - // we support only jdk.test.whitebox.WhiteBox$WhiteBoxPermission. - // See JDK-8199290 - private static String[] addInnerClasses(String[] classes, int startIdx) { - boolean seenNewWb = false; - boolean seenNewWbInner = false; - final String newWb = "jdk.test.whitebox.WhiteBox"; - final String newWbInner = newWb + "$WhiteBoxPermission"; - - ArrayList list = new ArrayList<>(); - - for (int i = startIdx; i < classes.length; i++) { - String cls = classes[i]; - list.add(cls); - switch (cls) { - case newWb: seenNewWb = true; break; - case newWbInner: seenNewWbInner = true; break; - } - } - if (seenNewWb && !seenNewWbInner) { - list.add(newWbInner); - } - String[] array = new String[list.size()]; - list.toArray(array); - return array; - } - public static class Manifest { private final InputStream in; @@ -188,13 +162,11 @@ private static void writeJar_impl(String jarFile, Manifest manifest, String clas * @build jdk.test.lib.helpers.ClassFileInstaller */ public static String writeJar(String jarFile, String... classes) throws Exception { - classes = addInnerClasses(classes, 0); writeJar_impl(jarFile, null, classes); return getJarPath(jarFile); } public static String writeJar(String jarFile, Manifest manifest, String... classes) throws Exception { - classes = addInnerClasses(classes, 0); writeJar_impl(jarFile, manifest, classes); return getJarPath(jarFile); } diff --git a/test/lib/jdk/test/lib/hprof/model/JavaHeapObject.java b/test/lib/jdk/test/lib/hprof/model/JavaHeapObject.java index b50045a7287b1..9841e1b01c573 100644 --- a/test/lib/jdk/test/lib/hprof/model/JavaHeapObject.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaHeapObject.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,12 +35,6 @@ import java.util.Map; import jdk.test.lib.hprof.util.Misc; - -/** - * - * @author Bill Foote - */ - /** * Represents an object that's allocated out of the Java heap. It occupies * memory in the VM, and is the sort of thing that in a JDK 1.1 VM had diff --git a/test/lib/jdk/test/lib/hprof/model/JavaStatic.java b/test/lib/jdk/test/lib/hprof/model/JavaStatic.java index 0fa3fbb06dc54..fbb794def56d7 100644 --- a/test/lib/jdk/test/lib/hprof/model/JavaStatic.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaStatic.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ package jdk.test.lib.hprof.model; -/** - * - * @author Bill Foote - */ - /** * Represents the value of a static field of a JavaClass */ diff --git a/test/lib/jdk/test/lib/hprof/model/JavaThing.java b/test/lib/jdk/test/lib/hprof/model/JavaThing.java index a76c9cc3198c5..9674a413d2440 100644 --- a/test/lib/jdk/test/lib/hprof/model/JavaThing.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaThing.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * 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,12 +30,6 @@ package jdk.test.lib.hprof.model; -/** - * - * @author Bill Foote - */ - - /** * Represents a java "Thing". A thing is anything that can be the value of * a field. This includes JavaHeapObject, JavaObjectRef, and JavaValue. diff --git a/test/lib/jdk/test/lib/hprof/model/Root.java b/test/lib/jdk/test/lib/hprof/model/Root.java index 3e87eb22a44e7..c3b821be0769d 100644 --- a/test/lib/jdk/test/lib/hprof/model/Root.java +++ b/test/lib/jdk/test/lib/hprof/model/Root.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * 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,12 +32,6 @@ import jdk.test.lib.hprof.util.Misc; -/** - * - * @author Bill Foote - */ - - /** * Represents a member of the rootset, that is, one of the objects that * the GC starts from when marking reachable objects. diff --git a/test/lib/jdk/test/lib/hprof/model/Snapshot.java b/test/lib/jdk/test/lib/hprof/model/Snapshot.java index 3ea77b876fd61..dbb9c7fd1f3e1 100644 --- a/test/lib/jdk/test/lib/hprof/model/Snapshot.java +++ b/test/lib/jdk/test/lib/hprof/model/Snapshot.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * 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,17 +30,13 @@ package jdk.test.lib.hprof.model; +import java.io.IOException; import java.lang.ref.SoftReference; import java.util.*; import jdk.test.lib.hprof.parser.ReadBuffer; import jdk.test.lib.hprof.util.Misc; -/** - * - * @author Bill Foote - */ - /** * Represents a snapshot of the Java objects in the VM at one instant. * This is the top-level "model" object read out of a single .hprof or .bod @@ -637,7 +633,7 @@ private synchronized void initSiteTraces() { } @Override - public void close() throws Exception { + public void close() throws IOException { readBuf.close(); } diff --git a/test/lib/jdk/test/lib/hprof/model/StackFrame.java b/test/lib/jdk/test/lib/hprof/model/StackFrame.java index 0ea2b0e471663..851faffd67cbe 100644 --- a/test/lib/jdk/test/lib/hprof/model/StackFrame.java +++ b/test/lib/jdk/test/lib/hprof/model/StackFrame.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * 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,12 +30,6 @@ package jdk.test.lib.hprof.model; -/** - * - * @author Bill Foote - */ - - /** * Represents a stack frame. */ diff --git a/test/lib/jdk/test/lib/hprof/model/StackTrace.java b/test/lib/jdk/test/lib/hprof/model/StackTrace.java index ecab592e3420f..b4a9c66781259 100644 --- a/test/lib/jdk/test/lib/hprof/model/StackTrace.java +++ b/test/lib/jdk/test/lib/hprof/model/StackTrace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * 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,12 +30,6 @@ package jdk.test.lib.hprof.model; -/** - * - * @author Bill Foote - */ - - /** * Represents a stack trace, that is, an ordered collection of stack frames. */ diff --git a/test/lib/jdk/test/lib/hprof/parser/FileReadBuffer.java b/test/lib/jdk/test/lib/hprof/parser/FileReadBuffer.java index eab5cff84c83d..be7672170b69c 100644 --- a/test/lib/jdk/test/lib/hprof/parser/FileReadBuffer.java +++ b/test/lib/jdk/test/lib/hprof/parser/FileReadBuffer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -86,7 +86,7 @@ public synchronized long getLong(long pos) throws IOException { } @Override - public void close() throws Exception { + public void close() throws IOException { file.close(); } } diff --git a/test/lib/jdk/test/lib/hprof/parser/MappedReadBuffer.java b/test/lib/jdk/test/lib/hprof/parser/MappedReadBuffer.java index d91c453a0f698..96da03a4057fd 100644 --- a/test/lib/jdk/test/lib/hprof/parser/MappedReadBuffer.java +++ b/test/lib/jdk/test/lib/hprof/parser/MappedReadBuffer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -127,7 +127,7 @@ public synchronized long getLong(long pos) throws IOException { } @Override - public void close() throws Exception { + public void close() throws IOException { file.close(); } diff --git a/test/lib/jdk/test/lib/hprof/parser/ReadBuffer.java b/test/lib/jdk/test/lib/hprof/parser/ReadBuffer.java index 4b06b79a53b2f..03c9d5d4a42bb 100644 --- a/test/lib/jdk/test/lib/hprof/parser/ReadBuffer.java +++ b/test/lib/jdk/test/lib/hprof/parser/ReadBuffer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * 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,4 +43,5 @@ public interface ReadBuffer extends AutoCloseable { public short getShort(long pos) throws IOException; public int getInt(long pos) throws IOException; public long getLong(long pos) throws IOException; + public void close() throws IOException; } diff --git a/test/lib/jdk/test/lib/hprof/parser/Reader.java b/test/lib/jdk/test/lib/hprof/parser/Reader.java index 447d96e770edd..7732befe50379 100644 --- a/test/lib/jdk/test/lib/hprof/parser/Reader.java +++ b/test/lib/jdk/test/lib/hprof/parser/Reader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -63,6 +63,7 @@ protected Reader(PositionDataInputStream in) { * @param heapFile The name of a file containing a heap dump * @param callStack If true, read the call stack of allocaation sites */ + @SuppressWarnings("try") public static Snapshot readFile(String heapFile, boolean callStack, int debugLevel) throws IOException { @@ -136,6 +137,7 @@ public static Snapshot readFile(String heapFile, boolean callStack, * * @param heapFile The name of a file containing a heap dump */ + @SuppressWarnings("try") public static String getStack(String heapFile, int debugLevel) throws IOException { int dumpNumber = 1; diff --git a/test/lib/jdk/test/lib/jfr/Events.java b/test/lib/jdk/test/lib/jfr/Events.java index 5a180659f9fcf..5676b7021d621 100644 --- a/test/lib/jdk/test/lib/jfr/Events.java +++ b/test/lib/jdk/test/lib/jfr/Events.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -233,7 +233,7 @@ public static void assertMissingValue(RecordedEvent event, String name) { private static void assertThread(RecordedThread eventThread, Thread thread) { assertNotNull(eventThread, "Thread in event was null"); - assertEquals(eventThread.getJavaThreadId(), thread.getId(), "Wrong thread id"); + assertEquals(eventThread.getJavaThreadId(), thread.threadId(), "Wrong thread id"); assertEquals(eventThread.getJavaName(), thread.getName(), "Wrong thread name"); ThreadGroup threadGroup = thread.getThreadGroup(); diff --git a/test/lib/jdk/test/lib/jvmti/DebugeeClass.java b/test/lib/jdk/test/lib/jvmti/DebugeeClass.java index c71e25edd9975..9025d5eefe87a 100644 --- a/test/lib/jdk/test/lib/jvmti/DebugeeClass.java +++ b/test/lib/jdk/test/lib/jvmti/DebugeeClass.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * 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.jvmti; +import java.io.Serial; + /** * Base class for debuggee class in JVMTI tests. * @@ -49,6 +51,7 @@ public class DebugeeClass { /** * This method is used to load library with native methods implementation, if needed. */ + @SuppressWarnings("restricted") public static void loadLibrary(String name) { try { System.loadLibrary(name); @@ -70,6 +73,9 @@ public static void safeSleep(long millis) { } public class Failure extends RuntimeException { + @Serial + private static final long serialVersionUID = -4069390356498980839L; + public Failure() { } diff --git a/test/lib/jdk/test/lib/management/ThreadMXBeanTool.java b/test/lib/jdk/test/lib/management/ThreadMXBeanTool.java index eeb4297f5009c..c42d78ad1770f 100644 --- a/test/lib/jdk/test/lib/management/ThreadMXBeanTool.java +++ b/test/lib/jdk/test/lib/management/ThreadMXBeanTool.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,7 +45,7 @@ public static void waitUntilBlockingOnObject(Thread thread, Thread.State state, + Integer.toHexString(System.identityHashCode(object)); ThreadMXBean tmx = ManagementFactory.getThreadMXBean(); while (thread.isAlive()) { - ThreadInfo ti = tmx.getThreadInfo(thread.getId()); + ThreadInfo ti = tmx.getThreadInfo(thread.threadId()); if (ti.getThreadState() == state && (want == null || want.equals(ti.getLockName()))) { return; @@ -60,7 +60,7 @@ public static void waitUntilBlockingOnObject(Thread thread, Thread.State state, public static void waitUntilInNative(Thread thread) throws InterruptedException { ThreadMXBean tmx = ManagementFactory.getThreadMXBean(); while (thread.isAlive()) { - ThreadInfo ti = tmx.getThreadInfo(thread.getId()); + ThreadInfo ti = tmx.getThreadInfo(thread.threadId()); if (ti.isInNative()) { return; } diff --git a/test/lib/jdk/test/lib/net/IPSupport.java b/test/lib/jdk/test/lib/net/IPSupport.java index 9a630ea1831b1..31255e20c6a99 100644 --- a/test/lib/jdk/test/lib/net/IPSupport.java +++ b/test/lib/jdk/test/lib/net/IPSupport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * 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,17 +28,13 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.PrintStream; -import java.io.UncheckedIOException; import java.net.Inet4Address; import java.net.Inet6Address; import java.net.InetAddress; import java.net.ProtocolFamily; import java.net.StandardProtocolFamily; import java.nio.channels.SocketChannel; -import java.security.AccessController; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; -import java.util.concurrent.Callable; + import jtreg.SkippedException; /** @@ -55,17 +51,16 @@ public class IPSupport { private static final int IPV6_SNDBUF_AIX = 65487; static { - hasIPv4 = runPrivilegedAction(() -> isSupported(Inet4Address.class)); - hasIPv6 = runPrivilegedAction(() -> isSupported(Inet6Address.class)); - preferIPv4Stack = runPrivilegedAction(() -> Boolean.parseBoolean( - System.getProperty("java.net.preferIPv4Stack"))); - preferIPv6Addresses = runPrivilegedAction(() -> Boolean.parseBoolean( - System.getProperty("java.net.preferIPv6Addresses"))); + hasIPv4 = isSupported(Inet4Address.class); + hasIPv6 = isSupported(Inet6Address.class); + preferIPv4Stack = Boolean.parseBoolean(System.getProperty("java.net.preferIPv4Stack")); + preferIPv6Addresses = Boolean.parseBoolean(System.getProperty("java.net.preferIPv6Addresses")); if (!preferIPv4Stack && !hasIPv4 && !hasIPv6) { throw new AssertionError("IPv4 and IPv6 both not available and java.net.preferIPv4Stack is not true"); } } + @SuppressWarnings("try") private static boolean isSupported(Class addressType) { ProtocolFamily family = addressType == Inet4Address.class ? StandardProtocolFamily.INET : StandardProtocolFamily.INET6; @@ -76,16 +71,6 @@ private static boolean isSupported(Class addressType) { } } - @SuppressWarnings("removal") - private static T runPrivilegedAction(Callable callable) { - try { - PrivilegedExceptionAction pa = () -> callable.call(); - return AccessController.doPrivileged(pa); - } catch (PrivilegedActionException pae) { - throw new UncheckedIOException((IOException) pae.getCause()); - } - } - private IPSupport() { } /** diff --git a/test/lib/jdk/test/lib/net/SimpleHttpServer.java b/test/lib/jdk/test/lib/net/SimpleHttpServer.java index 312df96a64bff..1905091eac67c 100644 --- a/test/lib/jdk/test/lib/net/SimpleHttpServer.java +++ b/test/lib/jdk/test/lib/net/SimpleHttpServer.java @@ -1,6 +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 @@ -102,7 +101,7 @@ public void handle(final HttpExchange t) throws IOException { try { uri = URI.create("file://" + rootUri.getRawPath() + path).normalize(); fPath = Path.of(uri); - } catch (IllegalArgumentException | FileSystemNotFoundException | SecurityException ex) { + } catch (IllegalArgumentException | FileSystemNotFoundException ex) { ex.printStackTrace(); notfound(t, path); return; diff --git a/test/lib/jdk/test/lib/net/SimpleSSLContext.java b/test/lib/jdk/test/lib/net/SimpleSSLContext.java index e8611fb007f32..3c26809f1283e 100644 --- a/test/lib/jdk/test/lib/net/SimpleSSLContext.java +++ b/test/lib/jdk/test/lib/net/SimpleSSLContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * 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,13 +34,6 @@ * Creates a simple usable SSLContext for SSLSocketFactory * or a HttpsServer using either a given keystore or a default * one in the test tree. - * - * Using this class with a security manager requires the following - * permissions to be granted: - * - * permission "java.util.PropertyPermission" "test.src.path", "read"; - * permission java.io.FilePermission "/path/to/test/lib/jdk/test/lib/testkeys", "read"; - * The exact path above depends on the location of the test. */ public class SimpleSSLContext { @@ -54,47 +47,19 @@ public SimpleSSLContext() throws IOException { this(() -> "TLS"); } - @SuppressWarnings("removal") private SimpleSSLContext(Supplier protocols) throws IOException { - try { - final String proto = protocols.get(); - AccessController.doPrivileged(new PrivilegedExceptionAction() { - @Override - public Void run() throws Exception { - String paths = System.getProperty("test.src.path"); - StringTokenizer st = new StringTokenizer(paths, File.pathSeparator); - boolean securityExceptions = false; - while (st.hasMoreTokens()) { - String path = st.nextToken(); - try { - File f = new File(path, "jdk/test/lib/net/testkeys"); - if (f.exists()) { - try (FileInputStream fis = new FileInputStream(f)) { - init(fis, proto); - return null; - } - } - } catch (SecurityException e) { - // catch and ignore because permission only required - // for one entry on path (at most) - securityExceptions = true; - } - } - if (securityExceptions) { - System.err.println("SecurityExceptions thrown on loading testkeys"); - } - return null; + String proto = protocols.get(); + String paths = System.getProperty("test.src.path"); + StringTokenizer st = new StringTokenizer(paths, File.pathSeparator); + while (st.hasMoreTokens()) { + String path = st.nextToken(); + File f = new File(path, "jdk/test/lib/net/testkeys"); + if (f.exists()) { + try (FileInputStream fis = new FileInputStream(f)) { + init(fis, proto); + break; } - }); - } catch (PrivilegedActionException pae) { - Throwable t = pae.getCause() != null ? pae.getCause() : pae; - if (t instanceof IOException) - throw (IOException)t; - if (t instanceof RuntimeException) - throw (RuntimeException)t; - if (t instanceof Error) - throw (Error)t; - throw new RuntimeException(t); + } } } diff --git a/test/lib/jdk/test/lib/os/linux/HugePageConfiguration.java b/test/lib/jdk/test/lib/os/linux/HugePageConfiguration.java index 0bb6db1602102..0873cb2b5d032 100644 --- a/test/lib/jdk/test/lib/os/linux/HugePageConfiguration.java +++ b/test/lib/jdk/test/lib/os/linux/HugePageConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2023, 2024, Red Hat Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -160,7 +160,6 @@ private static long readDefaultHugePageSizeFromOS() { while (scanner.hasNextLine()) { Matcher mat = pat.matcher(scanner.nextLine()); if (mat.matches()) { - scanner.close(); return Long.parseLong(mat.group(1)) * 1024; } } diff --git a/test/lib/jdk/test/lib/process/ProcessTools.java b/test/lib/jdk/test/lib/process/ProcessTools.java index fd543d0c3b785..7d03268cac472 100644 --- a/test/lib/jdk/test/lib/process/ProcessTools.java +++ b/test/lib/jdk/test/lib/process/ProcessTools.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,9 +39,6 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.security.AccessController; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; @@ -252,7 +249,7 @@ public static Process startProcess(String name, TimeUnit unit) throws IOException, InterruptedException, TimeoutException { System.out.println("[" + name + "]:" + String.join(" ", processBuilder.command())); - Process p = privilegedStart(processBuilder); + Process p = processBuilder.start(); StreamPumper stdout = new StreamPumper(p.getInputStream()); StreamPumper stderr = new StreamPumper(p.getErrorStream()); @@ -716,7 +713,7 @@ public static OutputAnalyzer executeProcess(ProcessBuilder pb, String input, Process p = null; boolean failed = false; try { - p = privilegedStart(pb); + p = pb.start(); if (input != null) { try (PrintStream ps = new PrintStream(p.getOutputStream())) { ps.print(input); @@ -732,10 +729,7 @@ public static OutputAnalyzer executeProcess(ProcessBuilder pb, String input, { // Dumping the process output to a separate file var fileName = String.format("pid-%d-output.log", p.pid()); var processOutput = getProcessLog(pb, output); - AccessController.doPrivileged((PrivilegedExceptionAction) () -> { - Files.writeString(Path.of(fileName), processOutput); - return null; - }); + Files.writeString(Path.of(fileName), processOutput); System.out.printf( "Output and diagnostic info for process %d " + "was saved into '%s'%n", p.pid(), fileName); @@ -883,16 +877,6 @@ public static ProcessBuilder addJvmLib(ProcessBuilder pb) throws Exception { return pb; } - @SuppressWarnings("removal") - private static Process privilegedStart(ProcessBuilder pb) throws IOException { - try { - return AccessController.doPrivileged( - (PrivilegedExceptionAction) pb::start); - } catch (PrivilegedActionException e) { - throw (IOException) e.getException(); - } - } - private static class ProcessImpl extends Process { private final InputStream stdOut; @@ -997,7 +981,7 @@ public static void main(String[] args) throws Throwable { String[] classArgs = new String[args.length - 2]; System.arraycopy(args, 2, classArgs, 0, args.length - 2); Class c = Class.forName(className); - Method mainMethod = c.getMethod("main", new Class[] { String[].class }); + Method mainMethod = c.getMethod("main", new Class[] { String[].class }); mainMethod.setAccessible(true); if (testThreadFactoryName.equals("Virtual")) { diff --git a/test/lib/jdk/test/lib/thread/VThreadPinner.java b/test/lib/jdk/test/lib/thread/VThreadPinner.java index f77dba978efa1..c6b332d2791e9 100644 --- a/test/lib/jdk/test/lib/thread/VThreadPinner.java +++ b/test/lib/jdk/test/lib/thread/VThreadPinner.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -114,7 +114,9 @@ public static void runPinned(ThrowingRunnable task) thr throw e; if (ex instanceof Error e) throw e; - throw (X) ex; + @SuppressWarnings("unchecked") + var x = (X) ex; + throw x; } } diff --git a/test/lib/jdk/test/lib/thread/VThreadRunner.java b/test/lib/jdk/test/lib/thread/VThreadRunner.java index 1b09e5e0d1222..3c1a076659a04 100644 --- a/test/lib/jdk/test/lib/thread/VThreadRunner.java +++ b/test/lib/jdk/test/lib/thread/VThreadRunner.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -94,7 +94,9 @@ public static void run(String name, throw e; if (ex instanceof Error e) throw e; - throw (X) ex; + @SuppressWarnings("unchecked") + var x = (X) ex; + throw x; } } diff --git a/test/lib/jdk/test/lib/util/FileUtils.java b/test/lib/jdk/test/lib/util/FileUtils.java index 191cb46f9c243..7b2ab434af2f5 100644 --- a/test/lib/jdk/test/lib/util/FileUtils.java +++ b/test/lib/jdk/test/lib/util/FileUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -266,7 +266,7 @@ public static boolean areMountPointsAccessibleAndUnique() { (new InputStreamReader(proc.getInputStream())); // Skip the first line as it is the "df" output header. if (reader.readLine() != null ) { - Set mountPoints = new HashSet(); + Set mountPoints = new HashSet<>(); String mountPoint = null; while ((mountPoint = reader.readLine()) != null) { if (!mountPoints.add(mountPoint)) { @@ -299,8 +299,8 @@ public static boolean areMountPointsAccessibleAndUnique() { }; }); - final AtomicReference throwableReference = - new AtomicReference(); + final AtomicReference throwableReference = + new AtomicReference<>(); thr.setUncaughtExceptionHandler( new Thread.UncaughtExceptionHandler() { public void uncaughtException(Thread t, Throwable e) { @@ -315,7 +315,7 @@ public void uncaughtException(Thread t, Throwable e) { throw new RuntimeException(ie); } - Throwable uncaughtException = (Throwable)throwableReference.get(); + Throwable uncaughtException = throwableReference.get(); if (uncaughtException != null) { throw new RuntimeException(uncaughtException); } @@ -365,6 +365,7 @@ public static void listFileDescriptors(PrintStream ps) { } // Return the current process handle count + @SuppressWarnings("restricted") public static long getProcessHandleCount() { if (IS_WINDOWS) { if (!nativeLibLoaded) { diff --git a/test/lib/jdk/test/whitebox/WhiteBox.java b/test/lib/jdk/test/whitebox/WhiteBox.java index f68eb978912a2..41ad60a7c4b08 100644 --- a/test/lib/jdk/test/whitebox/WhiteBox.java +++ b/test/lib/jdk/test/whitebox/WhiteBox.java @@ -29,18 +29,11 @@ import java.util.List; import java.util.function.BiFunction; import java.util.function.Function; -import java.security.BasicPermission; import java.util.Objects; import jdk.test.whitebox.parser.DiagnosticCommand; public class WhiteBox { - @SuppressWarnings("serial") - public static class WhiteBoxPermission extends BasicPermission { - public WhiteBoxPermission(String s) { - super(s); - } - } private WhiteBox() {} private static final WhiteBox instance = new WhiteBox(); diff --git a/test/make/TestIdea.gmk b/test/make/TestIdea.gmk index fce8769b239cf..9ecc00dae80e8 100644 --- a/test/make/TestIdea.gmk +++ b/test/make/TestIdea.gmk @@ -1,5 +1,5 @@ -# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. # 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,14 +28,21 @@ default: all IDEA_OUTPUT_DIR := $(TESTMAKE_OUTPUTDIR)/verify-idea +# Unset these variables to avoid having the current environment interfere with +# the idea generation script. SPEC needs to remain as idea.sh will call back to +# make and that call needs to have SPEC defined. +unexport HAS_SPEC +unexport CONF +unexport CONF_NAME + clean-idea: $(RM) -r $(IDEA_OUTPUT_DIR) verify-idea: $(MKDIR) -p $(IDEA_OUTPUT_DIR) - MAKEFLAGS= MFLAGS= $(BASH) $(TOPDIR)/bin/idea.sh -o $(IDEA_OUTPUT_DIR)/idea1 - MAKEFLAGS= MFLAGS= $(BASH) $(TOPDIR)/bin/idea.sh -o $(IDEA_OUTPUT_DIR)/idea2 java.base - MAKEFLAGS= MFLAGS= $(BASH) $(TOPDIR)/bin/idea.sh -o $(IDEA_OUTPUT_DIR)/idea3 java.base jdk.compiler + cd $(WORKSPACE_ROOT) && MAKEFLAGS= MFLAGS= $(BASH) $(TOPDIR)/bin/idea.sh -o $(IDEA_OUTPUT_DIR)/idea1 + cd $(WORKSPACE_ROOT) && MAKEFLAGS= MFLAGS= $(BASH) $(TOPDIR)/bin/idea.sh -o $(IDEA_OUTPUT_DIR)/idea2 java.base + cd $(WORKSPACE_ROOT) && MAKEFLAGS= MFLAGS= $(BASH) $(TOPDIR)/bin/idea.sh -o $(IDEA_OUTPUT_DIR)/idea3 java.base jdk.compiler TEST_TARGETS += verify-idea diff --git a/test/micro/org/openjdk/bench/jdk/classfile/AbstractCorpusBenchmark.java b/test/micro/org/openjdk/bench/jdk/classfile/AbstractCorpusBenchmark.java index f3c934d9c658d..ea361b4975b02 100644 --- a/test/micro/org/openjdk/bench/jdk/classfile/AbstractCorpusBenchmark.java +++ b/test/micro/org/openjdk/bench/jdk/classfile/AbstractCorpusBenchmark.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,8 +44,6 @@ @Warmup(iterations = 2) @Measurement(iterations = 4) @Fork(value = 1, jvmArgs = { - "--add-exports", "java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED", - "--add-exports", "java.base/jdk.internal.org.objectweb.asm.tree=ALL-UNNAMED", "--add-exports", "java.base/jdk.internal.classfile.components=ALL-UNNAMED", "--add-exports", "java.base/jdk.internal.classfile.impl=ALL-UNNAMED"}) @State(Scope.Benchmark) diff --git a/test/micro/org/openjdk/bench/jdk/classfile/AdaptNull.java b/test/micro/org/openjdk/bench/jdk/classfile/AdaptNull.java index 55c33b36805a3..680d1626b2c62 100644 --- a/test/micro/org/openjdk/bench/jdk/classfile/AdaptNull.java +++ b/test/micro/org/openjdk/bench/jdk/classfile/AdaptNull.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,10 +35,6 @@ public class AdaptNull extends AbstractCorpusBenchmark { @Param({ // "ARRAYCOPY", - "ASM_1", - "ASM_3", - "ASM_UNSHARED_3", -// "ASM_TREE", "SHARED_1", "SHARED_2", "SHARED_3", diff --git a/test/micro/org/openjdk/bench/jdk/classfile/ReadDeep.java b/test/micro/org/openjdk/bench/jdk/classfile/ReadDeep.java index 4165785135cea..a134e04bd5adb 100644 --- a/test/micro/org/openjdk/bench/jdk/classfile/ReadDeep.java +++ b/test/micro/org/openjdk/bench/jdk/classfile/ReadDeep.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,12 +29,6 @@ import java.lang.classfile.CompoundElement; import java.lang.classfile.MethodModel; import java.lang.classfile.instruction.LoadInstruction; -import jdk.internal.org.objectweb.asm.ClassReader; -import jdk.internal.org.objectweb.asm.ClassVisitor; -import jdk.internal.org.objectweb.asm.MethodVisitor; -import jdk.internal.org.objectweb.asm.Opcodes; -import jdk.internal.org.objectweb.asm.tree.ClassNode; -import jdk.internal.org.objectweb.asm.tree.MethodNode; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Mode; @@ -45,55 +39,6 @@ */ public class ReadDeep extends AbstractCorpusBenchmark { - @Benchmark - @BenchmarkMode(Mode.Throughput) - public void asmStreamCountLoads(Blackhole bh) { - for (byte[] bytes : classes) { - ClassReader cr = new ClassReader(bytes); - - var mv = new MethodVisitor(Opcodes.ASM9) { - int count = 0; - - @Override - public void visitVarInsn(int opcode, int var) { - ++count; - } - }; - - var visitor = new ClassVisitor(Opcodes.ASM9) { - @Override - public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) { - return mv; - } - }; - cr.accept(visitor, 0); - bh.consume(mv.count); - } - } - - @Benchmark - @BenchmarkMode(Mode.Throughput) - public void asmTreeCountLoads(Blackhole bh) { - for (byte[] bytes : classes) { - var mv = new MethodVisitor(Opcodes.ASM9) { - int count = 0; - - @Override - public void visitVarInsn(int opcode, int var) { - ++count; - } - }; - - ClassNode node = new ClassNode(); - ClassReader cr = new ClassReader(bytes); - cr.accept(node, 0); - for (MethodNode mn : node.methods) { - mn.accept(mv); - } - bh.consume(mv.count); - } - } - @Benchmark @BenchmarkMode(Mode.Throughput) public void jdkElementsCountLoads(Blackhole bh) { diff --git a/test/micro/org/openjdk/bench/jdk/classfile/ReadMetadata.java b/test/micro/org/openjdk/bench/jdk/classfile/ReadMetadata.java index 08b1b6312b1c0..0a12c5214e7bb 100644 --- a/test/micro/org/openjdk/bench/jdk/classfile/ReadMetadata.java +++ b/test/micro/org/openjdk/bench/jdk/classfile/ReadMetadata.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * 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,42 +27,11 @@ import java.lang.classfile.ClassModel; import java.lang.classfile.ClassFile; import java.lang.classfile.FieldModel; -import jdk.internal.org.objectweb.asm.*; -import jdk.internal.org.objectweb.asm.tree.*; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.infra.Blackhole; public class ReadMetadata extends AbstractCorpusBenchmark { - @Benchmark - @BenchmarkMode(Mode.Throughput) - public void asmStreamReadName(Blackhole bh) { - for (byte[] bytes : classes) { - ClassReader cr = new ClassReader(bytes); - var visitor = new ClassVisitor(Opcodes.ASM9) { - String theName; - - @Override - public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { - theName = name; - } - }; - cr.accept(visitor, 0); - bh.consume(visitor.theName); - } - } - - @Benchmark - @BenchmarkMode(Mode.Throughput) - public void asmTreeReadName(Blackhole bh) { - for (byte[] bytes : classes) { - ClassNode node = new ClassNode(); - ClassReader cr = new ClassReader(bytes); - cr.accept(node, 0); - bh.consume(node.name); - } - } - @Benchmark @BenchmarkMode(Mode.Throughput) public void jdkReadName(Blackhole bh) { @@ -90,43 +59,6 @@ public void jdkReadMemberNames(Blackhole bh) { } } - @Benchmark - @BenchmarkMode(Mode.Throughput) - public void asmStreamCountFields(Blackhole bh) { - for (byte[] bytes : classes) { - ClassReader cr = new ClassReader(bytes); - var visitor = new ClassVisitor(Opcodes.ASM9) { - int count; - - @Override - public FieldVisitor visitField(int access, String name, String descriptor, String signature, Object value) { - if ((access & Opcodes.ACC_PUBLIC) != 1) { - ++count; - } - return null; - } - }; - cr.accept(visitor, 0); - bh.consume(visitor.count); - } - } - - @Benchmark - @BenchmarkMode(Mode.Throughput) - public void asmTreeCountFields(Blackhole bh) { - for (byte[] bytes : classes) { - int count = 0; - ClassNode node = new ClassNode(); - ClassReader cr = new ClassReader(bytes); - cr.accept(node, 0); - for (FieldNode fn : node.fields) - if ((fn.access & Opcodes.ACC_PUBLIC) != 1) { - ++count; - } - bh.consume(count); - } - } - @Benchmark @BenchmarkMode(Mode.Throughput) public void jdkTreeCountFields(Blackhole bh) { diff --git a/test/micro/org/openjdk/bench/jdk/classfile/Transforms.java b/test/micro/org/openjdk/bench/jdk/classfile/Transforms.java index 8af03a8b874c4..19c8744203983 100644 --- a/test/micro/org/openjdk/bench/jdk/classfile/Transforms.java +++ b/test/micro/org/openjdk/bench/jdk/classfile/Transforms.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,27 +41,12 @@ import java.lang.classfile.MethodModel; import java.lang.classfile.MethodTransform; import jdk.internal.classfile.components.ClassRemapper; -import jdk.internal.org.objectweb.asm.AnnotationVisitor; -import jdk.internal.org.objectweb.asm.Attribute; -import jdk.internal.org.objectweb.asm.ClassReader; -import jdk.internal.org.objectweb.asm.ClassVisitor; -import jdk.internal.org.objectweb.asm.FieldVisitor; -import jdk.internal.org.objectweb.asm.Handle; -import jdk.internal.org.objectweb.asm.Label; -import jdk.internal.org.objectweb.asm.MethodVisitor; -import jdk.internal.org.objectweb.asm.ModuleVisitor; -import jdk.internal.org.objectweb.asm.Opcodes; -import jdk.internal.org.objectweb.asm.RecordComponentVisitor; -import jdk.internal.org.objectweb.asm.TypePath; -import jdk.internal.org.objectweb.asm.tree.ClassNode; /** * Transforms */ public class Transforms { - static int ASM9 = 9 << 16 | 0 << 8; - public static final ClassTransform threeLevelNoop = (cb, ce) -> { if (ce instanceof MethodModel mm) { cb.transformMethod(mm, (mb, me) -> { @@ -123,38 +108,6 @@ public enum NoOpTransform { UNSHARED_3(false, threeLevelNoop), SHARED_3_NO_STACKMAP(true, threeLevelNoop, ClassFile.StackMapsOption.DROP_STACK_MAPS), SHARED_3_NO_DEBUG(true, threeLevelNoop, ClassFile.DebugElementsOption.DROP_DEBUG, ClassFile.LineNumbersOption.DROP_LINE_NUMBERS), - ASM_1(bytes -> { - ClassReader cr = new ClassReader(bytes); - jdk.internal.org.objectweb.asm.ClassWriter cw = new jdk.internal.org.objectweb.asm.ClassWriter(cr, jdk.internal.org.objectweb.asm.ClassWriter.COMPUTE_FRAMES); - cr.accept(cw, 0); - return cw.toByteArray(); - }), - ASM_UNSHARED_1(bytes -> { - ClassReader cr = new ClassReader(bytes); - jdk.internal.org.objectweb.asm.ClassWriter cw = new jdk.internal.org.objectweb.asm.ClassWriter(jdk.internal.org.objectweb.asm.ClassWriter.COMPUTE_FRAMES); - cr.accept(cw, 0); - return cw.toByteArray(); - }), - ASM_3(bytes -> { - ClassReader cr = new ClassReader(bytes); - jdk.internal.org.objectweb.asm.ClassWriter cw = new jdk.internal.org.objectweb.asm.ClassWriter(cr, jdk.internal.org.objectweb.asm.ClassWriter.COMPUTE_FRAMES); - cr.accept(new CustomClassVisitor(cw), 0); - return cw.toByteArray(); - }), - ASM_UNSHARED_3(bytes -> { - ClassReader cr = new ClassReader(bytes); - jdk.internal.org.objectweb.asm.ClassWriter cw = new jdk.internal.org.objectweb.asm.ClassWriter(jdk.internal.org.objectweb.asm.ClassWriter.COMPUTE_FRAMES); - cr.accept(new CustomClassVisitor(cw), 0); - return cw.toByteArray(); - }), - ASM_TREE(bytes -> { - ClassNode node = new ClassNode(); - ClassReader cr = new ClassReader(bytes); - cr.accept(node, 0); - jdk.internal.org.objectweb.asm.ClassWriter cw = new jdk.internal.org.objectweb.asm.ClassWriter(cr, jdk.internal.org.objectweb.asm.ClassWriter.COMPUTE_FRAMES); - node.accept(cw); - return cw.toByteArray(); - }), CLASS_REMAPPER(bytes -> ClassRemapper.of(Map.of()).remapClass(ClassFile.of(), ClassFile.of().parse(bytes))); @@ -186,12 +139,6 @@ public enum NoOpTransform { } public enum InjectNopTransform { - ASM_NOP_SHARED(bytes -> { - ClassReader cr = new ClassReader(bytes); - jdk.internal.org.objectweb.asm.ClassWriter cw = new jdk.internal.org.objectweb.asm.ClassWriter(cr, jdk.internal.org.objectweb.asm.ClassWriter.COMPUTE_FRAMES); - cr.accept(new NopClassVisitor(cw), 0); - return cw.toByteArray(); - }), NOP_SHARED(bytes -> { var cc = ClassFile.of(); ClassModel cm = cc.parse(bytes); @@ -226,13 +173,6 @@ public void accept(CodeElement e) { } public enum SimpleTransform { - ASM_ADD_FIELD(bytes -> { - ClassReader cr = new ClassReader(bytes); - jdk.internal.org.objectweb.asm.ClassWriter cw = new jdk.internal.org.objectweb.asm.ClassWriter(cr, jdk.internal.org.objectweb.asm.ClassWriter.COMPUTE_FRAMES); - cr.accept(cw, 0); - cw.visitField(0, "argleBargleWoogaWooga", "I", null, null); - return cw.toByteArray(); - }), HIGH_SHARED_ADD_FIELD(bytes -> { var cc = ClassFile.of(); ClassModel cm = cc.parse(bytes); @@ -257,20 +197,6 @@ public void atEnd(ClassBuilder builder) { cb.withField("argleBargleWoogaWooga", ConstantDescs.CD_int, b -> { }); }); }), - ASM_DEL_METHOD(bytes -> { - ClassReader cr = new ClassReader(bytes); - jdk.internal.org.objectweb.asm.ClassWriter cw = new jdk.internal.org.objectweb.asm.ClassWriter(cr, jdk.internal.org.objectweb.asm.ClassWriter.COMPUTE_FRAMES); - ClassVisitor v = new ClassVisitor(ASM9, cw) { - @Override - public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) { - return (name.equals("hashCode") && descriptor.equals("()Z")) - ? null - : super.visitMethod(access, name, descriptor, signature, exceptions); - } - }; - cr.accept(cw, 0); - return cw.toByteArray(); - }), HIGH_SHARED_DEL_METHOD(bytes -> { var cc = ClassFile.of(); ClassModel cm = cc.parse(bytes); @@ -303,277 +229,4 @@ public MethodVisitor visitMethod(int access, String name, String descriptor, Str } } - static class CustomClassVisitor extends ClassVisitor { - - public CustomClassVisitor(ClassVisitor writer) { - super(ASM9, writer); - } - - @Override - public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { - super.visit(version, access, name, signature, superName, interfaces); - } - - @Override - public void visitSource(String source, String debug) { - super.visitSource(source, debug); - } - - @Override - public ModuleVisitor visitModule(String name, int access, String version) { - return super.visitModule(name, access, version); - } - - @Override - public void visitNestHost(String nestHost) { - super.visitNestHost(nestHost); - } - - @Override - public void visitOuterClass(String owner, String name, String descriptor) { - super.visitOuterClass(owner, name, descriptor); - } - - @Override - public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) { - return super.visitAnnotation(descriptor, visible); - } - - @Override - public AnnotationVisitor visitTypeAnnotation(int typeRef, TypePath typePath, String descriptor, boolean visible) { - return super.visitTypeAnnotation(typeRef, typePath, descriptor, visible); - } - - @Override - public void visitAttribute(Attribute attribute) { - super.visitAttribute(attribute); - } - - @Override - public void visitNestMember(String nestMember) { - super.visitNestMember(nestMember); - } - - @Override - public void visitInnerClass(String name, String outerName, String innerName, int access) { - super.visitInnerClass(name, outerName, innerName, access); - } - - @Override - public RecordComponentVisitor visitRecordComponent(String name, String descriptor, String signature) { - return super.visitRecordComponent(name, descriptor, signature); - } - - @Override - public FieldVisitor visitField(int access, String name, String descriptor, String signature, Object value) { - return super.visitField(access, name, descriptor, signature, value); - } - - @Override - public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) { - MethodVisitor mv = super.visitMethod(access, name, descriptor, signature, exceptions); - return new CustomMethodVisitor(mv); - } - - @Override - public void visitEnd() { - super.visitEnd(); - } - }; - - - static class CustomMethodVisitor extends MethodVisitor { - - public CustomMethodVisitor(MethodVisitor methodVisitor) { - super(ASM9, methodVisitor); - } - - @Override - public void visitParameter(String name, int access) { - super.visitParameter(name, access); - } - - @Override - public AnnotationVisitor visitAnnotationDefault() { - return super.visitAnnotationDefault(); - } - - @Override - public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) { - return super.visitAnnotation(descriptor, visible); - } - - @Override - public AnnotationVisitor visitTypeAnnotation(int typeRef, TypePath typePath, String descriptor, boolean visible) { - return super.visitTypeAnnotation(typeRef, typePath, descriptor, visible); - } - - @Override - public void visitAnnotableParameterCount(int parameterCount, boolean visible) { - super.visitAnnotableParameterCount(parameterCount, visible); - } - - @Override - public AnnotationVisitor visitParameterAnnotation(int parameter, String descriptor, boolean visible) { - return super.visitParameterAnnotation(parameter, descriptor, visible); - } - - @Override - public void visitAttribute(Attribute attribute) { - super.visitAttribute(attribute); - } - - @Override - public void visitCode() { - super.visitCode(); - } - - @Override - public void visitFrame(int type, int numLocal, Object[] local, int numStack, Object[] stack) { - super.visitFrame(type, numLocal, local, numStack, stack); - } - - @Override - public void visitInsn(int opcode) { - super.visitInsn(opcode); - } - - @Override - public void visitIntInsn(int opcode, int operand) { - super.visitIntInsn(opcode, operand); - } - - @Override - public void visitVarInsn(int opcode, int var) { - super.visitVarInsn(opcode, var); - } - - @Override - public void visitTypeInsn(int opcode, String type) { - super.visitTypeInsn(opcode, type); - } - - @Override - public void visitFieldInsn(int opcode, String owner, String name, String descriptor) { - super.visitFieldInsn(opcode, owner, name, descriptor); - } - - @Override - @SuppressWarnings("deprecation") - public void visitMethodInsn(int opcode, String owner, String name, String descriptor) { - super.visitMethodInsn(opcode, owner, name, descriptor); - } - - @Override - public void visitMethodInsn(int opcode, String owner, String name, String descriptor, boolean isInterface) { - super.visitMethodInsn(opcode, owner, name, descriptor, isInterface); - } - - @Override - public void visitInvokeDynamicInsn(String name, String descriptor, Handle bootstrapMethodHandle, Object... bootstrapMethodArguments) { - super.visitInvokeDynamicInsn(name, descriptor, bootstrapMethodHandle, bootstrapMethodArguments); - } - - @Override - public void visitJumpInsn(int opcode, Label label) { - super.visitJumpInsn(opcode, label); - } - - @Override - public void visitLabel(Label label) { - super.visitLabel(label); - } - - @Override - public void visitLdcInsn(Object value) { - super.visitLdcInsn(value); - } - - @Override - public void visitIincInsn(int var, int increment) { - super.visitIincInsn(var, increment); - } - - @Override - public void visitTableSwitchInsn(int min, int max, Label dflt, Label... labels) { - super.visitTableSwitchInsn(min, max, dflt, labels); - } - - @Override - public void visitLookupSwitchInsn(Label dflt, int[] keys, Label[] labels) { - super.visitLookupSwitchInsn(dflt, keys, labels); - } - - @Override - public void visitMultiANewArrayInsn(String descriptor, int numDimensions) { - super.visitMultiANewArrayInsn(descriptor, numDimensions); - } - - @Override - public AnnotationVisitor visitInsnAnnotation(int typeRef, TypePath typePath, String descriptor, boolean visible) { - return super.visitInsnAnnotation(typeRef, typePath, descriptor, visible); - } - - @Override - public void visitTryCatchBlock(Label start, Label end, Label handler, String type) { - super.visitTryCatchBlock(start, end, handler, type); - } - - @Override - public AnnotationVisitor visitTryCatchAnnotation(int typeRef, TypePath typePath, String descriptor, boolean visible) { - return super.visitTryCatchAnnotation(typeRef, typePath, descriptor, visible); - } - - @Override - public void visitLocalVariable(String name, String descriptor, String signature, Label start, Label end, int index) { - super.visitLocalVariable(name, descriptor, signature, start, end, index); - } - - @Override - public AnnotationVisitor visitLocalVariableAnnotation(int typeRef, TypePath typePath, Label[] start, Label[] end, int[] index, String descriptor, boolean visible) { - return super.visitLocalVariableAnnotation(typeRef, typePath, start, end, index, descriptor, visible); - } - - @Override - public void visitLineNumber(int line, Label start) { - super.visitLineNumber(line, start); - } - - @Override - public void visitMaxs(int maxStack, int maxLocals) { - super.visitMaxs(maxStack, maxLocals); - } - - @Override - public void visitEnd() { - super.visitEnd(); - } - }; - - static class NopClassVisitor extends CustomClassVisitor { - - public NopClassVisitor(ClassVisitor writer) { - super(writer); - } - - @Override - public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) { - MethodVisitor mv = super.visitMethod(access, name, descriptor, signature, exceptions); - return new NopMethodVisitor(mv); - } - } - - static class NopMethodVisitor extends CustomMethodVisitor { - - public NopMethodVisitor(MethodVisitor methodVisitor) { - super(methodVisitor); - } - - @Override - public void visitCode() { - super.visitCode(); - visitInsn(Opcodes.NOP); - } - } - } diff --git a/test/micro/org/openjdk/bench/jdk/classfile/Write.java b/test/micro/org/openjdk/bench/jdk/classfile/Write.java index ffd5b8f1c5ed5..9317ef78806eb 100644 --- a/test/micro/org/openjdk/bench/jdk/classfile/Write.java +++ b/test/micro/org/openjdk/bench/jdk/classfile/Write.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ import java.lang.reflect.AccessFlag; import java.lang.classfile.ClassFile; import java.lang.classfile.attribute.SourceFileAttribute; -import jdk.internal.org.objectweb.asm.*; import org.openjdk.jmh.annotations.*; import java.io.FileOutputStream; import static java.lang.classfile.ClassFile.ACC_PUBLIC; @@ -57,8 +56,6 @@ @Warmup(iterations = 3) @Measurement(iterations = 5) @Fork(value = 1, jvmArgs = { - "--add-exports", "java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED", - "--add-exports", "java.base/jdk.internal.org.objectweb.asm.tree=ALL-UNNAMED", "--add-exports", "java.base/jdk.internal.classfile.impl=ALL-UNNAMED"}) public class Write { static final int REPEATS = 40; @@ -70,76 +67,9 @@ public class Write { } METHOD_NAMES = names; } - static String checkFileAsm = "/tmp/asw/MyClass.class"; static String checkFileBc = "/tmp/byw/MyClass.class"; - static boolean writeClassAsm = Files.exists(Paths.get(checkFileAsm).getParent()); static boolean writeClassBc = Files.exists(Paths.get(checkFileBc).getParent()); - - @Benchmark - @BenchmarkMode(Mode.Throughput) - public byte[] asmStream() { - ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES); - cw.visit(Opcodes.V12, Opcodes.ACC_PUBLIC, "MyClass", null, "java/lang/Object", null); - cw.visitSource("MyClass.java", null); - - { - MethodVisitor mv = cw.visitMethod(0, INIT_NAME, "()V", null, null); - mv.visitCode(); - Label startLabel = new Label(); - Label endLabel = new Label(); - mv.visitLabel(startLabel); - mv.visitVarInsn(Opcodes.ALOAD, 0); - mv.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/lang/Object", INIT_NAME, "()V", false); - mv.visitInsn(Opcodes.RETURN); - mv.visitLabel(endLabel); - mv.visitLocalVariable("this", "LMyClass;", null, startLabel, endLabel, 1); - mv.visitMaxs(-1, -1); - mv.visitEnd(); - } - - for (int xi = 0; xi < REPEATS; ++xi) { - MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC+Opcodes.ACC_STATIC, METHOD_NAMES[xi], "([Ljava/lang/String;)V", null, null); - mv.visitCode(); - Label loopTop = new Label(); - Label loopEnd = new Label(); - Label startLabel = new Label(); - Label endLabel = new Label(); - Label iStart = new Label(); - mv.visitLabel(startLabel); - mv.visitInsn(Opcodes.ICONST_1); - mv.visitVarInsn(Opcodes.ISTORE, 1); - mv.visitLabel(iStart); - mv.visitInsn(Opcodes.ICONST_1); - mv.visitVarInsn(Opcodes.ISTORE, 2); - mv.visitLabel(loopTop); - mv.visitVarInsn(Opcodes.ILOAD, 2); - mv.visitIntInsn(Opcodes.BIPUSH, 10); - mv.visitJumpInsn(Opcodes.IF_ICMPGE, loopEnd); - mv.visitVarInsn(Opcodes.ILOAD, 1); - mv.visitVarInsn(Opcodes.ILOAD, 2); - mv.visitInsn(Opcodes.IMUL); - mv.visitVarInsn(Opcodes.ISTORE, 1); - mv.visitIincInsn(2, 1); - mv.visitJumpInsn(Opcodes.GOTO, loopTop); - mv.visitLabel(loopEnd); - mv.visitFieldInsn(Opcodes.GETSTATIC,"java/lang/System", "out", "Ljava/io/PrintStream;"); - mv.visitVarInsn(Opcodes.ILOAD, 1); - mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/io/PrintStream", "println", "(I)V", false); - mv.visitLabel(endLabel); - mv.visitInsn(Opcodes.RETURN); - mv.visitLocalVariable("fac", "I", null, startLabel, endLabel, 1); - mv.visitLocalVariable("i", "I", null, iStart, loopEnd, 2); - mv.visitMaxs(-1, -1); - mv.visitEnd(); - } - cw.visitEnd(); - - byte[] bytes = cw.toByteArray(); - if (writeClassAsm) writeClass(bytes, checkFileAsm); - return bytes; - } - @Benchmark @BenchmarkMode(Mode.Throughput) public byte[] jdkTree() { diff --git a/test/micro/org/openjdk/bench/jdk/incubator/vector/SpiltReplicate.java b/test/micro/org/openjdk/bench/jdk/incubator/vector/SpiltReplicate.java index 9f717908569a6..447eab012de24 100644 --- a/test/micro/org/openjdk/bench/jdk/incubator/vector/SpiltReplicate.java +++ b/test/micro/org/openjdk/bench/jdk/incubator/vector/SpiltReplicate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * 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 @@ @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.NANOSECONDS) -@Fork(1) +@Fork(value=1, jvmArgs={"--add-modules=jdk.incubator.vector"}) public class SpiltReplicate { @CompilerControl(CompilerControl.Mode.DONT_INLINE) public long broadcastInt() { diff --git a/test/micro/org/openjdk/bench/vm/compiler/FluidSBBench.java b/test/micro/org/openjdk/bench/vm/compiler/FluidSBBench.java new file mode 100644 index 0000000000000..794ff768678ab --- /dev/null +++ b/test/micro/org/openjdk/bench/vm/compiler/FluidSBBench.java @@ -0,0 +1,61 @@ +/* + * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +package org.openjdk.bench.vm.compiler; + +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Fork; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Warmup; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Scope; +import java.util.concurrent.TimeUnit; + +@Warmup(iterations = 3, time = 300, timeUnit = TimeUnit.MILLISECONDS) +@Measurement(iterations = 3, time = 300, timeUnit = TimeUnit.MILLISECONDS) +@Fork(value = 1, jvmArgsAppend = {"-XX:+UseParallelGC", "-Xmx1g", "-Xms1g"}) +@BenchmarkMode(Mode.AverageTime) +@OutputTimeUnit(TimeUnit.NANOSECONDS) +@State(Scope.Thread) +public class FluidSBBench { + static final String PREFIX = "a"; + String foo = "aaaaa aaaaa aaaaa aaaaa aaaaa"; + + @Benchmark + public String fluid() { + return new StringBuilder().append(PREFIX).append(foo).toString(); + } + + @Benchmark + public String nonFluid() { + final StringBuilder sb = new StringBuilder(); + sb.append(PREFIX); + sb.append(foo); + return sb.toString(); + } +} diff --git a/test/micro/org/openjdk/bench/vm/compiler/MergeLoadBench.java b/test/micro/org/openjdk/bench/vm/compiler/MergeLoadBench.java new file mode 100644 index 0000000000000..e29b5373791d3 --- /dev/null +++ b/test/micro/org/openjdk/bench/vm/compiler/MergeLoadBench.java @@ -0,0 +1,515 @@ +/* + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, Alibaba Group Holding Limited. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package org.openjdk.bench.vm.compiler; + +import org.openjdk.jmh.annotations.*; +import org.openjdk.jmh.infra.Blackhole; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; +import java.nio.ByteOrder; +import java.util.Random; +import java.util.concurrent.TimeUnit; + +import jdk.internal.misc.Unsafe; + +@BenchmarkMode(Mode.AverageTime) +@OutputTimeUnit(TimeUnit.NANOSECONDS) +@State(Scope.Thread) +@Warmup(iterations = 3, time = 500, timeUnit = TimeUnit.MILLISECONDS) +@Measurement(iterations = 5, time = 1000, timeUnit = TimeUnit.MILLISECONDS) +@Fork(value = 1, jvmArgs = {"--add-exports", "java.base/jdk.internal.misc=ALL-UNNAMED"}) +public class MergeLoadBench { + private static final Unsafe UNSAFE = Unsafe.getUnsafe(); + + final static VarHandle + INT_L = MethodHandles.byteArrayViewVarHandle(int[].class , ByteOrder.LITTLE_ENDIAN), + INT_B = MethodHandles.byteArrayViewVarHandle(int[].class , ByteOrder.BIG_ENDIAN), + LONG_L = MethodHandles.byteArrayViewVarHandle(long[].class, ByteOrder.LITTLE_ENDIAN), + LONG_B = MethodHandles.byteArrayViewVarHandle(long[].class, ByteOrder.BIG_ENDIAN), + CHAR_L = MethodHandles.byteArrayViewVarHandle(char[].class, ByteOrder.LITTLE_ENDIAN), + CHAR_B = MethodHandles.byteArrayViewVarHandle(char[].class, ByteOrder.BIG_ENDIAN); + + final static int NUMBERS = 8192; + + final byte[] bytes4 = new byte[NUMBERS * 4]; + final byte[] bytes8 = new byte[NUMBERS * 8]; + final int [] ints = new int [NUMBERS ]; + final long[] longs = new long[NUMBERS ]; + + @Setup + public void setup() { + Random r = new Random(); + for (int i = 0; i < ints.length; i++) { + ints[i] = r.nextInt(); + INT_L.set(bytes4, i * 4, i); + } + + for (int i = 0; i < longs.length; i++) { + longs[i] = r.nextLong(); + LONG_L.set(bytes8, i * 8, i); + } + } + + /* + * The names of these cases have the following `B/L/V/U` suffixes, which are: + * ``` + * B BigEndian + * L LittleEndian + * V VarHandle + * U Unsafe + * R ReverseBytes + * C Unsafe.getChar & putChar + * S Unsafe.getShort & putShort + * ``` + */ + + @Benchmark + public void getIntB(Blackhole BH) { + int sum = 0; + for (int i = 0; i < ints.length; i++) { + sum += getIntB(bytes4, i * 4); + } + BH.consume(sum); + } + + @Benchmark + public void getIntBU(Blackhole BH) { + int sum = 0; + for (int i = 0; i < ints.length; i++) { + sum += getIntBU(bytes4, i * 4); + } + BH.consume(sum); + } + + @Benchmark + public void getIntBV(Blackhole BH) { + int sum = 0; + for (int i = 0; i < ints.length; i++) { + sum += (int) INT_B.get(bytes4, i * 4); + } + BH.consume(sum); + } + + @Benchmark + public void getIntL(Blackhole BH) { + int sum = 0; + for (int i = 0; i < ints.length; i++) { + sum += getIntL(bytes4, i * 4); + } + BH.consume(sum); + } + + @Benchmark + public void getIntLU(Blackhole BH) { + int sum = 0; + for (int i = 0; i < ints.length; i++) { + sum += getIntLU(bytes4, i * 4); + } + BH.consume(sum); + } + + @Benchmark + public void getIntLV(Blackhole BH) { + int sum = 0; + for (int i = 0; i < ints.length; i++) { + sum += (int) INT_L.get(bytes4, i * 4); + } + BH.consume(sum); + } + + @Benchmark + public void getIntRB(Blackhole BH) { + int sum = 0; + for (int i = 0; i < ints.length; i++) { + sum += getIntRB(bytes4, i * 4); + } + BH.consume(sum); + } + + @Benchmark + public void getIntRBU(Blackhole BH) { + int sum = 0; + for (int i = 0; i < ints.length; i++) { + sum += getIntRBU(bytes4, i * 4); + } + BH.consume(sum); + } + + @Benchmark + public void getIntRL(Blackhole BH) { + int sum = 0; + for (int i = 0; i < ints.length; i++) { + sum += getIntRL(bytes4, i * 4); + } + BH.consume(sum); + } + + @Benchmark + public void getIntRLU(Blackhole BH) { + int sum = 0; + for (int i = 0; i < ints.length; i++) { + sum += getIntRLU(bytes4, i * 4); + } + BH.consume(sum); + } + + @Benchmark + public void getIntRU(Blackhole BH) { + int sum = 0; + for (int i = 0; i < ints.length; i++) { + sum += Integer.reverseBytes( + UNSAFE.getInt(bytes4, Unsafe.ARRAY_BYTE_BASE_OFFSET + i * 4)); + } + BH.consume(sum); + } + + @Benchmark + public void getIntU(Blackhole BH) { + int sum = 0; + for (int i = 0; i < ints.length; i++) { + sum += UNSAFE.getInt(bytes4, Unsafe.ARRAY_BYTE_BASE_OFFSET + i * 4); + } + BH.consume(sum); + } + + @Benchmark + public void getLongB(Blackhole BH) { + long sum = 0; + for (int i = 0; i < longs.length; i++) { + sum += getLongB(bytes8, i * 8); + } + BH.consume(sum); + } + + @Benchmark + public void getLongBU(Blackhole BH) { + long sum = 0; + for (int i = 0; i < longs.length; i++) { + sum += getLongBU(bytes8, i * 8); + } + BH.consume(sum); + } + + @Benchmark + public void getLongBV(Blackhole BH) { + long sum = 0; + for (int i = 0; i < ints.length; i++) { + sum += (long) LONG_B.get(bytes8, i * 8); + } + BH.consume(sum); + } + + @Benchmark + public void getLongL(Blackhole BH) { + long sum = 0; + for (int i = 0; i < longs.length; i++) { + sum += getLongL(bytes8, i * 8); + } + BH.consume(sum); + } + + @Benchmark + public void getLongLU(Blackhole BH) { + long sum = 0; + for (int i = 0; i < longs.length; i++) { + sum += getLongLU(bytes8, i * 8); + } + BH.consume(sum); + } + + @Benchmark + public void getLongLV(Blackhole BH) { + long sum = 0; + for (int i = 0; i < ints.length; i++) { + sum += (long) LONG_L.get(bytes8, i * 8); + } + BH.consume(sum); + } + + @Benchmark + public void getLongRB(Blackhole BH) { + long sum = 0; + for (int i = 0; i < longs.length; i++) { + sum += getLongRB(bytes8, i * 8); + } + BH.consume(sum); + } + + @Benchmark + public void getLongRBU(Blackhole BH) { + long sum = 0; + for (int i = 0; i < longs.length; i++) { + sum += getLongRBU(bytes8, i * 8); + } + BH.consume(sum); + } + + @Benchmark + public void getLongRL(Blackhole BH) { + long sum = 0; + for (int i = 0; i < longs.length; i++) { + sum += getLongRL(bytes8, i * 8); + } + BH.consume(sum); + } + + @Benchmark + public void getLongRLU(Blackhole BH) { + long sum = 0; + for (int i = 0; i < longs.length; i++) { + sum += getLongRLU(bytes8, i * 8); + } + BH.consume(sum); + } + + @Benchmark + public void getLongRU(Blackhole BH) { + long sum = 0; + for (int i = 0; i < longs.length; i++) { + sum += Long.reverseBytes( + UNSAFE.getLong(bytes8, Unsafe.ARRAY_BYTE_BASE_OFFSET + i * 8)); + } + BH.consume(sum); + } + + @Benchmark + public void getLongU(Blackhole BH) { + long sum = 0; + for (int i = 0; i < longs.length; i++) { + sum += UNSAFE.getLong(bytes8, Unsafe.ARRAY_BYTE_BASE_OFFSET + i * 8); + } + BH.consume(sum); + } + + @Benchmark + public void getCharB(Blackhole BH) { + long sum = 0; + for (int i = 0; i < longs.length; i++) { + char c = getCharB(bytes4, i); + sum += c; + } + BH.consume(sum); + } + + @Benchmark + public void getCharBV(Blackhole BH) { + long sum = 0; + for (int i = 0; i < longs.length; i++) { + char c = (char) CHAR_B.get(bytes4, Unsafe.ARRAY_BYTE_BASE_OFFSET + i * 2); + sum += c; + } + BH.consume(sum); + } + + @Benchmark + public void getCharBU(Blackhole BH) { + long sum = 0; + for (int i = 0; i < longs.length; i++) { + char c = getCharBU(bytes4, i); + sum += c; + } + BH.consume(sum); + } + + @Benchmark + public void getCharL(Blackhole BH) { + long sum = 0; + for (int i = 0; i < longs.length; i++) { + char c = getCharL(bytes4, i); + sum += c; + } + BH.consume(sum); + } + @Benchmark + public void getCharLU(Blackhole BH) { + long sum = 0; + for (int i = 0; i < longs.length; i++) { + char c = getCharLU(bytes4, i); + sum += c; + } + BH.consume(sum); + } + + + @Benchmark + public void getCharLV(Blackhole BH) { + long sum = 0; + for (int i = 0; i < longs.length; i++) { + char c = (char) CHAR_L.get(bytes4, Unsafe.ARRAY_BYTE_BASE_OFFSET + i * 2); + sum += c; + } + BH.consume(sum); + } + + @Benchmark + public void getCharC(Blackhole BH) { + long sum = 0; + for (int i = 0; i < longs.length; i++) { + char c = UNSAFE.getChar(bytes4, Unsafe.ARRAY_BYTE_BASE_OFFSET + i * 2); + sum += c; + } + BH.consume(sum); + } + + static int getIntB(byte[] array, int offset) { + return ((array[offset ] & 0xff) << 24) + | ((array[offset + 1] & 0xff) << 16) + | ((array[offset + 2] & 0xff) << 8) + | ((array[offset + 3] & 0xff) ); + } + + static int getIntBU(byte[] array, int offset) { + final long address = Unsafe.ARRAY_BYTE_BASE_OFFSET + offset; + return ((UNSAFE.getByte(array, address ) & 0xff) << 24) + | ((UNSAFE.getByte(array, address + 1) & 0xff) << 16) + | ((UNSAFE.getByte(array, address + 2) & 0xff) << 8) + | ((UNSAFE.getByte(array, address + 3) & 0xff) ); + } + + static int getIntL(byte[] array, int offset) { + return ((array[offset ] & 0xff) ) + | ((array[offset + 1] & 0xff) << 8) + | ((array[offset + 2] & 0xff) << 16) + | ((array[offset + 3] & 0xff) << 24); + } + + static int getIntRB(byte[] array, int offset) { + return Integer.reverseBytes(getIntB(array, offset)); + } + + static int getIntRBU(byte[] array, int offset) { + return Integer.reverseBytes(getIntBU(array, offset)); + } + + static int getIntRL(byte[] array, int offset) { + return Integer.reverseBytes(getIntL(array, offset)); + } + + static int getIntRLU(byte[] array, int offset) { + return Integer.reverseBytes(getIntLU(array, offset)); + } + + static long getLongB(byte[] array, int offset) { + return (((long) array[offset ] & 0xff) << 56) + | (((long) array[offset + 1] & 0xff) << 48) + | (((long) array[offset + 2] & 0xff) << 40) + | (((long) array[offset + 3] & 0xff) << 32) + | (((long) array[offset + 4] & 0xff) << 24) + | (((long) array[offset + 5] & 0xff) << 16) + | (((long) array[offset + 6] & 0xff) << 8) + | (((long) array[offset + 7] & 0xff) ); + } + + static long getLongBU(byte[] array, int offset) { + final long address = Unsafe.ARRAY_BYTE_BASE_OFFSET + offset; + return (((long)(UNSAFE.getByte(array, address) & 0xff)) << 56) + | (((long)(UNSAFE.getByte(array, address + 1) & 0xff)) << 48) + | (((long)(UNSAFE.getByte(array, address + 2) & 0xff)) << 40) + | (((long)(UNSAFE.getByte(array, address + 3) & 0xff)) << 32) + | (((long)(UNSAFE.getByte(array, address + 4) & 0xff)) << 24) + | (((long)(UNSAFE.getByte(array, address + 5) & 0xff)) << 16) + | (((long)(UNSAFE.getByte(array, address + 6) & 0xff)) << 8) + | (((long)(UNSAFE.getByte(array, address + 7) & 0xff)) ); + } + + public static long getLongL(byte[] array, int offset) { + return (((long) array[offset ] & 0xff) ) + | (((long) array[offset + 1] & 0xff) << 8) + | (((long) array[offset + 2] & 0xff) << 16) + | (((long) array[offset + 3] & 0xff) << 24) + | (((long) array[offset + 4] & 0xff) << 32) + | (((long) array[offset + 5] & 0xff) << 40) + | (((long) array[offset + 6] & 0xff) << 48) + | (((long) array[offset + 7] & 0xff) << 56); + } + + static long getLongLU(byte[] array, int offset) { + final long address = Unsafe.ARRAY_BYTE_BASE_OFFSET + offset; + return (((long)(UNSAFE.getByte(array, address ) & 0xff)) ) + | (((long)(UNSAFE.getByte(array, address + 1) & 0xff)) << 8) + | (((long)(UNSAFE.getByte(array, address + 2) & 0xff)) << 16) + | (((long)(UNSAFE.getByte(array, address + 3) & 0xff)) << 24) + | (((long)(UNSAFE.getByte(array, address + 4) & 0xff)) << 32) + | (((long)(UNSAFE.getByte(array, address + 5) & 0xff)) << 40) + | (((long)(UNSAFE.getByte(array, address + 6) & 0xff)) << 48) + | (((long)(UNSAFE.getByte(array, address + 7) & 0xff)) << 56); + } + + static long getLongRB(byte[] array, int offset) { + return getLongB(array, offset); + } + + static long getLongRBU(byte[] array, int offset) { + return getLongBU(array, offset); + } + + static long getLongRL(byte[] array, int offset) { + return getLongL(array, offset); + } + + static long getLongRLU(byte[] array, int offset) { + return getLongLU(array, offset); + } + + public static int getIntLU(byte[] array, int offset) { + final long address = Unsafe.ARRAY_BYTE_BASE_OFFSET + offset; + return ((UNSAFE.getByte(array, address ) & 0xff) ) + | ((UNSAFE.getByte(array, address + 1) & 0xff) << 8) + | ((UNSAFE.getByte(array, address + 2) & 0xff) << 16) + | ((UNSAFE.getByte(array, address + 3) & 0xff) << 24); + } + + public static char getCharB(byte[] val, int index) { + index <<= 1; + return (char)(((val[index ] & 0xff) << 8) + | ((val[index + 1] & 0xff))); + } + + public static char getCharBR(byte[] val, int index) { + return Character.reverseBytes(getCharB(val, index)); + } + + public static char getCharL(byte[] val, int index) { + index <<= 1; + return (char)(((val[index ] & 0xff)) + | ((val[index + 1] & 0xff) << 8)); + } + + public static char getCharLR(byte[] val, int index) { + return Character.reverseBytes(getCharL(val, index)); + } + + public static char getCharBU(byte[] array, int offset) { + final long address = Unsafe.ARRAY_BYTE_BASE_OFFSET + (offset << 1); + return (char) (((UNSAFE.getByte(array, address ) & 0xff) << 8) + | ((UNSAFE.getByte(array, address + 1) & 0xff) )); + } + + public static char getCharLU(byte[] array, int offset) { + final long address = Unsafe.ARRAY_BYTE_BASE_OFFSET + (offset << 1); + return (char) (((UNSAFE.getByte(array, address ) & 0xff) ) + | ((UNSAFE.getByte(array, address + 1) & 0xff) << 8)); + } +} diff --git a/test/micro/org/openjdk/bench/vm/compiler/MergeStoreBench.java b/test/micro/org/openjdk/bench/vm/compiler/MergeStoreBench.java index 870422de25683..88b6886881363 100644 --- a/test/micro/org/openjdk/bench/vm/compiler/MergeStoreBench.java +++ b/test/micro/org/openjdk/bench/vm/compiler/MergeStoreBench.java @@ -25,13 +25,9 @@ import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.infra.Blackhole; -import org.openjdk.jmh.runner.Runner; -import org.openjdk.jmh.runner.options.Options; -import org.openjdk.jmh.runner.options.OptionsBuilder; import java.lang.invoke.MethodHandles; import java.lang.invoke.VarHandle; -import java.lang.reflect.Field; import java.nio.ByteOrder; import java.util.Random; import java.util.concurrent.TimeUnit; @@ -41,18 +37,19 @@ @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.NANOSECONDS) @State(Scope.Thread) -@Warmup(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) +@Warmup(iterations = 3, time = 500, timeUnit = TimeUnit.MILLISECONDS) @Measurement(iterations = 5, time = 1000, timeUnit = TimeUnit.MILLISECONDS) -@Fork(value = 3, jvmArgs = {"--add-exports", "java.base/jdk.internal.misc=ALL-UNNAMED"}) +@Fork(value = 1, jvmArgs = {"--add-exports", "java.base/jdk.internal.misc=ALL-UNNAMED"}) public class MergeStoreBench { private static final Unsafe UNSAFE = Unsafe.getUnsafe(); - final static VarHandle INT_L = MethodHandles.byteArrayViewVarHandle(int[].class , ByteOrder.LITTLE_ENDIAN); - final static VarHandle INT_B = MethodHandles.byteArrayViewVarHandle(int[].class , ByteOrder.BIG_ENDIAN); - final static VarHandle LONG_L = MethodHandles.byteArrayViewVarHandle(long[].class, ByteOrder.LITTLE_ENDIAN); - final static VarHandle LONG_B = MethodHandles.byteArrayViewVarHandle(long[].class, ByteOrder.BIG_ENDIAN); - final static VarHandle CHAR_L = MethodHandles.byteArrayViewVarHandle(char[].class, ByteOrder.LITTLE_ENDIAN); - final static VarHandle CHAR_B = MethodHandles.byteArrayViewVarHandle(char[].class, ByteOrder.BIG_ENDIAN); + final static VarHandle + INT_L = MethodHandles.byteArrayViewVarHandle(int[].class , ByteOrder.LITTLE_ENDIAN), + INT_B = MethodHandles.byteArrayViewVarHandle(int[].class , ByteOrder.BIG_ENDIAN), + LONG_L = MethodHandles.byteArrayViewVarHandle(long[].class, ByteOrder.LITTLE_ENDIAN), + LONG_B = MethodHandles.byteArrayViewVarHandle(long[].class, ByteOrder.BIG_ENDIAN), + CHAR_L = MethodHandles.byteArrayViewVarHandle(char[].class, ByteOrder.LITTLE_ENDIAN), + CHAR_B = MethodHandles.byteArrayViewVarHandle(char[].class, ByteOrder.BIG_ENDIAN); final static int NUMBERS = 8192; @@ -89,115 +86,6 @@ public void setup() { * ``` */ - @Benchmark - public void getIntB(Blackhole BH) { - int sum = 0; - for (int i = 0; i < ints.length; i++) { - sum += getIntB(bytes4, i * 4); - } - BH.consume(sum); - } - - @Benchmark - public void getIntBU(Blackhole BH) { - int sum = 0; - for (int i = 0; i < ints.length; i++) { - sum += getIntBU(bytes4, i * 4); - } - BH.consume(sum); - } - - @Benchmark - public void getIntBV(Blackhole BH) { - int sum = 0; - for (int i = 0; i < ints.length; i++) { - sum += (int) INT_B.get(bytes4, i * 4); - } - BH.consume(sum); - } - - @Benchmark - public void getIntL(Blackhole BH) { - int sum = 0; - for (int i = 0; i < ints.length; i++) { - sum += getIntL(bytes4, i * 4); - } - BH.consume(sum); - } - - @Benchmark - public void getIntLU(Blackhole BH) { - int sum = 0; - for (int i = 0; i < ints.length; i++) { - sum += getIntLU(bytes4, i * 4); - } - BH.consume(sum); - } - - @Benchmark - public void getIntLV(Blackhole BH) { - int sum = 0; - for (int i = 0; i < ints.length; i++) { - sum += (int) INT_L.get(bytes4, i * 4); - } - BH.consume(sum); - } - - @Benchmark - public void getIntRB(Blackhole BH) { - int sum = 0; - for (int i = 0; i < ints.length; i++) { - sum += getIntRB(bytes4, i * 4); - } - BH.consume(sum); - } - - @Benchmark - public void getIntRBU(Blackhole BH) { - int sum = 0; - for (int i = 0; i < ints.length; i++) { - sum += getIntRBU(bytes4, i * 4); - } - BH.consume(sum); - } - - @Benchmark - public void getIntRL(Blackhole BH) { - int sum = 0; - for (int i = 0; i < ints.length; i++) { - sum += getIntRL(bytes4, i * 4); - } - BH.consume(sum); - } - - @Benchmark - public void getIntRLU(Blackhole BH) { - int sum = 0; - for (int i = 0; i < ints.length; i++) { - sum += getIntRLU(bytes4, i * 4); - } - BH.consume(sum); - } - - @Benchmark - public void getIntRU(Blackhole BH) { - int sum = 0; - for (int i = 0; i < ints.length; i++) { - sum += Integer.reverseBytes( - UNSAFE.getInt(bytes4, Unsafe.ARRAY_BYTE_BASE_OFFSET + i * 4)); - } - BH.consume(sum); - } - - @Benchmark - public void getIntU(Blackhole BH) { - int sum = 0; - for (int i = 0; i < ints.length; i++) { - sum += UNSAFE.getInt(bytes4, Unsafe.ARRAY_BYTE_BASE_OFFSET + i * 4); - } - BH.consume(sum); - } - @Benchmark public void setIntB(Blackhole BH) { int sum = 0; @@ -211,613 +99,396 @@ public void setIntB(Blackhole BH) { @Benchmark public void setIntBU(Blackhole BH) { - int sum = 0; - for (int i = 0; i < ints.length; i++) { - int v = ints[i]; - setIntBU(bytes4, i * 4, v); - sum += v; + int off = 0; + for (int i = ints.length - 1; i >= 0; i--) { + setIntBU(bytes4, off, ints[i]); + off += 4; } - BH.consume(sum); + BH.consume(off); } @Benchmark public void setIntBV(Blackhole BH) { - int sum = 0; - for (int i = 0; i < ints.length; i++) { - int v = ints[i]; - INT_B.set(bytes4, i * 4, v); - sum += v; + int off = 0; + for (int i = ints.length - 1; i >= 0; i--) { + INT_B.set(bytes4, off, ints[i]); + off += 4; } - BH.consume(sum); + BH.consume(off); } @Benchmark public void setIntL(Blackhole BH) { - int sum = 0; - for (int i = 0; i < ints.length; i++) { - int v = ints[i]; - setIntL(bytes4, i * 4, v); - sum += v; + int off = 0; + for (int i = ints.length - 1; i >= 0; i--) { + setIntL(bytes4, off, ints[i]); + off += 4; } - BH.consume(sum); + BH.consume(off); } @Benchmark public void setIntLU(Blackhole BH) { - int sum = 0; - for (int i = 0; i < ints.length; i++) { - int v = ints[i]; - setIntLU(bytes4, i * 4, v); - sum += v; + int off = 0; + for (int i = ints.length - 1; i >= 0; i--) { + setIntLU(bytes4, off, ints[i]); + off += 4; } - BH.consume(sum); + BH.consume(off); } @Benchmark public void setIntLV(Blackhole BH) { - long sum = 0; - for (int i = 0; i < ints.length; i++) { - int v = ints[i]; - INT_L.set(bytes4, i * 4, v); - sum += v; + int off = 0; + for (int i = ints.length - 1; i >= 0; i--) { + INT_L.set(bytes4, off, ints[i]); + off += 4; } - BH.consume(sum); + BH.consume(off); } @Benchmark public void setIntRB(Blackhole BH) { - long sum = 0; - for (int i = 0; i < ints.length; i++) { - int v = ints[i]; - setIntRB(bytes4, i * 4, ints[i]); - sum += v; + int off = 0; + for (int i = ints.length - 1; i >= 0; i--) { + setIntRB(bytes4, off, ints[i]); + off += 4; } - BH.consume(sum); + BH.consume(off); } @Benchmark public void setIntRBU(Blackhole BH) { - long sum = 0; - for (int i = 0; i < ints.length; i++) { - int v = ints[i]; - setIntRBU(bytes4, i * 4, v); - sum += v; + int off = 0; + for (int i = ints.length - 1; i >= 0; i--) { + setIntRBU(bytes4, off, ints[i]); + off += 4; } - BH.consume(sum); + BH.consume(off); } @Benchmark public void setIntRL(Blackhole BH) { - long sum = 0; - for (int i = 0; i < ints.length; i++) { - int v = ints[i]; - setIntRL(bytes4, i * 4, ints[i]); - sum += v; + int off = 0; + for (int i = ints.length - 1; i >= 0; i--) { + setIntRL(bytes4, off, ints[i]); + off += 4; } - BH.consume(sum); + BH.consume(off); } @Benchmark public void setIntRLU(Blackhole BH) { - long sum = 0; - for (int i = 0; i < ints.length; i++) { - int v = ints[i]; - setIntRLU(bytes4, i * 4, v); - sum += v; + int off = 0; + for (int i = ints.length - 1; i >= 0; i--) { + setIntRLU(bytes4, off, ints[i]); + off += 4; } - BH.consume(sum); + BH.consume(off); } @Benchmark public void setIntRU(Blackhole BH) { - long sum = 0; - for (int i = 0; i < ints.length; i++) { - int v = ints[i]; - v = Integer.reverseBytes(v); - UNSAFE.putInt(bytes4, Unsafe.ARRAY_BYTE_BASE_OFFSET + i * 4, v); - sum += v; + int off = 0; + for (int i = ints.length - 1; i >= 0; i--) { + UNSAFE.putInt(bytes4, Unsafe.ARRAY_BYTE_BASE_OFFSET + off, Integer.reverseBytes(ints[i])); + off += 4; } - BH.consume(sum); + BH.consume(off); } @Benchmark public void setIntU(Blackhole BH) { - long sum = 0; - for (int i = 0; i < ints.length; i++) { - int v = ints[i]; - UNSAFE.putInt(bytes4, Unsafe.ARRAY_BYTE_BASE_OFFSET + i * 4, v); - sum += v; - } - BH.consume(sum); - } - - @Benchmark - public void getLongB(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - sum += getLongB(bytes8, i * 8); - } - BH.consume(sum); - } - - @Benchmark - public void getLongBU(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - sum += getLongBU(bytes8, i * 8); - } - BH.consume(sum); - } - - @Benchmark - public void getLongBV(Blackhole BH) { - long sum = 0; - for (int i = 0; i < ints.length; i++) { - sum += (long) LONG_B.get(bytes8, i * 8); - } - BH.consume(sum); - } - - @Benchmark - public void getLongL(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - sum += getLongL(bytes8, i * 8); - } - BH.consume(sum); - } - - @Benchmark - public void getLongLU(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - sum += getLongLU(bytes8, i * 8); - } - BH.consume(sum); - } - - @Benchmark - public void getLongLV(Blackhole BH) { - long sum = 0; - for (int i = 0; i < ints.length; i++) { - sum += (long) LONG_L.get(bytes8, i * 8); + int off = 0; + for (int i = ints.length - 1; i >= 0; i--) { + UNSAFE.putInt(bytes4, Unsafe.ARRAY_BYTE_BASE_OFFSET + off, ints[i]); + off += 4; } - BH.consume(sum); - } - - @Benchmark - public void getLongRB(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - sum += getLongRB(bytes8, i * 8); - } - BH.consume(sum); - } - - @Benchmark - public void getLongRBU(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - sum += getLongRBU(bytes8, i * 8); - } - BH.consume(sum); - } - - @Benchmark - public void getLongRL(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - sum += getLongRL(bytes8, i * 8); - } - BH.consume(sum); - } - - @Benchmark - public void getLongRLU(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - sum += getLongRLU(bytes8, i * 8); - } - BH.consume(sum); - } - - @Benchmark - public void getLongRU(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - sum += Long.reverseBytes( - UNSAFE.getLong(bytes8, Unsafe.ARRAY_BYTE_BASE_OFFSET + i * 8)); - } - BH.consume(sum); - } - - @Benchmark - public void getLongU(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - sum += UNSAFE.getLong(bytes8, Unsafe.ARRAY_BYTE_BASE_OFFSET + i * 8); - } - BH.consume(sum); + BH.consume(off); } @Benchmark public void setLongB(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - long v = longs[i]; - setLongB(bytes8, i * 8, v); - sum += v; + int off = 0; + for (int i = longs.length - 1; i >= 0; i--) { + setLongB(bytes8, off, longs[i]); + off += 8; } - BH.consume(sum); + BH.consume(off); } @Benchmark public void setLongBU(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - long v = longs[i]; - setLongBU(bytes8, i * 8, v); - sum += v; + int off = 0; + for (int i = longs.length - 1; i >= 0; i--) { + setLongBU(bytes8, off, longs[i]); + off += 8; } - BH.consume(sum); + BH.consume(off); } @Benchmark public void setLongBV(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - long v = longs[i]; - LONG_B.set(bytes8, i * 8, v); - sum += v; + int off = 0; + for (int i = longs.length - 1; i >= 0; i--) { + LONG_B.set(bytes8, off, longs[i]); + off += 8; } - BH.consume(sum); + BH.consume(off); } @Benchmark public void setLongL(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - long v = longs[i]; - setLongL(bytes8, i * 8, v); - sum += v; + int off = 0; + for (int i = longs.length - 1; i >= 0; i--) { + setLongL(bytes8, off, longs[i]); + off += 8; } - BH.consume(sum); + BH.consume(off); } @Benchmark public void setLongLU(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - long v = longs[i]; - setLongLU(bytes8, i * 8, v); - sum += v; + int off = 0; + for (int i = longs.length - 1; i >= 0; i--) { + setLongLU(bytes8, off, longs[i]); + off += 8; } - BH.consume(sum); + BH.consume(off); } @Benchmark public void setLongLV(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - long v = longs[i]; - LONG_L.set(bytes8, i * 8, v); - sum += v; + int off = 0; + for (int i = longs.length - 1; i >= 0; i--) { + LONG_L.set(bytes8, off, longs[i]); + off += 8; } - BH.consume(sum); + BH.consume(off); } @Benchmark public void setLongRB(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - long v = longs[i]; - setLongRB(bytes8, i * 8, v); - sum += v; + int off = 0; + for (int i = longs.length - 1; i >= 0; i--) { + setLongRB(bytes8, off, longs[i]); + off += 8; } - BH.consume(sum); + BH.consume(off); } @Benchmark public void setLongRBU(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - long v = longs[i]; - setLongRBU(bytes8, i * 8, v); - sum += v; + int off = 0; + for (int i = longs.length - 1; i >= 0; i--) { + setLongRBU(bytes8, off, longs[i]); + off += 8; } - BH.consume(sum); + BH.consume(off); } @Benchmark public void setLongRL(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - long v = longs[i]; - setLongRL(bytes8, i * 8, v); - sum += v; + int off = 0; + for (int i = longs.length - 1; i >= 0; i--) { + setLongRL(bytes8, off, longs[i]); + off += 8; } - BH.consume(sum); + BH.consume(off); } @Benchmark public void setLongRLU(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - long v = longs[i]; - setLongRLU(bytes8, i * 8, v); - sum += v; + int off = 0; + for (int i = longs.length - 1; i >= 0; i--) { + setLongRLU(bytes8, off, longs[i]); + off += 8; } - BH.consume(sum); + BH.consume(off); } @Benchmark public void setLongRU(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - long v = longs[i]; - v = Long.reverseBytes(v); - UNSAFE.putLong(bytes8, Unsafe.ARRAY_BYTE_BASE_OFFSET + i * 8, v); - sum += v; + int off = 0; + for (int i = longs.length - 1; i >= 0; i--) { + UNSAFE.putLong(bytes8, Unsafe.ARRAY_BYTE_BASE_OFFSET + off, Long.reverseBytes(longs[i])); + off += 8; } - BH.consume(sum); + BH.consume(off); } @Benchmark public void setLongU(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - long v = longs[i]; - UNSAFE.putLong(bytes8, Unsafe.ARRAY_BYTE_BASE_OFFSET + i * 8, v); - sum += v; - } - BH.consume(sum); - } - - @Benchmark - public void getCharB(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - char c = getCharB(bytes4, i); - sum += c; + int off = 0; + for (int i = longs.length - 1; i >= 0; i--) { + UNSAFE.putLong(bytes8, Unsafe.ARRAY_BYTE_BASE_OFFSET + off, longs[i]); + off += 8; } - BH.consume(sum); + BH.consume(off); } @Benchmark - public void getCharBV(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - char c = (char) CHAR_B.get(bytes4, Unsafe.ARRAY_BYTE_BASE_OFFSET + i * 2); - sum += c; - } - BH.consume(sum); - } - - @Benchmark - public void getCharBU(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - char c = getCharBU(bytes4, i); - sum += c; + public void setCharBS(Blackhole BH) { + int off = 0; + for (int i = chars.length - 1; i >= 0; i--) { + putShortB(bytes4, off, chars[i]); + off += 2; } - BH.consume(sum); + BH.consume(off); } @Benchmark - public void getCharL(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - char c = getCharL(bytes4, i); - sum += c; - } - BH.consume(sum); - } - @Benchmark - public void getCharLU(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - char c = getCharLU(bytes4, i); - sum += c; + public void setCharBV(Blackhole BH) { + int off = 0; + for (int i = chars.length - 1; i >= 0; i--) { + CHAR_B.set(bytes4, off, chars[i]); + off += 2; } - BH.consume(sum); + BH.consume(off); } - @Benchmark - public void getCharLV(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - char c = (char) CHAR_L.get(bytes4, Unsafe.ARRAY_BYTE_BASE_OFFSET + i * 2); - sum += c; + public void setCharLS(Blackhole BH) { + int off = 0; + for (int i = chars.length - 1; i >= 0; i--) { + putShortL(bytes4, off, chars[i]); + off += 2; } - BH.consume(sum); + BH.consume(off); } @Benchmark - public void getCharC(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - char c = UNSAFE.getChar(bytes4, Unsafe.ARRAY_BYTE_BASE_OFFSET + i * 2); - sum += c; + public void setCharLV(Blackhole BH) { + int off = 0; + for (int i = chars.length - 1; i >= 0; i--) { + CHAR_L.set(bytes4, off, chars[i]); + off += 2; } - BH.consume(sum); + BH.consume(off); } @Benchmark - public void setCharBS(Blackhole BH) { - long sum = 0; - for (int i = 0; i < chars.length; i++) { - char c = chars[i]; - putShortB(bytes4, i * 2, c); - sum += c; + public void setCharC(Blackhole BH) { + int off = 0; + for (int i = chars.length - 1; i >= 0; i--) { + UNSAFE.putChar(bytes4, Unsafe.ARRAY_BYTE_BASE_OFFSET + off, chars[i]); + off += 2; } - BH.consume(sum); + BH.consume(off); } + /* + * putChars4 and putBytes4 Test whether four constant chars can be MergeStored + * + */ @Benchmark - public void setCharBV(Blackhole BH) { - long sum = 0; - for (int i = 0; i < chars.length; i++) { - char c = chars[i]; - CHAR_B.set(bytes4, i * 2, c); - sum += c; + public void putBytes4(Blackhole BH) { + int off = 0; + for (int i = 0; i < NUMBERS; i++) { + off = putBytes4(bytes4, off, 'n', 'u', 'l', 'l'); } - BH.consume(sum); + BH.consume(off); } @Benchmark - public void setCharLS(Blackhole BH) { - long sum = 0; - for (int i = 0; i < chars.length; i++) { - char c = chars[i]; - putShortL(bytes4, i * 2, c); - sum += c; + public void putBytes4X(Blackhole BH) { + int off = 0; + for (int i = 0; i < NUMBERS; i++) { + off = putBytes4X(bytes4, off, 'n', 'u', 'l', 'l'); } - BH.consume(sum); + BH.consume(off); } @Benchmark - public void setCharLV(Blackhole BH) { - long sum = 0; - for (int i = 0; i < chars.length; i++) { - char c = chars[i]; - CHAR_L.set(bytes4, i * 2, c); - sum += c; + public void putBytes4U(Blackhole BH) { + int off = 0; + for (int i = 0; i < NUMBERS; i++) { + off = putBytes4U(bytes4, off, 'n', 'u', 'l', 'l'); } - BH.consume(sum); + BH.consume(off); } @Benchmark - public void setCharC(Blackhole BH) { - long sum = 0; - for (int i = 0; i < chars.length; i++) { - char c = chars[i]; - UNSAFE.putChar(bytes4, Unsafe.ARRAY_BYTE_BASE_OFFSET + i * 2, c); - sum += c; + @SuppressWarnings("deprecation") + public void putBytes4GetBytes(Blackhole BH) { + int off = 0; + for (int i = 0; i < NUMBERS; i++) { + "null".getBytes(0, 4, bytes4, off); + off += 4; } - BH.consume(sum); + BH.consume(off); } - /* - * putChars4 Test whether four constant chars can be MergeStored - * - */ @Benchmark public void putChars4B(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - putChars4B(bytes8, i * 4); - sum += longs[i]; + int off = 0; + for (int i = 0; i < NUMBERS; i++) { + off = putChars4B(bytes8, off, 'n', 'u', 'l', 'l'); } - BH.consume(sum); + BH.consume(off); } @Benchmark public void putChars4BU(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - putChars4BU(bytes8, i * 4); - sum += longs[i]; + int off = 0; + for (int i = 0; i < NUMBERS; i++) { + off = putChars4BU(bytes8, off, 'n', 'u', 'l', 'l'); } - BH.consume(sum); + BH.consume(off); } @Benchmark public void putChars4BV(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - putChars4BV(bytes8, i * 4); - sum += longs[i]; + int off = 0; + for (int i = 0; i < NUMBERS; i++) { + off = putChars4BV(bytes8, off, 'n', 'u', 'l', 'l'); } - BH.consume(sum); + BH.consume(off); } @Benchmark public void putChars4L(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - putChars4L(bytes8, i * 4); - sum += longs[i]; + int off = 0; + for (int i = 0; i < NUMBERS; i++) { + off = putChars4L(bytes8, off, 'n', 'u', 'l', 'l'); } - BH.consume(sum); + BH.consume(off); } @Benchmark public void putChars4LU(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - putChars4LU(bytes8, i * 4); - sum += longs[i]; + int off = 0; + for (int i = 0; i < NUMBERS; i++) { + off = putChars4LU(bytes8, off, 'n', 'u', 'l', 'l'); } - BH.consume(sum); + BH.consume(off); } @Benchmark public void putChars4LV(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - putChars4LV(bytes8, i * 4); - sum += longs[i]; + int off = 0; + for (int i = 0; i < NUMBERS; i++) { + off = putChars4LV(bytes8, off, 'n', 'u', 'l', 'l'); } - BH.consume(sum); + BH.consume(off); } @Benchmark public void putChars4C(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - putChars4C(bytes8, i * 4); - sum += longs[i]; + int off = 0; + for (int i = 0; i < NUMBERS; i++) { + off = putChars4C(bytes8, off, 'n', 'u', 'l', 'l'); } - BH.consume(sum); + BH.consume(off); } @Benchmark public void putChars4S(Blackhole BH) { - long sum = 0; - for (int i = 0; i < longs.length; i++) { - putChars4S(bytes8, i * 4); - sum += longs[i]; + int off = 0; + for (int i = 0; i < NUMBERS; i++) { + off = putChars4S(bytes8, off, 'n', 'u', 'l', 'l'); } - BH.consume(sum); - } - - static int getIntB(byte[] array, int offset) { - return ((array[offset ] & 0xff) << 24) - | ((array[offset + 1] & 0xff) << 16) - | ((array[offset + 2] & 0xff) << 8) - | ((array[offset + 3] & 0xff) ); - } - - static int getIntBU(byte[] array, int offset) { - final long address = Unsafe.ARRAY_BYTE_BASE_OFFSET + offset; - return ((UNSAFE.getByte(array, address ) & 0xff) << 24) - | ((UNSAFE.getByte(array, address + 1) & 0xff) << 16) - | ((UNSAFE.getByte(array, address + 2) & 0xff) << 8) - | ((UNSAFE.getByte(array, address + 3) & 0xff) ); - } - - static int getIntL(byte[] array, int offset) { - return ((array[offset ] & 0xff) ) - | ((array[offset + 1] & 0xff) << 8) - | ((array[offset + 2] & 0xff) << 16) - | ((array[offset + 3] & 0xff) << 24); - } - - static int getIntRB(byte[] array, int offset) { - return Integer.reverseBytes(getIntB(array, offset)); - } - - static int getIntRBU(byte[] array, int offset) { - return Integer.reverseBytes(getIntBU(array, offset)); - } - - static int getIntRL(byte[] array, int offset) { - return Integer.reverseBytes(getIntL(array, offset)); - } - - static int getIntRLU(byte[] array, int offset) { - return Integer.reverseBytes(getIntLU(array, offset)); + BH.consume(off); } static void setIntB(byte[] array, int offset, int value) { @@ -870,68 +541,6 @@ public static void setIntRBU(byte[] array, int offset, int value) { setIntBU(array, offset, value); } - static long getLongB(byte[] array, int offset) { - return (((long) array[offset ] & 0xff) << 56) - | (((long) array[offset + 1] & 0xff) << 48) - | (((long) array[offset + 2] & 0xff) << 40) - | (((long) array[offset + 3] & 0xff) << 32) - | (((long) array[offset + 4] & 0xff) << 24) - | (((long) array[offset + 5] & 0xff) << 16) - | (((long) array[offset + 6] & 0xff) << 8) - | (((long) array[offset + 7] & 0xff) ); - } - - static long getLongBU(byte[] array, int offset) { - final long address = Unsafe.ARRAY_BYTE_BASE_OFFSET + offset; - return (((long)(UNSAFE.getByte(array, address) & 0xff)) << 56) - | (((long)(UNSAFE.getByte(array, address + 1) & 0xff)) << 48) - | (((long)(UNSAFE.getByte(array, address + 2) & 0xff)) << 40) - | (((long)(UNSAFE.getByte(array, address + 3) & 0xff)) << 32) - | (((long)(UNSAFE.getByte(array, address + 4) & 0xff)) << 24) - | (((long)(UNSAFE.getByte(array, address + 5) & 0xff)) << 16) - | (((long)(UNSAFE.getByte(array, address + 6) & 0xff)) << 8) - | (((long)(UNSAFE.getByte(array, address + 7) & 0xff)) ); - } - - public static long getLongL(byte[] array, int offset) { - return (((long) array[offset ] & 0xff) ) - | (((long) array[offset + 1] & 0xff) << 8) - | (((long) array[offset + 2] & 0xff) << 16) - | (((long) array[offset + 3] & 0xff) << 24) - | (((long) array[offset + 4] & 0xff) << 32) - | (((long) array[offset + 5] & 0xff) << 40) - | (((long) array[offset + 6] & 0xff) << 48) - | (((long) array[offset + 7] & 0xff) << 56); - } - - static long getLongLU(byte[] array, int offset) { - final long address = Unsafe.ARRAY_BYTE_BASE_OFFSET + offset; - return (((long)(UNSAFE.getByte(array, address ) & 0xff)) ) - | (((long)(UNSAFE.getByte(array, address + 1) & 0xff)) << 8) - | (((long)(UNSAFE.getByte(array, address + 2) & 0xff)) << 16) - | (((long)(UNSAFE.getByte(array, address + 3) & 0xff)) << 24) - | (((long)(UNSAFE.getByte(array, address + 4) & 0xff)) << 32) - | (((long)(UNSAFE.getByte(array, address + 5) & 0xff)) << 40) - | (((long)(UNSAFE.getByte(array, address + 6) & 0xff)) << 48) - | (((long)(UNSAFE.getByte(array, address + 7) & 0xff)) << 56); - } - - static long getLongRB(byte[] array, int offset) { - return getLongB(array, offset); - } - - static long getLongRBU(byte[] array, int offset) { - return getLongBU(array, offset); - } - - static long getLongRL(byte[] array, int offset) { - return getLongL(array, offset); - } - - static long getLongRLU(byte[] array, int offset) { - return getLongLU(array, offset); - } - static void setLongB(byte[] array, int offset, long value) { array[offset] = (byte) (value >> 56); array[offset + 1] = (byte) (value >> 48); @@ -998,112 +607,95 @@ public static void setLongLU(byte[] array, int offset, long value) { UNSAFE.putByte(array, address + 7, (byte) (value >> 56)); } - public static int getIntLU(byte[] array, int offset) { - final long address = Unsafe.ARRAY_BYTE_BASE_OFFSET + offset; - return ((UNSAFE.getByte(array, address ) & 0xff) ) - | ((UNSAFE.getByte(array, address + 1) & 0xff) << 8) - | ((UNSAFE.getByte(array, address + 2) & 0xff) << 16) - | ((UNSAFE.getByte(array, address + 3) & 0xff) << 24); - } - - public static char getCharB(byte[] val, int index) { - index <<= 1; - return (char)(((val[index ] & 0xff) << 8) - | ((val[index + 1] & 0xff))); - } - - public static char getCharBR(byte[] val, int index) { - return Character.reverseBytes(getCharB(val, index)); - } - - public static char getCharL(byte[] val, int index) { - index <<= 1; - return (char)(((val[index ] & 0xff)) - | ((val[index + 1] & 0xff) << 8)); + public int putBytes4(byte[] bytes, int offset, int c0, int c1, int c2, int c3) { + bytes[offset ] = (byte) c0; + bytes[offset + 1] = (byte) c1; + bytes[offset + 2] = (byte) c2; + bytes[offset + 3] = (byte) c3; + return offset + 4; } - public static char getCharLR(byte[] val, int index) { - return Character.reverseBytes(getCharL(val, index)); + public int putBytes4X(byte[] bytes, int offset, int c0, int c1, int c2, int c3) { + bytes[offset++] = (byte) c0; + bytes[offset++] = (byte) c1; + bytes[offset++] = (byte) c2; + bytes[offset++] = (byte) c3; + return offset; } - public static char getCharBU(byte[] array, int offset) { - final long address = Unsafe.ARRAY_BYTE_BASE_OFFSET + (offset << 1); - return (char) (((UNSAFE.getByte(array, address ) & 0xff) << 8) - | ((UNSAFE.getByte(array, address + 1) & 0xff) )); - } - - public static char getCharLU(byte[] array, int offset) { - final long address = Unsafe.ARRAY_BYTE_BASE_OFFSET + (offset << 1); - return (char) (((UNSAFE.getByte(array, address ) & 0xff) ) - | ((UNSAFE.getByte(array, address + 1) & 0xff) << 8)); + public int putBytes4U(byte[] bytes, int offset, int c0, int c1, int c2, int c3) { + final long address = Unsafe.ARRAY_BYTE_BASE_OFFSET + offset; + UNSAFE.putByte(bytes, address , (byte) c0); + UNSAFE.putByte(bytes, address + 1, (byte) c1); + UNSAFE.putByte(bytes, address + 2, (byte) c2); + UNSAFE.putByte(bytes, address + 3, (byte) c3); + return offset + 4; } - public void putChars4B(byte[] bytes, int offset) { - char c0 = 'n', c1 = 'u', c2 = 'l', c3 = 'l'; + public int putChars4B(byte[] bytes, int offset, char c0, char c1, char c2, char c3) { putShortB(bytes, offset , c0); putShortB(bytes, offset + 1, c1); putShortB(bytes, offset + 2, c2); putShortB(bytes, offset + 3, c3); + return offset + 4; } - public void putChars4BU(byte[] bytes, int offset) { - char c0 = 'n', c1 = 'u', c2 = 'l', c3 = 'l'; + public int putChars4BU(byte[] bytes, int offset, char c0, char c1, char c2, char c3) { putShortBU(bytes, offset , c0); putShortBU(bytes, offset + 1, c1); putShortBU(bytes, offset + 2, c2); putShortBU(bytes, offset + 3, c3); + return offset + 4; } - public void putChars4BV(byte[] bytes, int offset) { - char c0 = 'n', c1 = 'u', c2 = 'l', c3 = 'l'; - offset <<= 1; - CHAR_B.set(bytes, offset , c0); + public int putChars4BV(byte[] bytes, int offset, char c0, char c1, char c2, char c3) { + CHAR_B.set(bytes, offset , c0); CHAR_B.set(bytes, offset + 2, c1); CHAR_B.set(bytes, offset + 4, c2); CHAR_B.set(bytes, offset + 6, c3); + return offset + 8; } - public void putChars4L(byte[] bytes, int offset) { - char c0 = 'n', c1 = 'u', c2 = 'l', c3 = 'l'; + public int putChars4L(byte[] bytes, int offset, char c0, char c1, char c2, char c3) { putShortL(bytes, offset , c0); putShortL(bytes, offset + 1, c1); putShortL(bytes, offset + 2, c2); putShortL(bytes, offset + 3, c3); + return offset + 4; } - public void putChars4LV(byte[] bytes, int offset) { - char c0 = 'n', c1 = 'u', c2 = 'l', c3 = 'l'; - offset <<= 1; + public int putChars4LV(byte[] bytes, int offset, char c0, char c1, char c2, char c3) { CHAR_L.set(bytes, offset , c0); CHAR_L.set(bytes, offset + 2, c1); CHAR_L.set(bytes, offset + 4, c2); CHAR_L.set(bytes, offset + 6, c3); + return offset + 8; } - public void putChars4LU(byte[] bytes, int offset) { - char c0 = 'n', c1 = 'u', c2 = 'l', c3 = 'l'; + public int putChars4LU(byte[] bytes, int offset, char c0, char c1, char c2, char c3) { putShortLU(bytes, offset , c0); putShortLU(bytes, offset + 1, c1); putShortLU(bytes, offset + 2, c2); putShortLU(bytes, offset + 3, c3); + return offset + 4; } - public void putChars4C(byte[] bytes, int offset) { - char c0 = 'n', c1 = 'u', c2 = 'l', c3 = 'l'; - final long address = Unsafe.ARRAY_BYTE_BASE_OFFSET + (offset << 1); + public int putChars4C(byte[] bytes, int offset, char c0, char c1, char c2, char c3) { + final long address = Unsafe.ARRAY_BYTE_BASE_OFFSET + offset; UNSAFE.putChar(bytes, address , c0); UNSAFE.putChar(bytes, address + 2, c1); UNSAFE.putChar(bytes, address + 4, c2); UNSAFE.putChar(bytes, address + 6, c3); + return offset + 8; } - public void putChars4S(byte[] bytes, int offset) { - char c0 = 'n', c1 = 'u', c2 = 'l', c3 = 'l'; - final long address = Unsafe.ARRAY_BYTE_BASE_OFFSET + (offset << 1); + public int putChars4S(byte[] bytes, int offset, char c0, char c1, char c2, char c3) { + final long address = Unsafe.ARRAY_BYTE_BASE_OFFSET + offset; UNSAFE.putShort(bytes, address , (short) c0); UNSAFE.putShort(bytes, address + 2, (short) c1); UNSAFE.putShort(bytes, address + 4, (short) c2); UNSAFE.putShort(bytes, address + 6, (short) c3); + return offset + 8; } private static void putShortB(byte[] val, int index, int c) { @@ -1129,4 +721,9 @@ public static void putShortLU(byte[] array, int offset, int c) { UNSAFE.putByte(array, address , (byte) (c )); UNSAFE.putByte(array, address + 1, (byte) (c >> 8)); } + + @Fork(value = 1, jvmArgs = { + "--add-exports", "java.base/jdk.internal.misc=ALL-UNNAMED", "-XX:+UnlockDiagnosticVMOptions", "-XX:-MergeStores" + }) + public static class MergeStoresDisabled extends MergeStoreBench {} }