diff --git a/bin/idea.sh b/bin/idea.sh index c85ae294454e5..eb37964f39685 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 ALLOW=IDEA_OUTPUT,MODULES IDEA_OUTPUT=$IDEA_OUTPUT MODULES="$*" $CONF_ARG || exit 1 cd $SCRIPT_DIR . $IDEA_OUTPUT/env.cfg 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/Global.gmk b/make/Global.gmk index 86487c1c2fc19..25753f1ae5763 100644 --- a/make/Global.gmk +++ b/make/Global.gmk @@ -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 @@ -108,6 +108,7 @@ help: $(info $(_) MICRO="OPT1=x;OPT2=y" # Control the MICRO test harness, use 'make test-only MICRO=help' to list) $(info $(_) TEST_OPTS="OPT1=x;..." # Generic control of all test harnesses) $(info $(_) TEST_VM_OPTS="ARG ..." # Same as setting TEST_OPTS to VM_OPTIONS="ARG ...") + $(info $(_) ALLOW="FOO,BAR" # Do not warn that FOO and BAR are non-control variables) $(info ) $(if $(all_confs), $(info Available configurations in $(build_dir):) $(foreach var,$(all_confs),$(info * $(var))), \ $(info No configurations were found in $(build_dir).) $(info Run 'bash configure' to create a configuration.)) diff --git a/make/InitSupport.gmk b/make/InitSupport.gmk index eea593a80db95..baee52a888edc 100644 --- a/make/InitSupport.gmk +++ b/make/InitSupport.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,12 +48,15 @@ ifeq ($(HAS_SPEC), ) # from the command-line. ############################################################################## - # Make control variables, handled by Init.gmk - INIT_CONTROL_VARIABLES += LOG CONF CONF_NAME SPEC JOBS TEST_JOBS CONF_CHECK \ - COMPARE_BUILD JTREG GTEST MICRO TEST_OPTS TEST_VM_OPTS TEST_DEPS + # Essential control variables that are handled by Init.gmk + INIT_CONTROL_VARIABLES := LOG CONF CONF_NAME SPEC JOBS CONF_CHECK ALLOW \ + COMPARE_BUILD - # All known make control variables - MAKE_CONTROL_VARIABLES := $(INIT_CONTROL_VARIABLES) TEST JDK_FILTER SPEC_FILTER + # All known make control variables; these are handled in other makefiles + MAKE_CONTROL_VARIABLES += JDK_FILTER SPEC_FILTER \ + TEST TEST_JOBS JTREG GTEST MICRO TEST_OPTS TEST_VM_OPTS TEST_DEPS + + ALL_CONTROL_VARIABLES := $(INIT_CONTROL_VARIABLES) $(MAKE_CONTROL_VARIABLES) # Define a simple reverse function. # Should maybe move to MakeBase.gmk, but we can't include that file now. @@ -87,8 +90,10 @@ ifeq ($(HAS_SPEC), ) command_line_variables := $$(strip $$(foreach var, \ $$(subst \ ,_,$$(MAKEOVERRIDES)), \ $$(firstword $$(subst =, , $$(var))))) + allowed_command_line_variables := $$(strip $$(subst $$(COMMA), , $$(ALLOW))) unknown_command_line_variables := $$(strip \ - $$(filter-out $$(MAKE_CONTROL_VARIABLES), $$(command_line_variables))) + $$(filter-out $$(ALL_CONTROL_VARIABLES) $$(allowed_command_line_variables), \ + $$(command_line_variables))) ifneq ($$(unknown_command_line_variables), ) $$(info Note: Command line contains non-control variables:) $$(foreach var, $$(unknown_command_line_variables), $$(info * $$(var)=$$($$(var)))) @@ -211,13 +216,15 @@ ifeq ($(HAS_SPEC), ) $$(if $$(findstring $$(CONF), $$(var)), $$(var)))) endif ifneq ($$(filter $$(CONF), $$(matching_confs)), ) + ifneq ($$(word 2, $$(matching_confs)), ) + # Don't repeat this output on make restarts caused by including + # generated files. + ifeq ($$(MAKE_RESTARTS), ) + $$(info Using exact match for CONF=$$(CONF) (other matches are possible)) + endif + endif # If we found an exact match, use that matching_confs := $$(CONF) - # Don't repeat this output on make restarts caused by including - # generated files. - ifeq ($$(MAKE_RESTARTS), ) - $$(info Using exact match for CONF=$$(CONF) (other matches are possible)) - endif endif endif ifeq ($$(matching_confs), ) 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/basic.m4 b/make/autoconf/basic.m4 index f574174a12e8a..35eb63bea0c84 100644 --- a/make/autoconf/basic.m4 +++ b/make/autoconf/basic.m4 @@ -84,9 +84,15 @@ AC_DEFUN_ONCE([BASIC_SETUP_PATHS], # We get the top-level directory from the supporting wrappers. BASIC_WINDOWS_VERIFY_DIR($TOPDIR, source) + orig_topdir="$TOPDIR" UTIL_FIXUP_PATH(TOPDIR) AC_MSG_CHECKING([for top-level directory]) AC_MSG_RESULT([$TOPDIR]) + if test "x$TOPDIR" != "x$orig_topdir"; then + AC_MSG_WARN([Your top dir was originally represented as $orig_topdir,]) + AC_MSG_WARN([but after rewriting it became $TOPDIR.]) + AC_MSG_WARN([This typically means you have characters like space in the path, which can cause all kind of trouble.]) + fi AC_SUBST(TOPDIR) if test "x$CUSTOM_ROOT" != x; then diff --git a/make/autoconf/flags-cflags.m4 b/make/autoconf/flags-cflags.m4 index c1b873ed0ab42..38021267f42df 100644 --- a/make/autoconf/flags-cflags.m4 +++ b/make/autoconf/flags-cflags.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 @@ -235,9 +235,10 @@ AC_DEFUN([FLAGS_SETUP_WARNINGS], CFLAGS_WARNINGS_ARE_ERRORS="-Werror" # Additional warnings that are not activated by -Wall and -Wextra - WARNINGS_ENABLE_ADDITIONAL="-Wpointer-arith -Wreturn-type -Wsign-compare \ - -Wtrampolines -Wundef -Wunused-const-variable=1 -Wunused-function \ - -Wunused-result -Wunused-value -Wtype-limits -Wuninitialized" + WARNINGS_ENABLE_ADDITIONAL="-Winvalid-pch -Wpointer-arith -Wreturn-type \ + -Wsign-compare -Wtrampolines -Wtype-limits -Wundef -Wuninitialized \ + -Wunused-const-variable=1 -Wunused-function -Wunused-result \ + -Wunused-value" WARNINGS_ENABLE_ADDITIONAL_CXX="-Woverloaded-virtual -Wreorder" WARNINGS_ENABLE_ALL_CFLAGS="-Wall -Wextra -Wformat=2 $WARNINGS_ENABLE_ADDITIONAL" WARNINGS_ENABLE_ALL_CXXFLAGS="$WARNINGS_ENABLE_ALL_CFLAGS $WARNINGS_ENABLE_ADDITIONAL_CXX" @@ -564,8 +565,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++) @@ -736,6 +737,11 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP], # for all archs except arm and ppc, prevent gcc to omit frame pointer $1_CFLAGS_CPU_JDK="${$1_CFLAGS_CPU_JDK} -fno-omit-frame-pointer" fi + if test "x$FLAGS_CPU" = xppc64le; then + # Little endian machine uses ELFv2 ABI. + # Use Power8, this is the first CPU to support PPC64 LE with ELFv2 ABI. + $1_CFLAGS_CPU_JVM="${$1_CFLAGS_CPU_JVM} -DABI_ELFv2 -mcpu=power8 -mtune=power8" + fi fi if test "x$OPENJDK_TARGET_OS" = xaix; then $1_CFLAGS_CPU="-mcpu=pwr8" 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/autoconf/util_paths.m4 b/make/autoconf/util_paths.m4 index 7717150dfd9ea..9e3e5472c9e49 100644 --- a/make/autoconf/util_paths.m4 +++ b/make/autoconf/util_paths.m4 @@ -77,7 +77,10 @@ AC_DEFUN([UTIL_FIXUP_PATH], imported_path="" fi fi - if test "x$imported_path" != "x$path"; then + [ imported_path_lower=`$ECHO $imported_path | $TR '[:upper:]' '[:lower:]'` ] + [ orig_path_lower=`$ECHO $path | $TR '[:upper:]' '[:lower:]'` ] + # If only case differs, keep original path + if test "x$imported_path_lower" != "x$orig_path_lower"; then $1="$imported_path" fi else @@ -357,6 +360,8 @@ AC_DEFUN([UTIL_SETUP_TOOL], fi $1="$tool_command" fi + # Make sure we add fixpath if needed + UTIL_FIXUP_EXECUTABLE($1) if test "x$tool_args" != x; then # If we got arguments, re-append them to the command after the fixup. $1="[$]$1 $tool_args" 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/jib-profiles.js b/make/conf/jib-profiles.js index e6204d2995edb..9f04fce2ca6c5 100644 --- a/make/conf/jib-profiles.js +++ b/make/conf/jib-profiles.js @@ -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 @@ -1092,9 +1092,9 @@ var getJibProfilesDependencies = function (input, common) { windows_x64: "VS2022-17.6.5+1.0", linux_aarch64: "gcc13.2.0-OL7.6+1.0", linux_arm: "gcc8.2.0-Fedora27+1.0", - linux_ppc64le: "gcc8.2.0-Fedora27+1.0", - linux_s390x: "gcc8.2.0-Fedora27+1.0", - linux_riscv64: "gcc11.3.0-Fedora_rawhide_68692+1.1" + linux_ppc64le: "gcc13.2.0-Fedora_41+1.0", + linux_s390x: "gcc13.2.0-Fedora_41+1.0", + linux_riscv64: "gcc13.2.0-Fedora_41+1.0" }; var devkit_platform = (input.target_cpu == "x86" 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/devkit/Tools.gmk b/make/devkit/Tools.gmk index 300501f5f35ff..249eaa6624715 100644 --- a/make/devkit/Tools.gmk +++ b/make/devkit/Tools.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 @@ -63,18 +63,14 @@ ifeq ($(BASE_OS), OL) LINUX_VERSION := OL6.4 endif else ifeq ($(BASE_OS), Fedora) + DEFAULT_OS_VERSION := 41 + ifeq ($(BASE_OS_VERSION), ) + BASE_OS_VERSION := $(DEFAULT_OS_VERSION) + endif ifeq ($(ARCH), riscv64) - DEFAULT_OS_VERSION := rawhide/68692 - ifeq ($(BASE_OS_VERSION), ) - BASE_OS_VERSION := $(DEFAULT_OS_VERSION) - endif - BASE_URL := http://fedora.riscv.rocks/repos-dist/$(BASE_OS_VERSION)/$(ARCH)/Packages/ + BASE_URL := http://fedora.riscv.rocks/repos-dist/f$(BASE_OS_VERSION)/latest/$(ARCH)/Packages/ else - DEFAULT_OS_VERSION := 27 LATEST_ARCHIVED_OS_VERSION := 35 - ifeq ($(BASE_OS_VERSION), ) - BASE_OS_VERSION := $(DEFAULT_OS_VERSION) - endif ifeq ($(filter x86_64 armhfp, $(ARCH)), ) FEDORA_TYPE := fedora-secondary else @@ -203,7 +199,7 @@ RPM_LIST := \ glibc glibc-headers glibc-devel \ cups-libs cups-devel \ libX11 libX11-devel \ - xorg-x11-proto-devel \ + libxcb xorg-x11-proto-devel \ alsa-lib alsa-lib-devel \ libXext libXext-devel \ libXtst libXtst-devel \ @@ -441,8 +437,9 @@ $(gcc) \ # wants. $(BUILDDIR)/$(binutils_ver)/Makefile : CONFIG += --enable-64-bit-bfd --libdir=$(PREFIX)/$(word 1,$(LIBDIRS)) -ifneq ($(ARCH), riscv64) - # gold is not available for riscv64 for some reason, +ifeq ($(filter $(ARCH), s390x riscv64 ppc64le), ) + # gold compiles but cannot link properly on s390x @ gcc 13.2 and Fedore 41 + # gold is not available for riscv64 and ppc64le, # and subsequent linking will fail if we try to enable it. LINKER_CONFIG := --enable-gold=default endif 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/hotspot/lib/JvmOverrideFiles.gmk b/make/hotspot/lib/JvmOverrideFiles.gmk index 6a513e10c61d4..20776afded8e3 100644 --- a/make/hotspot/lib/JvmOverrideFiles.gmk +++ b/make/hotspot/lib/JvmOverrideFiles.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 @@ -52,15 +52,23 @@ ifneq ($(FDLIBM_CFLAGS), ) endif ifeq ($(call isTargetOs, linux), true) - BUILD_LIBJVM_sharedRuntimeTrig.cpp_CXXFLAGS := -DNO_PCH $(FDLIBM_CFLAGS) $(LIBJVM_FDLIBM_COPY_OPT_FLAG) - BUILD_LIBJVM_sharedRuntimeTrans.cpp_CXXFLAGS := -DNO_PCH $(FDLIBM_CFLAGS) $(LIBJVM_FDLIBM_COPY_OPT_FLAG) + BUILD_LIBJVM_sharedRuntimeTrig.cpp_CXXFLAGS := $(FDLIBM_CFLAGS) $(LIBJVM_FDLIBM_COPY_OPT_FLAG) + BUILD_LIBJVM_sharedRuntimeTrans.cpp_CXXFLAGS := $(FDLIBM_CFLAGS) $(LIBJVM_FDLIBM_COPY_OPT_FLAG) ifeq ($(TOOLCHAIN_TYPE), clang) JVM_PRECOMPILED_HEADER_EXCLUDE := \ - sharedRuntimeTrig.cpp \ - sharedRuntimeTrans.cpp \ + sharedRuntimeTrig.cpp \ + sharedRuntimeTrans.cpp \ + $(OPT_SPEED_SRC) \ + # + endif + + ifeq ($(call isTargetCpu, ppc64le)+$(TOOLCHAIN_TYPE), true+gcc) + JVM_PRECOMPILED_HEADER_EXCLUDE := \ + sharedRuntimeTrig.cpp \ + sharedRuntimeTrans.cpp \ $(OPT_SPEED_SRC) \ - # + # endif ifeq ($(call isTargetCpu, x86), true) 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.incubator.vector/Lib.gmk b/make/modules/jdk.incubator.vector/Lib.gmk index 69da7ed059a6c..7d2ef440b6714 100644 --- a/make/modules/jdk.incubator.vector/Lib.gmk +++ b/make/modules/jdk.incubator.vector/Lib.gmk @@ -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 @@ -64,7 +64,7 @@ ifeq ($(call isTargetOs, linux)+$(call isTargetCpu, aarch64)+$(INCLUDE_COMPILER2 EXTRA_SRC := libsleef/generated, \ DISABLED_WARNINGS_gcc := unused-function sign-compare tautological-compare ignored-qualifiers, \ DISABLED_WARNINGS_clang := unused-function sign-compare tautological-compare ignored-qualifiers, \ - CFLAGS := $(SVE_CFLAGS), \ + vector_math_sve.c_CFLAGS := $(SVE_CFLAGS), \ )) TARGETS += $(BUILD_LIBSLEEF) 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/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..0c11d26a4766c 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" @@ -1218,15 +1217,24 @@ void LIR_Assembler::emit_alloc_array(LIR_OpAllocArray* op) { void LIR_Assembler::type_profile_helper(Register mdo, ciMethodData *md, ciProfileData *data, Register recv, Label* update_done) { + + // Given a profile data offset, generate an Address which points to + // the corresponding slot in mdo->data(). + // Clobbers rscratch2. + auto slot_at = [=](ByteSize offset) -> Address { + return __ form_address(rscratch2, mdo, + md->byte_offset_of_slot(data, offset), + LogBytesPerWord); + }; + for (uint i = 0; i < ReceiverTypeData::row_limit(); i++) { Label next_test; // See if the receiver is receiver[n]. - __ lea(rscratch2, Address(mdo, md->byte_offset_of_slot(data, ReceiverTypeData::receiver_offset(i)))); - __ ldr(rscratch1, Address(rscratch2)); + __ ldr(rscratch1, slot_at(ReceiverTypeData::receiver_offset(i))); __ cmp(recv, rscratch1); __ br(Assembler::NE, next_test); - Address data_addr(mdo, md->byte_offset_of_slot(data, ReceiverTypeData::receiver_count_offset(i))); - __ addptr(data_addr, DataLayout::counter_increment); + __ addptr(slot_at(ReceiverTypeData::receiver_count_offset(i)), + DataLayout::counter_increment); __ b(*update_done); __ bind(next_test); } @@ -1234,15 +1242,12 @@ void LIR_Assembler::type_profile_helper(Register mdo, // Didn't find receiver; find next empty slot and fill it in for (uint i = 0; i < ReceiverTypeData::row_limit(); i++) { Label next_test; - __ lea(rscratch2, - Address(mdo, md->byte_offset_of_slot(data, ReceiverTypeData::receiver_offset(i)))); - Address recv_addr(rscratch2); + Address recv_addr(slot_at(ReceiverTypeData::receiver_offset(i))); __ ldr(rscratch1, recv_addr); __ cbnz(rscratch1, next_test); __ str(recv, recv_addr); __ mov(rscratch1, DataLayout::counter_increment); - __ lea(rscratch2, Address(mdo, md->byte_offset_of_slot(data, ReceiverTypeData::receiver_count_offset(i)))); - __ str(rscratch1, Address(rscratch2)); + __ str(rscratch1, slot_at(ReceiverTypeData::receiver_count_offset(i))); __ b(*update_done); __ bind(next_test); } @@ -1414,8 +1419,7 @@ void LIR_Assembler::emit_opTypeCheck(LIR_OpTypeCheck* op) { // Object is null; update MDO and exit Address data_addr = __ form_address(rscratch2, mdo, - md->byte_offset_of_slot(data, DataLayout::flags_offset()), - 0); + md->byte_offset_of_slot(data, DataLayout::flags_offset()), 0); __ ldrb(rscratch1, data_addr); __ orr(rscratch1, rscratch1, BitData::null_seen_byte_constant()); __ strb(rscratch1, data_addr); @@ -2566,10 +2570,12 @@ void LIR_Assembler::emit_profile_call(LIR_OpProfileCall* op) { for (i = 0; i < VirtualCallData::row_limit(); i++) { ciKlass* receiver = vc_data->receiver(i); if (receiver == nullptr) { - Address recv_addr(mdo, md->byte_offset_of_slot(data, VirtualCallData::receiver_offset(i))); __ mov_metadata(rscratch1, known_klass->constant_encoding()); - __ lea(rscratch2, recv_addr); - __ str(rscratch1, Address(rscratch2)); + Address recv_addr = + __ form_address(rscratch2, mdo, + md->byte_offset_of_slot(data, VirtualCallData::receiver_offset(i)), + LogBytesPerWord); + __ str(rscratch1, recv_addr); Address data_addr(mdo, md->byte_offset_of_slot(data, VirtualCallData::receiver_count_offset(i))); __ addptr(data_addr, DataLayout::counter_increment); return; 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 017e86a9dc30f..9892de21a8114 100644 --- a/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "compiler/compiler_globals.hpp" #include "gc/shared/barrierSet.hpp" 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.hpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp index 244de10d0e26c..bd537af59e471 100644 --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp @@ -1173,7 +1173,10 @@ class MacroAssembler: public Assembler { // Arithmetics + // Clobber: rscratch1, rscratch2 void addptr(const Address &dst, int32_t src); + + // Clobber: rscratch1 void cmpptr(Register src1, Address src2); void cmpoop(Register obj1, Register obj2); 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 6010ddd25fe33..b0b299876018a 100644 --- a/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "asm/macroAssembler.inline.hpp" #include "code/codeCache.hpp" 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 0a3240fa56efc..fbe06a6d78138 100644 --- a/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "classfile/javaClasses.hpp" #include "compiler/disassembler.hpp" 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 418e5145f71de..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" 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 b70a4b495b2cc..e9e6187a6d181 100644 --- a/src/hotspot/cpu/arm/interp_masm_arm.cpp +++ b/src/hotspot/cpu/arm/interp_masm_arm.cpp @@ -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/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 d84ae9d14d67a..3f1cd1e23de8c 100644 --- a/src/hotspot/cpu/arm/templateInterpreterGenerator_arm.cpp +++ b/src/hotspot/cpu/arm/templateInterpreterGenerator_arm.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/assembler.hpp" #include "asm/macroAssembler.inline.hpp" #include "classfile/javaClasses.hpp" 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/assembler_ppc.hpp b/src/hotspot/cpu/ppc/assembler_ppc.hpp index 68a0c78e7cfb3..11532edaad9ce 100644 --- a/src/hotspot/cpu/ppc/assembler_ppc.hpp +++ b/src/hotspot/cpu/ppc/assembler_ppc.hpp @@ -294,6 +294,8 @@ class Assembler : public AbstractAssembler { CLRRWI_OPCODE = RLWINM_OPCODE, CLRLWI_OPCODE = RLWINM_OPCODE, + RLWNM_OPCODE = (23u << OPCODE_SHIFT), + RLWIMI_OPCODE = (20u << OPCODE_SHIFT), SLW_OPCODE = (31u << OPCODE_SHIFT | 24u << 1), @@ -424,6 +426,9 @@ class Assembler : public AbstractAssembler { RLDIC_OPCODE = (30u << OPCODE_SHIFT | 2u << XO_27_29_SHIFT), // MD-FORM RLDIMI_OPCODE = (30u << OPCODE_SHIFT | 3u << XO_27_29_SHIFT), // MD-FORM + RLDCL_OPCODE = (30u << OPCODE_SHIFT | 8u << 1), + RLDCR_OPCODE = (30u << OPCODE_SHIFT | 9u << 1), + SRADI_OPCODE = (31u << OPCODE_SHIFT | 413u << XO_21_29_SHIFT), // XS-FORM SLD_OPCODE = (31u << OPCODE_SHIFT | 27u << 1), // X-FORM @@ -1696,6 +1701,14 @@ class Assembler : public AbstractAssembler { inline void insrdi( Register a, Register s, int n, int b); inline void insrwi( Register a, Register s, int n, int b); + // Rotate variable + inline void rlwnm( Register a, Register s, Register b, int mb, int me); + inline void rlwnm_(Register a, Register s, Register b, int mb, int me); + inline void rldcl( Register a, Register s, Register b, int mb); + inline void rldcl_(Register a, Register s, Register b, int mb); + inline void rldcr( Register a, Register s, Register b, int me); + inline void rldcr_(Register a, Register s, Register b, int me); + // PPC 1, section 3.3.2 Fixed-Point Load Instructions // 4 bytes inline void lwzx( Register d, Register s1, Register s2); diff --git a/src/hotspot/cpu/ppc/assembler_ppc.inline.hpp b/src/hotspot/cpu/ppc/assembler_ppc.inline.hpp index eae75da9fbff3..6bef4ec4a7b51 100644 --- a/src/hotspot/cpu/ppc/assembler_ppc.inline.hpp +++ b/src/hotspot/cpu/ppc/assembler_ppc.inline.hpp @@ -336,6 +336,13 @@ inline void Assembler::rldimi_( Register a, Register s, int sh6, int mb6) inline void Assembler::insrdi( Register a, Register s, int n, int b) { Assembler::rldimi(a, s, 64-(b+n), b); } inline void Assembler::insrwi( Register a, Register s, int n, int b) { Assembler::rlwimi(a, s, 32-(b+n), b, b+n-1); } +inline void Assembler::rlwnm( Register a, Register s, Register b, int mb, int me) { emit_int32(RLWNM_OPCODE | rta(a) | rs(s) | rb(b) | mb2125(mb) | me2630(me) | rc(0)); } +inline void Assembler::rlwnm_(Register a, Register s, Register b, int mb, int me) { emit_int32(RLWNM_OPCODE | rta(a) | rs(s) | rb(b) | mb2125(mb) | me2630(me) | rc(1)); } +inline void Assembler::rldcl( Register a, Register s, Register b, int mb) { emit_int32(RLDCL_OPCODE | rta(a) | rs(s) | rb(b) | mb2126(mb) | rc(0)); } +inline void Assembler::rldcl_( Register a, Register s, Register b, int mb) { emit_int32(RLDCL_OPCODE | rta(a) | rs(s) | rb(b) | mb2126(mb) | rc(1)); } +inline void Assembler::rldcr( Register a, Register s, Register b, int me) { emit_int32(RLDCR_OPCODE | rta(a) | rs(s) | rb(b) | me2126(me) | rc(0)); } +inline void Assembler::rldcr_( Register a, Register s, Register b, int me) { emit_int32(RLDCR_OPCODE | rta(a) | rs(s) | rb(b) | me2126(me) | rc(1)); } + // PPC 1, section 3.3.2 Fixed-Point Load Instructions inline void Assembler::lwzx( Register d, Register s1, Register s2) { emit_int32(LWZX_OPCODE | rt(d) | ra0mem(s1) | rb(s2));} inline void Assembler::lwz( Register d, Address &a) { 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..99e46a5cba5b0 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" @@ -603,10 +602,9 @@ OopMapSet* Runtime1::generate_code_for(C1StubId id, StubAssembler* sasm) { { // Support for uint StubRoutine::partial_subtype_check( Klass sub, Klass super ); const Register sub_klass = R5, super_klass = R4, - temp1_reg = R6, - temp2_reg = R0; - __ check_klass_subtype_slow_path(sub_klass, super_klass, temp1_reg, temp2_reg); // returns with CR0.eq if successful - __ crandc(CCR0, Assembler::equal, CCR0, Assembler::equal); // failed: CR0.ne + temp1_reg = R6; + __ check_klass_subtype_slow_path(sub_klass, super_klass, temp1_reg, noreg); + // Result is in CR0. __ blr(); } break; 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 e097adb1dbfc6..ffbcb083f3cd1 100644 --- a/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp +++ b/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp @@ -24,7 +24,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/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..e85f6c112298a 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" @@ -2107,16 +2106,17 @@ void MacroAssembler::check_klass_subtype_fast_path(Register sub_klass, #undef FINAL_JUMP } -void MacroAssembler::check_klass_subtype_slow_path(Register sub_klass, - Register super_klass, - Register temp1_reg, - Register temp2_reg, - Label* L_success, - Register result_reg) { +void MacroAssembler::check_klass_subtype_slow_path_linear(Register sub_klass, + Register super_klass, + Register temp1_reg, + Register temp2_reg, + Label* L_success, + Register result_reg) { const Register array_ptr = temp1_reg; // current value from cache array const Register temp = temp2_reg; assert_different_registers(sub_klass, super_klass, array_ptr, temp); + assert(L_success == nullptr || result_reg == noreg, "can't have both"); int source_offset = in_bytes(Klass::secondary_supers_offset()); int target_offset = in_bytes(Klass::secondary_super_cache_offset()); @@ -2131,7 +2131,7 @@ void MacroAssembler::check_klass_subtype_slow_path(Register sub_klass, // TODO: PPC port: assert(4 == arrayOopDesc::length_length_in_bytes(), "precondition violated."); lwz(temp, length_offset, array_ptr); cmpwi(CCR0, temp, 0); - beq(CCR0, result_reg!=noreg ? failure : fallthru); // length 0 + beq(CCR0, (L_success == nullptr) ? failure : fallthru); // indicate failure if length 0 mtctr(temp); // load ctr @@ -2144,18 +2144,111 @@ void MacroAssembler::check_klass_subtype_slow_path(Register sub_klass, bdnz(loop); bind(failure); - if (result_reg!=noreg) li(result_reg, 1); // load non-zero result (indicates a miss) + if (result_reg != noreg) { + li(result_reg, 1); // load non-zero result (indicates a miss) + } else if (L_success == nullptr) { + crandc(CCR0, Assembler::equal, CCR0, Assembler::equal); // miss indicated by CR0.ne + } b(fallthru); bind(hit); std(super_klass, target_offset, sub_klass); // save result to cache - if (result_reg != noreg) { li(result_reg, 0); } // load zero result (indicates a hit) - if (L_success != nullptr) { b(*L_success); } - else if (result_reg == noreg) { blr(); } // return with CR0.eq if neither label nor result reg provided + if (result_reg != noreg) { + li(result_reg, 0); // load zero result (indicates a hit) + } else if (L_success != nullptr) { + b(*L_success); + } bind(fallthru); } +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; +} + +void MacroAssembler::push_set(RegSet set) +{ + int spill_offset = 0; + for (RegSetIterator it = set.begin(); *it != noreg; ++it) { + spill_offset += wordSize; + std(*it, -spill_offset, R1_SP); + } +} + +void MacroAssembler::pop_set(RegSet set) +{ + int spill_offset = 0; + for (RegSetIterator it = set.begin(); *it != noreg; ++it) { + spill_offset += wordSize; + ld(*it, -spill_offset, R1_SP); + } +} + +void MacroAssembler::check_klass_subtype_slow_path_table(Register sub_klass, + Register super_klass, + Register temp1_reg, + Register temp2_reg, + Label* L_success, + Register result_reg) { + RegSet temps = RegSet::of(temp1_reg, temp2_reg); + + assert_different_registers(sub_klass, super_klass, temp1_reg, temp2_reg, result_reg, R0); + + Register temp3_reg = noreg, temp4_reg = noreg; + bool result_reg_provided = (result_reg != noreg); // otherwise, result will be in CR0 + + BLOCK_COMMENT("check_klass_subtype_slow_path_table"); + + RegSetIterator available_regs + = (RegSet::range(R2, R12) - temps - sub_klass - super_klass).begin(); + + RegSet pushed_regs; + + temp1_reg = allocate_if_noreg(temp1_reg, available_regs, pushed_regs); + temp2_reg = allocate_if_noreg(temp2_reg, available_regs, pushed_regs); + temp3_reg = allocate_if_noreg(temp3_reg, available_regs, pushed_regs); + temp4_reg = allocate_if_noreg(temp4_reg, available_regs, pushed_regs); + result_reg = allocate_if_noreg(result_reg, available_regs, pushed_regs); + + push_set(pushed_regs); + + lookup_secondary_supers_table_var(sub_klass, super_klass, + temp1_reg, temp2_reg, temp3_reg, temp4_reg, + result_reg); + + if (L_success != nullptr || !result_reg_provided) { + // result_reg may get overwritten by pop_set + cmpdi(CCR0, result_reg, 0); + } + + // Unspill the temp. registers: + pop_set(pushed_regs); + + if (L_success != nullptr) { + beq(CCR0, *L_success); + } +} + +void MacroAssembler::check_klass_subtype_slow_path(Register sub_klass, + Register super_klass, + Register temp1_reg, + Register temp2_reg, + Label* L_success, + Register result_reg) { + if (UseSecondarySupersTable) { + check_klass_subtype_slow_path_table(sub_klass, super_klass, temp1_reg, temp2_reg, L_success, result_reg); + } else { + if (temp2_reg == noreg) temp2_reg = R0; + check_klass_subtype_slow_path_linear(sub_klass, super_klass, temp1_reg, temp2_reg, L_success, result_reg); + } +} + // Try fast path, then go to slow one if not successful void MacroAssembler::check_klass_subtype(Register sub_klass, Register super_klass, @@ -2208,19 +2301,19 @@ do { \ (result == R8_ARG6 || result == noreg), "registers must match ppc64.ad"); \ } while(0) -void MacroAssembler::lookup_secondary_supers_table(Register r_sub_klass, - Register r_super_klass, - Register temp1, - Register temp2, - Register temp3, - Register temp4, - Register result, - u1 super_klass_slot) { +void MacroAssembler::lookup_secondary_supers_table_const(Register r_sub_klass, + Register r_super_klass, + Register temp1, + Register temp2, + Register temp3, + Register temp4, + Register result, + u1 super_klass_slot) { assert_different_registers(r_sub_klass, r_super_klass, temp1, temp2, temp3, temp4, result); Label L_done; - BLOCK_COMMENT("lookup_secondary_supers_table {"); + BLOCK_COMMENT("lookup_secondary_supers_table_const {"); const Register r_array_base = temp1, @@ -2228,7 +2321,7 @@ void MacroAssembler::lookup_secondary_supers_table(Register r_sub_klass, r_array_index = temp3, r_bitmap = temp4; - LOOKUP_SECONDARY_SUPERS_TABLE_REGISTERS; + LOOKUP_SECONDARY_SUPERS_TABLE_REGISTERS; // Required for stub call below. ld(r_bitmap, in_bytes(Klass::secondary_supers_bitmap_offset()), r_sub_klass); @@ -2290,7 +2383,90 @@ void MacroAssembler::lookup_secondary_supers_table(Register r_sub_klass, bctrl(); bind(L_done); - BLOCK_COMMENT("} lookup_secondary_supers_table"); + BLOCK_COMMENT("} lookup_secondary_supers_table_const"); + + if (VerifySecondarySupers) { + verify_secondary_supers_table(r_sub_klass, r_super_klass, result, + temp1, temp2, temp3); + } +} + +// 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 temp1, + Register temp2, + Register temp3, + Register temp4, + Register result) { + assert_different_registers(r_sub_klass, r_super_klass, temp1, temp2, temp3, temp4, result, R0); + + Label L_done; + + BLOCK_COMMENT("lookup_secondary_supers_table_var {"); + + const Register + r_array_base = temp1, + slot = temp2, + r_array_index = temp3, + r_bitmap = temp4; + + lbz(slot, in_bytes(Klass::hash_slot_offset()), r_super_klass); + ld(r_bitmap, in_bytes(Klass::secondary_supers_bitmap_offset()), r_sub_klass); + + li(result, 1); // Make sure that result is nonzero if the test below misses. + + // 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. + xori(R0, slot, Klass::SECONDARY_SUPERS_TABLE_SIZE - 1); // slot ^ 63 === 63 - slot (mod 64) + sld_(r_array_index, r_bitmap, R0); // shift left by 63-slot + + // We test the MSB of r_array_index, i.e. its sign bit + bge(CCR0, L_done); + + // We will consult the secondary-super array. + ld(r_array_base, in_bytes(Klass::secondary_supers_offset()), r_sub_klass); + + // 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"); + + // Get the first array index that can contain super_klass into r_array_index. + popcntd(r_array_index, r_array_index); + + // NB! r_array_index is off by 1. It is compensated by keeping r_array_base off by 1 word. + sldi(r_array_index, r_array_index, LogBytesPerWord); // scale + + ldx(R0, r_array_base, r_array_index); + xor_(result, R0, r_super_klass); + beq(CCR0, L_done); // found a match, result is 0 in this case + + // Linear probe. Rotate the bitmap so that the next bit to test is + // in Bit 1. + neg(R0, slot); // rotate right + rldcl(r_bitmap, r_bitmap, R0, 0); + Register temp = slot; + andi_(temp, r_bitmap, 2); + beq(CCR0, L_done); // fail (result != 0) + + // 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, temp); + // return whatever we got from slow path + + bind(L_done); + + BLOCK_COMMENT("} lookup_secondary_supers_table_var"); if (VerifySecondarySupers) { verify_secondary_supers_table(r_sub_klass, r_super_klass, result, @@ -2313,8 +2489,6 @@ void MacroAssembler::lookup_secondary_supers_table_slow_path(Register r_super_kl r_array_length = temp1, r_sub_klass = noreg; - LOOKUP_SECONDARY_SUPERS_TABLE_REGISTERS; - Label L_done; // Load the array length. @@ -2405,8 +2579,6 @@ void MacroAssembler::verify_secondary_supers_table(Register r_sub_klass, r_array_index = temp3, r_bitmap = noreg; // unused - LOOKUP_SECONDARY_SUPERS_TABLE_REGISTERS; - BLOCK_COMMENT("verify_secondary_supers_table {"); Label passed, failure; @@ -2433,13 +2605,17 @@ void MacroAssembler::verify_secondary_supers_table(Register r_sub_klass, cmpd(CCR0, result, linear_result); beq(CCR0, passed); - assert_different_registers(R3_ARG1, r_sub_klass, linear_result, result); - mr_if_needed(R3_ARG1, r_super_klass); - assert_different_registers(R4_ARG2, linear_result, result); - mr_if_needed(R4_ARG2, r_sub_klass); - assert_different_registers(R5_ARG3, result); - neg(R5_ARG3, linear_result); - neg(R6_ARG4, result); + // report fatal error and terminate VM + + // Argument shuffle. Using stack to avoid clashes. + std(r_super_klass, -8, R1_SP); + std(r_sub_klass, -16, R1_SP); + std(linear_result, -24, R1_SP); + mr_if_needed(R6_ARG4, result); + ld(R3_ARG1, -8, R1_SP); + ld(R4_ARG2, -16, R1_SP); + ld(R5_ARG3, -24, R1_SP); + const char* msg = "mismatch"; load_const_optimized(R7_ARG5, (intptr_t)msg, R0); call_VM_leaf(CAST_FROM_FN_PTR(address, Klass::on_secondary_supers_verification_failure)); diff --git a/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp b/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp index 3e82c1c678578..6ea3b853cd762 100644 --- a/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp +++ b/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp @@ -612,6 +612,20 @@ class MacroAssembler: public Assembler { // The temp_reg can be noreg, if no temps are available. // It can also be sub_klass or super_klass, meaning it's OK to kill that one. // Updates the sub's secondary super cache as necessary. + void check_klass_subtype_slow_path_linear(Register sub_klass, + Register super_klass, + Register temp1_reg, + Register temp2_reg, + Label* L_success = nullptr, + Register result_reg = noreg); + + void check_klass_subtype_slow_path_table(Register sub_klass, + Register super_klass, + Register temp1_reg, + Register temp2_reg, + Label* L_success = nullptr, + Register result_reg = noreg); + void check_klass_subtype_slow_path(Register sub_klass, Register super_klass, Register temp1_reg, @@ -619,6 +633,25 @@ class MacroAssembler: public Assembler { Label* L_success = nullptr, Register result_reg = noreg); + void lookup_secondary_supers_table_var(Register sub_klass, + Register r_super_klass, + Register temp1, + Register temp2, + Register temp3, + Register temp4, + Register result); + + // 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); + + // Frameless register spills (negative offset from SP) + void push_set(RegSet set); + void pop_set(RegSet set); + // Simplified, combined version, good for typical uses. // Falls through on failure. void check_klass_subtype(Register sub_klass, @@ -631,14 +664,14 @@ class MacroAssembler: public Assembler { // As above, but with a constant super_klass. // The result is in Register result, not the condition codes. - void lookup_secondary_supers_table(Register r_sub_klass, - Register r_super_klass, - Register temp1, - Register temp2, - Register temp3, - Register temp4, - Register result, - u1 super_klass_slot); + void lookup_secondary_supers_table_const(Register r_sub_klass, + Register r_super_klass, + Register temp1, + Register temp2, + Register temp3, + Register temp4, + Register result, + u1 super_klass_slot); void verify_secondary_supers_table(Register r_sub_klass, Register r_super_klass, 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/ppc.ad b/src/hotspot/cpu/ppc/ppc.ad index 808dd02273895..38a0d480ec5ab 100644 --- a/src/hotspot/cpu/ppc/ppc.ad +++ b/src/hotspot/cpu/ppc/ppc.ad @@ -12069,6 +12069,7 @@ instruct branchLoopEndFar(cmpOp cmp, flagsRegSrc crx, label labl) %{ instruct partialSubtypeCheck(iRegPdst result, iRegP_N2P subklass, iRegP_N2P superklass, iRegPdst tmp_klass, iRegPdst tmp_arrayptr) %{ match(Set result (PartialSubtypeCheck subklass superklass)); + predicate(!UseSecondarySupersTable); effect(TEMP_DEF result, TEMP tmp_klass, TEMP tmp_arrayptr); ins_cost(DEFAULT_COST*10); @@ -12080,6 +12081,30 @@ instruct partialSubtypeCheck(iRegPdst result, iRegP_N2P subklass, iRegP_N2P supe ins_pipe(pipe_class_default); %} +// 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(iRegPsrc sub, iRegPsrc super, iRegPdst result, + iRegPdst tempR1, iRegPdst tempR2, iRegPdst tempR3, iRegPdst tempR4, + flagsRegCR0 cr0, regCTR ctr) +%{ + match(Set result (PartialSubtypeCheck sub super)); + predicate(UseSecondarySupersTable); + effect(KILL cr0, KILL ctr, TEMP_DEF result, TEMP tempR1, TEMP tempR2, TEMP tempR3, TEMP tempR4); + + ins_cost(DEFAULT_COST * 10); // slightly larger than the next version + format %{ "partialSubtypeCheck $result, $sub, $super" %} + ins_encode %{ + __ lookup_secondary_supers_table_var($sub$$Register, $super$$Register, + $tempR1$$Register, $tempR2$$Register, $tempR3$$Register, $tempR4$$Register, + $result$$Register); + %} + ins_pipe(pipe_class_memory); +%} + instruct partialSubtypeCheckConstSuper(rarg3RegP sub, rarg2RegP super_reg, immP super_con, rarg6RegP result, rarg1RegP tempR1, rarg5RegP tempR2, rarg4RegP tempR3, rscratch1RegP tempR4, flagsRegCR0 cr0, regCTR ctr) @@ -12094,9 +12119,9 @@ instruct partialSubtypeCheckConstSuper(rarg3RegP sub, rarg2RegP super_reg, immP ins_encode %{ u1 super_klass_slot = ((Klass*)$super_con$$constant)->hash_slot(); if (InlineSecondarySupersTest) { - __ lookup_secondary_supers_table($sub$$Register, $super_reg$$Register, - $tempR1$$Register, $tempR2$$Register, $tempR3$$Register, $tempR4$$Register, - $result$$Register, super_klass_slot); + __ lookup_secondary_supers_table_const($sub$$Register, $super_reg$$Register, + $tempR1$$Register, $tempR2$$Register, $tempR3$$Register, $tempR4$$Register, + $result$$Register, super_klass_slot); } else { address stub = StubRoutines::lookup_secondary_supers_table_stub(super_klass_slot); Register r_stub_addr = $tempR1$$Register; 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 bad1a037b9a20..95544045ff7a7 100644 --- a/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp +++ b/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "code/debugInfoRec.hpp" #include "code/compiledIC.hpp" diff --git a/src/hotspot/cpu/ppc/stubGenerator_ppc.cpp b/src/hotspot/cpu/ppc/stubGenerator_ppc.cpp index f1168b5d07bf2..f32e62560721f 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" @@ -2039,7 +2038,8 @@ class StubGenerator: public StubCodeGenerator { void generate_type_check(Register sub_klass, Register super_check_offset, Register super_klass, - Register temp, + Register temp1, + Register temp2, Label& L_success) { assert_different_registers(sub_klass, super_check_offset, super_klass); @@ -2047,9 +2047,9 @@ class StubGenerator: public StubCodeGenerator { Label L_miss; - __ check_klass_subtype_fast_path(sub_klass, super_klass, temp, R0, &L_success, &L_miss, nullptr, + __ check_klass_subtype_fast_path(sub_klass, super_klass, temp1, temp2, &L_success, &L_miss, nullptr, super_check_offset); - __ check_klass_subtype_slow_path(sub_klass, super_klass, temp, R0, &L_success); + __ check_klass_subtype_slow_path(sub_klass, super_klass, temp1, temp2, &L_success); // Fall through on failure! __ bind(L_miss); @@ -2079,8 +2079,7 @@ class StubGenerator: public StubCodeGenerator { const Register R10_oop = R10_ARG8; // actual oop copied const Register R11_klass = R11_scratch1; // oop._klass const Register R12_tmp = R12_scratch2; - - const Register R2_minus1 = R2; + const Register R2_tmp = R2; //__ align(CodeEntryAlignment); StubCodeMark mark(this, "StubRoutines", name); @@ -2118,7 +2117,6 @@ class StubGenerator: public StubCodeGenerator { Label load_element, store_element, store_null, success, do_epilogue; __ or_(R9_remain, R5_count, R5_count); // Initialize loop index, and test it. __ li(R8_offset, 0); // Offset from start of arrays. - __ li(R2_minus1, -1); __ bne(CCR0, load_element); // Empty array: Nothing to do. @@ -2146,7 +2144,7 @@ class StubGenerator: public StubCodeGenerator { } __ addi(R8_offset, R8_offset, heapOopSize); // Step to next offset. - __ add_(R9_remain, R2_minus1, R9_remain); // Decrement the count. + __ addic_(R9_remain, R9_remain, -1); // Decrement the count. __ beq(CCR0, success); // ======== loop entry is here ======== @@ -2166,7 +2164,7 @@ class StubGenerator: public StubCodeGenerator { __ load_klass(R11_klass, R10_oop); // Query the object klass. - generate_type_check(R11_klass, R6_ckoff, R7_ckval, R12_tmp, + generate_type_check(R11_klass, R6_ckoff, R7_ckval, R12_tmp, R2_tmp, // Branch to this on success: store_element); // ======== end loop ======== @@ -2500,7 +2498,7 @@ class StubGenerator: public StubCodeGenerator { int sco_offset = in_bytes(Klass::super_check_offset_offset()); __ lwz(sco_temp, sco_offset, dst_klass); generate_type_check(src_klass, sco_temp, dst_klass, - temp, L_disjoint_plain_copy); + temp, /* temp */ R10_ARG8, L_disjoint_plain_copy); // Fetch destination element klass from the ObjArrayKlass header. int ek_offset = in_bytes(ObjArrayKlass::element_klass_offset()); @@ -4458,9 +4456,9 @@ address generate_lookup_secondary_supers_table_stub(u1 super_klass_index) { r_bitmap = R11_scratch1, result = R8_ARG6; - __ lookup_secondary_supers_table(r_sub_klass, r_super_klass, - r_array_base, r_array_length, r_array_index, - r_bitmap, result, super_klass_index); + __ lookup_secondary_supers_table_const(r_sub_klass, r_super_klass, + r_array_base, r_array_length, r_array_index, + r_bitmap, result, super_klass_index); __ blr(); return start; 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 ec372bfb07d9d..c8b5dbe0c163e 100644 --- a/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp +++ b/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "classfile/javaClasses.hpp" #include "compiler/disassembler.hpp" 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 a9d601edbbef5..3a638357f0b37 100644 --- a/src/hotspot/cpu/riscv/assembler_riscv.hpp +++ b/src/hotspot/cpu/riscv/assembler_riscv.hpp @@ -330,7 +330,104 @@ class InternalAddress: public Address { }; class Assembler : public AbstractAssembler { -public: +protected: + + static int zfa_zli_lookup_double(uint64_t value) { + switch(value) { + case 0xbff0000000000000 : return 0; + case 0x0010000000000000 : return 1; + case 0x3ef0000000000000 : return 2; + case 0x3f00000000000000 : return 3; + case 0x3f70000000000000 : return 4; + case 0x3f80000000000000 : return 5; + case 0x3fb0000000000000 : return 6; + case 0x3fc0000000000000 : return 7; + case 0x3fd0000000000000 : return 8; + case 0x3fd4000000000000 : return 9; + case 0x3fd8000000000000 : return 10; + case 0x3fdc000000000000 : return 11; + case 0x3fe0000000000000 : return 12; + case 0x3fe4000000000000 : return 13; + case 0x3fe8000000000000 : return 14; + case 0x3fec000000000000 : return 15; + case 0x3ff0000000000000 : return 16; + case 0x3ff4000000000000 : return 17; + case 0x3ff8000000000000 : return 18; + case 0x3ffc000000000000 : return 19; + case 0x4000000000000000 : return 20; + case 0x4004000000000000 : return 21; + case 0x4008000000000000 : return 22; + case 0x4010000000000000 : return 23; + case 0x4020000000000000 : return 24; + case 0x4030000000000000 : return 25; + case 0x4060000000000000 : return 26; + case 0x4070000000000000 : return 27; + case 0x40e0000000000000 : return 28; + case 0x40f0000000000000 : return 29; + case 0x7ff0000000000000 : return 30; + case 0x7ff8000000000000 : return 31; + default: break; + } + return -1; + } + + + static int zfa_zli_lookup_float(uint32_t value) { + switch(value) { + case 0xbf800000 : return 0; + case 0x00800000 : return 1; + case 0x37800000 : return 2; + case 0x38000000 : return 3; + case 0x3b800000 : return 4; + case 0x3c000000 : return 5; + case 0x3d800000 : return 6; + case 0x3e000000 : return 7; + case 0x3e800000 : return 8; + case 0x3ea00000 : return 9; + case 0x3ec00000 : return 10; + case 0x3ee00000 : return 11; + case 0x3f000000 : return 12; + case 0x3f200000 : return 13; + case 0x3f400000 : return 14; + case 0x3f600000 : return 15; + case 0x3f800000 : return 16; + case 0x3fa00000 : return 17; + case 0x3fc00000 : return 18; + case 0x3fe00000 : return 19; + case 0x40000000 : return 20; + case 0x40200000 : return 21; + case 0x40400000 : return 22; + case 0x40800000 : return 23; + case 0x41000000 : return 24; + case 0x41800000 : return 25; + case 0x43000000 : return 26; + case 0x43800000 : return 27; + case 0x47000000 : return 28; + case 0x47800000 : return 29; + case 0x7f800000 : return 30; + case 0x7fc00000 : return 31; + default: break; + } + return -1; + } + + public: + + static bool can_zfa_zli_float(jfloat f) { + if (!UseZfa) { + return false; + } + uint32_t f_bits = (uint32_t)jint_cast(f); + return zfa_zli_lookup_float(f_bits) != -1; + } + + static bool can_zfa_zli_double(jdouble d) { + if (!UseZfa) { + return false; + } + uint64_t d_bits = (uint64_t)julong_cast(d); + return zfa_zli_lookup_double(d_bits) != -1; + } enum { instruction_size = 4, @@ -552,24 +649,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 +892,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 +905,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 +987,427 @@ 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); + } -// 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); \ + template + void fp_base(FloatRegister Rd, uint8_t Rs1, uint8_t Rs2, int8_t rm) { + guarantee(is_uimm5(Rs1), "Rs1 is out of validity"); + guarantee(is_uimm5(Rs2), "Rs2 is out of validity"); + fp_base(Rd->raw_encoding(), Rs1, Rs2, (RoundingMode)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); + public: -#undef 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); + } + + void fsqrt_d(FloatRegister Rd, FloatRegister Rs1, RoundingMode rm = rne) { + fp_base(Rd, Rs1, 0b00000, rm); + } + + 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); + } + +// -------------- ZFA Instruction Definitions -------------- +// Zfa Extension for Additional Floating-Point Instructions + void _fli_s(FloatRegister Rd, uint8_t Rs1) { + assert_cond(UseZfa); + fp_base(Rd, Rs1, 0b00001, 0b000); + } + + void _fli_d(FloatRegister Rd, uint8_t Rs1) { + assert_cond(UseZfa); + fp_base(Rd, Rs1, 0b00001, 0b000); + } // ========================== // RISC-V Vector Extension @@ -2230,7 +2507,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 +2524,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 +2545,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 +2602,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 +3227,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 +3255,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 +3270,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 +3347,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 +3679,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 029c4069c0700..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" diff --git a/src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.cpp b/src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.cpp index 6ac3ebe518497..c6af2de3cd420 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" @@ -426,6 +425,8 @@ void LIR_Assembler::const2reg(LIR_Opr src, LIR_Opr dest, LIR_PatchCode patch_cod assert(dest->is_register(), "should not call otherwise"); LIR_Const* c = src->as_constant_ptr(); address const_addr = nullptr; + jfloat fconst; + jdouble dconst; switch (c->type()) { case T_INT: @@ -461,15 +462,25 @@ void LIR_Assembler::const2reg(LIR_Opr src, LIR_Opr dest, LIR_PatchCode patch_cod break; case T_FLOAT: - const_addr = float_constant(c->as_jfloat()); - assert(const_addr != nullptr, "must create float constant in the constant table"); - __ flw(dest->as_float_reg(), InternalAddress(const_addr)); + fconst = c->as_jfloat(); + if (MacroAssembler::can_fp_imm_load(fconst)) { + __ fli_s(dest->as_float_reg(), fconst); + } else { + const_addr = float_constant(fconst); + assert(const_addr != nullptr, "must create float constant in the constant table"); + __ flw(dest->as_float_reg(), InternalAddress(const_addr)); + } break; case T_DOUBLE: - const_addr = double_constant(c->as_jdouble()); - assert(const_addr != nullptr, "must create double constant in the constant table"); - __ fld(dest->as_double_reg(), InternalAddress(const_addr)); + dconst = c->as_jdouble(); + if (MacroAssembler::can_dp_imm_load(dconst)) { + __ fli_d(dest->as_double_reg(), dconst); + } else { + const_addr = double_constant(c->as_jdouble()); + assert(const_addr != nullptr, "must create double constant in the constant table"); + __ fld(dest->as_double_reg(), InternalAddress(const_addr)); + } break; default: 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 10aa5514fdf3e..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" @@ -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 717f10ca30d57..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" @@ -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 d04f48713eda7..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" @@ -2059,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); @@ -2153,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); @@ -2369,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/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 7d5f630d0aa37..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" 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 e5d4952e1728c..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" 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 316dae5ead1bf..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" 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 8ae97492affda..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" 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 ad4f243e5e1e3..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" diff --git a/src/hotspot/cpu/riscv/globals_riscv.hpp b/src/hotspot/cpu/riscv/globals_riscv.hpp index 806cca16269ea..36c32d90cb3ee 100644 --- a/src/hotspot/cpu/riscv/globals_riscv.hpp +++ b/src/hotspot/cpu/riscv/globals_riscv.hpp @@ -103,7 +103,9 @@ define_pd_global(intx, InlineSmallCode, 1000); product(bool, UseZba, false, DIAGNOSTIC, "Use Zba instructions") \ product(bool, UseZbb, false, DIAGNOSTIC, "Use Zbb instructions") \ product(bool, UseZbs, false, DIAGNOSTIC, "Use Zbs instructions") \ + product(bool, UseZfa, false, EXPERIMENTAL, "Use Zfa 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 605a8124e6cd5..c132f9cda7a08 100644 --- a/src/hotspot/cpu/riscv/interp_masm_riscv.cpp +++ b/src/hotspot/cpu/riscv/interp_masm_riscv.cpp @@ -24,7 +24,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/riscv/interpreterRT_riscv.cpp b/src/hotspot/cpu/riscv/interpreterRT_riscv.cpp index 602aacb99485c..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" 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 f0e5992b04b65..61261a1721300 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" @@ -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); } @@ -2605,6 +2593,45 @@ void MacroAssembler::movptr2(Register Rd, uint64_t addr, int32_t &offset, Regist offset = lower12; } +// floating point imm move +bool MacroAssembler::can_fp_imm_load(float imm) { + jint f_bits = jint_cast(imm); + if (f_bits == 0) { + return true; + } + return can_zfa_zli_float(imm); +} + +bool MacroAssembler::can_dp_imm_load(double imm) { + julong d_bits = julong_cast(imm); + if (d_bits == 0) { + return true; + } + return can_zfa_zli_double(imm); +} + +void MacroAssembler::fli_s(FloatRegister Rd, float imm) { + jint f_bits = jint_cast(imm); + if (f_bits == 0) { + fmv_w_x(Rd, zr); + return; + } + int Rs = zfa_zli_lookup_float(f_bits); + assert(Rs != -1, "Must be"); + _fli_s(Rd, Rs); +} + +void MacroAssembler::fli_d(FloatRegister Rd, double imm) { + uint64_t d_bits = (uint64_t)julong_cast(imm); + if (d_bits == 0) { + fmv_d_x(Rd, zr); + return; + } + int Rs = zfa_zli_lookup_double(d_bits); + assert(Rs != -1, "Must be"); + _fli_d(Rd, Rs); +} + void MacroAssembler::add(Register Rd, Register Rn, int64_t increment, Register tmp) { if (is_simm12(increment)) { addi(Rd, Rn, increment); @@ -2619,7 +2646,7 @@ void MacroAssembler::sub(Register Rd, Register Rn, int64_t decrement, Register t add(Rd, Rn, -decrement, tmp); } -void MacroAssembler::addw(Register Rd, Register Rn, int32_t increment, Register tmp) { +void MacroAssembler::addw(Register Rd, Register Rn, int64_t increment, Register tmp) { if (is_simm12(increment)) { addiw(Rd, Rn, increment); } else { @@ -2629,7 +2656,7 @@ void MacroAssembler::addw(Register Rd, Register Rn, int32_t increment, Register } } -void MacroAssembler::subw(Register Rd, Register Rn, int32_t decrement, Register tmp) { +void MacroAssembler::subw(Register Rd, Register Rn, int64_t decrement, Register tmp) { addw(Rd, Rn, -decrement, tmp); } @@ -2869,6 +2896,24 @@ void MacroAssembler::revb(Register Rd, Register Rs, Register tmp1, Register tmp2 orr(Rd, tmp1, Rd); } +// rotate right with shift bits +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) { @@ -2901,16 +2946,6 @@ void MacroAssembler::rolw(Register dst, Register src, uint32_t shift, Register t 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 +4112,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 +4151,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 +4164,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); @@ -4159,12 +4192,13 @@ void MacroAssembler::repne_scan(Register addr, Register value, Register count, 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); @@ -4238,7 +4272,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 +4315,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 +4427,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; @@ -4379,6 +4511,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 +4611,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 +4649,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); @@ -4475,9 +4704,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. @@ -5699,7 +5925,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); \ @@ -6142,10 +6368,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); } } diff --git a/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp b/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp index b2e79edd96341..41ccd0c4b2f74 100644 --- a/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp +++ b/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp @@ -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); @@ -884,19 +920,24 @@ class MacroAssembler: public Assembler { void movptr1(Register Rd, uintptr_t addr, int32_t &offset); void movptr2(Register Rd, uintptr_t addr, int32_t &offset, Register tmp); public: + // float imm move + static bool can_fp_imm_load(float imm); + static bool can_dp_imm_load(double imm); + void fli_s(FloatRegister Rd, float imm); + void fli_d(FloatRegister Rd, double imm); // arith - 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, int32_t increment, Register tmp = t0); - void subw(Register Rd, Register Rn, int32_t decrement, Register tmp = 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, int32_t decrement) { + 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, int32_t decrement) { + void subiw(Register Rd, Register Rn, int64_t decrement) { assert(is_simm12(-decrement), "Must be"); addiw(Rd, Rn, -decrement); } @@ -926,9 +967,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(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 andi(Register Rd, Register Rn, int64_t imm, 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 a9b48fd18c406..b8660afb5fd4f 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 { @@ -4920,7 +4920,11 @@ instruct loadConF(fRegF dst, immF con) %{ %} ins_encode %{ - __ flw(as_FloatRegister($dst$$reg), $constantaddress($con)); + if (MacroAssembler::can_fp_imm_load($con$$constant)) { + __ fli_s(as_FloatRegister($dst$$reg), $con$$constant); + } else { + __ flw(as_FloatRegister($dst$$reg), $constantaddress($con)); + } %} ins_pipe(fp_load_constant_s); @@ -4950,7 +4954,11 @@ instruct loadConD(fRegD dst, immD con) %{ %} ins_encode %{ - __ fld(as_FloatRegister($dst$$reg), $constantaddress($con)); + if (MacroAssembler::can_dp_imm_load($con$$constant)) { + __ fli_d(as_FloatRegister($dst$$reg), $con$$constant); + } else { + __ fld(as_FloatRegister($dst$$reg), $constantaddress($con)); + } %} ins_pipe(fp_load_constant_d); @@ -7348,7 +7356,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 +7371,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 +7386,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 +7401,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 +10027,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 +10041,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 +10075,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 +10098,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/runtime_riscv.cpp b/src/hotspot/cpu/riscv/runtime_riscv.cpp index 33c1fb6e06bfd..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" @@ -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 f919bd9c53075..49e630bbfdf91 100644 --- a/src/hotspot/cpu/riscv/sharedRuntime_riscv.cpp +++ b/src/hotspot/cpu/riscv/sharedRuntime_riscv.cpp @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "asm/macroAssembler.inline.hpp" #include "code/compiledIC.hpp" @@ -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)); diff --git a/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp b/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp index 439162f01f105..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" @@ -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); @@ -1591,7 +1593,18 @@ class StubGenerator: public StubCodeGenerator { __ 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); @@ -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()); @@ -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(); 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 48eaa8533775a..79de9becbaedc 100644 --- a/src/hotspot/cpu/riscv/templateInterpreterGenerator_riscv.cpp +++ b/src/hotspot/cpu/riscv/templateInterpreterGenerator_riscv.cpp @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "classfile/javaClasses.hpp" #include "compiler/disassembler.hpp" diff --git a/src/hotspot/cpu/riscv/templateTable_riscv.cpp b/src/hotspot/cpu/riscv/templateTable_riscv.cpp index 59e9ab95d94b5..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" 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..68665d12378a7 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 // @@ -156,8 +157,11 @@ class VM_Version : public Abstract_VM_Version { decl(ext_Zbc , "Zbc" , RV_NO_FLAG_BIT, true , NO_UPDATE_DEFAULT) \ 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_Zfa , "Zfa" , RV_NO_FLAG_BIT, true , UPDATE_DEFAULT(UseZfa)) \ 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 +227,8 @@ class VM_Version : public Abstract_VM_Version { RV_ENABLE_EXTENSION(UseZbb) \ RV_ENABLE_EXTENSION(UseZbs) \ RV_ENABLE_EXTENSION(UseZcb) \ + RV_ENABLE_EXTENSION(UseZfa) \ + 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 0e31dbd33e198..cb335e407347b 100644 --- a/src/hotspot/cpu/s390/interp_masm_s390.cpp +++ b/src/hotspot/cpu/s390/interp_masm_s390.cpp @@ -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" 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 3647aca0008b8..83a5c61bfc6c1 100644 --- a/src/hotspot/cpu/s390/macroAssembler_s390.cpp +++ b/src/hotspot/cpu/s390/macroAssembler_s390.cpp @@ -24,7 +24,6 @@ * */ -#include "precompiled.hpp" #include "asm/codeBuffer.hpp" #include "asm/macroAssembler.inline.hpp" #include "code/compiledIC.hpp" 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 62f5c8fa524b4..9716a5d71b3e6 100644 --- a/src/hotspot/cpu/s390/sharedRuntime_s390.cpp +++ b/src/hotspot/cpu/s390/sharedRuntime_s390.cpp @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "code/debugInfoRec.hpp" #include "code/vtableStubs.hpp" 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 99179bcad0611..c40be5edec754 100644 --- a/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp +++ b/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "classfile/javaClasses.hpp" #include "compiler/disassembler.hpp" 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 ff5b1c1454dfc..44087663a34b5 100644 --- a/src/hotspot/cpu/x86/interp_masm_x86.cpp +++ b/src/hotspot/cpu/x86/interp_masm_x86.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "compiler/compiler_globals.hpp" #include "interp_masm_x86.hpp" #include "interpreter/interpreter.hpp" 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 b9901a1e95bf7..bbe62db33f00e 100644 --- a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp +++ b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #ifndef _WINDOWS #include "alloca.h" #endif @@ -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 b4e005faff3b9..548243cba838d 100644 --- a/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp +++ b/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "classfile/javaClasses.hpp" #include "compiler/compiler_globals.hpp" 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 b2124c6b157f4..af5c0fa94b1c0 100644 --- a/src/hotspot/cpu/x86/templateInterpreterGenerator_x86_64.cpp +++ b/src/hotspot/cpu/x86/templateInterpreterGenerator_x86_64.cpp @@ -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/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..57b8a37baf253 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" @@ -379,9 +378,10 @@ static void next_line(FILE *f) { } while (c != '\n' && c != EOF); } -void os::Linux::kernel_version(long* major, long* minor) { - *major = -1; - *minor = -1; +void os::Linux::kernel_version(long* major, long* minor, long* patch) { + *major = 0; + *minor = 0; + *patch = 0; struct utsname buffer; int ret = uname(&buffer); @@ -389,12 +389,29 @@ void os::Linux::kernel_version(long* major, long* minor) { log_warning(os)("uname(2) failed to get kernel version: %s", os::errno_name(ret)); return; } - int nr_matched = sscanf(buffer.release, "%ld.%ld", major, minor); - if (nr_matched != 2) { - log_warning(os)("Parsing kernel version failed, expected 2 version numbers, only matched %d", nr_matched); + int nr_matched = sscanf(buffer.release, "%ld.%ld.%ld", major, minor, patch); + if (nr_matched != 3) { + log_warning(os)("Parsing kernel version failed, expected 3 version numbers, only matched %d", nr_matched); } } +int os::Linux::kernel_version_compare(long major1, long minor1, long patch1, + long major2, long minor2, long patch2) { + // Compare major versions + if (major1 > major2) return 1; + if (major1 < major2) return -1; + + // Compare minor versions + if (minor1 > minor2) return 1; + if (minor1 < minor2) return -1; + + // Compare patchlevel versions + if (patch1 > patch2) return 1; + if (patch1 < patch2) return -1; + + return 0; +} + bool os::Linux::get_tick_information(CPUPerfTicks* pticks, int which_logical_cpu) { FILE* fh; uint64_t userTicks, niceTicks, systemTicks, idleTicks; @@ -847,7 +864,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 +880,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 +942,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 +1049,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 +1071,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 +1079,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 +1187,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 +1383,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 +1405,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 +1474,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 +2323,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 +2378,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 +2407,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 +2535,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 +2900,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 +3058,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 +3775,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 +3787,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 +3986,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 +4046,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 +4075,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 +4491,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 +4541,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 +5291,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..bd2e1ea323048 100644 --- a/src/hotspot/os/linux/os_linux.hpp +++ b/src/hotspot/os/linux/os_linux.hpp @@ -91,7 +91,13 @@ class os::Linux { }; static int active_processor_count(); - static void kernel_version(long* major, long* minor); + static void kernel_version(long* major, long* minor, long* patch); + + // If kernel1 > kernel2 return 1 + // If kernel1 < kernel2 return -1 + // If kernel1 = kernel2 return 0 + static int kernel_version_compare(long major1, long minor1, long patch1, + long major2, long minor2, long patch2); // which_logical_cpu=-1 returns accumulated ticks for all cpus. static bool get_tick_information(CPUPerfTicks* pticks, int which_logical_cpu); @@ -193,7 +199,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..766bb70a97710 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" @@ -67,11 +66,11 @@ bool LinuxSystemMemoryBarrier::initialize() { // RISCV port was introduced in kernel 4.4. // 4.4 also made membar private expedited mandatory. // But RISCV actually don't support it until 6.9. - long major, minor; - os::Linux::kernel_version(&major, &minor); - if (!(major > 6 || (major == 6 && minor >= 9))) { - log_info(os)("Linux kernel %ld.%ld does not support MEMBARRIER PRIVATE_EXPEDITED on RISC-V.", - major, minor); + long major, minor, patch; + os::Linux::kernel_version(&major, &minor, &patch); + if (os::Linux::kernel_version_compare(major, minor, patch, 6, 9, 0) == -1) { + log_info(os)("Linux kernel %ld.%ld.%ld does not support MEMBARRIER PRIVATE_EXPEDITED on RISC-V.", + major, minor, patch); return false; } #endif 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 0b6a1469d0647..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" 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..5b427693a8dfd 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,8 +23,9 @@ * */ -#include "precompiled.hpp" #include "logging/log.hpp" +#include "logging/logMessage.hpp" +#include "os_linux.hpp" #include "riscv_hwprobe.hpp" #include "runtime/os.hpp" #include "runtime/vm_version.hpp" @@ -164,7 +165,18 @@ void RiscvHwprobe::add_features_from_query_result() { VM_Version::ext_C.enable_feature(); } if (is_set(RISCV_HWPROBE_KEY_IMA_EXT_0, RISCV_HWPROBE_IMA_V)) { - VM_Version::ext_V.enable_feature(); + // Linux signal return bug when using vector with vlen > 128b in pre 6.8.5. + long major, minor, patch; + os::Linux::kernel_version(&major, &minor, &patch); + if (os::Linux::kernel_version_compare(major, minor, patch, 6, 8, 5) == -1) { + LogMessage(os) log; + if (log.is_info()) { + log.info("Linux kernels before 6.8.5 (current %ld.%ld.%ld) have a known bug when using Vector and signals.", major, minor, patch); + log.info("Vector not enabled automatically via hwprobe, but can be turned on with -XX:+UseRVV."); + } + } else { + VM_Version::ext_V.enable_feature(); + } } if (is_set(RISCV_HWPROBE_KEY_IMA_EXT_0, RISCV_HWPROBE_EXT_ZBA)) { VM_Version::ext_Zba.enable_feature(); @@ -178,6 +190,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 2df2fbf8adca9..930e5e9df1bf7 100644 --- a/src/hotspot/share/c1/c1_LIRGenerator.cpp +++ b/src/hotspot/share/c1/c1_LIRGenerator.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "c1/c1_Compilation.hpp" #include "c1/c1_Defs.hpp" #include "c1/c1_FrameMap.hpp" 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..1b4b6ffb22c7a 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" @@ -43,6 +42,7 @@ #include "jvm.h" #include "logging/log.hpp" #include "logging/logTag.hpp" +#include "memory/oopFactory.hpp" #include "memory/resourceArea.hpp" #include "oops/constantPool.inline.hpp" #include "runtime/atomic.hpp" @@ -112,6 +112,12 @@ ClassListParser::~ClassListParser() { _instance = nullptr; } +void ClassListParser::parse_classlist(const char* classlist_path, ParseMode parse_mode, TRAPS) { + UnregisteredClasses::initialize(CHECK); + ClassListParser parser(classlist_path, parse_mode); + parser.parse(THREAD); +} + void ClassListParser::parse(TRAPS) { for (; !_input_stream.done(); _input_stream.next()) { _line = _input_stream.current_line(); @@ -388,6 +394,19 @@ bool ClassListParser::parse_uint_option(const char* option_name, int* value) { return false; } +objArrayOop ClassListParser::get_specified_interfaces(TRAPS) { + const int n = _interfaces->length(); + if (n == 0) { + return nullptr; + } else { + objArrayOop array = oopFactory::new_objArray(vmClasses::Class_klass(), n, CHECK_NULL); + for (int i = 0; i < n; i++) { + array->obj_at_put(i, lookup_class_by_id(_interfaces->at(i))->java_mirror()); + } + return array; + } +} + void ClassListParser::print_specified_interfaces() { const int n = _interfaces->length(); jio_fprintf(defaultStream::error_stream(), "Currently specified interfaces[%d] = {\n", n); @@ -515,7 +534,17 @@ InstanceKlass* ClassListParser::load_class_from_source(Symbol* class_name, TRAPS ResourceMark rm; char * source_path = os::strdup_check_oom(ClassLoader::uri_to_path(_source)); - InstanceKlass* k = UnregisteredClasses::load_class(class_name, source_path, CHECK_NULL); + InstanceKlass* specified_super = lookup_class_by_id(_super); + Handle super_class(THREAD, specified_super->java_mirror()); + objArrayOop r = get_specified_interfaces(CHECK_NULL); + objArrayHandle interfaces(THREAD, r); + InstanceKlass* k = UnregisteredClasses::load_class(class_name, source_path, + super_class, interfaces, CHECK_NULL); + if (k->java_super() != specified_super) { + error("The specified super class %s (id %d) does not match actual super class %s", + specified_super->external_name(), _super, + k->java_super()->external_name()); + } if (k->local_interfaces()->length() != _interfaces->length()) { print_specified_interfaces(); print_actual_interfaces(k); @@ -735,49 +764,6 @@ InstanceKlass* ClassListParser::lookup_class_by_id(int id) { return *klass_ptr; } - -InstanceKlass* ClassListParser::lookup_super_for_current_class(Symbol* super_name) { - if (!is_loading_from_source()) { - return nullptr; - } - - InstanceKlass* k = lookup_class_by_id(super()); - if (super_name != k->name()) { - error("The specified super class %s (id %d) does not match actual super class %s", - k->name()->as_klass_external_name(), super(), - super_name->as_klass_external_name()); - } - return k; -} - -InstanceKlass* ClassListParser::lookup_interface_for_current_class(Symbol* interface_name) { - if (!is_loading_from_source()) { - return nullptr; - } - - const int n = _interfaces->length(); - if (n == 0) { - error("Class %s implements the interface %s, but no interface has been specified in the input line", - _class_name, interface_name->as_klass_external_name()); - ShouldNotReachHere(); - } - - int i; - for (i=0; iat(i)); - if (interface_name == k->name()) { - return k; - } - } - - // interface_name is not specified by the "interfaces:" keyword. - print_specified_interfaces(); - error("The interface %s implemented by class %s does not match any of the specified interface IDs", - interface_name->as_klass_external_name(), _class_name); - ShouldNotReachHere(); - return nullptr; -} - InstanceKlass* ClassListParser::find_builtin_class_helper(JavaThread* current, Symbol* class_name_symbol, oop class_loader_oop) { Handle class_loader(current, class_loader_oop); return SystemDictionary::find_instance_klass(current, class_name_symbol, class_loader); diff --git a/src/hotspot/share/cds/classListParser.hpp b/src/hotspot/share/cds/classListParser.hpp index 540e61335d0ad..1b059b4d85a4b 100644 --- a/src/hotspot/share/cds/classListParser.hpp +++ b/src/hotspot/share/cds/classListParser.hpp @@ -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 @@ -137,12 +137,10 @@ class ClassListParser : public StackObj { void print_diagnostic_info(outputStream* st, const char* msg, ...) ATTRIBUTE_PRINTF(3, 0); void constant_pool_resolution_warning(const char* msg, ...) ATTRIBUTE_PRINTF(2, 0); void error(const char* msg, ...) ATTRIBUTE_PRINTF(2, 0); + objArrayOop get_specified_interfaces(TRAPS); public: - static void parse_classlist(const char* classlist_path, ParseMode parse_mode, TRAPS) { - ClassListParser parser(classlist_path, parse_mode); - parser.parse(THREAD); - } + static void parse_classlist(const char* classlist_path, ParseMode parse_mode, TRAPS); static bool is_parsing_thread(); static ClassListParser* instance() { @@ -201,12 +199,6 @@ class ClassListParser : public StackObj { } bool is_loading_from_source(); - - // Look up the super or interface of the current class being loaded - // (in this->load_current_class()). - InstanceKlass* lookup_super_for_current_class(Symbol* super_name); - InstanceKlass* lookup_interface_for_current_class(Symbol* interface_name); - static void populate_cds_indy_info(const constantPoolHandle &pool, int cp_index, CDSIndyInfo* cii, TRAPS); }; #endif // SHARE_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 2133f85ae004c..acdb330d91bcc 100644 --- a/src/hotspot/share/cds/dynamicArchive.cpp +++ b/src/hotspot/share/cds/dynamicArchive.cpp @@ -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()); diff --git a/src/hotspot/share/cds/filemap.cpp b/src/hotspot/share/cds/filemap.cpp index c6be8ab7947e0..e82313bb84d92 100644 --- a/src/hotspot/share/cds/filemap.cpp +++ b/src/hotspot/share/cds/filemap.cpp @@ -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(); } } @@ -1555,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); @@ -1578,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)); } @@ -1623,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); @@ -2109,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); @@ -2171,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()); @@ -2334,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; } @@ -2371,9 +2370,9 @@ bool FileMapInfo::map_heap_region_impl() { 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; } 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 bd2f05080222f..a51a903df090a 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. @@ -214,34 +214,64 @@ void MetaspaceShared::dump_loaded_classes(const char* file_name, TRAPS) { } } -static bool shared_base_too_high(char* specified_base, char* aligned_base, size_t cds_max) { - if (specified_base != nullptr && aligned_base < specified_base) { - // SharedBaseAddress is very high (e.g., 0xffffffffffffff00) so - // align_up(SharedBaseAddress, MetaspaceShared::core_region_alignment()) has wrapped around. - return true; +// If p is not aligned, move it up to the next address that's aligned with alignment. +// If this is not possible (because p is too high), return nullptr. Example: +// p = 0xffffffffffff0000, alignment= 0x10000 => return nullptr. +static char* align_up_or_null(char* p, size_t alignment) { + assert(p != nullptr, "sanity"); + if (is_aligned(p, alignment)) { + return p; + } + + char* down = align_down(p, alignment); + if (max_uintx - uintx(down) < uintx(alignment)) { + // Run out of address space to align up. + return nullptr; } + + char* aligned = align_up(p, alignment); + assert(aligned >= p, "sanity"); + assert(aligned != nullptr, "sanity"); + return aligned; +} + +static bool shared_base_too_high(char* specified_base, char* aligned_base, size_t cds_max) { + // Caller should have checked if align_up_or_null( returns nullptr (comparing specified_base + // with nullptr is UB). + assert(aligned_base != nullptr, "sanity"); + assert(aligned_base >= specified_base, "sanity"); + if (max_uintx - uintx(aligned_base) < uintx(cds_max)) { - // The end of the archive will wrap around + // Not enough address space to hold an archive of cds_max bytes from aligned_base. return true; + } else { + return false; } - - return false; } static char* compute_shared_base(size_t cds_max) { char* specified_base = (char*)SharedBaseAddress; - char* aligned_base = align_up(specified_base, MetaspaceShared::core_region_alignment()); + size_t alignment = MetaspaceShared::core_region_alignment(); if (UseCompressedClassPointers) { - aligned_base = align_up(specified_base, Metaspace::reserve_alignment()); + alignment = MAX2(alignment, Metaspace::reserve_alignment()); + } + + if (SharedBaseAddress == 0) { + // Special meaning of -XX:SharedBaseAddress=0 -> Always map archive at os-selected address. + return specified_base; } + char* aligned_base = align_up_or_null(specified_base, alignment); + if (aligned_base != specified_base) { log_info(cds)("SharedBaseAddress (" INTPTR_FORMAT ") aligned up to " INTPTR_FORMAT, p2i(specified_base), p2i(aligned_base)); } const char* err = nullptr; - if (shared_base_too_high(specified_base, aligned_base, cds_max)) { + if (aligned_base == nullptr) { + err = "too high"; + } else if (shared_base_too_high(specified_base, aligned_base, cds_max)) { err = "too high"; } else if (!shared_base_valid(aligned_base)) { err = "invalid for this platform"; @@ -249,12 +279,15 @@ static char* compute_shared_base(size_t cds_max) { return aligned_base; } + // Arguments::default_SharedBaseAddress() is hard-coded in cds_globals.hpp. It must be carefully + // picked that (a) the align_up() below will always return a valid value; (b) none of + // the following asserts will fail. log_warning(cds)("SharedBaseAddress (" INTPTR_FORMAT ") is %s. Reverted to " INTPTR_FORMAT, p2i((void*)SharedBaseAddress), err, p2i((void*)Arguments::default_SharedBaseAddress())); specified_base = (char*)Arguments::default_SharedBaseAddress(); - aligned_base = align_up(specified_base, MetaspaceShared::core_region_alignment()); + aligned_base = align_up(specified_base, alignment); // Make sure the default value of SharedBaseAddress specified in globals.hpp is sane. assert(!shared_base_too_high(specified_base, aligned_base, cds_max), "Sanity"); @@ -264,7 +297,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 +318,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 +577,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 +648,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 +668,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 +801,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 +830,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); } } @@ -1000,7 +1042,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." @@ -1008,25 +1050,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 @@ -1090,7 +1114,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 @@ -1244,9 +1268,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()) { @@ -1475,8 +1499,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; @@ -1486,7 +1509,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); } @@ -1608,8 +1631,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; } @@ -1778,7 +1801,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..173713e341a85 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,14 +22,13 @@ * */ -#include "precompiled.hpp" #include "cds/unregisteredClasses.hpp" #include "classfile/classFileStream.hpp" #include "classfile/classLoader.inline.hpp" #include "classfile/classLoaderExt.hpp" #include "classfile/javaClasses.inline.hpp" #include "classfile/symbolTable.hpp" -#include "classfile/systemDictionaryShared.hpp" +#include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" #include "memory/oopFactory.hpp" #include "memory/resourceArea.hpp" @@ -39,10 +38,22 @@ #include "runtime/javaCalls.hpp" #include "services/threadService.hpp" +InstanceKlass* UnregisteredClasses::_UnregisteredClassLoader_klass = nullptr; + +void UnregisteredClasses::initialize(TRAPS) { + if (_UnregisteredClassLoader_klass == nullptr) { + // no need for synchronization as this function is called single-threaded. + Symbol* klass_name = SymbolTable::new_symbol("jdk/internal/misc/CDS$UnregisteredClassLoader"); + Klass* k = SystemDictionary::resolve_or_fail(klass_name, true, CHECK); + _UnregisteredClassLoader_klass = InstanceKlass::cast(k); + } +} + // Load the class of the given name from the location given by path. The path is specified by // the "source:" in the class list file (see classListParser.cpp), and can be a directory or // a JAR file. -InstanceKlass* UnregisteredClasses::load_class(Symbol* name, const char* path, TRAPS) { +InstanceKlass* UnregisteredClasses::load_class(Symbol* name, const char* path, + Handle super_class, objArrayHandle interfaces, TRAPS) { assert(name != nullptr, "invariant"); assert(CDSConfig::is_dumping_static_archive(), "this function is only used with -Xshare:dump"); @@ -50,19 +61,23 @@ InstanceKlass* UnregisteredClasses::load_class(Symbol* name, const char* path, T THREAD->get_thread_stat()->perf_timers_addr(), PerfClassTraceTime::CLASS_LOAD); + // Call CDS$UnregisteredClassLoader::load(String name, Class superClass, Class[] interfaces) + Symbol* methodName = SymbolTable::new_symbol("load"); + Symbol* methodSignature = SymbolTable::new_symbol("(Ljava/lang/String;Ljava/lang/Class;[Ljava/lang/Class;)Ljava/lang/Class;"); Symbol* path_symbol = SymbolTable::new_symbol(path); - Symbol* findClass = SymbolTable::new_symbol("findClass"); - Handle url_classloader = get_url_classloader(path_symbol, CHECK_NULL); + Handle classloader = get_classloader(path_symbol, CHECK_NULL); Handle ext_class_name = java_lang_String::externalize_classname(name, CHECK_NULL); JavaValue result(T_OBJECT); - JavaCallArguments args(2); - args.set_receiver(url_classloader); + JavaCallArguments args(3); + args.set_receiver(classloader); args.push_oop(ext_class_name); + args.push_oop(super_class); + args.push_oop(interfaces); JavaCalls::call_virtual(&result, - vmClasses::URLClassLoader_klass(), - findClass, - vmSymbols::string_class_signature(), + UnregisteredClassLoader_klass(), + methodName, + methodSignature, &args, CHECK_NULL); assert(result.get_type() == T_OBJECT, "just checking"); @@ -70,45 +85,35 @@ InstanceKlass* UnregisteredClasses::load_class(Symbol* name, const char* path, T return InstanceKlass::cast(java_lang_Class::as_Klass(obj)); } -class URLClassLoaderTable : public ResourceHashtable< +class UnregisteredClasses::ClassLoaderTable : public ResourceHashtable< Symbol*, OopHandle, 137, // prime number AnyObj::C_HEAP> {}; -static URLClassLoaderTable* _url_classloader_table = nullptr; +static UnregisteredClasses::ClassLoaderTable* _classloader_table = nullptr; -Handle UnregisteredClasses::create_url_classloader(Symbol* path, TRAPS) { +Handle UnregisteredClasses::create_classloader(Symbol* path, TRAPS) { ResourceMark rm(THREAD); JavaValue result(T_OBJECT); Handle path_string = java_lang_String::create_from_str(path->as_C_string(), CHECK_NH); - JavaCalls::call_static(&result, - vmClasses::jdk_internal_loader_ClassLoaders_klass(), - vmSymbols::toFileURL_name(), - vmSymbols::toFileURL_signature(), - path_string, CHECK_NH); - assert(result.get_type() == T_OBJECT, "just checking"); - oop url_h = result.get_oop(); - objArrayHandle urls = oopFactory::new_objArray_handle(vmClasses::URL_klass(), 1, CHECK_NH); - urls->obj_at_put(0, url_h); - - Handle url_classloader = JavaCalls::construct_new_instance( - vmClasses::URLClassLoader_klass(), - vmSymbols::url_array_classloader_void_signature(), - urls, Handle(), CHECK_NH); - return url_classloader; + Handle classloader = JavaCalls::construct_new_instance( + UnregisteredClassLoader_klass(), + vmSymbols::string_void_signature(), + path_string, CHECK_NH); + return classloader; } -Handle UnregisteredClasses::get_url_classloader(Symbol* path, TRAPS) { - if (_url_classloader_table == nullptr) { - _url_classloader_table = new (mtClass)URLClassLoaderTable(); +Handle UnregisteredClasses::get_classloader(Symbol* path, TRAPS) { + if (_classloader_table == nullptr) { + _classloader_table = new (mtClass)ClassLoaderTable(); } - OopHandle* url_classloader_ptr = _url_classloader_table->get(path); - if (url_classloader_ptr != nullptr) { - return Handle(THREAD, (*url_classloader_ptr).resolve()); + OopHandle* classloader_ptr = _classloader_table->get(path); + if (classloader_ptr != nullptr) { + return Handle(THREAD, (*classloader_ptr).resolve()); } else { - Handle url_classloader = create_url_classloader(path, CHECK_NH); - _url_classloader_table->put(path, OopHandle(Universe::vm_global(), url_classloader())); + Handle classloader = create_classloader(path, CHECK_NH); + _classloader_table->put(path, OopHandle(Universe::vm_global(), classloader())); path->increment_refcount(); - return url_classloader; + return classloader; } } diff --git a/src/hotspot/share/cds/unregisteredClasses.hpp b/src/hotspot/share/cds/unregisteredClasses.hpp index a9f7dceaead62..ea3a308c2de24 100644 --- a/src/hotspot/share/cds/unregisteredClasses.hpp +++ b/src/hotspot/share/cds/unregisteredClasses.hpp @@ -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 @@ -25,15 +25,30 @@ #ifndef SHARE_CDS_UNREGISTEREDCLASSES_HPP #define SHARE_CDS_UNREGISTEREDCLASSES_HPP +#include "memory/allStatic.hpp" #include "runtime/handles.hpp" +class InstanceKlass; +class Symbol; + class UnregisteredClasses: AllStatic { public: - static InstanceKlass* load_class(Symbol* h_name, const char* path, TRAPS); + static InstanceKlass* load_class(Symbol* h_name, const char* path, + Handle super_class, objArrayHandle interfaces, + TRAPS); + static void initialize(TRAPS); + static InstanceKlass* UnregisteredClassLoader_klass() { + return _UnregisteredClassLoader_klass; + } + + class ClassLoaderTable; private: - static Handle create_url_classloader(Symbol* path, TRAPS); - static Handle get_url_classloader(Symbol* path, TRAPS); + // Don't put this in vmClasses as it's used only with CDS dumping. + static InstanceKlass* _UnregisteredClassLoader_klass; + + static Handle create_classloader(Symbol* path, TRAPS); + static Handle get_classloader(Symbol* path, TRAPS); }; #endif // SHARE_CDS_UNREGISTEREDCLASSES_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 043470a32a227..5eade4a12c168 100644 --- a/src/hotspot/share/ci/ciFlags.cpp +++ b/src/hotspot/share/ci/ciFlags.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciFlags.hpp" // ciFlags 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 e14e237167d8c..f3e49634d2984 100644 --- a/src/hotspot/share/ci/ciKlass.cpp +++ b/src/hotspot/share/ci/ciKlass.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "ci/ciKlass.hpp" #include "ci/ciSymbol.hpp" #include "ci/ciUtilities.inline.hpp" 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 c552e48c8b8e9..92d31c48ca814 100644 --- a/src/hotspot/share/classfile/classFileParser.cpp +++ b/src/hotspot/share/classfile/classFileParser.cpp @@ -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( @@ -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 650d0a9fa744d..4c698170079ba 100644 --- a/src/hotspot/share/classfile/javaClasses.cpp +++ b/src/hotspot/share/classfile/javaClasses.cpp @@ -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; } 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..34b4c72399d9e 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" @@ -424,16 +423,6 @@ InstanceKlass* SystemDictionary::resolve_with_circularity_detection(Symbol* clas assert(next_name != nullptr, "null superclass for resolving"); assert(!Signature::is_array(next_name), "invalid superclass name"); -#if INCLUDE_CDS - if (CDSConfig::is_dumping_static_archive()) { - // Special processing for handling UNREGISTERED shared classes. - InstanceKlass* k = SystemDictionaryShared::lookup_super_for_unregistered_class(class_name, - next_name, is_superclass); - if (k) { - return k; - } - } -#endif // INCLUDE_CDS // If class_name is already loaded, just return the superclass or superinterface. // Make sure there's a placeholder for the class_name before resolving. diff --git a/src/hotspot/share/classfile/systemDictionaryShared.cpp b/src/hotspot/share/classfile/systemDictionaryShared.cpp index 180ba73e68144..0b40fb6d68137 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" @@ -36,6 +35,7 @@ #include "cds/heapShared.hpp" #include "cds/metaspaceShared.hpp" #include "cds/runTimeClassInfo.hpp" +#include "cds/unregisteredClasses.hpp" #include "classfile/classFileStream.hpp" #include "classfile/classLoader.hpp" #include "classfile/classLoaderData.inline.hpp" @@ -205,15 +205,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 +247,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 +335,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; @@ -363,6 +353,12 @@ bool SystemDictionaryShared::check_for_exclusion_impl(InstanceKlass* k) { } } + if (k == UnregisteredClasses::UnregisteredClassLoader_klass()) { + ResourceMark rm; + log_info(cds)("Skipping %s: used only when dumping CDS archive", k->name()->as_C_string()); + return true; + } + return false; // false == k should NOT be excluded } @@ -481,45 +477,6 @@ bool SystemDictionaryShared::add_unregistered_class(Thread* current, InstanceKla return (klass == *v); } -// This function is called to lookup the super/interfaces of shared classes for -// unregistered loaders. E.g., SharedClass in the below example -// where "super:" (and optionally "interface:") have been specified. -// -// java/lang/Object id: 0 -// Interface id: 2 super: 0 source: cust.jar -// SharedClass id: 4 super: 0 interfaces: 2 source: cust.jar -InstanceKlass* SystemDictionaryShared::lookup_super_for_unregistered_class( - Symbol* class_name, Symbol* super_name, bool is_superclass) { - - assert(CDSConfig::is_dumping_static_archive(), "only when static dumping"); - - if (!ClassListParser::is_parsing_thread()) { - // Unregistered classes can be created only by ClassListParser::_parsing_thread. - - return nullptr; - } - - ClassListParser* parser = ClassListParser::instance(); - if (parser == nullptr) { - // We're still loading the well-known classes, before the ClassListParser is created. - return nullptr; - } - if (class_name->equals(parser->current_class_name())) { - // When this function is called, all the numbered super and interface types - // must have already been loaded. Hence this function is never recursively called. - if (is_superclass) { - return parser->lookup_super_for_current_class(super_name); - } else { - return parser->lookup_interface_for_current_class(super_name); - } - } else { - // The VM is not trying to resolve a super type of parser->current_class_name(). - // Instead, it's resolving an error class (because parser->current_class_name() has - // failed parsing or verification). Don't do anything here. - return nullptr; - } -} - void SystemDictionaryShared::set_shared_class_misc_info(InstanceKlass* k, ClassFileStream* cfs) { assert(CDSConfig::is_dumping_archive(), "sanity"); assert(!is_builtin(k), "must be unregistered class"); @@ -601,9 +558,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 +612,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 +661,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 +671,11 @@ void SystemDictionaryShared::find_all_archivable_classes_impl() { dup_checker.mark_duplicated_classes(); } - ResourceMark rm; - - // 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); + _dumptime_table->iterate_all_live_classes([&] (InstanceKlass* k, DumpTimeClassInfo& info) { + SystemDictionaryShared::check_for_exclusion(k, &info); + }); - // 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 +804,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 +1215,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/vmClassMacros.hpp b/src/hotspot/share/classfile/vmClassMacros.hpp index 395034d4a21a6..7dc2d7f60c963 100644 --- a/src/hotspot/share/classfile/vmClassMacros.hpp +++ b/src/hotspot/share/classfile/vmClassMacros.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 @@ -138,7 +138,6 @@ /* support for CDS */ \ do_klass(ByteArrayInputStream_klass, java_io_ByteArrayInputStream ) \ do_klass(URL_klass, java_net_URL ) \ - do_klass(URLClassLoader_klass, java_net_URLClassLoader ) \ do_klass(Enum_klass, java_lang_Enum ) \ do_klass(Jar_Manifest_klass, java_util_jar_Manifest ) \ do_klass(jdk_internal_loader_BuiltinClassLoader_klass,jdk_internal_loader_BuiltinClassLoader ) \ 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 38226d232ef66..4357e44e18761 100644 --- a/src/hotspot/share/classfile/vmIntrinsics.cpp +++ b/src/hotspot/share/classfile/vmIntrinsics.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/vmIntrinsics.hpp" #include "classfile/vmSymbols.hpp" #include "compiler/compilerDirectives.hpp" diff --git a/src/hotspot/share/classfile/vmSymbols.cpp b/src/hotspot/share/classfile/vmSymbols.cpp index 5a531f7cbd99c..3dfeebf7ea1fd 100644 --- a/src/hotspot/share/classfile/vmSymbols.cpp +++ b/src/hotspot/share/classfile/vmSymbols.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/serializeClosure.hpp" #include "classfile/symbolTable.hpp" diff --git a/src/hotspot/share/classfile/vmSymbols.hpp b/src/hotspot/share/classfile/vmSymbols.hpp index 46c156a54452a..8ee5ff02a6a09 100644 --- a/src/hotspot/share/classfile/vmSymbols.hpp +++ b/src/hotspot/share/classfile/vmSymbols.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 @@ -124,7 +124,6 @@ class SerializeClosure; template(java_security_ProtectionDomain, "java/security/ProtectionDomain") \ template(java_security_SecureClassLoader, "java/security/SecureClassLoader") \ template(java_net_URL, "java/net/URL") \ - template(java_net_URLClassLoader, "java/net/URLClassLoader") \ template(java_util_jar_Manifest, "java/util/jar/Manifest") \ template(java_io_ByteArrayInputStream, "java/io/ByteArrayInputStream") \ template(java_io_Serializable, "java/io/Serializable") \ @@ -356,6 +355,8 @@ class SerializeClosure; template(jdk_internal_foreign_abi_VMStorage_array_array_signature, "[[Ljdk/internal/foreign/abi/VMStorage;") \ template(jdk_internal_foreign_abi_CallConv, "jdk/internal/foreign/abi/UpcallLinker$CallRegs") \ \ + template(jdk_internal_foreign_NativeMemorySegmentImpl, "jdk/internal/foreign/NativeMemorySegmentImpl") \ + \ /* Support for JVMCI */ \ JVMCI_VM_SYMBOLS_DO(template, do_alias) \ \ @@ -737,7 +738,6 @@ class SerializeClosure; template(runtimeSetup, "runtimeSetup") \ template(toFileURL_name, "toFileURL") \ template(toFileURL_signature, "(Ljava/lang/String;)Ljava/net/URL;") \ - template(url_array_classloader_void_signature, "([Ljava/net/URL;Ljava/lang/ClassLoader;)V") \ \ /* jcmd Thread.dump_to_file */ \ template(jdk_internal_vm_ThreadDumper, "jdk/internal/vm/ThreadDumper") \ diff --git a/src/hotspot/share/code/codeBehaviours.cpp b/src/hotspot/share/code/codeBehaviours.cpp index 34fda41b0ebd6..1f9eb0e29141d 100644 --- a/src/hotspot/share/code/codeBehaviours.cpp +++ b/src/hotspot/share/code/codeBehaviours.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/codeBehaviours.hpp" #include "runtime/mutexLocker.hpp" #include "runtime/safepoint.hpp" diff --git a/src/hotspot/share/code/codeBlob.cpp b/src/hotspot/share/code/codeBlob.cpp index 23f621ffec832..1a041b4679907 100644 --- a/src/hotspot/share/code/codeBlob.cpp +++ b/src/hotspot/share/code/codeBlob.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/relocInfo.hpp" diff --git a/src/hotspot/share/code/codeBlob.hpp b/src/hotspot/share/code/codeBlob.hpp index 8ecd9e21537df..63294d71892f5 100644 --- a/src/hotspot/share/code/codeBlob.hpp +++ b/src/hotspot/share/code/codeBlob.hpp @@ -97,7 +97,6 @@ class JavaFrameAnchor; // for UpcallStub::jfa_for_frame class CodeBlob { friend class VMStructs; friend class JVMCIVMStructs; - friend class CodeCacheDumper; protected: // order fields from large to small to minimize padding between fields diff --git a/src/hotspot/share/code/codeCache.cpp b/src/hotspot/share/code/codeCache.cpp index 81609c5884573..40a9819a40e37 100644 --- a/src/hotspot/share/code/codeCache.cpp +++ b/src/hotspot/share/code/codeCache.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/codeHeapState.hpp" @@ -178,10 +177,10 @@ GrowableArray* 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 67a48cfdd152d..6659ac90dd822 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" @@ -774,20 +773,6 @@ void CompileBroker::compilation_init(JavaThread* THREAD) { } #if defined(ASSERT) && COMPILER2_OR_JVMCI -// Stress testing. Dedicated threads revert optimizations based on escape analysis concurrently to -// the running java application. Configured with vm options DeoptimizeObjectsALot*. -class DeoptimizeObjectsALotThread : public JavaThread { - - static void deopt_objs_alot_thread_entry(JavaThread* thread, TRAPS); - void deoptimize_objects_alot_loop_single(); - void deoptimize_objects_alot_loop_all(); - -public: - DeoptimizeObjectsALotThread() : JavaThread(&deopt_objs_alot_thread_entry) { } - - bool is_hidden_from_external_view() const { return true; } -}; - // Entry for DeoptimizeObjectsALotThread. The threads are started in // CompileBroker::init_compiler_threads() iff DeoptimizeObjectsALot is enabled void DeoptimizeObjectsALotThread::deopt_objs_alot_thread_entry(JavaThread* thread, TRAPS) { @@ -1917,7 +1902,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 +1993,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 +2016,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; } @@ -2778,9 +2763,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/compileBroker.hpp b/src/hotspot/share/compiler/compileBroker.hpp index f6067f75d32aa..ac62a20bc6ff2 100644 --- a/src/hotspot/share/compiler/compileBroker.hpp +++ b/src/hotspot/share/compiler/compileBroker.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 @@ -39,6 +39,22 @@ class nmethod; +#if defined(ASSERT) && COMPILER2_OR_JVMCI +// Stress testing. Dedicated threads revert optimizations based on escape analysis concurrently to +// the running java application. Configured with vm options DeoptimizeObjectsALot*. +class DeoptimizeObjectsALotThread : public JavaThread { + + static void deopt_objs_alot_thread_entry(JavaThread* thread, TRAPS); + void deoptimize_objects_alot_loop_single(); + void deoptimize_objects_alot_loop_all(); + +public: + DeoptimizeObjectsALotThread() : JavaThread(&deopt_objs_alot_thread_entry) { } + + bool is_hidden_from_external_view() const { return true; } +}; +#endif + // CompilerCounters // // Per Compiler Performance Counters. 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..f1d309807b5dc 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" @@ -51,6 +50,11 @@ ParMarkBitMap::initialize(MemRegion covered_region) rs_align, page_sz); + if (!rs.is_reserved()) { + // Failed to reserve memory for the bitmap, + return false; + } + const size_t used_page_sz = rs.page_size(); os::trace_page_sizes("Mark Bitmap", raw_bytes, raw_bytes, rs.base(), rs.size(), used_page_sz); @@ -58,25 +62,24 @@ ParMarkBitMap::initialize(MemRegion covered_region) MemTracker::record_virtual_memory_tag((address)rs.base(), mtGC); _virtual_space = new PSVirtualSpace(rs, page_sz); - if (_virtual_space != nullptr && _virtual_space->expand_by(_reserved_byte_size)) { - _heap_start = covered_region.start(); - _heap_size = covered_region.word_size(); - BitMap::bm_word_t* map = (BitMap::bm_word_t*)_virtual_space->reserved_low_addr(); - _beg_bits = BitMapView(map, bits); - return true; - } - _heap_start = nullptr; - _heap_size = 0; - if (_virtual_space != nullptr) { + if (!_virtual_space->expand_by(_reserved_byte_size)) { + // Failed to commit memory for the bitmap. + delete _virtual_space; - _virtual_space = nullptr; + // Release memory reserved in the space. - if (rs.is_reserved()) { - MemoryReserver::release(rs); - } + MemoryReserver::release(rs); + + return false; } - return false; + + _heap_start = covered_region.start(); + _heap_size = covered_region.word_size(); + BitMap::bm_word_t* map = (BitMap::bm_word_t*)_virtual_space->reserved_low_addr(); + _beg_bits = BitMapView(map, bits); + + return true; } #ifdef ASSERT 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..f00e18c3297b9 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,13 +22,14 @@ * */ -#include "precompiled.hpp" #include "gc/parallel/objectStartArray.hpp" #include "gc/parallel/parMarkBitMap.inline.hpp" #include "gc/parallel/parallelScavengeHeap.hpp" #include "gc/parallel/psCompactionManager.inline.hpp" #include "gc/parallel/psOldGen.hpp" #include "gc/parallel/psParallelCompact.inline.hpp" +#include "gc/shared/partialArraySplitter.inline.hpp" +#include "gc/shared/partialArrayState.hpp" #include "gc/shared/preservedMarks.inline.hpp" #include "gc/shared/taskqueue.inline.hpp" #include "logging/log.hpp" @@ -43,9 +44,9 @@ PSOldGen* ParCompactionManager::_old_gen = nullptr; ParCompactionManager** ParCompactionManager::_manager_array = nullptr; -ParCompactionManager::OopTaskQueueSet* ParCompactionManager::_oop_task_queues = nullptr; -ParCompactionManager::ObjArrayTaskQueueSet* ParCompactionManager::_objarray_task_queues = nullptr; +ParCompactionManager::PSMarkTasksQueueSet* ParCompactionManager::_marking_stacks = nullptr; ParCompactionManager::RegionTaskQueueSet* ParCompactionManager::_region_task_queues = nullptr; +PartialArrayStateManager* ParCompactionManager::_partial_array_state_manager = nullptr; ObjectStartArray* ParCompactionManager::_start_array = nullptr; ParMarkBitMap* ParCompactionManager::_mark_bitmap = nullptr; @@ -55,8 +56,10 @@ Monitor* ParCompactionManager::_shadow_region_monitor = nullptr; PreservedMarksSet* ParCompactionManager::_preserved_marks_set = nullptr; ParCompactionManager::ParCompactionManager(PreservedMarks* preserved_marks, - ReferenceProcessor* ref_processor) - : _mark_and_push_closure(this, ref_processor) { + ReferenceProcessor* ref_processor, + uint parallel_gc_threads) + :_partial_array_splitter(_partial_array_state_manager, parallel_gc_threads), + _mark_and_push_closure(this, ref_processor) { ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); @@ -79,8 +82,10 @@ void ParCompactionManager::initialize(ParMarkBitMap* mbm) { assert(_manager_array == nullptr, "Attempt to initialize twice"); _manager_array = NEW_C_HEAP_ARRAY(ParCompactionManager*, parallel_gc_threads, mtGC); - _oop_task_queues = new OopTaskQueueSet(parallel_gc_threads); - _objarray_task_queues = new ObjArrayTaskQueueSet(parallel_gc_threads); + assert(_partial_array_state_manager == nullptr, "Attempt to initialize twice"); + _partial_array_state_manager + = new PartialArrayStateManager(parallel_gc_threads); + _marking_stacks = new PSMarkTasksQueueSet(parallel_gc_threads); _region_task_queues = new RegionTaskQueueSet(parallel_gc_threads); _preserved_marks_set = new PreservedMarksSet(true); @@ -89,16 +94,15 @@ void ParCompactionManager::initialize(ParMarkBitMap* mbm) { // Create and register the ParCompactionManager(s) for the worker threads. for(uint i=0; iget(i), - PSParallelCompact::ref_processor()); - oop_task_queues()->register_queue(i, _manager_array[i]->oop_stack()); - _objarray_task_queues->register_queue(i, &_manager_array[i]->_objarray_stack); + PSParallelCompact::ref_processor(), + parallel_gc_threads); + marking_stacks()->register_queue(i, _manager_array[i]->marking_stack()); region_task_queues()->register_queue(i, _manager_array[i]->region_stack()); } _shadow_region_array = new (mtGC) GrowableArray(10, mtGC); _shadow_region_monitor = new Monitor(Mutex::nosafepoint, "CompactionManager_lock"); - } void ParCompactionManager::flush_all_string_dedup_requests() { @@ -115,42 +119,41 @@ ParCompactionManager::gc_thread_compaction_manager(uint index) { return _manager_array[index]; } -inline void ParCompactionManager::publish_and_drain_oop_tasks() { - oop obj; - while (oop_stack()->pop_overflow(obj)) { - if (!oop_stack()->try_push_to_taskqueue(obj)) { - follow_contents(obj); - } - } - while (oop_stack()->pop_local(obj)) { - follow_contents(obj); - } +void ParCompactionManager::push_objArray(oop obj) { + assert(obj->is_objArray(), "precondition"); + _mark_and_push_closure.do_klass(obj->klass()); + + objArrayOop obj_array = objArrayOop(obj); + size_t array_length = obj_array->length(); + size_t initial_chunk_size = + _partial_array_splitter.start(&_marking_stack, obj_array, nullptr, array_length); + follow_array(obj_array, 0, initial_chunk_size); } -bool ParCompactionManager::publish_or_pop_objarray_tasks(ObjArrayTask& task) { - while (_objarray_stack.pop_overflow(task)) { - if (!_objarray_stack.try_push_to_taskqueue(task)) { - return true; - } - } - return false; +void ParCompactionManager::process_array_chunk(PartialArrayState* state, bool stolen) { + // Access before release by claim(). + oop obj = state->source(); + PartialArraySplitter::Claim claim = + _partial_array_splitter.claim(state, &_marking_stack, stolen); + follow_array(objArrayOop(obj), claim._start, claim._end); } void ParCompactionManager::follow_marking_stacks() { + ScannerTask task; do { // First, try to move tasks from the overflow stack into the shared buffer, so // that other threads can steal. Otherwise process the overflow stack first. - publish_and_drain_oop_tasks(); - - // Process ObjArrays one at a time to avoid marking stack bloat. - ObjArrayTask task; - if (publish_or_pop_objarray_tasks(task) || - _objarray_stack.pop_local(task)) { - follow_array((objArrayOop)task.obj(), task.index()); + while (marking_stack()->pop_overflow(task)) { + if (!marking_stack()->try_push_to_taskqueue(task)) { + follow_contents(task, false); + } + } + while (marking_stack()->pop_local(task)) { + follow_contents(task, false); } - } while (!marking_stacks_empty()); + } while (!marking_stack_empty()); - assert(marking_stacks_empty(), "Sanity"); + assert(marking_stack_empty(), "Sanity"); } void ParCompactionManager::drain_region_stacks() { @@ -197,11 +200,32 @@ void ParCompactionManager::remove_all_shadow_regions() { _shadow_region_array->clear(); } + +#if TASKQUEUE_STATS +void ParCompactionManager::print_and_reset_taskqueue_stats() { + marking_stacks()->print_and_reset_taskqueue_stats("Marking Stacks"); + + auto get_pa_stats = [&](uint i) { + return _manager_array[i]->partial_array_task_stats(); + }; + PartialArrayTaskStats::log_set(ParallelGCThreads, get_pa_stats, + "Partial Array Task Stats"); + uint parallel_gc_threads = ParallelScavengeHeap::heap()->workers().max_workers(); + for (uint i = 0; i < parallel_gc_threads; ++i) { + get_pa_stats(i)->reset(); + } +} + +PartialArrayTaskStats* ParCompactionManager::partial_array_task_stats() { + return _partial_array_splitter.stats(); +} +#endif // TASKQUEUE_STATS + #ifdef ASSERT void ParCompactionManager::verify_all_marking_stack_empty() { uint parallel_gc_threads = ParallelGCThreads; for (uint i = 0; i < parallel_gc_threads; i++) { - assert(_manager_array[i]->marking_stacks_empty(), "Marking stack should be empty"); + assert(_manager_array[i]->marking_stack_empty(), "Marking stack should be empty"); } } diff --git a/src/hotspot/share/gc/parallel/psCompactionManager.hpp b/src/hotspot/share/gc/parallel/psCompactionManager.hpp index cd4eefe775b57..739d2cb1cc7e2 100644 --- a/src/hotspot/share/gc/parallel/psCompactionManager.hpp +++ b/src/hotspot/share/gc/parallel/psCompactionManager.hpp @@ -27,6 +27,9 @@ #include "classfile/classLoaderData.hpp" #include "gc/parallel/psParallelCompact.hpp" +#include "gc/shared/partialArraySplitter.hpp" +#include "gc/shared/partialArrayTaskStats.hpp" +#include "gc/shared/partialArrayState.hpp" #include "gc/shared/preservedMarks.hpp" #include "gc/shared/stringdedup/stringDedup.hpp" #include "gc/shared/taskqueue.hpp" @@ -64,26 +67,22 @@ class ParCompactionManager : public CHeapObj { friend class PCAddThreadRootsMarkingTaskClosure; private: - typedef OverflowTaskQueue OopTaskQueue; - typedef GenericTaskQueueSet OopTaskQueueSet; - - // 32-bit: 4K * 8 = 32KiB; 64-bit: 8K * 16 = 128KiB - #define QUEUE_SIZE (1 << NOT_LP64(12) LP64_ONLY(13)) - typedef OverflowTaskQueue ObjArrayTaskQueue; - typedef GenericTaskQueueSet ObjArrayTaskQueueSet; - #undef QUEUE_SIZE - typedef OverflowTaskQueue RegionTaskQueue; - typedef GenericTaskQueueSet RegionTaskQueueSet; + typedef OverflowTaskQueue PSMarkTaskQueue; + typedef GenericTaskQueueSet PSMarkTasksQueueSet; + typedef OverflowTaskQueue RegionTaskQueue; + typedef GenericTaskQueueSet RegionTaskQueueSet; static ParCompactionManager** _manager_array; - static OopTaskQueueSet* _oop_task_queues; - static ObjArrayTaskQueueSet* _objarray_task_queues; + static PSMarkTasksQueueSet* _marking_stacks; static ObjectStartArray* _start_array; static RegionTaskQueueSet* _region_task_queues; static PSOldGen* _old_gen; - OopTaskQueue _oop_stack; - ObjArrayTaskQueue _objarray_stack; + static PartialArrayStateManager* _partial_array_state_manager; + PartialArraySplitter _partial_array_splitter; + + PSMarkTaskQueue _marking_stack; + size_t _next_shadow_region; PCMarkAndPushClosure _mark_and_push_closure; @@ -109,23 +108,20 @@ class ParCompactionManager : public CHeapObj { static PSOldGen* old_gen() { return _old_gen; } static ObjectStartArray* start_array() { return _start_array; } - static OopTaskQueueSet* oop_task_queues() { return _oop_task_queues; } + static PSMarkTasksQueueSet* marking_stacks() { return _marking_stacks; } static void initialize(ParMarkBitMap* mbm); - void publish_and_drain_oop_tasks(); - // Try to publish all contents from the objArray task queue overflow stack to - // the shared objArray stack. - // Returns true and a valid task if there has not been enough space in the shared - // objArray stack, otherwise returns false and the task is invalid. - bool publish_or_pop_objarray_tasks(ObjArrayTask& task); - ParCompactionManager(PreservedMarks* preserved_marks, - ReferenceProcessor* ref_processor); + ReferenceProcessor* ref_processor, + uint parallel_gc_threads); // Array of task queues. Needed by the task terminator. static RegionTaskQueueSet* region_task_queues() { return _region_task_queues; } - OopTaskQueue* oop_stack() { return &_oop_stack; } + + inline PSMarkTaskQueue* marking_stack() { return &_marking_stack; } + inline void push(PartialArrayState* stat); + void push_objArray(oop obj); // To collect per-region live-words in a worker local cache in order to // reduce threads contention. @@ -155,6 +151,11 @@ class ParCompactionManager : public CHeapObj { MarkingStatsCache* _marking_stats_cache; +#if TASKQUEUE_STATS + static void print_and_reset_taskqueue_stats(); + PartialArrayTaskStats* partial_array_task_stats(); +#endif // TASKQUEUE_STATS + public: static const size_t InvalidShadow = ~0; static size_t pop_shadow_region_mt_safe(PSParallelCompact::RegionData* region_ptr); @@ -189,7 +190,6 @@ class ParCompactionManager : public CHeapObj { // Save for later processing. Must not fail. inline void push(oop obj); - inline void push_objarray(oop objarray, size_t index); inline void push_region(size_t index); // Check mark and maybe push on marking stack. @@ -198,19 +198,19 @@ class ParCompactionManager : public CHeapObj { // Access function for compaction managers static ParCompactionManager* gc_thread_compaction_manager(uint index); - static bool steal(int queue_num, oop& t); - static bool steal_objarray(int queue_num, ObjArrayTask& t); + static bool steal(int queue_num, ScannerTask& t); static bool steal(int queue_num, size_t& region); - // Process tasks remaining on any marking stack + // Process tasks remaining on marking stack void follow_marking_stacks(); - inline bool marking_stacks_empty() const; + inline bool marking_stack_empty() const; // Process tasks remaining on any stack void drain_region_stacks(); - void follow_contents(oop obj); - void follow_array(objArrayOop array, int index); + inline void follow_contents(const ScannerTask& task, bool stolen); + inline void follow_array(objArrayOop array, size_t start, size_t end); + void process_array_chunk(PartialArrayState* state, bool stolen); class FollowStackClosure: public VoidClosure { private: @@ -234,8 +234,8 @@ class ParCompactionManager : public CHeapObj { static void verify_all_region_stack_empty() NOT_DEBUG_RETURN; }; -bool ParCompactionManager::marking_stacks_empty() const { - return _oop_stack.is_empty() && _objarray_stack.is_empty(); +bool ParCompactionManager::marking_stack_empty() const { + return _marking_stack.is_empty(); } #endif // SHARE_GC_PARALLEL_PSCOMPACTIONMANAGER_HPP diff --git a/src/hotspot/share/gc/parallel/psCompactionManager.inline.hpp b/src/hotspot/share/gc/parallel/psCompactionManager.inline.hpp index 94529d2742305..2c0b8480726ab 100644 --- a/src/hotspot/share/gc/parallel/psCompactionManager.inline.hpp +++ b/src/hotspot/share/gc/parallel/psCompactionManager.inline.hpp @@ -32,6 +32,8 @@ #include "gc/parallel/parMarkBitMap.hpp" #include "gc/parallel/psParallelCompact.inline.hpp" #include "gc/parallel/psStringDedup.hpp" +#include "gc/shared/partialArrayState.hpp" +#include "gc/shared/partialArrayTaskStepper.inline.hpp" #include "gc/shared/taskqueue.inline.hpp" #include "oops/access.inline.hpp" #include "oops/arrayOop.hpp" @@ -46,12 +48,8 @@ inline void PCMarkAndPushClosure::do_oop_work(T* p) { _compaction_manager->mark_and_push(p); } -inline bool ParCompactionManager::steal(int queue_num, oop& t) { - return oop_task_queues()->steal(queue_num, t); -} - -inline bool ParCompactionManager::steal_objarray(int queue_num, ObjArrayTask& t) { - return _objarray_task_queues->steal(queue_num, t); +inline bool ParCompactionManager::steal(int queue_num, ScannerTask& t) { + return marking_stacks()->steal(queue_num, t); } inline bool ParCompactionManager::steal(int queue_num, size_t& region) { @@ -59,14 +57,11 @@ inline bool ParCompactionManager::steal(int queue_num, size_t& region) { } inline void ParCompactionManager::push(oop obj) { - _oop_stack.push(obj); + marking_stack()->push(ScannerTask(obj)); } -void ParCompactionManager::push_objarray(oop obj, size_t index) -{ - ObjArrayTask task(obj, index); - assert(task.is_valid(), "bad ObjArrayTask"); - _objarray_stack.push(task); +inline void ParCompactionManager::push(PartialArrayState* stat) { + marking_stack()->push(ScannerTask(stat)); } void ParCompactionManager::push_region(size_t index) @@ -111,43 +106,38 @@ inline void ParCompactionManager::FollowStackClosure::do_void() { } template -inline void follow_array_specialized(objArrayOop obj, int index, ParCompactionManager* cm) { - const size_t len = size_t(obj->length()); - const size_t beg_index = size_t(index); - assert(beg_index < len || len == 0, "index too large"); - - const size_t stride = MIN2(len - beg_index, (size_t)ObjArrayMarkingStride); - const size_t end_index = beg_index + stride; +inline void follow_array_specialized(objArrayOop obj, size_t start, size_t end, ParCompactionManager* cm) { + assert(start <= end, "invariant"); T* const base = (T*)obj->base(); - T* const beg = base + beg_index; - T* const end = base + end_index; - - if (end_index < len) { - cm->push_objarray(obj, end_index); // Push the continuation. - } + T* const beg = base + start; + T* const chunk_end = base + end; // Push the non-null elements of the next stride on the marking stack. - for (T* e = beg; e < end; e++) { + for (T* e = beg; e < chunk_end; e++) { cm->mark_and_push(e); } } -inline void ParCompactionManager::follow_array(objArrayOop obj, int index) { +inline void ParCompactionManager::follow_array(objArrayOop obj, size_t start, size_t end) { if (UseCompressedOops) { - follow_array_specialized(obj, index, this); + follow_array_specialized(obj, start, end, this); } else { - follow_array_specialized(obj, index, this); + follow_array_specialized(obj, start, end, this); } } -inline void ParCompactionManager::follow_contents(oop obj) { - assert(PSParallelCompact::mark_bitmap()->is_marked(obj), "should be marked"); - - if (obj->is_objArray()) { - _mark_and_push_closure.do_klass(obj->klass()); - follow_array(objArrayOop(obj), 0); +inline void ParCompactionManager::follow_contents(const ScannerTask& task, bool stolen) { + if (task.is_partial_array_state()) { + assert(PSParallelCompact::mark_bitmap()->is_marked(task.to_partial_array_state()->source()), "should be marked"); + process_array_chunk(task.to_partial_array_state(), stolen); } else { - obj->oop_iterate(&_mark_and_push_closure); + oop obj = task.to_oop(); + assert(PSParallelCompact::mark_bitmap()->is_marked(obj), "should be marked"); + if (obj->is_objArray()) { + push_objArray(obj); + } else { + obj->oop_iterate(&_mark_and_push_closure); + } } } @@ -219,5 +209,4 @@ inline void ParCompactionManager::flush_and_destroy_marking_stats_cache() { delete _marking_stats_cache; _marking_stats_cache = nullptr; } - #endif // SHARE_GC_PARALLEL_PSCOMPACTIONMANAGER_INLINE_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..90f4d6367bd5e 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" @@ -249,25 +248,30 @@ ParallelCompactData::create_vspace(size_t count, size_t element_size) rs_align, page_sz); + if (!rs.is_reserved()) { + // Failed to reserve memory. + return nullptr; + } + os::trace_page_sizes("Parallel Compact Data", raw_bytes, raw_bytes, rs.base(), rs.size(), page_sz); MemTracker::record_virtual_memory_tag((address)rs.base(), mtGC); PSVirtualSpace* vspace = new PSVirtualSpace(rs, page_sz); - if (vspace != nullptr) { - if (vspace->expand_by(_reserved_byte_size)) { - return vspace; - } + + if (!vspace->expand_by(_reserved_byte_size)) { + // Failed to commit memory. + delete vspace; + // Release memory reserved in the space. - if (rs.is_reserved()) { - MemoryReserver::release(rs); - rs = {}; - } + MemoryReserver::release(rs); + + return nullptr; } - return nullptr; + return vspace; } bool ParallelCompactData::initialize_region_data(size_t heap_size) @@ -584,16 +588,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 +1079,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 @@ -1210,12 +1214,9 @@ void steal_marking_work(TaskTerminator& terminator, uint worker_id) { ParCompactionManager::gc_thread_compaction_manager(worker_id); do { - oop obj = nullptr; - ObjArrayTask task; - if (ParCompactionManager::steal_objarray(worker_id, task)) { - cm->follow_array((objArrayOop)task.obj(), task.index()); - } else if (ParCompactionManager::steal(worker_id, obj)) { - cm->follow_contents(obj); + ScannerTask task; + if (ParCompactionManager::steal(worker_id, task)) { + cm->follow_contents(task, true); } cm->follow_marking_stacks(); } while (!terminator.offer_termination()); @@ -1231,7 +1232,7 @@ class MarkFromRootsTask : public WorkerTask { MarkFromRootsTask(uint active_workers) : WorkerTask("MarkFromRootsTask"), _strong_roots_scope(active_workers), - _terminator(active_workers, ParCompactionManager::oop_task_queues()), + _terminator(active_workers, ParCompactionManager::marking_stacks()), _active_workers(active_workers) {} virtual void work(uint worker_id) { @@ -1269,7 +1270,7 @@ class ParallelCompactRefProcProxyTask : public RefProcProxyTask { public: ParallelCompactRefProcProxyTask(uint max_workers) : RefProcProxyTask("ParallelCompactRefProcProxyTask", max_workers), - _terminator(_max_workers, ParCompactionManager::oop_task_queues()) {} + _terminator(_max_workers, ParCompactionManager::marking_stacks()) {} void work(uint worker_id) override { assert(worker_id < _max_workers, "sanity"); @@ -1379,8 +1380,7 @@ void PSParallelCompact::marking_phase(ParallelOldTracer *gc_tracer) { _gc_tracer.report_object_count_after_gc(is_alive_closure(), &ParallelScavengeHeap::heap()->workers()); } #if TASKQUEUE_STATS - ParCompactionManager::oop_task_queues()->print_and_reset_taskqueue_stats("Oop Queue"); - ParCompactionManager::_objarray_task_queues->print_and_reset_taskqueue_stats("ObjArrayOop Queue"); + ParCompactionManager::print_and_reset_taskqueue_stats(); #endif } @@ -1688,7 +1688,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 +1697,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; @@ -2478,4 +2478,3 @@ void MoveAndUpdateShadowClosure::complete_region(HeapWord* dest_addr, PSParallel ParCompactionManager::push_shadow_region_mt_safe(_shadow); } } - 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..be31da5b05d3c 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" @@ -205,7 +204,7 @@ class ParallelScavengeRefProcProxyTask : public RefProcProxyTask { public: ParallelScavengeRefProcProxyTask(uint max_workers) : RefProcProxyTask("ParallelScavengeRefProcProxyTask", max_workers), - _terminator(max_workers, ParCompactionManager::oop_task_queues()) {} + _terminator(max_workers, ParCompactionManager::marking_stacks()) {} void work(uint worker_id) override { assert(worker_id < _max_workers, "sanity"); @@ -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..5baad7f995adf 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" @@ -47,14 +46,17 @@ SerialBlockOffsetTable::SerialBlockOffsetTable(MemRegion reserved, size_t init_word_size): _reserved(reserved) { size_t size = compute_size(reserved.word_size()); + ReservedSpace rs = MemoryReserver::reserve(size, mtGC); + if (!rs.is_reserved()) { vm_exit_during_initialization("Could not reserve enough space for heap offset array"); } - if (!_vs.initialize(rs, 0)) { - vm_exit_during_initialization("Could not reserve enough space for heap offset array"); - } + const bool initialized = _vs.initialize(rs, 0 /* committed_size */); + + assert(initialized, "Should never fail when commmitted_size is 0"); + _offset_base = (uint8_t*)(_vs.low_boundary() - (uintptr_t(reserved.start()) >> CardTable::card_shift())); resize(init_word_size); log_trace(gc, bot)("SerialBlockOffsetTable::SerialBlockOffsetTable: "); 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..2408a41a87b05 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" @@ -96,6 +95,7 @@ SerialHeap::SerialHeap() : _gc_policy_counters(new GCPolicyCounters("Copy:MSC", 2, 2)), _young_manager(nullptr), _old_manager(nullptr), + _is_heap_almost_full(false), _eden_pool(nullptr), _survivor_pool(nullptr), _old_pool(nullptr) { @@ -219,8 +219,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(); @@ -284,13 +283,12 @@ size_t SerialHeap::max_capacity() const { // Return true if any of the following is true: // . the allocation won't fit into the current young gen heap // . gc locker is occupied (jni critical section) -// . heap memory is tight -- the most recent previous collection -// was a full collection because a partial collection (would -// have) failed and is likely to fail again +// . heap memory is tight bool SerialHeap::should_try_older_generation_allocation(size_t word_size) const { size_t young_capacity = _young_gen->capacity_before_gc(); return (word_size > heap_word_size(young_capacity)) - || GCLocker::is_active_and_needs_gc(); + || GCLocker::is_active_and_needs_gc() + || _is_heap_almost_full; } HeapWord* SerialHeap::expand_heap_and_allocate(size_t size, bool is_tlab) { @@ -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)" : ""); } } } @@ -462,7 +460,7 @@ bool SerialHeap::do_young_collection(bool clear_soft_refs) { prepare_for_verify(); Universe::verify("Before GC"); } - gc_prologue(false); + gc_prologue(); COMPILER2_OR_JVMCI_PRESENT(DerivedPointerTable::clear()); save_marks(); @@ -730,7 +728,7 @@ void SerialHeap::do_full_collection_no_gc_locker(bool clear_all_soft_refs) { Universe::verify("Before GC"); } - gc_prologue(true); + gc_prologue(); COMPILER2_OR_JVMCI_PRESENT(DerivedPointerTable::clear()); CodeCache::on_gc_marking_cycle_start(); ClassUnloadingContext ctx(1 /* num_nmethod_unlink_workers */, @@ -936,7 +934,7 @@ void SerialHeap::print_heap_change(const PreGenGCValues& pre_gc_values) const { MetaspaceUtils::print_metaspace_change(pre_gc_values.metaspace_sizes()); } -void SerialHeap::gc_prologue(bool full) { +void SerialHeap::gc_prologue() { // Fill TLAB's and such ensure_parsability(true); // retire TLABs @@ -953,5 +951,18 @@ void SerialHeap::gc_epilogue(bool full) { _young_gen->gc_epilogue(full); _old_gen->gc_epilogue(); + if (_is_heap_almost_full) { + // Reset the emergency state if eden is empty after a young/full gc + if (_young_gen->eden()->is_empty()) { + _is_heap_almost_full = false; + } + } else { + if (full && !_young_gen->eden()->is_empty()) { + // Usually eden should be empty after a full GC, so heap is probably too + // full now; entering emergency state. + _is_heap_almost_full = true; + } + } + MetaspaceCounters::update_performance_counters(); }; diff --git a/src/hotspot/share/gc/serial/serialHeap.hpp b/src/hotspot/share/gc/serial/serialHeap.hpp index d787d216e37ab..28ab7905bbc79 100644 --- a/src/hotspot/share/gc/serial/serialHeap.hpp +++ b/src/hotspot/share/gc/serial/serialHeap.hpp @@ -95,6 +95,13 @@ class SerialHeap : public CollectedHeap { GCMemoryManager* _young_manager; GCMemoryManager* _old_manager; + // Indicate whether heap is almost or approaching full. + // Usually, there is some memory headroom for application/gc to run properly. + // However, in extreme cases, e.g. young-gen is non-empty after a full gc, we + // will attempt some uncommon measures, e.g. alllocating small objs in + // old-gen. + bool _is_heap_almost_full; + // Helper functions for allocation HeapWord* attempt_allocation(size_t size, bool is_tlab, @@ -111,6 +118,9 @@ class SerialHeap : public CollectedHeap { bool is_young_gc_safe() const; + void gc_prologue(); + void gc_epilogue(bool full); + public: // Returns JNI_OK on success jint initialize() override; @@ -226,10 +236,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..fbfc07a4e0903 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" @@ -83,15 +82,16 @@ void CardTable::initialize(void* region0_start, void* region1_start) { const size_t rs_align = MAX2(_page_size, os::vm_allocation_granularity()); ReservedSpace rs = MemoryReserver::reserve(_byte_map_size, rs_align, _page_size); - MemTracker::record_virtual_memory_tag((address)rs.base(), mtGC); - - os::trace_page_sizes("Card Table", num_bytes, num_bytes, - rs.base(), rs.size(), _page_size); if (!rs.is_reserved()) { vm_exit_during_initialization("Could not reserve enough space for the " "card marking array"); } + MemTracker::record_virtual_memory_tag((address)rs.base(), mtGC); + + os::trace_page_sizes("Card Table", num_bytes, num_bytes, + rs.base(), rs.size(), _page_size); + // The assembler store_check code will do an unsigned shift of the oop, // then add it to _byte_map_base, i.e. // 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/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/taskqueue.hpp b/src/hotspot/share/gc/shared/taskqueue.hpp index a6ab5741048fe..42d32f3dc96b9 100644 --- a/src/hotspot/share/gc/shared/taskqueue.hpp +++ b/src/hotspot/share/gc/shared/taskqueue.hpp @@ -561,8 +561,10 @@ class ObjArrayTask class PartialArrayState; -// Discriminated union over oop*, narrowOop*, and PartialArrayState. +// Discriminated union over oop/oop*, narrowOop*, and PartialArrayState. // Uses a low tag in the associated pointer to identify the category. +// Oop/oop* are overloaded using the same tag because they can not appear at the +// same time. // Used as a task queue element type. class ScannerTask { void* _p; @@ -595,6 +597,8 @@ class ScannerTask { public: ScannerTask() : _p(nullptr) {} + explicit ScannerTask(oop p) : _p(encode(p, OopTag)) {} + explicit ScannerTask(oop* p) : _p(encode(p, OopTag)) {} explicit ScannerTask(narrowOop* p) : _p(encode(p, NarrowOopTag)) {} @@ -622,6 +626,10 @@ class ScannerTask { return static_cast(decode(OopTag)); } + oop to_oop() const { + return cast_to_oop(decode(OopTag)); + } + narrowOop* to_narrow_oop_ptr() const { return static_cast(decode(NarrowOopTag)); } 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..b3284051ee712 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" @@ -80,13 +79,14 @@ void ShenandoahCardTable::initialize() { } void ShenandoahCardTable::initialize(const ReservedSpace& card_table) { + if (!card_table.is_reserved()) { + vm_exit_during_initialization("Could not reserve enough space for the card marking array"); + } + MemTracker::record_virtual_memory_tag((address)card_table.base(), mtGC); os::trace_page_sizes("Card Table", _byte_map_size, _byte_map_size, card_table.base(), card_table.size(), _page_size); - if (!card_table.is_reserved()) { - vm_exit_during_initialization("Could not reserve enough space for the card marking array"); - } os::commit_memory_or_exit(card_table.base(), _byte_map_size, card_table.alignment(), false, "Cannot commit memory for card table"); } 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..db08014792c64 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); @@ -166,7 +166,11 @@ static ReservedSpace reserve(size_t size, size_t preferred_page_size) { size = align_up(size, alignment); } - return MemoryReserver::reserve(size, alignment, preferred_page_size); + const ReservedSpace reserved = MemoryReserver::reserve(size, alignment, preferred_page_size); + if (!reserved.is_reserved()) { + vm_exit_during_initialization("Could not reserve space"); + } + return reserved; } jint ShenandoahHeap::initialize() { @@ -186,7 +190,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 +280,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 +291,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); @@ -386,6 +390,10 @@ jint ShenandoahHeap::initialize() { if (_collection_set == nullptr) { cset_rs = MemoryReserver::reserve(cset_size, cset_align, os::vm_page_size()); + if (!cset_rs.is_reserved()) { + vm_exit_during_initialization("Cannot reserve memory for collection set"); + } + _collection_set = new ShenandoahCollectionSet(this, cset_rs, sh_rs.base()); } os::trace_page_sizes_for_requested_size("Collection Set", @@ -583,12 +591,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 +652,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 +670,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 +796,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 +850,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 +889,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 +1004,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 +1034,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 +1186,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 +1200,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 +1434,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 +1446,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 +1485,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 +1505,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 +1601,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 +2009,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 +2039,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 +2055,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 +2084,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 +2096,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 +2199,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 +2243,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 +2283,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 +2301,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 +2333,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 +2429,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 +2491,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 +2688,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 c9dbe5f402421..d6c47339f28a9 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahWorkGroup.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahWorkGroup.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2017, 2021, Red Hat, Inc. All rights reserved. - * 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 @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "gc/shenandoah/shenandoahThreadLocalData.hpp" 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..311ea2871f7b8 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" @@ -559,7 +558,9 @@ static const Node* get_base_and_offset(const MachNode* mach, intptr_t& offset) { // The memory address is computed by 'base' and fed to 'mach' via an // indirect memory operand (indicated by offset == 0). The ultimate base and // offset can be fetched directly from the inputs and Ideal type of 'base'. - offset = base->bottom_type()->isa_oopptr()->offset(); + const TypeOopPtr* oopptr = base->bottom_type()->isa_oopptr(); + if (oopptr == nullptr) return nullptr; + offset = oopptr->offset(); // Even if 'base' is not an Ideal AddP node anymore, Matcher::ReduceInst() // guarantees that the base address is still available at the same slot. base = base->in(AddPNode::Base); 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/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 507206e2147ab..b26c643d15fce 100644 --- a/src/hotspot/share/interpreter/linkResolver.cpp +++ b/src/hotspot/share/interpreter/linkResolver.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/archiveUtils.hpp" #include "classfile/classLoader.hpp" #include "classfile/defaultMethods.hpp" 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 27b01e99e5567..6a38553403d71 100644 --- a/src/hotspot/share/jfr/leakprofiler/chains/edgeUtils.cpp +++ b/src/hotspot/share/jfr/leakprofiler/chains/edgeUtils.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/javaClasses.inline.hpp" #include "jfr/leakprofiler/chains/edge.hpp" #include "jfr/leakprofiler/chains/edgeStore.hpp" 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/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 bc5f97c719af9..8128674dc1e58 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/classLoaderDataGraph.hpp" #include "classfile/javaClasses.inline.hpp" #include "classfile/moduleEntry.hpp" 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/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 1fa3f23173ce3..9bbf4fccae16c 100644 --- a/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp +++ b/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp @@ -21,7 +21,6 @@ * questions. */ -#include "precompiled.hpp" #include "classfile/classLoaderData.inline.hpp" #include "classfile/javaClasses.inline.hpp" #include "classfile/stringTable.hpp" 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 1a53f6b6d2cc1..78f5bca476957 100644 --- a/src/hotspot/share/jvmci/jvmciEnv.cpp +++ b/src/hotspot/share/jvmci/jvmciEnv.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/stringTable.hpp" #include "classfile/symbolTable.hpp" #include "classfile/systemDictionary.hpp" 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 97447c43b6e5a..96d369678f792 100644 --- a/src/hotspot/share/jvmci/vmStructs_jvmci.cpp +++ b/src/hotspot/share/jvmci/vmStructs_jvmci.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "code/codeCache.hpp" #include "code/compiledIC.hpp" #include "compiler/compileBroker.hpp" 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 019c2fcb36ca5..0b1470f1a2ed3 100644 --- a/src/hotspot/share/logging/logDecorators.cpp +++ b/src/hotspot/share/logging/logDecorators.cpp @@ -21,7 +21,6 @@ * questions. * */ -#include "precompiled.hpp" #include "logging/logDecorators.hpp" #include "runtime/os.hpp" 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 6eba01d8aa6c6..e3c68b49b1305 100644 --- a/src/hotspot/share/logging/logOutput.cpp +++ b/src/hotspot/share/logging/logOutput.cpp @@ -21,7 +21,6 @@ * questions. * */ -#include "precompiled.hpp" #include "jvm.h" #include "logging/log.hpp" #include "logging/logFileStreamOutput.hpp" 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 f5a0ab1bf533a..476fdebc9c540 100644 --- a/src/hotspot/share/logging/logSelection.cpp +++ b/src/hotspot/share/logging/logSelection.cpp @@ -21,7 +21,6 @@ * questions. * */ -#include "precompiled.hpp" #include "jvm_io.h" #include "logging/log.hpp" #include "logging/logSelection.hpp" @@ -145,7 +144,7 @@ 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; diff --git a/src/hotspot/share/logging/logSelectionList.cpp b/src/hotspot/share/logging/logSelectionList.cpp index d7e5981aa00c8..f8c2d9e7cfb69 100644 --- a/src/hotspot/share/logging/logSelectionList.cpp +++ b/src/hotspot/share/logging/logSelectionList.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "logging/logSelectionList.hpp" #include "logging/logTagSet.hpp" #include "runtime/os.hpp" @@ -72,7 +71,7 @@ bool LogSelectionList::parse(const char* str, outputStream* errstream) { 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; 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..3097ad1be1005 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); @@ -959,37 +958,34 @@ ReservedHeapSpace Universe::reserve_heap(size_t heap_size, size_t alignment) { // Now create the space. ReservedHeapSpace rhs = HeapReserver::reserve(total_reserved, alignment, page_size, AllocateHeapAt); - if (rhs.is_reserved()) { - assert(total_reserved == rhs.size(), "must be exactly of required size"); - assert(is_aligned(rhs.base(),alignment),"must be exactly of required alignment"); - - assert(markWord::encode_pointer_as_mark(rhs.base()).decode_pointer() == rhs.base(), - "area must be distinguishable from marks for mark-sweep"); - assert(markWord::encode_pointer_as_mark(&rhs.base()[rhs.size()]).decode_pointer() == - &rhs.base()[rhs.size()], - "area must be distinguishable from marks for mark-sweep"); + if (!rhs.is_reserved()) { + vm_exit_during_initialization( + err_msg("Could not reserve enough space for %zu KB object heap", + total_reserved/K)); + } - // We are good. + assert(total_reserved == rhs.size(), "must be exactly of required size"); + assert(is_aligned(rhs.base(),alignment),"must be exactly of required alignment"); - if (AllocateHeapAt != nullptr) { - log_info(gc,heap)("Successfully allocated Java heap at location %s", AllocateHeapAt); - } + assert(markWord::encode_pointer_as_mark(rhs.base()).decode_pointer() == rhs.base(), + "area must be distinguishable from marks for mark-sweep"); + assert(markWord::encode_pointer_as_mark(&rhs.base()[rhs.size()]).decode_pointer() == + &rhs.base()[rhs.size()], + "area must be distinguishable from marks for mark-sweep"); - if (UseCompressedOops) { - CompressedOops::initialize(rhs); - } + // We are good. - Universe::calculate_verify_data((HeapWord*)rhs.base(), (HeapWord*)rhs.end()); + if (AllocateHeapAt != nullptr) { + log_info(gc,heap)("Successfully allocated Java heap at location %s", AllocateHeapAt); + } - return rhs; + if (UseCompressedOops) { + CompressedOops::initialize(rhs); } - vm_exit_during_initialization( - err_msg("Could not reserve enough space for " SIZE_FORMAT "KB object heap", - total_reserved/K)); + Universe::calculate_verify_data((HeapWord*)rhs.base(), (HeapWord*)rhs.end()); - // satisfy compiler - ShouldNotReachHere(); + return rhs; } OopStorage* Universe::vm_weak() { diff --git a/src/hotspot/share/memory/virtualspace.cpp b/src/hotspot/share/memory/virtualspace.cpp index 73f74e0b9efcd..2ea90a6c9ddda 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" @@ -58,7 +57,7 @@ bool VirtualSpace::initialize(ReservedSpace rs, size_t committed_size) { } bool VirtualSpace::initialize_with_granularity(ReservedSpace rs, size_t committed_size, size_t max_commit_granularity) { - if(!rs.is_reserved()) return false; // allocation failed. + assert(rs.is_reserved(), "ReservedSpace should have been initialized"); assert(_low_boundary == nullptr, "VirtualSpace already initialized"); assert(max_commit_granularity > 0, "Granularity must be non-zero."); @@ -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 3ae91a03b6797..300b45277ada6 100644 --- a/src/hotspot/share/oops/fieldInfo.cpp +++ b/src/hotspot/share/oops/fieldInfo.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "oops/fieldInfo.inline.hpp" #include "runtime/atomic.hpp" diff --git a/src/hotspot/share/oops/fieldInfo.inline.hpp b/src/hotspot/share/oops/fieldInfo.inline.hpp index bf37d280510f7..d3d4d765081d0 100644 --- a/src/hotspot/share/oops/fieldInfo.inline.hpp +++ b/src/hotspot/share/oops/fieldInfo.inline.hpp @@ -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 43b078a8af233..9e3f73596e27b 100644 --- a/src/hotspot/share/oops/instanceKlass.cpp +++ b/src/hotspot/share/oops/instanceKlass.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/aotClassInitializer.hpp" #include "cds/archiveUtils.hpp" #include "cds/cdsConfig.hpp" @@ -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/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 d27665bbcc121..a3e1e4524795f 100644 --- a/src/hotspot/share/oops/klass.hpp +++ b/src/hotspot/share/oops/klass.hpp @@ -283,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; } 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 ab15379409f76..a0f6a901cf783 100644 --- a/src/hotspot/share/oops/method.cpp +++ b/src/hotspot/share/oops/method.cpp @@ -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"); 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 903c5660d5311..288a1ed359bbd 100644 --- a/src/hotspot/share/oops/objArrayKlass.cpp +++ b/src/hotspot/share/oops/objArrayKlass.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/moduleEntry.hpp" #include "classfile/packageEntry.hpp" #include "classfile/symbolTable.hpp" 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 86c4f9d7138c4..95377a8452df4 100644 --- a/src/hotspot/share/oops/typeArrayKlass.cpp +++ b/src/hotspot/share/oops/typeArrayKlass.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "classfile/moduleEntry.hpp" #include "classfile/packageEntry.hpp" #include "classfile/symbolTable.hpp" 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 56cfb9fe16e7b..9ed7bea750de7 100644 --- a/src/hotspot/share/opto/library_call.cpp +++ b/src/hotspot/share/opto/library_call.cpp @@ -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)); @@ -4256,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; @@ -4298,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; } @@ -4393,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); @@ -5130,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, @@ -5253,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); @@ -5272,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"); @@ -5293,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()); @@ -5914,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 @@ -8263,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; @@ -8531,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 78ffbe05ae492..a5a746626f8c5 100644 --- a/src/hotspot/share/opto/memnode.cpp +++ b/src/hotspot/share/opto/memnode.cpp @@ -23,7 +23,6 @@ * */ -#include "precompiled.hpp" #include "classfile/javaClasses.hpp" #include "compiler/compileLog.hpp" #include "gc/shared/barrierSet.hpp" @@ -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/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 e62524b37cd3c..4ef864fe9c445 100644 --- a/src/hotspot/share/opto/vectornode.cpp +++ b/src/hotspot/share/opto/vectornode.cpp @@ -21,7 +21,6 @@ * questions. */ -#include "precompiled.hpp" #include "memory/allocation.inline.hpp" #include "opto/connode.hpp" #include "opto/mulnode.hpp" 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 198165cdd1ed9..c4803fcfd4af9 100644 --- a/src/hotspot/share/prims/jvm.cpp +++ b/src/hotspot/share/prims/jvm.cpp @@ -22,7 +22,6 @@ * */ -#include "precompiled.hpp" #include "cds/cdsConfig.hpp" #include "cds/classListParser.hpp" #include "cds/classListWriter.hpp" diff --git a/src/hotspot/share/prims/jvmti.xml b/src/hotspot/share/prims/jvmti.xml index b63dfdfedb1aa..4bff3230c9ee3 100644 --- a/src/hotspot/share/prims/jvmti.xml +++ b/src/hotspot/share/prims/jvmti.xml @@ -1,7 +1,7 @@ m3 cycle - resolveAndBind(finder, "m1"); + assertThrows(ResolutionException.class, () -> resolveAndBind(finder, "m1")); } @@ -1554,8 +1573,8 @@ public void testCycleInProvider() { * - Configuration cf1: m1, m2 requires transitive m1 * - Configuration cf2: m1 requires m2 */ - @Test(expectedExceptions = { ResolutionException.class }) - public void testReadModuleWithSameNameAsSelf() { + @Test + void testReadModuleWithSameNameAsSelf() { ModuleDescriptor descriptor1_v1 = newBuilder("m1") .build(); @@ -1573,7 +1592,7 @@ public void testReadModuleWithSameNameAsSelf() { // resolve should throw ResolutionException ModuleFinder finder2 = ModuleUtils.finderOf(descriptor1_v2); - resolve(cf1, finder2, "m1"); + assertThrows(ResolutionException.class, () -> resolve(cf1, finder2, "m1")); } @@ -1585,8 +1604,8 @@ public void testReadModuleWithSameNameAsSelf() { * - Configuration cf2: m1, m3 requires transitive m1 * - Configuration cf3(cf1,cf2): m4 requires m2, m3 */ - @Test(expectedExceptions = { ResolutionException.class }) - public void testReadTwoModuleWithSameName() { + @Test + void testReadTwoModuleWithSameName() { ModuleDescriptor descriptor1 = newBuilder("m1") .build(); @@ -1613,16 +1632,19 @@ public void testReadTwoModuleWithSameName() { // should throw ResolutionException as m4 will read modules named "m1". ModuleFinder finder3 = ModuleUtils.finderOf(descriptor4); - Configuration.resolve(finder3, List.of(cf1, cf2), ModuleFinder.of(), Set.of("m4")); + assertThrows(ResolutionException.class, + () -> Configuration.resolve(finder3, + List.of(cf1, cf2), + ModuleFinder.of(), + Set.of("m4"))); } /** * Test two modules exporting package p to a module that reads both. */ - @Test(expectedExceptions = { ResolutionException.class }) - public void testPackageSuppliedByTwoOthers() { - + @Test + void testPackageSuppliedByTwoOthers() { ModuleDescriptor descriptor1 = newBuilder("m1") .requires("m2") .requires("m3") @@ -1640,7 +1662,7 @@ public void testPackageSuppliedByTwoOthers() { = ModuleUtils.finderOf(descriptor1, descriptor2, descriptor3); // m2 and m3 export package p to module m1 - resolve(finder, "m1"); + assertThrows(ResolutionException.class, () -> resolve(finder, "m1")); } @@ -1648,9 +1670,8 @@ public void testPackageSuppliedByTwoOthers() { * Test the scenario where a module contains a package p and reads * a module that exports package p. */ - @Test(expectedExceptions = { ResolutionException.class }) - public void testPackageSuppliedBySelfAndOther() { - + @Test + void testPackageSuppliedBySelfAndOther() { ModuleDescriptor descriptor1 = newBuilder("m1") .requires("m2") .packages(Set.of("p")) @@ -1663,7 +1684,7 @@ public void testPackageSuppliedBySelfAndOther() { ModuleFinder finder = ModuleUtils.finderOf(descriptor1, descriptor2); // m1 contains package p, module m2 exports package p to m1 - resolve(finder, "m1"); + assertThrows(ResolutionException.class, () -> resolve(finder, "m1")); } @@ -1671,7 +1692,8 @@ public void testPackageSuppliedBySelfAndOther() { * Test the scenario where a module contains a package p and reads * a module that also contains a package p. */ - public void testContainsPackageInSelfAndOther() { + @Test + void testContainsPackageInSelfAndOther() { ModuleDescriptor descriptor1 = newBuilder("m1") .requires("m2") .packages(Set.of("p")) @@ -1702,8 +1724,8 @@ public void testContainsPackageInSelfAndOther() { * Test the scenario where a module that exports a package that is also * exported by a module that it reads in a parent layer. */ - @Test(expectedExceptions = { ResolutionException.class }) - public void testExportSamePackageAsBootLayer() { + @Test + void testExportSamePackageAsBootLayer() { ModuleDescriptor descriptor = newBuilder("m1") .requires("java.base") .exports("java.lang") @@ -1714,14 +1736,15 @@ public void testExportSamePackageAsBootLayer() { Configuration bootConfiguration = ModuleLayer.boot().configuration(); // m1 contains package java.lang, java.base exports package java.lang to m1 - resolve(bootConfiguration, finder, "m1"); + assertThrows(ResolutionException.class, () -> resolve(bootConfiguration, finder, "m1")); } /** * Test "uses p.S" where p is contained in the same module. */ - public void testContainsService1() { + @Test + void testContainsService1() { ModuleDescriptor descriptor1 = newBuilder("m1") .packages(Set.of("p")) .uses("p.S") @@ -1739,8 +1762,8 @@ public void testContainsService1() { /** * Test "uses p.S" where p is contained in a different module. */ - @Test(expectedExceptions = { ResolutionException.class }) - public void testContainsService2() { + @Test + void testContainsService2() { ModuleDescriptor descriptor1 = newBuilder("m1") .packages(Set.of("p")) .build(); @@ -1753,14 +1776,15 @@ public void testContainsService2() { ModuleFinder finder = ModuleUtils.finderOf(descriptor1, descriptor2); // m2 does not read a module that exports p - resolve(finder, "m2"); + assertThrows(ResolutionException.class, () -> resolve(finder, "m2")); } /** * Test "provides p.S" where p is contained in the same module. */ - public void testContainsService3() { + @Test + void testContainsService3() { ModuleDescriptor descriptor1 = newBuilder("m1") .packages(Set.of("p", "q")) .provides("p.S", List.of("q.S1")) @@ -1778,8 +1802,8 @@ public void testContainsService3() { /** * Test "provides p.S" where p is contained in a different module. */ - @Test(expectedExceptions = { ResolutionException.class }) - public void testContainsService4() { + @Test + void testContainsService4() { ModuleDescriptor descriptor1 = newBuilder("m1") .packages(Set.of("p")) .build(); @@ -1792,46 +1816,182 @@ public void testContainsService4() { ModuleFinder finder = ModuleUtils.finderOf(descriptor1, descriptor2); // m2 does not read a module that exports p - resolve(finder, "m2"); + assertThrows(ResolutionException.class, () -> resolve(finder, "m2")); } + /** + * Test uses optional service. + * + * module m1 { requires static m2; uses p.S; } + */ + @Test + void testUsesOptionalService1() { + ModuleDescriptor descriptor1 = newBuilder("m1") + .requires(Set.of(Requires.Modifier.STATIC), "m2") + .uses("p.S") + .build(); + ModuleFinder finder = ModuleUtils.finderOf(descriptor1); + Configuration cf = resolve(finder, "m1"); + assertTrue(cf.modules().size() == 1); + assertTrue(cf.findModule("m1").isPresent()); + } /** - * Test "uses p.S" where p is not exported to the module. + * Test uses optional service. + * + * module m1 { requires m2; uses p.S; } + * module m2 { requires static transitive m3; } + */ + @Test + void testUsesOptionalService2() { + ModuleDescriptor descriptor1 = newBuilder("m1") + .requires("m2") + .uses("p.S") + .build(); + ModuleDescriptor descriptor2 = newBuilder("m2") + .requires(Set.of(Requires.Modifier.STATIC, Requires.Modifier.TRANSITIVE), "m3") + .build(); + ModuleFinder finder = ModuleUtils.finderOf(descriptor1, descriptor2); + Configuration cf = resolve(finder, "m1"); + assertTrue(cf.modules().size() == 2); + assertTrue(cf.findModule("m1").isPresent()); + assertTrue(cf.findModule("m2").isPresent()); + } + + /** + * Test uses optional service. + * + * module m1 { requires m2; uses p.S; } + * module m2 { requires transitive m3; } + * module m3 { requires static transitive m4; } */ - @Test(expectedExceptions = { ResolutionException.class }) - public void testServiceTypePackageNotExported1() { + @Test + void testUsesOptionalService3() { ModuleDescriptor descriptor1 = newBuilder("m1") + .requires("m2") .uses("p.S") .build(); + ModuleDescriptor descriptor2 = newBuilder("m2") + .requires(Set.of(Requires.Modifier.TRANSITIVE), "m3") + .build(); + ModuleDescriptor descriptor3 = newBuilder("m3") + .requires(Set.of(Requires.Modifier.STATIC, Requires.Modifier.TRANSITIVE), "m4") + .build(); + ModuleFinder finder = ModuleUtils.finderOf(descriptor1, descriptor2, descriptor3); + Configuration cf = resolve(finder, "m1"); + assertTrue(cf.modules().size() == 3); + assertTrue(cf.findModule("m1").isPresent()); + assertTrue(cf.findModule("m2").isPresent()); + assertTrue(cf.findModule("m3").isPresent()); + } + /** + * Test provides optional service. + * + * module m1 { requires static m2; provides p.S with q.P; } + */ + @Test + void testProvidesOptionalService1() { + ModuleDescriptor descriptor1 = newBuilder("m1") + .requires(Set.of(Requires.Modifier.STATIC), "m2") + .provides("p.S", List.of("q.P")) + .build(); ModuleFinder finder = ModuleUtils.finderOf(descriptor1); - - // m1 does not read a module that exports p - resolve(finder, "m1"); + Configuration cf = resolve(finder, "m1"); + assertTrue(cf.modules().size() == 1); + assertTrue(cf.findModule("m1").isPresent()); } + /** + * Test provides optional service. + * + * module m1 { requires m2; provides p.S with q.P; } + * module m2 { requires static transitive m3; } + */ + @Test + void testProvidesOptionalService2() { + ModuleDescriptor descriptor1 = newBuilder("m1") + .requires("m2") + .provides("p.S", List.of("q.P")) + .build(); + ModuleDescriptor descriptor2 = newBuilder("m2") + .requires(Set.of(Requires.Modifier.STATIC, Requires.Modifier.TRANSITIVE), "m3") + .build(); + ModuleFinder finder = ModuleUtils.finderOf(descriptor1, descriptor2); + Configuration cf = resolve(finder, "m1"); + assertTrue(cf.modules().size() == 2); + assertTrue(cf.findModule("m1").isPresent()); + assertTrue(cf.findModule("m2").isPresent()); + } /** - * Test "provides p.S" where p is not exported to the module. + * Test provides optional service. + * + * module m1 { requires m2; provides p.S with q.P; } + * module m2 { requires transitive m3; } + * module m3 { requires static transitive m4; } */ - @Test(expectedExceptions = { ResolutionException.class }) - public void testServiceTypePackageNotExported2() { + @Test + void testProvidesOptionalService3() { ModuleDescriptor descriptor1 = newBuilder("m1") - .provides("p.S", List.of("q.T")) + .requires("m2") + .provides("p.S", List.of("q.P")) + .build(); + ModuleDescriptor descriptor2 = newBuilder("m2") + .requires(Set.of(Requires.Modifier.TRANSITIVE), "m3") .build(); + ModuleDescriptor descriptor3 = newBuilder("m3") + .requires(Set.of(Requires.Modifier.STATIC, Requires.Modifier.TRANSITIVE), "m4") + .build(); + ModuleFinder finder = ModuleUtils.finderOf(descriptor1, descriptor2, descriptor3); + Configuration cf = resolve(finder, "m1"); + assertTrue(cf.modules().size() == 3); + assertTrue(cf.findModule("m1").isPresent()); + assertTrue(cf.findModule("m2").isPresent()); + assertTrue(cf.findModule("m3").isPresent()); + } + /** + * Test "uses p.S" where p is not exported to the module. + */ + @Test + void testServiceTypePackageNotExported1() { + ModuleDescriptor descriptor1 = newBuilder("m1") + .uses("p.S") + .build(); ModuleFinder finder = ModuleUtils.finderOf(descriptor1); - // m1 does not read a module that exports p - resolve(finder, "m1"); + // m1 does not read a module that exports p to m1 + assertThrows(ResolutionException.class, () -> resolve(finder, "m1")); + } + + /** + * Test "uses p.S" where p is not exported to the module. + * + * module m1 { requires m2; uses p.S; } + * module m2 { contains p; } + */ + @Test + void testServiceTypePackageNotExported2() { + ModuleDescriptor descriptor1 = newBuilder("m1") + .requires("m2") + .uses("p.S") + .build(); + ModuleDescriptor descriptor2 = newBuilder("m2") + .packages(Set.of("p")) + .build(); + ModuleFinder finder = ModuleUtils.finderOf(descriptor1, descriptor2); + + // m1 does not read a module that exports p to m1 + assertThrows(ResolutionException.class, () -> resolve(finder, "m1")); } /** * Test the empty configuration. */ - public void testEmptyConfiguration() { + @Test + void testEmptyConfiguration() { Configuration cf = Configuration.empty(); assertTrue(cf.parents().isEmpty()); @@ -1840,47 +2000,22 @@ public void testEmptyConfiguration() { assertFalse(cf.findModule("java.base").isPresent()); } - - // platform specific modules - - @DataProvider(name = "platformmatch") - public Object[][] createPlatformMatches() { - return new Object[][]{ - - { "", "" }, - { "linux-arm", "" }, - { "linux-arm", "linux-arm" }, - - }; - - }; - - @DataProvider(name = "platformmismatch") - public Object[][] createBad() { - return new Object[][] { - - { "linux-x64", "linux-arm" }, - { "linux-x64", "windows-x64" }, - - }; - } - /** * Test creating a configuration containing platform specific modules. */ - @Test(dataProvider = "platformmatch") - public void testPlatformMatch(String s1, String s2) throws IOException { - + @ParameterizedTest + @CsvSource({",", "linux-aarch64,", "linux-aarch64,linux-aarch64"}) + void testPlatformMatch(String targetPlatform1, String targetPlatform2) throws IOException { ModuleDescriptor base = ModuleDescriptor.newModule("java.base").build(); Path system = writeModule(base, null); ModuleDescriptor descriptor1 = ModuleDescriptor.newModule("m1") .requires("m2") .build(); - Path dir1 = writeModule(descriptor1, s1); + Path dir1 = writeModule(descriptor1, targetPlatform1); ModuleDescriptor descriptor2 = ModuleDescriptor.newModule("m2").build(); - Path dir2 = writeModule(descriptor2, s2); + Path dir2 = writeModule(descriptor2, targetPlatform2); ModuleFinder finder = ModuleFinder.of(system, dir1, dir2); @@ -1893,43 +2028,45 @@ public void testPlatformMatch(String s1, String s2) throws IOException { } /** - * Test attempting to create a configuration with modules for different - * platforms. + * Test attempting to create a configuration with modules for different platforms. */ - @Test(dataProvider = "platformmismatch", - expectedExceptions = FindException.class ) - public void testPlatformMisMatch(String s1, String s2) throws IOException { - testPlatformMatch(s1, s2); + @ParameterizedTest + @CsvSource({"linux-x64,linux-aarch64", "linux-x64,windows-x64"}) + void testPlatformMisMatch(String targetPlatform1, String targetPlatform2) throws IOException { + assertThrows(FindException.class, + () -> testPlatformMatch(targetPlatform1, targetPlatform2)); } // no parents - @Test(expectedExceptions = { IllegalArgumentException.class }) - public void testResolveRequiresWithNoParents() { + @Test + void testResolveRequiresWithNoParents() { ModuleFinder empty = ModuleFinder.of(); - Configuration.resolve(empty, List.of(), empty, Set.of()); + assertThrows(IllegalArgumentException.class, + () -> Configuration.resolve(empty, List.of(), empty, Set.of())); } - @Test(expectedExceptions = { IllegalArgumentException.class }) - public void testResolveRequiresAndUsesWithNoParents() { + @Test + void testResolveRequiresAndUsesWithNoParents() { ModuleFinder empty = ModuleFinder.of(); - Configuration.resolveAndBind(empty, List.of(), empty, Set.of()); + assertThrows(IllegalArgumentException.class, + () -> Configuration.resolveAndBind(empty, List.of(), empty, Set.of())); } // parents with modules for specific platforms - @Test(dataProvider = "platformmatch") - public void testResolveRequiresWithCompatibleParents(String s1, String s2) - throws IOException - { - ModuleDescriptor base = ModuleDescriptor.newModule("java.base").build(); + @ParameterizedTest + @CsvSource({",", "linux-aarch64,", "linux-aarch64,linux-aarch64"}) + void testResolveRequiresWithCompatibleParents(String targetPlatform1, + String targetPlatform2) throws IOException { + ModuleDescriptor base = ModuleDescriptor.newModule("java.base").build(); Path system = writeModule(base, null); ModuleDescriptor descriptor1 = ModuleDescriptor.newModule("m1").build(); - Path dir1 = writeModule(descriptor1, s1); + Path dir1 = writeModule(descriptor1, targetPlatform1); ModuleDescriptor descriptor2 = ModuleDescriptor.newModule("m2").build(); - Path dir2 = writeModule(descriptor2, s2); + Path dir2 = writeModule(descriptor2, targetPlatform2); ModuleFinder finder1 = ModuleFinder.of(system, dir1); Configuration cf1 = resolve(finder1, "m1"); @@ -1945,163 +2082,160 @@ public void testResolveRequiresWithCompatibleParents(String s1, String s2) } - @Test(dataProvider = "platformmismatch", - expectedExceptions = IllegalArgumentException.class ) - public void testResolveRequiresWithConflictingParents(String s1, String s2) - throws IOException - { - testResolveRequiresWithCompatibleParents(s1, s2); + @ParameterizedTest + @CsvSource({"linux-x64,linux-aarch64", "linux-x64,windows-x64"}) + void testResolveRequiresWithConflictingParents(String targetPlatform1, + String targetPlatform2) throws IOException { + assertThrows(IllegalArgumentException.class, + () -> testResolveRequiresWithCompatibleParents(targetPlatform1, targetPlatform2)); } // null handling - // finder1, finder2, roots - - - @Test(expectedExceptions = { NullPointerException.class }) - public void testResolveRequiresWithNull1() { - resolve((ModuleFinder)null, ModuleFinder.of()); + @Test + void testResolveRequiresWithNull1() { + assertThrows(NullPointerException.class, + () -> resolve((ModuleFinder) null, ModuleFinder.of())); } - @Test(expectedExceptions = { NullPointerException.class }) - public void testResolveRequiresWithNull2() { - resolve(ModuleFinder.of(), (ModuleFinder)null); + @Test + void testResolveRequiresWithNull2() { + assertThrows(NullPointerException.class, + () -> resolve(ModuleFinder.of(), (ModuleFinder) null)); } - @Test(expectedExceptions = { NullPointerException.class }) - public void testResolveRequiresWithNull3() { + @Test + void testResolveRequiresWithNull3() { Configuration empty = Configuration.empty(); - Configuration.resolve(null, List.of(empty), ModuleFinder.of(), Set.of()); + assertThrows(NullPointerException.class, + () -> Configuration.resolve(null, List.of(empty), ModuleFinder.of(), Set.of())); } - @Test(expectedExceptions = { NullPointerException.class }) - public void testResolveRequiresWithNull4() { + @Test + void testResolveRequiresWithNull4() { ModuleFinder empty = ModuleFinder.of(); - Configuration.resolve(empty, null, empty, Set.of()); + assertThrows(NullPointerException.class, + () -> Configuration.resolve(empty, null, empty, Set.of())); } - @Test(expectedExceptions = { NullPointerException.class }) - public void testResolveRequiresWithNull5() { + @Test + void testResolveRequiresWithNull5() { Configuration cf = ModuleLayer.boot().configuration(); - Configuration.resolve(ModuleFinder.of(), List.of(cf), null, Set.of()); + assertThrows(NullPointerException.class, + () -> Configuration.resolve(ModuleFinder.of(), List.of(cf), null, Set.of())); } - @Test(expectedExceptions = { NullPointerException.class }) - public void testResolveRequiresWithNull6() { + @Test + void testResolveRequiresWithNull6() { ModuleFinder empty = ModuleFinder.of(); Configuration cf = ModuleLayer.boot().configuration(); - Configuration.resolve(empty, List.of(cf), empty, null); + assertThrows(NullPointerException.class, + () -> Configuration.resolve(empty, List.of(cf), empty, null)); } - @Test(expectedExceptions = { NullPointerException.class }) - public void testResolveRequiresAndUsesWithNull1() { - resolveAndBind((ModuleFinder) null, ModuleFinder.of()); + @Test + void testResolveRequiresAndUsesWithNull1() { + assertThrows(NullPointerException.class, + () -> resolveAndBind((ModuleFinder) null, ModuleFinder.of())); } - @Test(expectedExceptions = { NullPointerException.class }) - public void testResolveRequiresAndUsesWithNull2() { - resolveAndBind(ModuleFinder.of(), (ModuleFinder) null); + @Test + void testResolveRequiresAndUsesWithNull2() { + assertThrows(NullPointerException.class, + () -> resolveAndBind(ModuleFinder.of(), (ModuleFinder) null)); } - @Test(expectedExceptions = { NullPointerException.class }) - public void testResolveRequiresAndUsesWithNull3() { + @Test + void testResolveRequiresAndUsesWithNull3() { Configuration empty = Configuration.empty(); - Configuration.resolveAndBind(null, List.of(empty), ModuleFinder.of(), Set.of()); + assertThrows(NullPointerException.class, + () -> Configuration.resolveAndBind(null, List.of(empty), ModuleFinder.of(), Set.of())); } - @Test(expectedExceptions = { NullPointerException.class }) - public void testResolveRequiresAndUsesWithNull4() { + @Test + void testResolveRequiresAndUsesWithNull4() { ModuleFinder empty = ModuleFinder.of(); - Configuration.resolveAndBind(empty, null, empty, Set.of()); + assertThrows(NullPointerException.class, + () -> Configuration.resolveAndBind(empty, null, empty, Set.of())); } - @Test(expectedExceptions = { NullPointerException.class }) - public void testResolveRequiresAndUsesWithNull5() { + @Test + void testResolveRequiresAndUsesWithNull5() { Configuration cf = ModuleLayer.boot().configuration(); - Configuration.resolveAndBind(ModuleFinder.of(), List.of(cf), null, Set.of()); + assertThrows(NullPointerException.class, + () -> Configuration.resolveAndBind(ModuleFinder.of(), List.of(cf), null, Set.of())); } - @Test(expectedExceptions = { NullPointerException.class }) - public void testResolveRequiresAndUsesWithNull6() { + @Test + void testResolveRequiresAndUsesWithNull6() { ModuleFinder empty = ModuleFinder.of(); Configuration cf = ModuleLayer.boot().configuration(); - Configuration.resolveAndBind(empty, List.of(cf), empty, null); + assertThrows(NullPointerException.class, + () -> Configuration.resolveAndBind(empty, List.of(cf), empty, null)); } - @Test(expectedExceptions = { NullPointerException.class }) - public void testFindModuleWithNull() { - Configuration.empty().findModule(null); + @Test + void testFindModuleWithNull() { + assertThrows(NullPointerException.class, () -> Configuration.empty().findModule(null)); } // unmodifiable collections - @DataProvider(name = "configurations") - public Object[][] configurations() { - // empty, boot, and custom configurations - return new Object[][] { - { Configuration.empty(), null }, - { ModuleLayer.boot().configuration(), null }, - { resolve(ModuleFinder.of()), null }, - }; - } - - @Test(dataProvider = "configurations", - expectedExceptions = { UnsupportedOperationException.class }) - public void testUnmodifiableParents1(Configuration cf, Object ignore) { - cf.parents().add(Configuration.empty()); - } - - @Test(dataProvider = "configurations", - expectedExceptions = { UnsupportedOperationException.class }) - public void testUnmodifiableParents2(Configuration cf, Object ignore) { - cf.parents().remove(Configuration.empty()); + static Stream configurations() { + return Stream.of( + Configuration.empty(), + ModuleLayer.boot().configuration(), + resolve(ModuleFinder.of()) + ); } - @Test(dataProvider = "configurations", - expectedExceptions = { UnsupportedOperationException.class }) - public void testUnmodifiableModules1(Configuration cf, Object ignore) { - ResolvedModule module = ModuleLayer.boot() - .configuration() - .findModule("java.base") - .orElseThrow(); - cf.modules().add(module); + @ParameterizedTest + @MethodSource("configurations") + void testUnmodifiableParents(Configuration cf) { + assertThrows(UnsupportedOperationException.class, + () -> cf.parents().add(Configuration.empty())); + assertThrows(UnsupportedOperationException.class, + () -> cf.parents().remove(Configuration.empty())); } - @Test(dataProvider = "configurations", - expectedExceptions = { UnsupportedOperationException.class }) - public void testUnmodifiableModules2(Configuration cf, Object ignore) { + @ParameterizedTest + @MethodSource("configurations") + void testUnmodifiableModules(Configuration cf) { ResolvedModule module = ModuleLayer.boot() .configuration() .findModule("java.base") .orElseThrow(); - cf.modules().remove(module); + assertThrows(UnsupportedOperationException.class, + () -> cf.modules().add(module)); + assertThrows(UnsupportedOperationException.class, + () -> cf.modules().remove(module)); } /** * Invokes parent.resolve(...) */ - private Configuration resolve(Configuration parent, - ModuleFinder before, - ModuleFinder after, - String... roots) { + private static Configuration resolve(Configuration parent, + ModuleFinder before, + ModuleFinder after, + String... roots) { return parent.resolve(before, after, Set.of(roots)); } - private Configuration resolve(Configuration parent, - ModuleFinder before, - String... roots) { + private static Configuration resolve(Configuration parent, + ModuleFinder before, + String... roots) { return resolve(parent, before, ModuleFinder.of(), roots); } - private Configuration resolve(ModuleFinder before, - ModuleFinder after, - String... roots) { + private static Configuration resolve(ModuleFinder before, + ModuleFinder after, + String... roots) { return resolve(Configuration.empty(), before, after, roots); } - private Configuration resolve(ModuleFinder before, - String... roots) { + private static Configuration resolve(ModuleFinder before, + String... roots) { return resolve(Configuration.empty(), before, roots); } @@ -2109,27 +2243,27 @@ private Configuration resolve(ModuleFinder before, /** * Invokes parent.resolveAndBind(...) */ - private Configuration resolveAndBind(Configuration parent, - ModuleFinder before, - ModuleFinder after, - String... roots) { + private static Configuration resolveAndBind(Configuration parent, + ModuleFinder before, + ModuleFinder after, + String... roots) { return parent.resolveAndBind(before, after, Set.of(roots)); } - private Configuration resolveAndBind(Configuration parent, - ModuleFinder before, - String... roots) { + private static Configuration resolveAndBind(Configuration parent, + ModuleFinder before, + String... roots) { return resolveAndBind(parent, before, ModuleFinder.of(), roots); } - private Configuration resolveAndBind(ModuleFinder before, - ModuleFinder after, - String... roots) { + private static Configuration resolveAndBind(ModuleFinder before, + ModuleFinder after, + String... roots) { return resolveAndBind(Configuration.empty(), before, after, roots); } - private Configuration resolveAndBind(ModuleFinder before, - String... roots) { + private static Configuration resolveAndBind(ModuleFinder before, + String... roots) { return resolveAndBind(Configuration.empty(), before, roots); } @@ -2138,7 +2272,7 @@ private Configuration resolveAndBind(ModuleFinder before, * Writes a module-info.class. If {@code targetPlatform} is not null then * it includes the ModuleTarget class file attribute with the target platform. */ - static Path writeModule(ModuleDescriptor descriptor, String targetPlatform) + private static Path writeModule(ModuleDescriptor descriptor, String targetPlatform) throws IOException { ModuleTarget target; diff --git a/test/jdk/java/net/DatagramSocket/InterruptibleDatagramSocket.java b/test/jdk/java/net/DatagramSocket/InterruptibleDatagramSocket.java index dbe10f9646c80..aca88bb95901a 100644 --- a/test/jdk/java/net/DatagramSocket/InterruptibleDatagramSocket.java +++ b/test/jdk/java/net/DatagramSocket/InterruptibleDatagramSocket.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, 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 @@ -37,6 +37,7 @@ * @test * @summary Check interrupt mechanism for DatagramSocket, * MulticastSocket, and DatagramSocketAdaptor + * @library /test/lib * @run main InterruptibleDatagramSocket */ @@ -97,6 +98,10 @@ else if (!s.isClosed() && interruptible) } public static void main(String[] args) throws Exception { + if (Thread.currentThread().isVirtual()) { + throw new jtreg.SkippedException( + "skipping test execution - main thread is a virtual thread"); + } try (DatagramSocket s = new DatagramSocket()) { System.out.println("Testing interrupt of DatagramSocket receive " + "on endpoint " + s.getLocalSocketAddress()); diff --git a/test/jdk/java/net/httpclient/AbstractConnectTimeoutHandshake.java b/test/jdk/java/net/httpclient/AbstractConnectTimeoutHandshake.java index b80ec09747a93..3febe7145b42e 100644 --- a/test/jdk/java/net/httpclient/AbstractConnectTimeoutHandshake.java +++ b/test/jdk/java/net/httpclient/AbstractConnectTimeoutHandshake.java @@ -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 @@ -44,10 +44,11 @@ import java.net.http.HttpRequest.BodyPublishers; import java.net.http.HttpResponse; import java.net.http.HttpResponse.BodyHandlers; + +import jdk.test.lib.net.URIBuilder; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; import org.testng.annotations.DataProvider; -import static java.lang.String.format; import static java.lang.System.out; import static java.net.http.HttpClient.Builder.NO_PROXY; import static java.net.http.HttpClient.Version.HTTP_1_1; @@ -56,7 +57,7 @@ import static java.util.concurrent.TimeUnit.NANOSECONDS; import static org.testng.Assert.fail; -public abstract class AbstractConnectTimeoutHandshake { +abstract class AbstractConnectTimeoutHandshake { // The number of iterations each testXXXClient performs. static final int TIMES = 2; @@ -197,15 +198,15 @@ static void printResponse(HttpResponse response) { // -- Infrastructure - static String serverAuthority(Server server) { - return InetAddress.getLoopbackAddress().getHostName() + ":" - + server.getPort(); - } - @BeforeTest public void setup() throws Exception { server = new Server(); - httpsURI = URI.create("https://" + serverAuthority(server) + "/foo"); + httpsURI = URIBuilder.newBuilder() + .scheme("https") + .loopback() + .port(server.getPort()) + .path("/foo") + .build(); out.println("HTTPS URI: " + httpsURI); } diff --git a/test/jdk/java/net/httpclient/AbstractThrowingPublishers.java b/test/jdk/java/net/httpclient/AbstractThrowingPublishers.java index 4079bd81e3e19..859169dcaae83 100644 --- a/test/jdk/java/net/httpclient/AbstractThrowingPublishers.java +++ b/test/jdk/java/net/httpclient/AbstractThrowingPublishers.java @@ -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,9 +21,6 @@ * questions. */ -import com.sun.net.httpserver.HttpServer; -import com.sun.net.httpserver.HttpsConfigurator; -import com.sun.net.httpserver.HttpsServer; import jdk.test.lib.net.SimpleSSLContext; import org.testng.ITestContext; import org.testng.ITestResult; @@ -40,8 +37,6 @@ import java.io.InputStream; import java.io.OutputStream; import java.io.UncheckedIOException; -import java.net.InetAddress; -import java.net.InetSocketAddress; import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; @@ -73,7 +68,6 @@ import java.util.stream.Collectors; import java.util.stream.Stream; import jdk.httpclient.test.lib.common.HttpServerAdapters; -import jdk.httpclient.test.lib.http2.Http2TestServer; import static java.lang.String.format; import static java.lang.System.out; @@ -479,10 +473,12 @@ private void testThrowing(String uri, boolean sameClient, // synchronous send will rethrow exceptions Throwable throwable = t.getCause(); assert throwable != null; - - if (thrower.test(where, throwable)) { - System.out.println(now() + "Got expected exception: " + throwable); - } else throw causeNotFound(where, t); + Throwable cause = findCause(where, throwable, thrower); + if (cause == null) { + throw causeNotFound(where, t); + } else { + System.out.println(now() + "Got expected exception: " + cause); + } } } if (response != null) { diff --git a/test/jdk/java/net/httpclient/AggregateRequestBodyTest.java b/test/jdk/java/net/httpclient/AggregateRequestBodyTest.java index d2bbd2635af31..a879525b4b4b9 100644 --- a/test/jdk/java/net/httpclient/AggregateRequestBodyTest.java +++ b/test/jdk/java/net/httpclient/AggregateRequestBodyTest.java @@ -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 @@ -33,8 +33,6 @@ * @summary Tests HttpRequest.BodyPublishers::concat */ -import java.net.InetAddress; -import java.net.InetSocketAddress; import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; @@ -57,6 +55,7 @@ import java.util.concurrent.Flow; import java.util.concurrent.Flow.Subscriber; import java.util.concurrent.Flow.Subscription; +import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicLong; @@ -67,12 +66,8 @@ import java.util.stream.LongStream; import java.util.stream.Stream; import jdk.httpclient.test.lib.common.HttpServerAdapters; -import jdk.httpclient.test.lib.http2.Http2TestServer; import javax.net.ssl.SSLContext; -import com.sun.net.httpserver.HttpServer; -import com.sun.net.httpserver.HttpsConfigurator; -import com.sun.net.httpserver.HttpsServer; import jdk.test.lib.net.SimpleSSLContext; import org.testng.Assert; import org.testng.ITestContext; @@ -419,9 +414,11 @@ public void cancel() { } static class RequestSubscriber implements Flow.Subscriber { - CompletableFuture subscriptionCF = new CompletableFuture<>(); - ConcurrentLinkedDeque items = new ConcurrentLinkedDeque<>(); - CompletableFuture> resultCF = new CompletableFuture<>(); + final CompletableFuture subscriptionCF = new CompletableFuture<>(); + final ConcurrentLinkedDeque items = new ConcurrentLinkedDeque<>(); + final CompletableFuture> resultCF = new CompletableFuture<>(); + + final Semaphore semaphore = new Semaphore(0); @Override public void onSubscribe(Subscription subscription) { @@ -431,6 +428,11 @@ public void onSubscribe(Subscription subscription) { @Override public void onNext(ByteBuffer item) { items.addLast(item); + int available = semaphore.availablePermits(); + if (available > Integer.MAX_VALUE - 8) { + onError(new IllegalStateException("too many buffers in queue: " + available)); + } + semaphore.release(); } @Override @@ -443,6 +445,18 @@ public void onComplete() { resultCF.complete(items.stream().collect(Collectors.toUnmodifiableList())); } + public ByteBuffer take() { + // it is not guaranteed that the buffer will be added to + // the queue in the same thread that calls request(1). + try { + semaphore.acquire(); + } catch (InterruptedException x) { + Thread.currentThread().interrupt(); + throw new CompletionException(x); + } + return items.pop(); + } + CompletableFuture> resultCF() { return resultCF; } } @@ -628,8 +642,9 @@ public void testPositiveRequests() { publisher.subscribe(requestSubscriber1); Subscription subscription1 = requestSubscriber1.subscriptionCF.join(); subscription1.request(16); - assertTrue(requestSubscriber1.resultCF().isDone()); + // onNext() may not be called in the same thread than request() List list1 = requestSubscriber1.resultCF().join(); + assertTrue(requestSubscriber1.resultCF().isDone()); String result1 = stringFromBytes(list1.stream()); assertEquals(result1, "Lorem ipsum dolor sit amet, consectetur adipiscing elit."); System.out.println("Got expected sentence with one request: \"%s\"".formatted(result1)); @@ -646,8 +661,8 @@ public void testPositiveRequests() { subscription2.request(4); assertFalse(requestSubscriber2.resultCF().isDone()); subscription2.request(1); - assertTrue(requestSubscriber2.resultCF().isDone()); List list2 = requestSubscriber2.resultCF().join(); + assertTrue(requestSubscriber2.resultCF().isDone()); String result2 = stringFromBytes(list2.stream()); assertEquals(result2, "Lorem ipsum dolor sit amet, consectetur adipiscing elit."); System.out.println("Got expected sentence with 4 requests: \"%s\"".formatted(result1)); @@ -689,7 +704,7 @@ public void testCancel() { // receive half the data for (int i = 0; i < n; i++) { subscription.request(1); - ByteBuffer buffer = subscriber.items.pop(); + ByteBuffer buffer = subscriber.take(); } // cancel subscription @@ -789,7 +804,8 @@ public void testCancelSubscription() { @Test(dataProvider = "variants") public void test(String uri, boolean sameClient) throws Exception { checkSkip(); - System.out.println("Request to " + uri); + System.out.printf("Request to %s (sameClient: %s)%n", uri, sameClient); + System.err.printf("Request to %s (sameClient: %s)%n", uri, sameClient); HttpClient client = newHttpClient(sameClient); @@ -802,7 +818,8 @@ public void test(String uri, boolean sameClient) throws Exception { .POST(publisher) .build(); for (int i = 0; i < ITERATION_COUNT; i++) { - System.out.println("Iteration: " + i); + System.out.println(uri + ": Iteration: " + i); + System.err.println(uri + ": Iteration: " + i); HttpResponse response = client.send(request, BodyHandlers.ofString()); int expectedResponse = RESPONSE_CODE; if (response.statusCode() != expectedResponse) diff --git a/test/jdk/java/net/httpclient/ConnectTimeoutHandshakeAsync.java b/test/jdk/java/net/httpclient/ConnectTimeoutHandshakeAsync.java index a5fa9e75d0952..6cdaf594b1d58 100644 --- a/test/jdk/java/net/httpclient/ConnectTimeoutHandshakeAsync.java +++ b/test/jdk/java/net/httpclient/ConnectTimeoutHandshakeAsync.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 @@ -29,6 +29,8 @@ * @test * @summary Tests connection timeouts during SSL handshake * @bug 8208391 + * @library /test/lib + * @build AbstractConnectTimeoutHandshake * @run testng/othervm ConnectTimeoutHandshakeAsync */ diff --git a/test/jdk/java/net/httpclient/ConnectTimeoutHandshakeSync.java b/test/jdk/java/net/httpclient/ConnectTimeoutHandshakeSync.java index b6a301dac28e4..17ea3041c5bd1 100644 --- a/test/jdk/java/net/httpclient/ConnectTimeoutHandshakeSync.java +++ b/test/jdk/java/net/httpclient/ConnectTimeoutHandshakeSync.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 @@ -29,6 +29,8 @@ * @test * @summary Tests connection timeouts during SSL handshake * @bug 8208391 + * @library /test/lib + * @build AbstractConnectTimeoutHandshake * @run testng/othervm ConnectTimeoutHandshakeSync */ diff --git a/test/jdk/java/net/httpclient/FlowAdapterPublisherTest.java b/test/jdk/java/net/httpclient/FlowAdapterPublisherTest.java index 3676eb7236be3..5d0935d721631 100644 --- a/test/jdk/java/net/httpclient/FlowAdapterPublisherTest.java +++ b/test/jdk/java/net/httpclient/FlowAdapterPublisherTest.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 @@ -233,8 +233,12 @@ void testPublishTooMany(String uri) throws InterruptedException { } private void assertMessage(Throwable t, String contains) { - if (!t.getMessage().contains(contains)) { - String error = "Exception message:[" + t.toString() + "] doesn't contain [" + contains + "]"; + Throwable cause = t; + do { + if (cause.getMessage().contains(contains)) break; + } while ((cause = cause.getCause()) != null); + if (cause == null) { + String error = "Exception message:[" + t + "] doesn't contain [" + contains + "]"; throw new AssertionError(error, t); } } diff --git a/test/jdk/java/net/httpclient/HttpClientSNITest.java b/test/jdk/java/net/httpclient/HttpClientSNITest.java index 1505a21659349..095508fd849f0 100644 --- a/test/jdk/java/net/httpclient/HttpClientSNITest.java +++ b/test/jdk/java/net/httpclient/HttpClientSNITest.java @@ -46,7 +46,6 @@ import jdk.httpclient.test.lib.common.ServerNameMatcher; import jdk.test.lib.net.SimpleSSLContext; import jdk.test.lib.net.URIBuilder; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; import static java.nio.charset.StandardCharsets.US_ASCII; @@ -70,8 +69,6 @@ public class HttpClientSNITest { private static final String RESP_BODY_TEXT = "hello world"; - private static SSLContext sslContext; - private static final class Handler implements HttpTestHandler { @Override @@ -85,12 +82,6 @@ public void handle(final HttpTestExchange exch) throws IOException { } } - @BeforeAll - static void beforeAll() throws Exception { - sslContext = new SimpleSSLContext().get(); - assertNotNull(sslContext, "could not create a SSLContext"); - } - /* * Creates and configures a HTTPS server with a SNIMatcher that * expects a specific SNI name to be sent by the connection client. @@ -104,9 +95,11 @@ static void beforeAll() throws Exception { @ParameterizedTest @ValueSource(booleans = {false, true}) void testRequestToIPLiteralHost(final boolean sniConfiguredOnClient) throws Exception { + final SSLContext sslContext = new SimpleSSLContext().get(); + assertNotNull(sslContext, "could not create a SSLContext"); final String expectedSNI = "non-dns-resolvable.foo.bar.localhost"; final ServerNameMatcher matcher = new ServerNameMatcher(expectedSNI); - final HttpTestServer server = createServer(matcher); + final HttpTestServer server = createServer(matcher, sslContext); try { final HttpClient.Builder builder = HttpClient.newBuilder().sslContext(sslContext); if (sniConfiguredOnClient) { @@ -156,10 +149,12 @@ void testRequestToIPLiteralHost(final boolean sniConfiguredOnClient) throws Exce @ParameterizedTest @ValueSource(booleans = {false, true}) void testRequestResolvedHostName(final boolean sniConfiguredOnClient) throws Exception { + final SSLContext sslContext = new SimpleSSLContext().get(); + assertNotNull(sslContext, "could not create a SSLContext"); final String resolvedHostName = InetAddress.getLoopbackAddress().getHostName(); final String expectedSNI = resolvedHostName; final ServerNameMatcher matcher = new ServerNameMatcher(expectedSNI); - final HttpTestServer server = createServer(matcher); + final HttpTestServer server = createServer(matcher, sslContext); try { final HttpClient.Builder builder = HttpClient.newBuilder().sslContext(sslContext); if (sniConfiguredOnClient) { @@ -190,7 +185,8 @@ void testRequestResolvedHostName(final boolean sniConfiguredOnClient) throws Exc /* * Creates a HttpsServer configured to use the given SNIMatcher */ - private static HttpTestServer createServer(final SNIMatcher matcher) throws Exception { + private static HttpTestServer createServer(final SNIMatcher matcher, + final SSLContext sslContext) throws Exception { final InetSocketAddress addr = new InetSocketAddress(InetAddress.getLoopbackAddress(), 0); final int backlog = 0; final HttpsServer httpsServer = HttpsServer.create(addr, backlog); diff --git a/test/jdk/java/net/httpclient/HttpResponseLimitingTest.java b/test/jdk/java/net/httpclient/HttpResponseLimitingTest.java new file mode 100644 index 0000000000000..b87e7ea8e49dd --- /dev/null +++ b/test/jdk/java/net/httpclient/HttpResponseLimitingTest.java @@ -0,0 +1,418 @@ +/* + * 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 8328919 + * @summary tests `limiting()` in `HttpResponse.Body{Handlers,Subscribers}` + * @key randomness + * @library /test/lib + * /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.common.HttpServerAdapters + * jdk.test.lib.RandomFactory + * jdk.test.lib.net.SimpleSSLContext + * @run junit HttpResponseLimitingTest + */ + +import jdk.httpclient.test.lib.common.HttpServerAdapters.HttpTestServer; +import jdk.test.lib.RandomFactory; +import jdk.test.lib.net.SimpleSSLContext; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import javax.net.ssl.SSLContext; +import java.io.IOException; +import java.io.InputStream; +import java.io.UncheckedIOException; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpHeaders; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.net.http.HttpResponse.BodyHandler; +import java.net.http.HttpResponse.BodyHandlers; +import java.net.http.HttpResponse.BodySubscriber; +import java.net.http.HttpResponse.BodySubscribers; +import java.nio.ByteBuffer; +import java.util.Arrays; +import java.util.List; +import java.util.Random; +import java.util.concurrent.CompletionStage; +import java.util.concurrent.Flow.Subscription; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import static java.net.http.HttpClient.Builder.NO_PROXY; +import static java.nio.charset.StandardCharsets.UTF_8; +import static java.util.Arrays.copyOfRange; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertThrows; + +class HttpResponseLimitingTest { + + private static final Random RANDOM = RandomFactory.getRandom(); + + private static final byte[] RESPONSE_BODY = "random non-empty body".getBytes(UTF_8); + + private static final String RESPONSE_HEADER_NAME = "X-Excessive-Data"; + + /** + * A header value larger than {@link #RESPONSE_BODY} to verify that {@code limiting()} doesn't affect header parsing. + */ + private static final String RESPONSE_HEADER_VALUE = "!".repeat(RESPONSE_BODY.length + 1); + + private static final ServerClientPair HTTP1 = ServerClientPair.of(HttpClient.Version.HTTP_1_1, false); + + private static final ServerClientPair HTTPS1 = ServerClientPair.of(HttpClient.Version.HTTP_1_1, true); + + private static final ServerClientPair HTTP2 = ServerClientPair.of(HttpClient.Version.HTTP_2, false); + + private static final ServerClientPair HTTPS2 = ServerClientPair.of(HttpClient.Version.HTTP_2, true); + + private record ServerClientPair(HttpTestServer server, HttpClient client, HttpRequest request) { + + private static final SSLContext SSL_CONTEXT = createSslContext(); + + private static SSLContext createSslContext() { + try { + return new SimpleSSLContext().get(); + } catch (IOException exception) { + throw new UncheckedIOException(exception); + } + } + + private ServerClientPair { + try { + server.start(); + } catch (Exception serverException) { + try { + client.close(); + } catch (Exception clientException) { + Exception localClientException = new RuntimeException("failed closing client", clientException); + serverException.addSuppressed(localClientException); + } + throw new RuntimeException("failed closing server", serverException); + } + } + + private static ServerClientPair of(HttpClient.Version version, boolean secure) { + + // Create the server and the request URI + SSLContext sslContext = secure ? SSL_CONTEXT : null; + HttpTestServer server = createServer(version, sslContext); + String handlerPath = "/"; + String requestUriScheme = secure ? "https" : "http"; + URI requestUri = URI.create(requestUriScheme + "://" + server.serverAuthority() + handlerPath); + + // Register the request handler + server.addHandler( + (exchange) -> { + exchange.getResponseHeaders().addHeader(RESPONSE_HEADER_NAME, RESPONSE_HEADER_VALUE); + exchange.sendResponseHeaders(200, RESPONSE_BODY.length); + try (var outputStream = exchange.getResponseBody()) { + outputStream.write(RESPONSE_BODY); + } + exchange.close(); + }, + handlerPath); + + // Create the client and the request + HttpClient client = createClient(version, sslContext); + HttpRequest request = HttpRequest.newBuilder(requestUri).version(version).build(); + + // Create the pair + return new ServerClientPair(server, client, request); + + } + + private static HttpTestServer createServer(HttpClient.Version version, SSLContext sslContext) { + try { + return HttpTestServer.create(version, sslContext); + } catch (IOException exception) { + throw new UncheckedIOException(exception); + } + } + + private static HttpClient createClient(HttpClient.Version version, SSLContext sslContext) { + HttpClient.Builder builder = HttpClient.newBuilder().version(version).proxy(NO_PROXY); + if (sslContext != null) { + builder.sslContext(sslContext); + } + return builder.build(); + } + + private HttpResponse request(BodyHandler downstreamHandler, long capacity) throws Exception { + var handler = BodyHandlers.limiting(downstreamHandler, capacity); + return client.send(request, handler); + } + + @Override + public String toString() { + String version = client.version().toString(); + return client.sslContext() != null ? version.replaceFirst("_", "S_") : version; + } + + } + + @AfterAll + static void closeServerClientPairs() { + Exception[] exceptionRef = {null}; + Stream + .of(HTTP1, HTTPS1, HTTP2, HTTPS2) + .flatMap(pair -> Stream.of( + pair.client::close, + pair.server::stop)) + .forEach(closer -> { + try { + closer.run(); + } catch (Exception exception) { + if (exceptionRef[0] == null) { + exceptionRef[0] = exception; + } else { + exceptionRef[0].addSuppressed(exception); + } + } + }); + if (exceptionRef[0] != null) { + throw new RuntimeException("failed closing one or more server-client pairs", exceptionRef[0]); + } + } + + @ParameterizedTest + @MethodSource("sufficientCapacities") + void testSuccessOnSufficientCapacityForByteArray(ServerClientPair pair, long sufficientCapacity) throws Exception { + HttpResponse response = pair.request(BodyHandlers.ofByteArray(), sufficientCapacity); + verifyHeaders(response.headers()); + assertArrayEquals(RESPONSE_BODY, response.body()); + } + + @ParameterizedTest + @MethodSource("sufficientCapacities") + void testSuccessOnSufficientCapacityForInputStream(ServerClientPair pair, long sufficientCapacity) throws Exception { + HttpResponse response = pair.request(BodyHandlers.ofInputStream(), sufficientCapacity); + verifyHeaders(response.headers()); + try (InputStream responseBodyStream = response.body()) { + byte[] responseBodyBuffer = responseBodyStream.readAllBytes(); + assertArrayEquals(RESPONSE_BODY, responseBodyBuffer); + } + } + + static Arguments[] sufficientCapacities() { + long minExtremeCapacity = RESPONSE_BODY.length; + long maxExtremeCapacity = Long.MAX_VALUE; + long nonExtremeCapacity = RANDOM.nextLong(minExtremeCapacity + 1, maxExtremeCapacity); + return capacityArgs(minExtremeCapacity, nonExtremeCapacity, maxExtremeCapacity); + } + + @ParameterizedTest + @MethodSource("insufficientCapacities") + void testFailureOnInsufficientCapacityForByteArray(ServerClientPair pair, long insufficientCapacity) { + BodyHandler handler = responseInfo -> { + verifyHeaders(responseInfo.headers()); + return BodySubscribers.limiting(BodySubscribers.ofByteArray(), insufficientCapacity); + }; + var exception = assertThrows(IOException.class, () -> pair.request(handler, insufficientCapacity)); + assertEquals(exception.getMessage(), "body exceeds capacity: " + insufficientCapacity); + } + + @ParameterizedTest + @MethodSource("insufficientCapacities") + void testFailureOnInsufficientCapacityForInputStream(ServerClientPair pair, long insufficientCapacity) throws Exception { + HttpResponse response = pair.request(BodyHandlers.ofInputStream(), insufficientCapacity); + verifyHeaders(response.headers()); + try (InputStream responseBodyStream = response.body()) { + var exception = assertThrows(IOException.class, responseBodyStream::readAllBytes); + assertNotNull(exception.getCause()); + assertEquals(exception.getCause().getMessage(), "body exceeds capacity: " + insufficientCapacity); + } + } + + static Arguments[] insufficientCapacities() { + long minExtremeCapacity = 0; + long maxExtremeCapacity = RESPONSE_BODY.length - 1; + long nonExtremeCapacity = RANDOM.nextLong(minExtremeCapacity + 1, maxExtremeCapacity); + return capacityArgs(minExtremeCapacity, nonExtremeCapacity, maxExtremeCapacity); + } + + private static void verifyHeaders(HttpHeaders responseHeaders) { + List responseHeaderValues = responseHeaders.allValues(RESPONSE_HEADER_NAME); + assertEquals(List.of(RESPONSE_HEADER_VALUE), responseHeaderValues); + } + + @ParameterizedTest + @MethodSource("invalidCapacities") + void testFailureOnInvalidCapacityForHandler(long invalidCapacity) { + var exception = assertThrows( + IllegalArgumentException.class, + () -> BodyHandlers.limiting(BodyHandlers.ofByteArray(), invalidCapacity)); + assertEquals(exception.getMessage(), "capacity must not be negative: " + invalidCapacity); + } + + @ParameterizedTest + @MethodSource("invalidCapacities") + void testFailureOnInvalidCapacityForSubscriber(long invalidCapacity) { + var exception = assertThrows( + IllegalArgumentException.class, + () -> BodySubscribers.limiting(BodySubscribers.ofByteArray(), invalidCapacity)); + assertEquals(exception.getMessage(), "capacity must not be negative: " + invalidCapacity); + } + + static long[] invalidCapacities() { + long minExtremeCapacity = Long.MIN_VALUE; + long maxExtremeCapacity = -1; + long nonExtremeCapacity = RANDOM.nextLong(minExtremeCapacity + 1, maxExtremeCapacity); + return new long[]{minExtremeCapacity, nonExtremeCapacity, maxExtremeCapacity}; + } + + @Test + void testFailureOnNullDownstreamHandler() { + var exception = assertThrows(NullPointerException.class, () -> BodyHandlers.limiting(null, 0)); + assertEquals(exception.getMessage(), "downstreamHandler"); + } + + @Test + void testFailureOnNullDownstreamSubscriber() { + var exception = assertThrows(NullPointerException.class, () -> BodySubscribers.limiting(null, 0)); + assertEquals(exception.getMessage(), "downstreamSubscriber"); + } + + private static Arguments[] capacityArgs(long... capacities) { + return Stream + .of(HTTP1, HTTPS1, HTTP2, HTTPS2) + .flatMap(pair -> Arrays + .stream(capacities) + .mapToObj(capacity -> Arguments.of(pair, capacity))) + .toArray(Arguments[]::new); + } + + @Test + void testSubscriberForCompleteConsumption() { + + // Create the subscriber (with sufficient capacity) + ObserverSubscriber downstreamSubscriber = new ObserverSubscriber(); + int sufficientCapacity = RESPONSE_BODY.length; + BodySubscriber subscriber = BodySubscribers.limiting(downstreamSubscriber, sufficientCapacity); + + // Emit values + subscriber.onSubscribe(DummySubscription.INSTANCE); + byte[] responseBodyPart1 = {RESPONSE_BODY[0]}; + byte[] responseBodyPart2 = copyOfRange(RESPONSE_BODY, 1, RESPONSE_BODY.length); + List buffers = toByteBuffers(responseBodyPart1, responseBodyPart2); + subscriber.onNext(buffers); + + // Verify the downstream propagation + assertSame(buffers, downstreamSubscriber.lastBuffers); + assertNull(downstreamSubscriber.lastThrowable); + assertFalse(downstreamSubscriber.completed); + + } + + @Test + void testSubscriberForFailureOnExcess() { + + // Create the subscriber (with insufficient capacity) + ObserverSubscriber downstreamSubscriber = new ObserverSubscriber(); + int insufficientCapacity = 2; + BodySubscriber subscriber = BodySubscribers.limiting(downstreamSubscriber, insufficientCapacity); + + // Emit values + subscriber.onSubscribe(DummySubscription.INSTANCE); + byte[] responseBodyPart1 = {RESPONSE_BODY[0]}; + byte[] responseBodyPart2 = copyOfRange(RESPONSE_BODY, 1, RESPONSE_BODY.length); + List buffers = toByteBuffers(responseBodyPart1, responseBodyPart2); + subscriber.onNext(buffers); + + // Verify the downstream propagation + assertNull(downstreamSubscriber.lastBuffers); + assertNotNull(downstreamSubscriber.lastThrowable); + assertEquals( + "body exceeds capacity: " + insufficientCapacity, + downstreamSubscriber.lastThrowable.getMessage()); + assertFalse(downstreamSubscriber.completed); + + } + + private static List toByteBuffers(byte[]... buffers) { + return Arrays.stream(buffers).map(ByteBuffer::wrap).collect(Collectors.toList()); + } + + private static final class ObserverSubscriber implements BodySubscriber { + + private List lastBuffers; + + private Throwable lastThrowable; + + private boolean completed; + + @Override + public CompletionStage getBody() { + throw new UnsupportedOperationException(); + } + + @Override + public void onSubscribe(Subscription subscription) { + subscription.request(Long.MAX_VALUE); + } + + @Override + public void onNext(List buffers) { + lastBuffers = buffers; + } + + @Override + public void onError(Throwable throwable) { + lastThrowable = throwable; + } + + @Override + public void onComplete() { + completed = true; + } + + } + + private enum DummySubscription implements Subscription { + + INSTANCE; + + @Override + public void request(long n) { + // Do nothing + } + + @Override + public void cancel() { + // Do nothing + } + + } + +} diff --git a/test/jdk/java/net/httpclient/HttpsTunnelAuthTest.java b/test/jdk/java/net/httpclient/HttpsTunnelAuthTest.java index f83118adea3f6..83961453f05f1 100644 --- a/test/jdk/java/net/httpclient/HttpsTunnelAuthTest.java +++ b/test/jdk/java/net/httpclient/HttpsTunnelAuthTest.java @@ -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 @@ -108,6 +108,7 @@ public class HttpsTunnelAuthTest implements HttpServerAdapters, AutoCloseable { } void setUp() throws IOException { + HttpServerAdapters.enableServerLogging(); // Creates an HTTP/1.1 Server that will authenticate for // arthur with password dent http1Server = DigestEchoServer.createServer(Version.HTTP_1_1, @@ -143,10 +144,8 @@ void setUp() throws IOException { // Creates a proxy selector that unconditionally select the // above proxy. - var ps = proxySelector = ProxySelector.of(proxy.getProxyAddress()); + proxySelector = ProxySelector.of(proxy.getProxyAddress()); - // Creates a client that uses the above proxy selector - client = newHttpClient(ps); } @Override @@ -177,23 +176,26 @@ public static void main(String[] args) throws Exception { try (HttpsTunnelAuthTest test = new HttpsTunnelAuthTest()) { test.setUp(); - // tests proxy and server authentication through: - // - plain proxy connection to plain HTTP/1.1 server, - test.test(Version.HTTP_1_1, "http", "/foo/http1"); + try (HttpClient client = test.newHttpClient(test.proxySelector)) { + // tests proxy and server authentication through: + // - plain proxy connection to plain HTTP/1.1 server, + test.test(client, Version.HTTP_1_1, "http", "/foo/http1"); + } // can't really test plain proxy connection to plain HTTP/2 server: // this is not supported: we downgrade to HTTP/1.1 in that case // so that is actually somewhat equivalent to the first case: // therefore we will use a new client to force re-authentication // of the proxy connection. - test.client = test.newHttpClient(test.proxySelector); - test.test(Version.HTTP_2, "http", "/foo/http2"); + try (HttpClient client = test.newHttpClient(test.proxySelector)) { + test.test(client, Version.HTTP_2, "http", "/foo/http2"); - // - proxy tunnel SSL connection to HTTP/1.1 server - test.test(Version.HTTP_1_1, "https", "/foo/https1"); + // - proxy tunnel SSL connection to HTTP/1.1 server + test.test(client, Version.HTTP_1_1, "https", "/foo/https1"); - // - proxy tunnel SSl connection to HTTP/2 server - test.test(Version.HTTP_2, "https", "/foo/https2"); + // - proxy tunnel SSl connection to HTTP/2 server + test.test(client, Version.HTTP_2, "https", "/foo/https2"); + } } } @@ -227,14 +229,14 @@ Version expectedVersion(String scheme, Version version) { return "http".equals(scheme) ? Version.HTTP_1_1 : version; } - public void test(Version version, String scheme, String path) throws Exception { + public void test(HttpClient client, Version version, String scheme, String path) throws Exception { System.out.printf("%nTesting %s, %s, %s%n", version, scheme, path); DigestEchoServer server = server(scheme, version); try { URI uri = jdk.test.lib.net.URIBuilder.newBuilder() .scheme(scheme) - .host("localhost") + .loopback() .port(server.getServerAddress().getPort()) .path(path).build(); diff --git a/test/jdk/java/net/httpclient/RedirectMethodChange.java b/test/jdk/java/net/httpclient/RedirectMethodChange.java index 7e5971c40022e..ed1afb384e10b 100644 --- a/test/jdk/java/net/httpclient/RedirectMethodChange.java +++ b/test/jdk/java/net/httpclient/RedirectMethodChange.java @@ -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 @@ -220,6 +220,7 @@ public void setup() throws Exception { @AfterTest public void teardown() throws Exception { + client.close(); httpTestServer.stop(); httpsTestServer.stop(); http2TestServer.stop(); @@ -240,8 +241,8 @@ public void teardown() throws Exception { */ static class RedirMethodChgeHandler implements HttpTestHandler { - boolean inTest; - String expectedMethod; + volatile boolean inTest; + volatile String expectedMethod; final String targetURL; RedirMethodChgeHandler(String targetURL) { @@ -272,11 +273,14 @@ public synchronized void handle(HttpTestExchange he) throws IOException { Throwable ex = new RuntimeException("Unexpected newtest:" + newtest + ", inTest:" + inTest + ", for " + he.getRequestURI()); ex.printStackTrace(); + inTest = false; // next request should be new test he.sendResponseHeaders(500, 0); return; } if (newtest) { + // set inTest before sending responses + inTest = true; HttpTestRequestHeaders hdrs = he.getRequestHeaders(); String value = hdrs.firstValue("X-Redirect-Code").get(); int redirectCode = Integer.parseInt(value); @@ -286,8 +290,9 @@ public synchronized void handle(HttpTestExchange he) throws IOException { HttpTestResponseHeaders headersbuilder = he.getResponseHeaders(); headersbuilder.addHeader("Location", targetURL); he.sendResponseHeaders(redirectCode, 0); - inTest = true; } else { + // set inTest before sending responses + inTest = false; // should be the redirect if (!he.getRequestURI().getPath().endsWith("/redirect/rmt")) { Throwable ex = new RuntimeException("Unexpected redirected request, got:" @@ -307,7 +312,6 @@ public synchronized void handle(HttpTestExchange he) throws IOException { os.write(RESPONSE.getBytes(US_ASCII)); } } - inTest = false; } } } diff --git a/test/jdk/java/net/httpclient/ShortRequestBody.java b/test/jdk/java/net/httpclient/ShortRequestBody.java index 0bdb395003958..ffebdeec5ce01 100644 --- a/test/jdk/java/net/httpclient/ShortRequestBody.java +++ b/test/jdk/java/net/httpclient/ShortRequestBody.java @@ -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 @@ -176,6 +176,23 @@ static void success(Supplier clientSupplier, "Expected 200, got ", resp.statusCode()); } + static void checkCause(Throwable cause) { + Throwable t = cause; + boolean found = false; + while (t != null && !found) { + check(t instanceof IOException, t, + "Expected cause IOException, but got: ", t); + String msg = t.getMessage(); + found = (msg != null && (msg.contains("Too many") || msg.contains("Too few"))); + t = t.getCause(); + } + if (!found) { + String msg = cause.getMessage(); + check(msg.contains("Too many") || msg.contains("Too few"), + cause, "Expected Too many|Too few, got: ", cause); + } + } + static void failureNonBlocking(Supplier clientSupplier, URI uri, HttpRequest.BodyPublisher publisher) @@ -194,12 +211,7 @@ static void failureNonBlocking(Supplier clientSupplier, throw new RuntimeException("Unexpected timeout", x); } catch (ExecutionException expected) { err.println("Caught expected: " + expected); - Throwable t = expected.getCause(); - check(t instanceof IOException, t, - "Expected cause IOException, but got: ", t); - String msg = t.getMessage(); - check(msg.contains("Too many") || msg.contains("Too few"), - t, "Expected Too many|Too few, got: ", t); + checkCause(expected.getCause()); } } @@ -219,9 +231,7 @@ static void failureBlocking(Supplier clientSupplier, throw new RuntimeException("Unexpected timeout", x); } catch (IOException expected) { err.println("Caught expected: " + expected); - String msg = expected.getMessage(); - check(msg.contains("Too many") || msg.contains("Too few"), - expected,"Expected Too many|Too few, got: ", expected); + checkCause(expected); } } diff --git a/test/jdk/java/net/httpclient/http2/ExpectContinueResetTest.java b/test/jdk/java/net/httpclient/http2/ExpectContinueResetTest.java index 68012208281da..5d09c01b96fc8 100644 --- a/test/jdk/java/net/httpclient/http2/ExpectContinueResetTest.java +++ b/test/jdk/java/net/httpclient/http2/ExpectContinueResetTest.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 @@ -73,6 +73,7 @@ public class ExpectContinueResetTest { URI warmup, partialResponseResetNoError, partialResponseResetError, fullResponseResetNoError, fullResponseResetError; static PrintStream err = new PrintStream(System.err); + static PrintStream out = System.out; @DataProvider(name = "testData") public Object[][] testData() { @@ -88,17 +89,24 @@ public Object[][] testData() { @Test(dataProvider = "testData") public void test(URI uri) { + out.printf("\nTesting with Version: %s, URI: %s\n", HTTP_2, uri.toASCIIString()); err.printf("\nTesting with Version: %s, URI: %s\n", HTTP_2, uri.toASCIIString()); Iterable iterable = EndlessDataChunks::new; HttpRequest.BodyPublisher testPub = HttpRequest.BodyPublishers.ofByteArrays(iterable); - Throwable testThrowable = null; + Exception expectedException = null; try { performRequest(testPub, uri); + throw new AssertionError("Expected exception not raised for " + uri); } catch (Exception e) { - testThrowable = e.getCause(); + expectedException = e; } - assertNotNull(testThrowable, "Request should have completed exceptionally but testThrowable is null"); - assertEquals(testThrowable.getClass(), IOException.class, "Test should have closed with an IOException"); + Throwable testThrowable = expectedException.getCause(); + if (testThrowable == null) { + throw new AssertionError("Unexpected null cause for " + expectedException, + expectedException); + } + assertEquals(testThrowable.getClass(), IOException.class, + "Test should have closed with an IOException"); testThrowable.printStackTrace(); } @@ -177,7 +185,7 @@ static class NoEndStreamOnPartialResponse implements Http2Handler { @Override public void handle(Http2TestExchange exchange) throws IOException { err.println("Sending 100"); - exchange.sendResponseHeaders(100, 0); + exchange.sendResponseHeaders(100, -1); if (exchange instanceof ExpectContinueResetTestExchangeImpl testExchange) { err.println("Sending Reset"); err.println(exchange.getRequestURI().getPath()); @@ -197,8 +205,9 @@ static class NoEndStreamOnFullResponse implements Http2Handler { @Override public void handle(Http2TestExchange exchange) throws IOException { err.println("Sending 100"); - exchange.sendResponseHeaders(100, 0); + exchange.sendResponseHeaders(100, -1); err.println("Sending 200"); + exchange.sendResponseHeaders(200, 0); if (exchange instanceof ExpectContinueResetTestExchangeImpl testExchange) { err.println("Sending Reset"); diff --git a/test/jdk/java/net/httpclient/http2/StreamFlowControlTest.java b/test/jdk/java/net/httpclient/http2/StreamFlowControlTest.java index 39768b68dc564..31cc58df2a8e3 100644 --- a/test/jdk/java/net/httpclient/http2/StreamFlowControlTest.java +++ b/test/jdk/java/net/httpclient/http2/StreamFlowControlTest.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 @@ -34,6 +34,7 @@ import java.io.IOException; import java.io.InputStream; +import java.io.InterruptedIOException; import java.io.OutputStream; import java.net.ProtocolException; import java.net.URI; @@ -335,7 +336,9 @@ public void handle(Http2TestExchange t) throws IOException { // to wait for the connection window fct.conn.obtainConnectionWindow(resp.length); } catch (InterruptedException ie) { - // ignore and continue... + var ioe = new InterruptedIOException(ie.toString()); + ioe.initCause(ie); + throw ioe; } } try { @@ -344,6 +347,7 @@ public void handle(Http2TestExchange t) throws IOException { if (t instanceof FCHttp2TestExchange fct) { fct.conn.updateConnectionWindow(resp.length); } + throw x; } } } finally { diff --git a/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/common/HttpServerAdapters.java b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/common/HttpServerAdapters.java index 4b00c0eea7bfd..6dc945231abb7 100644 --- a/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/common/HttpServerAdapters.java +++ b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/common/HttpServerAdapters.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 @@ -239,7 +239,7 @@ public static abstract class HttpTestExchange implements AutoCloseable { public abstract OutputStream getResponseBody(); public abstract HttpTestRequestHeaders getRequestHeaders(); public abstract HttpTestResponseHeaders getResponseHeaders(); - public abstract void sendResponseHeaders(int code, int contentLength) throws IOException; + public abstract void sendResponseHeaders(int code, long contentLength) throws IOException; public abstract URI getRequestURI(); public abstract String getRequestMethod(); public abstract void close(); @@ -292,7 +292,7 @@ public HttpTestResponseHeaders getResponseHeaders() { return HttpTestResponseHeaders.of(exchange.getResponseHeaders()); } @Override - public void sendResponseHeaders(int code, int contentLength) throws IOException { + public void sendResponseHeaders(int code, long contentLength) throws IOException { if (contentLength == 0) contentLength = -1; else if (contentLength < 0) contentLength = 0; exchange.sendResponseHeaders(code, contentLength); @@ -355,7 +355,7 @@ public HttpTestResponseHeaders getResponseHeaders() { return HttpTestResponseHeaders.of(exchange.getResponseHeaders()); } @Override - public void sendResponseHeaders(int code, int contentLength) throws IOException { + public void sendResponseHeaders(int code, long contentLength) throws IOException { if (contentLength == 0) contentLength = -1; else if (contentLength < 0) contentLength = 0; exchange.sendResponseHeaders(code, contentLength); diff --git a/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/BodyOutputStream.java b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/BodyOutputStream.java index db5778ec3d9f2..c6eee5afabfdb 100644 --- a/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/BodyOutputStream.java +++ b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/BodyOutputStream.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 @@ -63,22 +63,28 @@ synchronized void updateWindow(int update) { } void waitForWindow(int demand) throws InterruptedException { - // first wait for the connection window - conn.obtainConnectionWindow(demand); - // now wait for the stream window + // first wait for the stream window waitForStreamWindow(demand); + // now wait for the connection window + conn.obtainConnectionWindow(demand); } - public void waitForStreamWindow(int demand) throws InterruptedException { - synchronized (this) { - while (demand > 0) { - int n = Math.min(demand, window); - demand -= n; - window -= n; - if (demand > 0) { - wait(); + public void waitForStreamWindow(int amount) throws InterruptedException { + int demand = amount; + try { + synchronized (this) { + while (amount > 0) { + int n = Math.min(amount, window); + amount -= n; + window -= n; + if (amount > 0) { + wait(); + } } } + } catch (Throwable t) { + window += (demand - amount); + throw t; } } diff --git a/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2TestServerConnection.java b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2TestServerConnection.java index fb0ce92cd1da3..deec3ec2c24de 100644 --- a/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2TestServerConnection.java +++ b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2TestServerConnection.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 @@ -171,7 +171,7 @@ void fail(Throwable t) { Properties properties) throws IOException { - System.err.println("TestServer: New connection from " + socket); + System.err.println(server.name + ": New connection from " + socket); if (socket instanceof SSLSocket) { SSLSocket sslSocket = (SSLSocket)socket; @@ -218,10 +218,10 @@ private SettingsFrame getServerSettingProperties() { String prop = properties.getProperty(propPrefix + key); if (prop != null) { try { - System.err.println("TestServer: setting " + key + " property to: " + + System.err.println(server.name + ": setting " + key + " property to: " + prop); int num = Integer.parseInt(numS); - System.err.println("TestServer: num = " + num); + System.err.println(server.name + ": num = " + num); s.setParameter(num, Integer.parseInt(prop)); } catch (NumberFormatException e) {/* ignore errors */} } @@ -269,7 +269,7 @@ private void sendGoAway(final int error) throws IOException { } final GoAwayFrame frame = new GoAwayFrame(maxProcessedStreamId, error); outputQ.put(frame); - System.err.println("Sending GOAWAY frame " + frame + " from server connection " + this); + System.err.println(server.name + ": Sending GOAWAY frame " + frame + " from server connection " + this); } /** @@ -285,7 +285,7 @@ private PingRequest getNextRequest() { */ void handlePing(PingFrame ping) throws IOException { if (ping.streamid() != 0) { - System.err.println("Invalid ping received"); + System.err.println(server.name + ": Invalid ping received"); close(ErrorFrame.PROTOCOL_ERROR); return; } @@ -293,7 +293,7 @@ void handlePing(PingFrame ping) throws IOException { // did we send a Ping? PingRequest request = getNextRequest(); if (request == null) { - System.err.println("Invalid ping ACK received"); + System.err.println(server.name + ": Invalid ping ACK received"); close(ErrorFrame.PROTOCOL_ERROR); return; } else if (!Arrays.equals(request.pingData, ping.getData())) { @@ -356,7 +356,7 @@ void close(int error) { if (stopping) return; stopping = true; - System.err.printf("Server connection to %s stopping. %d streams\n", + System.err.printf(server.name + ": Server connection to %s stopping. %d streams\n", socket.getRemoteSocketAddress().toString(), streams.size()); streams.forEach((i, q) -> { q.orderlyClose(); @@ -376,16 +376,20 @@ private void readPreface() throws IOException { byte[] bytes = new byte[len]; int n = is.readNBytes(bytes, 0, len); if (Arrays.compare(clientPreface, bytes) != 0) { - System.err.printf("Invalid preface: read %d/%d bytes%n", n, len); - throw new IOException("Invalid preface: " + - new String(bytes, 0, len, ISO_8859_1)); + String msg = String.format("Invalid preface: read %s/%s bytes", n, len); + System.err.println(server.name + ": " + msg); + throw new IOException(msg +": \"" + + new String(bytes, 0, n, ISO_8859_1) + .replace("\r", "\\r") + .replace("\n", "\\n") + + "\""); } } Http1InitialRequest doUpgrade(Http1InitialRequest upgrade) throws IOException { String h2c = getHeader(upgrade.headers, "Upgrade"); if (h2c == null || !h2c.equals("h2c")) { - System.err.println("Server:HEADERS: " + upgrade); + System.err.println(server.name + ":HEADERS: " + upgrade); throw new IOException("Bad upgrade 1 " + h2c); } @@ -457,7 +461,7 @@ void run() throws Exception { socket.close(); return; } else { - System.err.println("Server:HEADERS: " + upgrade); + System.err.println(server.name + ":HEADERS: " + upgrade); throw new IOException("Bad upgrade 1 " + h2c); } } @@ -556,7 +560,7 @@ private void handleCommonFrame(Http2Frame f) throws IOException { outputQ.put(frame); return; } else if (f instanceof GoAwayFrame) { - System.err.println("Closing: "+ f.toString()); + System.err.println(server.name + ": Closing connection: "+ f.toString()); close(ErrorFrame.NO_ERROR); } else if (f instanceof PingFrame) { handlePing((PingFrame)f); @@ -649,7 +653,7 @@ void createPrimordialStream(Http1InitialRequest request) throws IOException { // skip processing the request if configured to do so final String connKey = connectionKey(); if (!shouldProcessNewHTTPRequest(connKey)) { - System.err.println("Rejecting primordial stream 1 and sending GOAWAY" + + System.err.println(server.name + ": Rejecting primordial stream 1 and sending GOAWAY" + " on server connection " + connKey + ", for request: " + path); sendGoAway(ErrorFrame.NO_ERROR); return; @@ -726,7 +730,7 @@ void createStream(HeaderFrame frame) throws IOException { final String connKey = connectionKey(); final String path = headers.firstValue(":path").orElse(""); if (!shouldProcessNewHTTPRequest(connKey)) { - System.err.println("Rejecting stream " + streamid + System.err.println(server.name + ": Rejecting stream " + streamid + " and sending GOAWAY on server connection " + connKey + ", for request: " + path); sendGoAway(ErrorFrame.NO_ERROR); @@ -764,17 +768,17 @@ void handleRequest(HttpHeaders headers, //System.out.println("scheme = " + scheme); String authority = headers.firstValue(":authority").orElse(""); //System.out.println("authority = " + authority); - System.err.printf("TestServer: %s %s\n", method, path); + System.err.printf(server.name + ": %s %s\n", method, path); int winsize = clientSettings.getParameter( SettingsFrame.INITIAL_WINDOW_SIZE); //System.err.println ("Stream window size = " + winsize); final InputStream bis; if (endStreamReceived && queue.size() == 0) { - System.err.println("Server: got END_STREAM for stream " + streamid); + System.err.println(server.name + ": got END_STREAM for stream " + streamid); bis = NullInputStream.INSTANCE; } else { - System.err.println("Server: creating input stream for stream " + streamid); + System.err.println(server.name + ": creating input stream for stream " + streamid); bis = new BodyInputStream(queue, streamid, this); } try (bis; @@ -802,7 +806,7 @@ headers, rspheadersBuilder, uri, bis, getSSLSession(), if (bos.closed) { Queue q = streams.get(streamid); if (q != null && (q.isClosed() || q.isClosing())) { - System.err.println("TestServer: Stream " + streamid + " closed: " + closed); + System.err.println(server.name + ": Stream " + streamid + " closed: " + closed); return; } } @@ -812,7 +816,7 @@ headers, rspheadersBuilder, uri, bis, getSSLSession(), // everything happens in the exchange from here. Hopefully will // return though. } catch (Throwable e) { - System.err.println("TestServer: handleRequest exception: " + e); + System.err.println(server.name + ": handleRequest exception: " + e); e.printStackTrace(); close(-1); } @@ -844,7 +848,7 @@ void readLoop() { while (!stopping) { Http2Frame frame = readFrameImpl(); if (frame == null) { - System.err.println("EOF reached on connection " + connectionKey() + System.err.println(server.name + ": EOF reached on connection " + connectionKey() + ", will no longer accept incoming frames"); closeIncoming(); return; @@ -865,7 +869,7 @@ void readLoop() { Queue q = streams.get(stream); if (frame.type() == HeadersFrame.TYPE) { if (q != null) { - System.err.println("HEADERS frame for existing stream! Error."); + System.err.println(server.name + ": HEADERS frame for existing stream! Error."); // TODO: close connection continue; } else { @@ -874,7 +878,8 @@ void readLoop() { // if we already sent a goaway, then don't create new streams with // higher stream ids. if (finalProcessedStreamId != -1 && streamId > finalProcessedStreamId) { - System.err.println(connectionKey() + " resetting stream " + streamId + System.err.println(server.name + ": " + connectionKey() + + " resetting stream " + streamId + " as REFUSED_STREAM"); final ResetFrame rst = new ResetFrame(streamId, REFUSED_STREAM); outputQ.put(rst); @@ -884,7 +889,7 @@ void readLoop() { } } else { if (q == null && !pushStreams.contains(stream)) { - System.err.printf("Non Headers frame received with"+ + System.err.printf(server.name + ": Non Headers frame received with"+ " non existing stream (%d) ", frame.streamid()); System.err.println(frame); continue; @@ -914,21 +919,21 @@ void readLoop() { } else if (isClientStreamId(stream) && stream < next) { // We may receive a reset on a client stream that has already // been closed. Just ignore it. - System.err.println("TestServer: received ResetFrame on closed stream: " + stream); + System.err.println(server.name + ": received ResetFrame on closed stream: " + stream); System.err.println(frame); } else if (isServerStreamId(stream) && stream < nextPush) { // We may receive a reset on a push stream that has already // been closed. Just ignore it. - System.err.println("TestServer: received ResetFrame on closed push stream: " + stream); + System.err.println(server.name + ": received ResetFrame on closed push stream: " + stream); System.err.println(frame); } else { - System.err.println("TestServer: Unexpected frame on: " + stream); + System.err.println(server.name + ": Unexpected frame on: " + stream); System.err.println(frame); throw new IOException("Unexpected frame"); } } else { if (!q.putIfOpen(frame)) { - System.err.printf("Stream %s is closed: dropping %s%n", + System.err.printf(server.name + ": Stream %s is closed: dropping %s%n", stream, frame); } } @@ -937,7 +942,7 @@ void readLoop() { } } catch (Throwable e) { if (!stopping) { - System.err.println("Http server reader thread shutdown"); + System.err.println(server.name + ": Http server reader thread shutdown"); e.printStackTrace(); } close(ErrorFrame.PROTOCOL_ERROR); @@ -1078,7 +1083,7 @@ void writeLoop() { : new ContinuationFrame(rh.streamid(), flags, list); if (Log.headers()) { // avoid too much chatter: log only if Log.headers() is enabled - System.err.println("TestServer writing " + hf); + System.err.println(server.name + ": writing " + hf); } writeFrame(hf); cont++; @@ -1088,7 +1093,7 @@ void writeLoop() { } else writeFrame(frame); } - System.err.println("TestServer: Connection writer stopping"); + System.err.println(server.name + ": Connection writer stopping " + connectionKey()); } catch (Throwable e) { e.printStackTrace(); /*close(); @@ -1140,7 +1145,7 @@ public void sendEndStream() throws IOException { ii.transferTo(oo); } catch (Throwable ex) { - System.err.printf("TestServer: pushing response error: %s\n", + System.err.printf(server.name + ": pushing response error: %s\n", ex.toString()); } finally { closeIgnore(ii); @@ -1303,7 +1308,7 @@ Http1InitialRequest readHttp1Request() throws IOException { } return new Http1InitialRequest(headers, buf); } catch (IOException e) { - System.err.println("TestServer: headers read: [ " + headers + " ]"); + System.err.println(server.name + ": headers read: [ " + headers + " ]"); throw e; } } @@ -1335,7 +1340,7 @@ void sendHttp1Response(int code, String msg, String... headers) throws IOExcepti } private void unexpectedFrame(Http2Frame frame) { - System.err.println("OOPS. Unexpected"); + System.err.println(server.name + ": OOPS. Unexpected"); assert false; } @@ -1375,19 +1380,41 @@ void registerStreamWindowUpdater(int streamid, Consumer r) { * @param amount */ public synchronized void obtainConnectionWindow(int amount) throws InterruptedException { - while (amount > 0) { - int n = Math.min(amount, sendWindow); - amount -= n; - sendWindow -= n; - if (amount > 0) - wait(); + int demand = amount; + try { + int waited = 0; + while (amount > 0) { + int n = Math.min(amount, sendWindow); + amount -= n; + sendWindow -= n; + if (amount > 0) { + // Do not include this print line on a version that does not have + // JDK-8337395 + System.err.printf("%s: blocked waiting for %s connection window, obtained %s%n", + server.name, amount, demand - amount); + waited++; + wait(); + } + } + if (waited > 0) { + // Do not backport this print line on a version that does not have + // JDK-8337395 + System.err.printf("%s: obtained %s connection window, remaining %s%n", + server.name, demand, sendWindow); + } + assert amount == 0; + } catch (Throwable t) { + sendWindow += (demand - amount); + throw t; } } public void updateConnectionWindow(int amount) { - System.out.printf("sendWindow (window=%s, amount=%s) is now: %s%n", - sendWindow, amount, sendWindow + amount); synchronized (this) { + // Do not backport this print line on a version that does not have + // JDK-8337395 + System.err.printf(server.name + ": update sendWindow (window=%s, amount=%s) is now: %s%n", + sendWindow, amount, sendWindow + amount); sendWindow += amount; notifyAll(); } diff --git a/test/jdk/java/net/httpclient/offline/FixedResponseHttpClient.java b/test/jdk/java/net/httpclient/offline/FixedResponseHttpClient.java index 76e32f04186a0..255f99a2e1c5e 100644 --- a/test/jdk/java/net/httpclient/offline/FixedResponseHttpClient.java +++ b/test/jdk/java/net/httpclient/offline/FixedResponseHttpClient.java @@ -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 @@ -209,8 +209,11 @@ public HttpClient.Version version() { if (obp.isPresent()) { ConsumingSubscriber subscriber = new ConsumingSubscriber(); obp.get().subscribe(subscriber); + // wait for our subscriber to be completed and get the + // list of ByteBuffers it received. + var buffers = subscriber.getBuffers().join(); if (responseBodyBytes == ECHO_SENTINAL) { - responseBody = subscriber.buffers; + responseBody = buffers; } } @@ -246,6 +249,13 @@ public HttpClient.Version version() { */ private static class ConsumingSubscriber implements Flow.Subscriber { final List buffers = Collections.synchronizedList(new ArrayList<>()); + // A CompletableFuture that will be completed with a list of ByteBuffers that the + // ConsumingSubscriber has consumed. + final CompletableFuture> consumed = new CompletableFuture<>(); + + public final CompletableFuture> getBuffers() { + return consumed; + } @Override public void onSubscribe(Flow.Subscription subscription) { @@ -256,9 +266,9 @@ public void onSubscribe(Flow.Subscription subscription) { buffers.add(item.duplicate()); } - @Override public void onError(Throwable throwable) { assert false : "Unexpected"; } + @Override public void onError(Throwable throwable) { consumed.completeExceptionally(throwable); } - @Override public void onComplete() { /* do nothing */ } + @Override public void onComplete() { consumed.complete(buffers.stream().toList()); } } @Override diff --git a/test/jdk/java/nio/channels/FileChannel/LoopingTruncate.java b/test/jdk/java/nio/channels/FileChannel/LoopingTruncate.java index 203ba47d6fb37..d3bca2d8f8e20 100644 --- a/test/jdk/java/nio/channels/FileChannel/LoopingTruncate.java +++ b/test/jdk/java/nio/channels/FileChannel/LoopingTruncate.java @@ -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,7 @@ * questions. */ -/** +/* * @test * @bug 8137121 8137230 * @summary (fc) Infinite loop FileChannel.truncate @@ -31,12 +31,12 @@ */ import java.nio.ByteBuffer; -import java.nio.channels.FileChannel; import java.nio.channels.ClosedByInterruptException; +import java.nio.channels.FileChannel; import java.nio.file.Files; import java.nio.file.Path; -import static java.nio.file.StandardOpenOption.*; import java.util.concurrent.TimeUnit; +import static java.nio.file.StandardOpenOption.*; import static jdk.test.lib.Utils.adjustTimeout; public class LoopingTruncate { @@ -48,7 +48,10 @@ public class LoopingTruncate { static long TIMEOUT = adjustTimeout(20_000); public static void main(String[] args) throws Throwable { - Path path = Files.createTempFile("LoopingTruncate.tmp", null); + // Intentionally opting out from the default `java.io.tmpdir`. + // It occasionally lacks the sufficient disk space this test needs. + Path pathDir = Path.of(System.getProperty("user.dir")); + Path path = Files.createTempFile(pathDir, "LoopingTruncate.tmp", null); try (FileChannel fc = FileChannel.open(path, CREATE, WRITE)) { fc.position(FATEFUL_SIZE + 1L); System.out.println(" Writing large file..."); diff --git a/test/jdk/java/nio/file/Files/probeContentType/Basic.java b/test/jdk/java/nio/file/Files/probeContentType/Basic.java index aee1b19a01dbb..a82269c6c5661 100644 --- a/test/jdk/java/nio/file/Files/probeContentType/Basic.java +++ b/test/jdk/java/nio/file/Files/probeContentType/Basic.java @@ -39,7 +39,6 @@ import java.util.stream.Stream; import jdk.internal.util.OperatingSystem; -import jdk.internal.util.OSVersion; import jdk.internal.util.StaticProperty; /** @@ -189,18 +188,8 @@ public static void main(String[] args) throws IOException { exTypes.add(new ExType("xlsx", List.of("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"))); exTypes.add(new ExType("wasm", List.of("application/wasm"))); - // extensions with content type that differs on Windows 11+ and - // Windows Server 2025 - if (OperatingSystem.isWindows() && - (StaticProperty.osName().matches("^.*[11|2025]$") || - new OSVersion(10, 0).compareTo(OSVersion.current()) > 0)) { - System.out.println("Windows 11+ detected: using different types"); - exTypes.add(new ExType("bz2", List.of("application/bz2", "application/x-bzip2", "application/x-bzip", "application/x-compressed"))); - exTypes.add(new ExType("csv", List.of("text/csv", "application/vnd.ms-excel"))); - exTypes.add(new ExType("rar", List.of("application/rar", "application/vnd.rar", "application/x-rar", "application/x-rar-compressed", "application/x-compressed"))); - exTypes.add(new ExType("rtf", List.of("application/rtf", "text/rtf", "application/msword"))); - exTypes.add(new ExType("7z", List.of("application/x-7z-compressed", "application/x-compressed"))); - } else { + // extensions with consistent content type on Unix (but not on Windows) + if (!OperatingSystem.isWindows()) { exTypes.add(new ExType("bz2", List.of("application/bz2", "application/x-bzip2", "application/x-bzip"))); exTypes.add(new ExType("csv", List.of("text/csv"))); exTypes.add(new ExType("rar", List.of("application/rar", "application/vnd.rar", "application/x-rar", "application/x-rar-compressed"))); diff --git a/test/jdk/java/nio/file/spi/SetDefaultProvider.java b/test/jdk/java/nio/file/spi/SetDefaultProvider.java index f4486885b6a7e..4d74c8fee934e 100644 --- a/test/jdk/java/nio/file/spi/SetDefaultProvider.java +++ b/test/jdk/java/nio/file/spi/SetDefaultProvider.java @@ -23,7 +23,8 @@ /* * @test - * @bug 4313887 7006126 8142968 8178380 8183320 8210112 8266345 8263940 8331467 8346573 + * @bug 4313887 7006126 8142968 8178380 8183320 8210112 8266345 8263940 8331467 + * 8346573 8346722 * @modules jdk.jartool jdk.jlink * @library /test/lib * @build testfsp/* testapp/* CustomSystemClassLoader diff --git a/test/jdk/java/nio/file/spi/testapp/testapp/Main.java b/test/jdk/java/nio/file/spi/testapp/testapp/Main.java index f9c3b1e273eff..6f61d431707e1 100644 --- a/test/jdk/java/nio/file/spi/testapp/testapp/Main.java +++ b/test/jdk/java/nio/file/spi/testapp/testapp/Main.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 @@ -58,5 +58,8 @@ public static void main(String[] args) throws Exception { throw new RuntimeException("'path' not in default file system"); if (!path.equals(foo)) throw new RuntimeException(path + " not equal to " + foo); + + // exercise the file type detector + String fileType = Files.probeContentType(Path.of(".")); } } diff --git a/test/jdk/java/security/KeyAgreement/Generic.java b/test/jdk/java/security/KeyAgreement/Generic.java new file mode 100644 index 0000000000000..dcf212dbffe7c --- /dev/null +++ b/test/jdk/java/security/KeyAgreement/Generic.java @@ -0,0 +1,79 @@ +/* + * 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 8189441 + * @library /test/lib /test/jdk/sun/security/pkcs11 + * @summary make sure Generic is accepted by all KeyAgreement implementations + * @run main Generic builtin + * @run main/othervm Generic nss + * @run main/othervm -DCUSTOM_P11_CONFIG_NAME=p11-nss-sensitive.txt Generic nss + */ +import jdk.test.lib.Asserts; + +import javax.crypto.KeyAgreement; +import java.security.KeyPairGenerator; +import java.security.Provider; +import java.security.Security; +import java.util.List; + +public class Generic { + + public static void main(String[] args) throws Exception { + if (args[0].equals("nss")) { + test(PKCS11Test.getSunPKCS11(PKCS11Test.getNssConfig())); + } else { + for (var p : Security.getProviders()) { + test(p); + } + } + } + + static void test(Provider p) throws Exception { + for (var s : p.getServices()) { + if (s.getType().equalsIgnoreCase("KeyAgreement")) { + try { + System.out.println(s.getProvider().getName() + "." + s.getAlgorithm()); + var g = KeyPairGenerator.getInstance(ka2kpg(s.getAlgorithm()), p); + var kp1 = g.generateKeyPair(); + var kp2 = g.generateKeyPair(); + var ka = KeyAgreement.getInstance(s.getAlgorithm(), s.getProvider()); + for (var alg : List.of("TlsPremasterSecret", "Generic")) { + ka.init(kp1.getPrivate()); + ka.doPhase(kp2.getPublic(), true); + Asserts.assertEquals( + ka.generateSecret(alg).getAlgorithm(), alg); + } + } catch (Exception e) { + throw e; + } + } + } + } + + // Find key algorithm from KeyAgreement algorithm + private static String ka2kpg(String ka) { + return ka.equals("ECDH") ? "EC" : ka; + } +} diff --git a/test/jdk/java/security/AccessControlContext/FailureDebugOption.java b/test/jdk/java/security/Provider/InvalidServiceTest.java similarity index 53% rename from test/jdk/java/security/AccessControlContext/FailureDebugOption.java rename to test/jdk/java/security/Provider/InvalidServiceTest.java index 2c0dd489c70de..fd56e6b3286da 100644 --- a/test/jdk/java/security/AccessControlContext/FailureDebugOption.java +++ b/test/jdk/java/security/Provider/InvalidServiceTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, Oracle and/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,27 +23,27 @@ /* * @test - * @bug 6648816 - * @summary REGRESSION: setting -Djava.security.debug=failure result in NPE - * in ACC - * @run main/othervm -Djava.security.debug=failure FailureDebugOption + * @bug 8344361 + * @summary Restore null return for invalid services */ -import java.security.ProtectionDomain; -import java.security.AccessController; -import java.security.AccessControlException; -import java.security.BasicPermission; +import java.security.Provider; -public class FailureDebugOption { +public class InvalidServiceTest { - public static void main (String argv[]) throws Exception { - try { - AccessController.checkPermission( - new BasicPermission("no such permission"){}); - } catch (NullPointerException npe) { - throw new Exception("Unexpected NullPointerException for security" + - " debug option, -Djava.security.debug=failure"); - } catch (AccessControlException ace) { + public static void main(String[] args) throws Exception { + Provider p1 = new LProvider("LegacyFormat"); + // this returns a service with null class name. Helps exercise the code path + Provider.Service s1 = p1.getService("MessageDigest", "SHA-1"); + if (s1 != null) + throw new RuntimeException("expecting null service"); + } + + private static class LProvider extends Provider { + LProvider(String name) { + super(name, "1.0", null); + put("Signature.MD5withRSA", "com.foo.Sig"); + put("MessageDigest.SHA-1 ImplementedIn", "Software"); } - } + } } diff --git a/test/jdk/java/security/cert/CertPathBuilder/GetInstance.java b/test/jdk/java/security/cert/CertPathBuilder/GetInstance.java index 5ec4d6caa5a79..4289fcfaeced7 100644 --- a/test/jdk/java/security/cert/CertPathBuilder/GetInstance.java +++ b/test/jdk/java/security/cert/CertPathBuilder/GetInstance.java @@ -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 @@ -30,11 +30,7 @@ * The test passes if it returns. * The test fails if an exception is thrown. */ -import java.security.cert.CertPathParameters; -import java.security.cert.CertPathBuilderResult; -import java.security.cert.CertPathBuilderSpi; import java.security.Provider; -import java.security.AccessController; import java.security.cert.CertPathBuilder; import java.security.NoSuchAlgorithmException; diff --git a/test/jdk/java/text/Format/DateFormat/DateFormatRegression.java b/test/jdk/java/text/Format/DateFormat/DateFormatRegression.java index cda264b628153..dbd12e66f60b2 100644 --- a/test/jdk/java/text/Format/DateFormat/DateFormatRegression.java +++ b/test/jdk/java/text/Format/DateFormat/DateFormatRegression.java @@ -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 @@ -34,7 +34,7 @@ * @bug 4029195 4052408 4056591 4059917 4060212 4061287 4065240 4071441 4073003 * 4089106 4100302 4101483 4103340 4103341 4104136 4104522 4106807 4108407 * 4134203 4138203 4148168 4151631 4151706 4153860 4162071 4182066 4209272 4210209 - * 4213086 4250359 4253490 4266432 4406615 4413980 8008577 8305853 8174269 + * 4213086 4250359 4253490 4266432 4406615 4413980 8008577 8305853 8174269 8347841 * @library /java/text/testlib * @run junit DateFormatRegression */ @@ -274,7 +274,7 @@ public void Test4065240() { try { Locale curLocale = Locale.GERMANY; Locale.setDefault(curLocale); - TimeZone.setDefault(TimeZone.getTimeZone("EST")); + TimeZone.setDefault(TimeZone.getTimeZone("America/Panama")); curDate = new Date(98, 0, 1); shortdate = DateFormat.getDateInstance(DateFormat.SHORT); fulldate = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG @@ -453,7 +453,7 @@ public void Test4413980() { TimeZone savedTimeZone = TimeZone.getDefault(); try { boolean pass = true; - String[] IDs = new String[] {"Undefined", "PST", "US/Pacific", + String[] IDs = new String[] {"Undefined", "America/Los_Angeles", "US/Pacific", "GMT+3:00", "GMT-01:30"}; for (int i = 0; i < IDs.length; i++) { TimeZone tz = TimeZone.getTimeZone(IDs[i]); @@ -543,7 +543,7 @@ public void Test4103340() { public void Test4103341() { TimeZone saveZone =TimeZone.getDefault(); try { - TimeZone.setDefault(TimeZone.getTimeZone("CST")); + TimeZone.setDefault(TimeZone.getTimeZone("America/Chicago")); SimpleDateFormat simple = new SimpleDateFormat("MM/dd/yyyy HH:mm"); if (!simple.getTimeZone().equals(TimeZone.getDefault())) fail("Fail: SimpleDateFormat not using default zone"); @@ -794,7 +794,7 @@ public void Test4406615() { Locale savedLocale = Locale.getDefault(); TimeZone savedTimeZone = TimeZone.getDefault(); Locale.setDefault(Locale.US); - TimeZone.setDefault(TimeZone.getTimeZone("PST")); + TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles")); Date d1, d2; String dt = "Mon, 1 Jan 2001 00:00:00"; @@ -1096,7 +1096,7 @@ public void Test4261506() { // XXX: Test assumes "PST" is not TimeZoneNames_ja. Need to // pick up another time zone when L10N is done to that file. - TimeZone.setDefault(TimeZone.getTimeZone("PST")); + TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles")); SimpleDateFormat fmt = new SimpleDateFormat("yy/MM/dd hh:ss zzz", Locale.JAPAN); @SuppressWarnings("deprecation") String result = fmt.format(new Date(1999 - 1900, 0, 1)); diff --git a/test/jdk/java/text/Format/DateFormat/DateFormatTest.java b/test/jdk/java/text/Format/DateFormat/DateFormatTest.java index 20490f43a38a6..a8e70ce6567ea 100644 --- a/test/jdk/java/text/Format/DateFormat/DateFormatTest.java +++ b/test/jdk/java/text/Format/DateFormat/DateFormatTest.java @@ -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,14 +24,16 @@ /** * @test * @bug 4052223 4089987 4469904 4326988 4486735 8008577 8045998 8140571 - * 8190748 8216969 8174269 + * 8190748 8216969 8174269 8347841 * @summary test DateFormat and SimpleDateFormat. * @modules jdk.localedata * @run junit DateFormatTest */ -import java.util.*; +import java.time.ZoneId; import java.text.*; +import java.util.*; +import java.util.function.Predicate; import static java.util.GregorianCalendar.*; import org.junit.jupiter.api.Test; @@ -89,7 +91,9 @@ public void TestWallyWedel() /* * A String array for the time zone ids. */ - String[] ids = TimeZone.getAvailableIDs(); + String[] ids = Arrays.stream(TimeZone.getAvailableIDs()) + .filter(Predicate.not(ZoneId.SHORT_IDS::containsKey)) + .toArray(String[]::new); /* * How many ids do we have? */ @@ -183,7 +187,7 @@ public void TestTwoDigitYearDSTParse() //logln(fmt.format(date)); // This shows what the current locale format is //logln(((SimpleDateFormat)fmt).toPattern()); TimeZone save = TimeZone.getDefault(); - TimeZone PST = TimeZone.getTimeZone("PST"); + TimeZone PST = TimeZone.getTimeZone("America/Los_Angeles"); String s = "03-Apr-04 2:20:47 o'clock AM PST"; int hour = 2; try { @@ -275,7 +279,7 @@ public void TestFieldPosition() "0034", "0012", "0513", "Pacific Daylight Time", }; Date someDate = new Date(871508052513L); - TimeZone PST = TimeZone.getTimeZone("PST"); + TimeZone PST = TimeZone.getTimeZone("America/Los_Angeles"); for (int j = 0, exp = 0; j < dateFormats.length; ++j) { DateFormat df = dateFormats[j]; if (!(df instanceof SimpleDateFormat)) { diff --git a/test/jdk/java/text/Format/DateFormat/SDFTCKZoneNamesTest.java b/test/jdk/java/text/Format/DateFormat/SDFTCKZoneNamesTest.java index a9f2e30a4d05b..aea3706f70efe 100644 --- a/test/jdk/java/text/Format/DateFormat/SDFTCKZoneNamesTest.java +++ b/test/jdk/java/text/Format/DateFormat/SDFTCKZoneNamesTest.java @@ -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 @@ -23,12 +23,13 @@ /** * @test - * @bug 8218948 + * @bug 8218948 8347841 * @summary TCK tests that check the time zone names between DFS.getZoneStrings() * and SDF.format("z*") * @run main SDFTCKZoneNamesTest */ import java.text.*; +import java.time.ZoneId; import java.util.Calendar; import java.util.Date; import java.util.List; @@ -325,6 +326,9 @@ public void SimpleDateFormat0062() { SimpleDateFormat sdf = new SimpleDateFormat(); Date date = new Date(1234567890); for (String[] tz : sdf.getDateFormatSymbols().getZoneStrings()) { + if (ZoneId.SHORT_IDS.containsKey(tz[0])) { + continue; + } sdf.setTimeZone(TimeZone.getTimeZone(tz[0])); for (int i = 0; i < patterns.length && passed; i++) { StringBuffer result = new StringBuffer("qwerty"); diff --git a/test/jdk/java/text/Format/DateFormat/bug4358730.java b/test/jdk/java/text/Format/DateFormat/bug4358730.java index 445a6c23fcfc3..9b37f9f56be05 100644 --- a/test/jdk/java/text/Format/DateFormat/bug4358730.java +++ b/test/jdk/java/text/Format/DateFormat/bug4358730.java @@ -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 @@ -31,7 +31,7 @@ /** * @test - * @bug 4358730 + * @bug 4358730 8347841 * @summary test that confirms Zero-Padding on year. * @run junit bug4358730 */ @@ -56,7 +56,7 @@ public void Test4358730() { Locale saveLocale = Locale.getDefault(); try { - TimeZone.setDefault(TimeZone.getTimeZone("PST")); + TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles")); Locale.setDefault(Locale.US); SimpleDateFormat sdf = new SimpleDateFormat(); diff --git a/test/jdk/java/util/Calendar/CalendarRegression.java b/test/jdk/java/util/Calendar/CalendarRegression.java index 24d34533bde58..93869e0af3bc8 100644 --- a/test/jdk/java/util/Calendar/CalendarRegression.java +++ b/test/jdk/java/util/Calendar/CalendarRegression.java @@ -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 @@ -30,7 +30,7 @@ * 4174361 4177484 4197699 4209071 4288792 4328747 4413980 4546637 4623997 * 4685354 4655637 4683492 4080631 4080631 4167995 4340146 4639407 * 4652815 4652830 4740554 4936355 4738710 4633646 4846659 4822110 4960642 - * 4973919 4980088 4965624 5013094 5006864 8152077 + * 4973919 4980088 4965624 5013094 5006864 8152077 8347841 * @library /java/text/testlib * @run junit CalendarRegression */ @@ -42,6 +42,8 @@ import java.text.DateFormat; import java.text.NumberFormat; import java.text.SimpleDateFormat; +import java.time.ZoneId; +import java.util.Arrays; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; @@ -50,6 +52,7 @@ import java.util.Map; import java.util.SimpleTimeZone; import java.util.TimeZone; +import java.util.function.Predicate; import static java.util.Calendar.*; @@ -75,7 +78,9 @@ public class CalendarRegression { public void Test4031502() { // This bug actually occurs on Windows NT as well, and doesn't // require the host zone to be set; it can be set in Java. - String[] ids = TimeZone.getAvailableIDs(); + String[] ids = Arrays.stream(TimeZone.getAvailableIDs()) + .filter(Predicate.not(ZoneId.SHORT_IDS::containsKey)) + .toArray(String[]::new); boolean bad = false; for (int i = 0; i < ids.length; ++i) { TimeZone zone = TimeZone.getTimeZone(ids[i]); @@ -489,7 +494,7 @@ public void Test4095407() { @Test public void Test4096231() { TimeZone GMT = TimeZone.getTimeZone("GMT"); - TimeZone PST = TimeZone.getTimeZone("PST"); + TimeZone PST = TimeZone.getTimeZone("America/Los_Angeles"); int sec = 0, min = 0, hr = 0, day = 1, month = 10, year = 1997; Calendar cal1 = new GregorianCalendar(PST); @@ -838,7 +843,7 @@ public void Test4114578() { TimeZone saveZone = TimeZone.getDefault(); boolean fail = false; try { - TimeZone.setDefault(TimeZone.getTimeZone("PST")); + TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles")); Calendar cal = Calendar.getInstance(); long onset = new Date(98, APRIL, 5, 1, 0).getTime() + ONE_HOUR; long cease = new Date(98, OCTOBER, 25, 0, 0).getTime() + 2 * ONE_HOUR; @@ -1163,8 +1168,8 @@ public void Test4147269() { @Test public void Test4149677() { TimeZone[] zones = {TimeZone.getTimeZone("GMT"), - TimeZone.getTimeZone("PST"), - TimeZone.getTimeZone("EAT")}; + TimeZone.getTimeZone("America/Los_Angeles"), + TimeZone.getTimeZone("Africa/Addis_Ababa")}; for (int i = 0; i < zones.length; ++i) { GregorianCalendar calendar = new GregorianCalendar(zones[i]); @@ -1197,7 +1202,7 @@ public void Test4149677() { @Test public void Test4162587() { TimeZone savedTz = TimeZone.getDefault(); - TimeZone tz = TimeZone.getTimeZone("PST"); + TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles"); TimeZone.setDefault(tz); GregorianCalendar cal = new GregorianCalendar(tz); Date d; @@ -1511,8 +1516,8 @@ public void Test4174361() { */ @Test public void Test4177484() { - TimeZone PST = TimeZone.getTimeZone("PST"); - TimeZone EST = TimeZone.getTimeZone("EST"); + TimeZone PST = TimeZone.getTimeZone("America/Los_Angeles"); + TimeZone EST = TimeZone.getTimeZone("America/Panama"); Calendar cal = Calendar.getInstance(PST, Locale.US); cal.clear(); @@ -1770,7 +1775,7 @@ public void Test4413980() { TimeZone savedTimeZone = TimeZone.getDefault(); try { boolean pass = true; - String[] IDs = new String[]{"Undefined", "PST", "US/Pacific", + String[] IDs = new String[]{"Undefined", "America/Los_Angeles", "US/Pacific", "GMT+3:00", "GMT-01:30"}; for (int i = 0; i < IDs.length; i++) { TimeZone tz = TimeZone.getTimeZone(IDs[i]); diff --git a/test/jdk/java/util/Calendar/JavatimeTest.java b/test/jdk/java/util/Calendar/JavatimeTest.java index 8f32801a307d0..115b1e4e8b876 100644 --- a/test/jdk/java/util/Calendar/JavatimeTest.java +++ b/test/jdk/java/util/Calendar/JavatimeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, 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,7 @@ /* *@test - *@bug 8007520 8008254 + *@bug 8007520 8008254 8347841 *@summary Test those bridge methods to/from java.time date/time classes * @key randomness */ @@ -107,23 +107,22 @@ public static void main(String[] args) throws Throwable { ///////////// java.util.TimeZone ///////////////////////// for (String zidStr : TimeZone.getAvailableIDs()) { - // TBD: tzdt intergration + if (ZoneId.SHORT_IDS.containsKey(zidStr)) { + continue; + } + // TBD: tzdt integration if (zidStr.startsWith("SystemV") || zidStr.contains("Riyadh8") - || zidStr.equals("US/Pacific-New") - || zidStr.equals("EST") - || zidStr.equals("HST") - || zidStr.equals("MST")) { + || zidStr.equals("US/Pacific-New")) { continue; } - ZoneId zid = ZoneId.of(zidStr, ZoneId.SHORT_IDS); + ZoneId zid = ZoneId.of(zidStr); if (!zid.equals(TimeZone.getTimeZone(zid).toZoneId())) { throw new RuntimeException("FAILED: zid -> tz -> zid :" + zidStr); } TimeZone tz = TimeZone.getTimeZone(zidStr); // no round-trip for alias and "GMT" if (!tz.equals(TimeZone.getTimeZone(tz.toZoneId())) - && !ZoneId.SHORT_IDS.containsKey(zidStr) && !zidStr.startsWith("GMT")) { throw new RuntimeException("FAILED: tz -> zid -> tz :" + zidStr); } diff --git a/test/jdk/java/util/Calendar/bug4316678.java b/test/jdk/java/util/Calendar/bug4316678.java index f6bd4b87cae4f..b1c24a6a0c4a1 100644 --- a/test/jdk/java/util/Calendar/bug4316678.java +++ b/test/jdk/java/util/Calendar/bug4316678.java @@ -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 @@ -23,7 +23,7 @@ /* * @test - * @bug 4316678 + * @bug 4316678 8347841 * @summary test that Calendar's Serialization works correctly. * @run junit bug4316678 */ @@ -53,7 +53,7 @@ public class bug4316678 { // Set custom JVM default TimeZone @BeforeAll static void initAll() { - TimeZone.setDefault(TimeZone.getTimeZone("PST")); + TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles")); } // Restore JVM default Locale and TimeZone diff --git a/test/jdk/java/util/Calendar/bug4372743.java b/test/jdk/java/util/Calendar/bug4372743.java index 193ad53d813b5..d3d2b39b5fc63 100644 --- a/test/jdk/java/util/Calendar/bug4372743.java +++ b/test/jdk/java/util/Calendar/bug4372743.java @@ -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 @@ -23,7 +23,7 @@ /* * @test - * @bug 4372743 + * @bug 4372743 8347841 * @summary test that checks transitions of ERA and YEAR which are caused by add(MONTH). * @run junit bug4372743 */ @@ -67,7 +67,7 @@ public class bug4372743 { // Set custom JVM default timezone @BeforeAll static void initAll() { - TimeZone.setDefault(TimeZone.getTimeZone("PST")); + TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles")); } // Restore JVM default timezone diff --git a/test/jdk/java/util/Currency/CheckDataVersion.java b/test/jdk/java/util/Currency/CheckDataVersion.java index 303603c5b85e2..d7e76be62389e 100644 --- a/test/jdk/java/util/Currency/CheckDataVersion.java +++ b/test/jdk/java/util/Currency/CheckDataVersion.java @@ -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 @@ -33,8 +33,6 @@ import java.io.FileReader; import java.io.IOException; import java.io.InputStream; -import java.security.AccessController; -import java.security.PrivilegedAction; import java.util.Currency; class CheckDataVersion { @@ -63,33 +61,23 @@ static void check() { break; } } + InputStream JREdata = Currency.class.getModule().getResourceAsStream("java/util/currency.data"); + DataInputStream dis = new DataInputStream(JREdata); + int magic = dis.readInt(); + if (magic != 0x43757244) { + throw new RuntimeException("The magic number in the JRE's currency data is incorrect. Expected: 0x43757244, Got: 0x"+magic); + } + int fileVerNumber = dis.readInt(); + int dataVerNumber = dis.readInt(); + if (Integer.parseInt(fileVersion) != fileVerNumber || + Integer.parseInt(dataVersion) != dataVerNumber) { + throw new RuntimeException("Test data and JRE's currency data are inconsistent. test: (file: "+fileVersion+" data: "+dataVersion+"), JRE: (file: "+fileVerNumber+" data: "+dataVerNumber+")"); + } + System.out.println("test: (file: "+fileVersion+" data: "+dataVersion+"), JRE: (file: "+fileVerNumber+" data: "+dataVerNumber+")"); } catch (IOException ioe) { - throw new RuntimeException(ioe); + throw new RuntimeException( + "currency.data was not retrieved properly", ioe); } - - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - try { - InputStream in = Currency.class.getModule().getResourceAsStream("java/util/currency.data"); - String sep = File.separator; - DataInputStream dis = new DataInputStream(in); - int magic = dis.readInt(); - if (magic != 0x43757244) { - throw new RuntimeException("The magic number in the JRE's currency data is incorrect. Expected: 0x43757244, Got: 0x"+magic); - } - int fileVerNumber = dis.readInt(); - int dataVerNumber = dis.readInt(); - if (Integer.parseInt(fileVersion) != fileVerNumber || - Integer.parseInt(dataVersion) != dataVerNumber) { - throw new RuntimeException("Test data and JRE's currency data are inconsistent. test: (file: "+fileVersion+" data: "+dataVersion+"), JRE: (file: "+fileVerNumber+" data: "+dataVerNumber+")"); - } -System.out.println("test: (file: "+fileVersion+" data: "+dataVersion+"), JRE: (file: "+fileVerNumber+" data: "+dataVerNumber+")"); - } catch (IOException ioe) { - throw new RuntimeException(ioe); - } - return null; - } - }); checked = true; } } diff --git a/test/jdk/java/util/Date/Bug4955000.java b/test/jdk/java/util/Date/Bug4955000.java index 4339f848f580a..f05e6ccd3f80a 100644 --- a/test/jdk/java/util/Date/Bug4955000.java +++ b/test/jdk/java/util/Date/Bug4955000.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, 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 @@ -23,7 +23,7 @@ /* * @test - * @bug 4955000 + * @bug 4955000 8347841 * @summary Make sure that a Date and a GregorianCalendar produce the * same date/time. Both are new implementations in 1.5. */ @@ -42,7 +42,7 @@ public class Bug4955000 { public static void main(String[] args) { TimeZone defaultTZ = TimeZone.getDefault(); try { - TimeZone.setDefault(TimeZone.getTimeZone("NST")); + TimeZone.setDefault(TimeZone.getTimeZone("Pacific/Auckland")); GregorianCalendar gc = new GregorianCalendar(TimeZone.getTimeZone("UTC")); // Date1025 int[] years1 = { diff --git a/test/jdk/java/util/Date/DateRegression.java b/test/jdk/java/util/Date/DateRegression.java index 8fe89d9d59bdf..eda575743e326 100644 --- a/test/jdk/java/util/Date/DateRegression.java +++ b/test/jdk/java/util/Date/DateRegression.java @@ -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 @@ -23,7 +23,8 @@ /* * @test - * @bug 4023247 4027685 4032037 4072029 4073003 4118010 4120606 4133833 4136916 6274757 6314387 + * @bug 4023247 4027685 4032037 4072029 4073003 4118010 4120606 4133833 + * 4136916 6274757 6314387 8347841 * @run junit DateRegression */ @@ -106,7 +107,7 @@ public void Test4072029() { TimeZone saveZone = TimeZone.getDefault(); try { - TimeZone.setDefault(TimeZone.getTimeZone("PST")); + TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles")); Date now = new Date(); String s = now.toString(); Date now2 = new Date(now.toString()); diff --git a/test/jdk/java/util/Date/DateTest.java b/test/jdk/java/util/Date/DateTest.java index 6740cb16faa3f..7dbb19409d37a 100644 --- a/test/jdk/java/util/Date/DateTest.java +++ b/test/jdk/java/util/Date/DateTest.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 @@ -23,7 +23,7 @@ /* * @test - * @bug 4143459 + * @bug 4143459 8347841 * @summary test Date * @run junit DateTest */ @@ -56,7 +56,7 @@ public void TestDefaultZoneLite() { d.setMonth(Calendar.JANUARY); d.setDate(1); d.setHours(6); - TimeZone.setDefault(TimeZone.getTimeZone("PST")); + TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles")); if (d.getHours() != 22) { fail("Fail: Date.setHours()/getHours() ignoring default zone"); } @@ -79,7 +79,7 @@ public void TestDefaultZone() { Date ref = new Date(883634400000L); // This is Thu Jan 1 1998 6:00 am GMT String refstr = "Jan 1 1998 6:00"; TimeZone GMT = TimeZone.getTimeZone("GMT"); - TimeZone PST = TimeZone.getTimeZone("PST"); + TimeZone PST = TimeZone.getTimeZone("America/Los_Angeles"); String[] names = { "year", "month", "date", "day of week", "hour", "offset" }; int[] GMT_EXP = { 98, Calendar.JANUARY, 1, Calendar.THURSDAY - Calendar.SUNDAY, 6, 0 }; @@ -207,7 +207,7 @@ public void TestDate480() { TimeZone save = TimeZone.getDefault(); try { - TimeZone.setDefault(TimeZone.getTimeZone("PST")); + TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles")); Date d1=new java.util.Date(97,8,13,10,8,13); System.out.println("d = "+d1); Date d2=new java.util.Date(97,8,13,30,8,13); // 20 hours later diff --git a/test/jdk/java/util/PluggableLocale/TimeZoneNameProviderTest.java b/test/jdk/java/util/PluggableLocale/TimeZoneNameProviderTest.java index 5a8463cbfdeb7..784998a9c3247 100644 --- a/test/jdk/java/util/PluggableLocale/TimeZoneNameProviderTest.java +++ b/test/jdk/java/util/PluggableLocale/TimeZoneNameProviderTest.java @@ -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 @@ -23,7 +23,7 @@ /* * @test - * @bug 4052440 8003267 8062588 8210406 8174269 8327434 + * @bug 4052440 8003267 8062588 8210406 8174269 8327434 8347841 * @summary TimeZoneNameProvider tests * @library providersrc/foobarutils * providersrc/barprovider @@ -37,6 +37,7 @@ import java.text.DateFormatSymbols; import java.text.ParseException; import java.text.SimpleDateFormat; +import java.time.ZoneId; import java.time.format.TextStyle; import java.util.Arrays; import java.util.Calendar; @@ -45,6 +46,7 @@ import java.util.Locale; import java.util.MissingResourceException; import java.util.TimeZone; +import java.util.function.Predicate; import java.util.stream.Stream; import com.bar.TimeZoneNameProviderImpl; @@ -72,7 +74,9 @@ public static void main(String[] s) { void test1() { List jreimplloc = Arrays.asList(LocaleProviderAdapter.forType(LocaleProviderAdapter.Type.CLDR).getTimeZoneNameProvider().getAvailableLocales()); List providerLocales = Arrays.asList(tznp.getAvailableLocales()); - String[] ids = TimeZone.getAvailableIDs(); + String[] ids = Arrays.stream(TimeZone.getAvailableIDs()) + .filter(Predicate.not(ZoneId.SHORT_IDS::containsKey)) + .toArray(String[]::new); // Sampling relevant locales Stream.concat(Stream.of(Locale.ROOT, Locale.US, Locale.JAPAN), providerLocales.stream()).forEach(target -> { @@ -176,7 +180,7 @@ void test2() { df.parse(DISPLAY_NAMES_KYOTO[i]); } } catch (ParseException pe) { - throw new RuntimeException("parse error occured" + pe); + throw new RuntimeException("parse error occurred" + pe); } finally { // restore the reserved locale and time zone Locale.setDefault(defaultLocale); @@ -186,8 +190,8 @@ void test2() { void test3() { final String[] TZNAMES = { - LATIME, PST, PST8PDT, US_PACIFIC, - TOKYOTIME, JST, JAPAN, + LATIME, PST8PDT, US_PACIFIC, + TOKYOTIME, JAPAN, }; for (String tzname : TZNAMES) { TimeZone tz = TimeZone.getTimeZone(tzname); @@ -208,17 +212,13 @@ void test3() { } final String LATIME = "America/Los_Angeles"; - final String PST = "PST"; final String PST8PDT = "PST8PDT"; final String US_PACIFIC = "US/Pacific"; final String LATIME_IN_OSAKA = tznp.getDisplayName(LATIME, false, TimeZone.LONG, OSAKA); final String TOKYOTIME = "Asia/Tokyo"; - final String JST = "JST"; final String JAPAN = "Japan"; - final String JST_IN_OSAKA = - tznp.getDisplayName(JST, false, TimeZone.LONG, OSAKA); void aliasTest() { // Check that provider's name for a standard id (America/Los_Angeles) is @@ -228,32 +228,10 @@ void aliasTest() { throw new RuntimeException("Could not get provider's localized name. result: "+latime+" expected: "+LATIME_IN_OSAKA); } - String pst = TimeZone.getTimeZone(PST).getDisplayName(OSAKA); - if (!LATIME_IN_OSAKA.equals(pst)) { - throw new RuntimeException("Provider's localized name is not available for an alias ID: "+PST+". result: "+pst+" expected: "+LATIME_IN_OSAKA); - } - String us_pacific = TimeZone.getTimeZone(US_PACIFIC).getDisplayName(OSAKA); if (!LATIME_IN_OSAKA.equals(us_pacific)) { throw new RuntimeException("Provider's localized name is not available for an alias ID: "+US_PACIFIC+". result: "+us_pacific+" expected: "+LATIME_IN_OSAKA); } - - // Check that provider's name for an alias id (JST) is - // propagated to its standard id and alias ids. - String jstime = TimeZone.getTimeZone(JST).getDisplayName(OSAKA); - if (!JST_IN_OSAKA.equals(jstime)) { - throw new RuntimeException("Could not get provider's localized name. result: "+jstime+" expected: "+JST_IN_OSAKA); - } - - String tokyotime = TimeZone.getTimeZone(TOKYOTIME).getDisplayName(OSAKA); - if (!JST_IN_OSAKA.equals(tokyotime)) { - throw new RuntimeException("Provider's localized name is not available for a standard ID: "+TOKYOTIME+". result: "+tokyotime+" expected: "+JST_IN_OSAKA); - } - - String japan = TimeZone.getTimeZone(JAPAN).getDisplayName(OSAKA); - if (!JST_IN_OSAKA.equals(japan)) { - throw new RuntimeException("Provider's localized name is not available for an alias ID: "+JAPAN+". result: "+japan+" expected: "+JST_IN_OSAKA); - } } /* diff --git a/test/jdk/java/util/Properties/StoreDeadlock.java b/test/jdk/java/util/Properties/StoreDeadlock.java index d59a444525187..0eb3e930a81c3 100644 --- a/test/jdk/java/util/Properties/StoreDeadlock.java +++ b/test/jdk/java/util/Properties/StoreDeadlock.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 6199320 + * @bug 6199320 8347841 * @summary Properties.store() causes deadlock when concurrently calling TimeZone apis * @run main/timeout=20 StoreDeadlock * @author Xueming Shen @@ -59,7 +59,7 @@ public void run() { } class Thread2 extends Thread { public void run() { - System.out.println("tz=" + TimeZone.getTimeZone("PST")); + System.out.println("tz=" + TimeZone.getTimeZone("America/Los_Angeles")); } } } diff --git a/test/jdk/java/util/TimeZone/Bug5097350.java b/test/jdk/java/util/TimeZone/Bug5097350.java index ff0894bf3d740..862d7f90a155f 100644 --- a/test/jdk/java/util/TimeZone/Bug5097350.java +++ b/test/jdk/java/util/TimeZone/Bug5097350.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2016, 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,16 +23,19 @@ /* * @test - * @bug 5097350 + * @bug 5097350 8347841 * @summary Make sure that TimeZone.getTimeZone returns a clone of a cached TimeZone instance. */ +import java.time.ZoneId; import java.util.*; -import java.text.*; +import java.util.function.Predicate; public class Bug5097350 { public static void main(String[] args) { - String[] tzids = TimeZone.getAvailableIDs(); + String[] tzids = Arrays.stream(TimeZone.getAvailableIDs()) + .filter(Predicate.not(ZoneId.SHORT_IDS::containsKey)) + .toArray(String[]::new); List ids = new ArrayList<>(tzids.length + 10); ids.addAll(Arrays.asList(tzids)); // add some custom ids diff --git a/test/jdk/java/util/TimeZone/Bug6329116.java b/test/jdk/java/util/TimeZone/Bug6329116.java index a79400990b253..cd48bffdfa258 100644 --- a/test/jdk/java/util/TimeZone/Bug6329116.java +++ b/test/jdk/java/util/TimeZone/Bug6329116.java @@ -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 @@ -25,13 +25,15 @@ * @test * @bug 6329116 6756569 6757131 6758988 6764308 6796489 6834474 6609737 6507067 * 7039469 7090843 7103108 7103405 7158483 8008577 8059206 8064560 8072042 - * 8077685 8151876 8166875 8169191 8170316 8176044 8174269 + * 8077685 8151876 8166875 8169191 8170316 8176044 8174269 8347841 * @summary Make sure that timezone short display names are identical to Olson's data. * @run junit Bug6329116 */ import java.io.*; +import java.time.ZoneId; import java.util.*; +import java.util.function.Predicate; import org.junit.jupiter.api.Test; @@ -44,7 +46,9 @@ public class Bug6329116 { // static Locale[] locales = Locale.getAvailableLocales(); static Locale[] locales = {Locale.US}; - static String[] timezones = TimeZone.getAvailableIDs(); + static String[] timezones = Arrays.stream(TimeZone.getAvailableIDs()) + .filter(Predicate.not(ZoneId.SHORT_IDS::containsKey)) + .toArray(String[]::new); @Test public void bug6329116() throws IOException { @@ -101,6 +105,9 @@ public void bug6329116() throws IOException { tzs[0] = timezoneID; for (int j = 0; j < tzs.length; j++) { + if (ZoneId.SHORT_IDS.containsKey(tzs[j])) { + continue; + } tz = TimeZone.getTimeZone(tzs[j]); if (!tzs[j].equals(tz.getID())) { diff --git a/test/jdk/java/util/TimeZone/Bug6772689.java b/test/jdk/java/util/TimeZone/Bug6772689.java index f730567013d35..b2ce085fc226f 100644 --- a/test/jdk/java/util/TimeZone/Bug6772689.java +++ b/test/jdk/java/util/TimeZone/Bug6772689.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 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 @@ -23,15 +23,18 @@ /* * @test - * @bug 6772689 + * @bug 6772689 8347841 * @summary Test for standard-to-daylight transitions at midnight: * date stays on the given day. */ +import java.time.ZoneId; +import java.util.Arrays; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.TimeZone; +import java.util.function.Predicate; import static java.util.GregorianCalendar.*; public class Bug6772689 { @@ -43,7 +46,9 @@ public static void main(String[] args) { int errors = 0; Calendar cal = new GregorianCalendar(BEGIN_YEAR, MARCH, 1); - String[] tzids = TimeZone.getAvailableIDs(); + String[] tzids = Arrays.stream(TimeZone.getAvailableIDs()) + .filter(Predicate.not(ZoneId.SHORT_IDS::containsKey)) + .toArray(String[]::new); try { for (String id : tzids) { TimeZone tz = TimeZone.getTimeZone(id); diff --git a/test/jdk/java/util/TimeZone/CLDRDisplayNamesTest.java b/test/jdk/java/util/TimeZone/CLDRDisplayNamesTest.java index 2ff278a583c33..158692676a9fd 100644 --- a/test/jdk/java/util/TimeZone/CLDRDisplayNamesTest.java +++ b/test/jdk/java/util/TimeZone/CLDRDisplayNamesTest.java @@ -130,7 +130,7 @@ public static void main(String[] args) { String displayName = zi.getDisplayName(false, TimeZone.SHORT, Locale.US); Locale.setDefault(originalLocale); if (!displayName.equals("GMT+05:00")) { - System.err.printf("Wrong display name for timezone Etc/GMT-5 : expected GMT+05:00, Actual " + displayName); + System.err.println("Wrong display name for timezone Etc/GMT-5 : expected GMT+05:00, Actual " + displayName); errors++; } diff --git a/test/jdk/java/util/TimeZone/DaylightTimeTest.java b/test/jdk/java/util/TimeZone/DaylightTimeTest.java index 4b637136f96b2..006f03424eea4 100644 --- a/test/jdk/java/util/TimeZone/DaylightTimeTest.java +++ b/test/jdk/java/util/TimeZone/DaylightTimeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 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 @@ -23,17 +23,21 @@ /* * @test - * @bug 6936350 + * @bug 6936350 8347841 * @summary Test case for TimeZone.observesDaylightTime() */ +import java.time.ZoneId; import java.util.*; +import java.util.function.Predicate; import static java.util.GregorianCalendar.*; public class DaylightTimeTest { private static final int ONE_HOUR = 60 * 60 * 1000; // one hour private static final int INTERVAL = 24 * ONE_HOUR; // one day - private static final String[] ZONES = TimeZone.getAvailableIDs(); + private static final String[] ZONES = Arrays.stream(TimeZone.getAvailableIDs()) + .filter(Predicate.not(ZoneId.SHORT_IDS::containsKey)) + .toArray(String[]::new); private static int errors = 0; public static void main(String[] args) { diff --git a/test/jdk/java/util/TimeZone/IDTest.java b/test/jdk/java/util/TimeZone/IDTest.java index d5396b619b8ea..97bf971abc905 100644 --- a/test/jdk/java/util/TimeZone/IDTest.java +++ b/test/jdk/java/util/TimeZone/IDTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2016, 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 @@ -23,24 +23,30 @@ /* * @test - * @bug 4509255 5055567 6176318 7090844 + * @bug 4509255 5055567 6176318 7090844 8347841 * @summary Tests consistencies of time zone IDs. */ +import java.time.ZoneId; import java.util.Arrays; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.TimeZone; import java.util.TreeMap; +import java.util.function.Predicate; public class IDTest { public static void main(String[] args) { Set ids = new HashSet<>(); Map> tree = new TreeMap<>(); - String[] tzs = TimeZone.getAvailableIDs(); - String[] tzs2 = TimeZone.getAvailableIDs(); + String[] tzs = Arrays.stream(TimeZone.getAvailableIDs()) + .filter(Predicate.not(ZoneId.SHORT_IDS::containsKey)) + .toArray(String[]::new); + String[] tzs2 = Arrays.stream(TimeZone.getAvailableIDs()) + .filter(Predicate.not(ZoneId.SHORT_IDS::containsKey)) + .toArray(String[]::new); if (tzs.length != tzs2.length) { throw new RuntimeException("tzs.length(" + tzs.length + ") != tzs2.length(" + tzs2.length + ")"); @@ -83,8 +89,12 @@ public static void main(String[] args) { // Check the getAvailableIDs(int) call to return the same // set of IDs int offset = key.intValue(); - tzs = TimeZone.getAvailableIDs(offset); - tzs2 = TimeZone.getAvailableIDs(offset); + tzs = Arrays.stream(TimeZone.getAvailableIDs(offset)) + .filter(Predicate.not(ZoneId.SHORT_IDS::containsKey)) + .toArray(String[]::new); + tzs2 = Arrays.stream(TimeZone.getAvailableIDs(offset)) + .filter(Predicate.not(ZoneId.SHORT_IDS::containsKey)) + .toArray(String[]::new); if (!Arrays.equals(tzs, tzs2)) { throw new RuntimeException("inconsistent tzs from getAvailableIDs("+offset+")"); } diff --git a/test/jdk/java/util/TimeZone/ListTimeZones.java b/test/jdk/java/util/TimeZone/ListTimeZones.java index 7dd309473e641..dad59a91a95e5 100644 --- a/test/jdk/java/util/TimeZone/ListTimeZones.java +++ b/test/jdk/java/util/TimeZone/ListTimeZones.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2013, 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 @@ -23,17 +23,21 @@ /** * @test - * @bug 6851214 + * @bug 6851214 8347841 * @summary Allow 24:00 as a valid end/start DST time stamp * @run main ListTimeZones */ +import java.time.ZoneId; import java.util.*; +import java.util.function.Predicate; public class ListTimeZones{ public static void main(String[] args){ Date date = new Date(); - String TimeZoneIds[] = TimeZone.getAvailableIDs(); + String[] TimeZoneIds = Arrays.stream(TimeZone.getAvailableIDs()) + .filter(Predicate.not(ZoneId.SHORT_IDS::containsKey)) + .toArray(String[]::new); for(int i = 0; i < TimeZoneIds.length; i++){ TimeZone tz = TimeZone.getTimeZone(TimeZoneIds[i]); Calendar calendar = new GregorianCalendar(tz); diff --git a/test/jdk/java/util/TimeZone/ThreeLetterZoneID.java b/test/jdk/java/util/TimeZone/ThreeLetterZoneID.java new file mode 100644 index 0000000000000..5df3ebe5bf0f1 --- /dev/null +++ b/test/jdk/java/util/TimeZone/ThreeLetterZoneID.java @@ -0,0 +1,49 @@ +/* + * 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 8342550 + * @summary Three-letter time zone IDs should output a deprecated warning + * message. + * @library /test/lib + * @build jdk.test.lib.process.ProcessTools + * @run main ThreeLetterZoneID + */ +import java.util.TimeZone; +import jdk.test.lib.process.ProcessTools; + +public class ThreeLetterZoneID { + public static void main(String... args) throws Exception { + if (args.length > 0) { + TimeZone.getTimeZone("PST"); + } else { + checkWarningMessage(); + } + } + + public static void checkWarningMessage() throws Exception { + ProcessTools.executeTestJava("ThreeLetterZoneID", "dummy") + .shouldContain("Use of the three-letter time zone ID \"PST\" is deprecated and it will be removed in a future release"); + } +} diff --git a/test/jdk/java/util/TimeZone/TimeZoneBoundaryTest.java b/test/jdk/java/util/TimeZone/TimeZoneBoundaryTest.java index c70ccc204de55..9e4ca02731d3b 100644 --- a/test/jdk/java/util/TimeZone/TimeZoneBoundaryTest.java +++ b/test/jdk/java/util/TimeZone/TimeZoneBoundaryTest.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 @@ -23,6 +23,7 @@ /* * @test + * @bug 8347841 * @summary test Time Zone Boundary * @run junit TimeZoneBoundaryTest */ @@ -251,7 +252,7 @@ void verifyDST(Date d, TimeZone time_zone, @Test public void TestBoundaries() { - TimeZone pst = TimeZone.getTimeZone("PST"); + TimeZone pst = TimeZone.getTimeZone("America/Los_Angeles"); TimeZone save = TimeZone.getDefault(); try { TimeZone.setDefault(pst); @@ -410,11 +411,8 @@ else if (!z.useDaylightTime()) @Test public void TestStepwise() { - findBoundariesStepwise(1997, ONE_DAY, TimeZone.getTimeZone("ACT"), 0); - // "EST" is disabled because its behavior depends on the mapping property. (6466476). - //findBoundariesStepwise(1997, ONE_DAY, TimeZone.getTimeZone("EST"), 2); - findBoundariesStepwise(1997, ONE_DAY, TimeZone.getTimeZone("HST"), 0); - findBoundariesStepwise(1997, ONE_DAY, TimeZone.getTimeZone("PST"), 2); + findBoundariesStepwise(1997, ONE_DAY, TimeZone.getTimeZone("Australia/Darwin"), 0); + findBoundariesStepwise(1997, ONE_DAY, TimeZone.getTimeZone("Pacific/Honolulu"), 0); findBoundariesStepwise(1997, ONE_DAY, TimeZone.getTimeZone("PST8PDT"), 2); findBoundariesStepwise(1997, ONE_DAY, TimeZone.getTimeZone("SystemV/PST"), 0); findBoundariesStepwise(1997, ONE_DAY, TimeZone.getTimeZone("SystemV/PST8PDT"), 2); diff --git a/test/jdk/java/util/TimeZone/TimeZoneData/VERSION b/test/jdk/java/util/TimeZone/TimeZoneData/VERSION index f40be22e9abc1..5159b3786e385 100644 --- a/test/jdk/java/util/TimeZone/TimeZoneData/VERSION +++ b/test/jdk/java/util/TimeZone/TimeZoneData/VERSION @@ -1 +1 @@ -tzdata2024b +tzdata2025a diff --git a/test/jdk/java/util/TimeZone/TimeZoneData/aliases.txt b/test/jdk/java/util/TimeZone/TimeZoneData/aliases.txt index 3217f68b82578..c8d855453c27f 100644 --- a/test/jdk/java/util/TimeZone/TimeZoneData/aliases.txt +++ b/test/jdk/java/util/TimeZone/TimeZoneData/aliases.txt @@ -1,6 +1,3 @@ -Link Asia/Riyadh87 Mideast/Riyadh87 -Link Asia/Riyadh88 Mideast/Riyadh88 -Link Asia/Riyadh89 Mideast/Riyadh89 Link Australia/Sydney Australia/ACT #= Australia/Canberra Link Australia/Lord_Howe Australia/LHI Link Australia/Sydney Australia/NSW diff --git a/test/jdk/java/util/TimeZone/TimeZoneRegression.java b/test/jdk/java/util/TimeZone/TimeZoneRegression.java index ca539336dae64..241afd3f7cf71 100644 --- a/test/jdk/java/util/TimeZone/TimeZoneRegression.java +++ b/test/jdk/java/util/TimeZone/TimeZoneRegression.java @@ -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 @@ -25,7 +25,7 @@ * @test * @bug 4052967 4073209 4073215 4084933 4096952 4109314 4126678 4151406 4151429 * 4154525 4154537 4154542 4154650 4159922 4162593 4173604 4176686 4184229 4208960 - * 4966229 6433179 6851214 8007520 8008577 8174269 + * 4966229 6433179 6851214 8007520 8008577 8174269 8347841 * @library /java/text/testlib * @run junit TimeZoneRegression */ @@ -42,8 +42,8 @@ public class TimeZoneRegression { @Test public void Test4073209() { - TimeZone z1 = TimeZone.getTimeZone("PST"); - TimeZone z2 = TimeZone.getTimeZone("PST"); + TimeZone z1 = TimeZone.getTimeZone("America/Los_Angeles"); + TimeZone z2 = TimeZone.getTimeZone("America/Los_Angeles"); if (z1 == z2) { fail("Fail: TimeZone should return clones"); } @@ -81,7 +81,7 @@ public void Test4084933() { // test both SimpleTimeZone and ZoneInfo objects. // @since 1.4 sub4084933(getPST()); - sub4084933(TimeZone.getTimeZone("PST")); + sub4084933(TimeZone.getTimeZone("America/Los_Angeles")); } private void sub4084933(TimeZone tz) { @@ -122,7 +122,7 @@ private void sub4084933(TimeZone tz) { @Test public void Test4096952() { - String[] ZONES = { "GMT", "MET", "IST" }; + String[] ZONES = { "GMT", "MET", "Asia/Kolkata" }; boolean pass = true; try { for (int i=0; i future = executor.submit(barrier::arriveAndAwaitAdvance); + var started = new CountDownLatch(1); + var stop = new CountDownLatch(1); + Future future = executor.submit(() -> { + started.countDown(); + stop.await(); + return null; + }); + started.await(); + try { + executor.shutdown(); + assertFalse(executor.awaitTermination(1, TimeUnit.SECONDS)); + assertFalse(future.isDone()); + } finally { + stop.countDown(); + } + assertTrue(executor.awaitTermination(1, TimeUnit.MINUTES)); + assertTrue(future.isDone()); + } + + /** + * Test awaitTermination with cancelled task still running. + */ + @ParameterizedTest + @MethodSource("executors") + void testAwaitTermination3(ExecutorService executor) throws Exception { + var started = new CountDownLatch(1); + var stop = new CountDownLatch(1); + Future future = executor.submit(() -> { + started.countDown(); + stop.await(); + return null; + }); + started.await(); try { + future.cancel(false); executor.shutdown(); - assertFalse(executor.awaitTermination(100, TimeUnit.MILLISECONDS)); - barrier.arriveAndAwaitAdvance(); - assertTrue(executor.awaitTermination(10, TimeUnit.SECONDS)); + assertFalse(executor.awaitTermination(1, TimeUnit.SECONDS)); } finally { - future.cancel(true); + stop.countDown(); } + assertTrue(executor.awaitTermination(1, TimeUnit.MINUTES)); + } + + /** + * Test awaitTermination with cancelled task that may not have started execution. + */ + @ParameterizedTest + @MethodSource("executors") + void testAwaitTermination4(ExecutorService executor) throws Exception { + Future future = executor.submit(() -> { + Thread.sleep(Duration.ofMillis(50)); + return null; + }); + future.cancel(false); + executor.shutdown(); + assertTrue(executor.awaitTermination(1, TimeUnit.MINUTES)); } /** diff --git a/test/jdk/java/util/stream/GatherersMapConcurrentTest.java b/test/jdk/java/util/stream/GatherersMapConcurrentTest.java index 557598de3eece..970a550400aa6 100644 --- a/test/jdk/java/util/stream/GatherersMapConcurrentTest.java +++ b/test/jdk/java/util/stream/GatherersMapConcurrentTest.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 @@ -24,6 +24,9 @@ import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.Semaphore; +import java.util.concurrent.atomic.AtomicLong; +import java.util.concurrent.locks.LockSupport; +import java.util.function.Function; import java.util.stream.Gatherer; import java.util.stream.Gatherers; import java.util.stream.Stream; @@ -298,7 +301,7 @@ public void behavesAsExpected(ConcurrencyConfig cc) { @ParameterizedTest @MethodSource("concurrencyConfigurations") - public void behavesAsExpectedWhenShortCircuited(ConcurrencyConfig cc) { + public void shortCircuits(ConcurrencyConfig cc) { final var limitTo = Math.max(cc.config().streamSize() / 2, 1); final var expectedResult = cc.config().stream() @@ -313,4 +316,60 @@ public void behavesAsExpectedWhenShortCircuited(ConcurrencyConfig cc) { assertEquals(expectedResult, result); } + + @ParameterizedTest + @MethodSource("concurrencyConfigurations") + public void ignoresAndRestoresCallingThreadInterruption(ConcurrencyConfig cc) { + final var limitTo = Math.max(cc.config().streamSize() / 2, 1); + + final var expectedResult = cc.config().stream() + .map(x -> x * x) + .limit(limitTo) + .toList(); + + // Ensure calling thread is interrupted + Thread.currentThread().interrupt(); + + final var result = cc.config().stream() + .gather(Gatherers.mapConcurrent(cc.concurrencyLevel(), x -> { + LockSupport.parkNanos(10000); // 10 us + return x * x; + })) + .limit(limitTo) + .toList(); + + // Ensure calling thread remains interrupted + assertEquals(true, Thread.interrupted()); + + assertEquals(expectedResult, result); + } + + @ParameterizedTest + @MethodSource("concurrencyConfigurations") + public void limitsWorkInProgressToMaxConcurrency(ConcurrencyConfig cc) { + final var elementNum = new AtomicLong(0); + final var wipCount = new AtomicLong(0); + final var limitTo = Math.max(cc.config().streamSize() / 2, 1); + + final var expectedResult = cc.config().stream() + .map(x -> x * x) + .limit(limitTo) + .toList(); + + Function fun = x -> { + if (wipCount.incrementAndGet() > cc.concurrencyLevel) + throw new IllegalStateException("Too much wip!"); + if (elementNum.getAndIncrement() == 0) + LockSupport.parkNanos(500_000_000); // 500 ms + return x * x; + }; + + final var result = cc.config().stream() + .gather(Gatherers.mapConcurrent(cc.concurrencyLevel(), fun)) + .gather(Gatherer.of((v, e, d) -> wipCount.decrementAndGet() >= 0 && d.push(e))) + .limit(limitTo) + .toList(); + + assertEquals(expectedResult, result); + } } diff --git a/test/jdk/java/util/zip/CloseInflaterDeflaterTest.java b/test/jdk/java/util/zip/CloseInflaterDeflaterTest.java index b8f91971060a5..5c6732503f53a 100644 --- a/test/jdk/java/util/zip/CloseInflaterDeflaterTest.java +++ b/test/jdk/java/util/zip/CloseInflaterDeflaterTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -127,8 +127,8 @@ public void testGZip(boolean useCloseMethod) throws IOException { gzip.finish(); } }); - // Write on a closed GZIPOutputStream, closed Deflater IOException expected - assertThrows(NullPointerException.class , () -> gzip.write(inputBytes, 0, INPUT_LENGTH)); + // Write on a closed GZIPOutputStream, closed Deflater IllegalStateException expected + assertThrows(IllegalStateException.class , () -> gzip.write(inputBytes, 0, INPUT_LENGTH)); } /** @@ -149,8 +149,8 @@ public void testDeflaterOutputStream(boolean useCloseMethod) throws IOException def.finish(); } }); - // Write on a closed DeflaterOutputStream, 'Deflater has been closed' NPE is expected - assertThrows(NullPointerException.class , () -> def.write(inputBytes, 0, INPUT_LENGTH)); + // Write on a closed DeflaterOutputStream, IllegalStateException is expected + assertThrows(IllegalStateException.class , () -> def.write(inputBytes, 0, INPUT_LENGTH)); } /** @@ -202,8 +202,8 @@ public void testZipCloseEntry(ZipOutputStream zip) throws IOException { assertThrows(IOException.class , () -> zip.putNextEntry(new ZipEntry(""))); zip.write(inputBytes, 0, INPUT_LENGTH); assertThrows(IOException.class , () -> zip.closeEntry()); - // Write on a closed ZipOutputStream , 'Deflater has been closed' NPE is expected - assertThrows(NullPointerException.class , () -> zip.write(inputBytes, 0, INPUT_LENGTH)); + // Write on a closed ZipOutputStream , IllegalStateException is expected + assertThrows(IllegalStateException.class , () -> zip.write(inputBytes, 0, INPUT_LENGTH)); } } diff --git a/test/jdk/java/util/zip/DeflaterClose.java b/test/jdk/java/util/zip/DeflaterClose.java new file mode 100644 index 0000000000000..a4c4b233b4ec5 --- /dev/null +++ b/test/jdk/java/util/zip/DeflaterClose.java @@ -0,0 +1,223 @@ +/* + * 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 + * 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.ByteArrayOutputStream; +import java.nio.charset.StandardCharsets; +import java.util.zip.Deflater; + +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + +/* + * @test + * @bug 8225763 + * @summary Test that the close() and end() methods on java.util.zip.Deflater + * @run junit DeflaterClose + */ +public class DeflaterClose { + + private static final String data = "foobarhelloworld!!!!"; + + /** + * Closes the Deflater multiple times and then expects close() and end() each + * to be called that many times. + */ + @Test + public void testCloseMultipleTimes() throws Exception { + final int numTimes = 3; + final Deflater simpleDeflater = new Deflater(); + closeMultipleTimesAfterCompressing(numTimes, simpleDeflater); + + final OverrideClose overriddenClose = new OverrideClose(); + closeMultipleTimesAfterCompressing(numTimes, overriddenClose); + // make sure close was called numTimes + assertEquals(numTimes, overriddenClose.numTimesCloseCalled, "close() was expected to be" + + " called " + numTimes + ", but was called " + overriddenClose.numTimesCloseCalled + + " time(s) on " + overriddenClose.getClass().getName()); + + final OverrideEnd overriddenEnd = new OverrideEnd(); + closeMultipleTimesAfterCompressing(numTimes, overriddenEnd); + // make sure end was called called numTimes + assertEquals(numTimes, overriddenEnd.numTimesEndCalled, "end() was expected to be called " + + numTimes + ", but was called " + overriddenEnd.numTimesEndCalled + " time(s) on " + + overriddenEnd.getClass().getName()); + + final OverrideCloseAndEnd overriddenCloseAndEnd = new OverrideCloseAndEnd(); + closeMultipleTimesAfterCompressing(numTimes, overriddenCloseAndEnd); + // make sure end was called called numTimes + assertEquals(numTimes, overriddenCloseAndEnd.numTimesEndCalled, "end() was expected to be called " + + numTimes + ", but was called" + overriddenCloseAndEnd.numTimesEndCalled + + " time(s) on " + overriddenCloseAndEnd.getClass().getName()); + assertEquals(numTimes, overriddenCloseAndEnd.numTimesCloseCalled, "close() was expected" + + " to be called " + numTimes + ", but was called " + + overriddenClose.numTimesCloseCalled + " time(s) on " + + overriddenCloseAndEnd.getClass().getName()); + } + + /** + * Closes the Deflater first and then calls end(). Verifies that close() was called + * just once but end() was called twice (once internally through close() and once + * explicitly) + */ + @Test + public void testCloseThenEnd() throws Exception { + final Deflater simpleDeflater = new Deflater(); + compressCloseThenEnd(simpleDeflater); + + final OverrideClose overriddenClose = new OverrideClose(); + compressCloseThenEnd(overriddenClose); + // make sure close was called once + assertEquals(1, overriddenClose.numTimesCloseCalled, "close() was expected to be called" + + " once, but was called " + overriddenClose.numTimesCloseCalled + + " time(s) on " + overriddenClose.getClass().getName()); + + final OverrideEnd overriddenEnd = new OverrideEnd(); + compressCloseThenEnd(overriddenEnd); + // make sure end was called twice (once through close() and then explicitly) + assertEquals(2, overriddenEnd.numTimesEndCalled, "end() was expected to be called" + + " twice, but was called " + overriddenEnd.numTimesEndCalled + + " time(s) on " + overriddenEnd.getClass().getName()); + + final OverrideCloseAndEnd overriddenCloseAndEnd = new OverrideCloseAndEnd(); + compressCloseThenEnd(overriddenCloseAndEnd); + // make sure end was called twice (once through close and once explicitly) + // and close was called once + assertEquals(2, overriddenCloseAndEnd.numTimesEndCalled, "end() was expected to" + + " be called twice, but was called " + overriddenCloseAndEnd.numTimesEndCalled + + " time(s) on " + overriddenCloseAndEnd.getClass().getName()); + assertEquals(1, overriddenCloseAndEnd.numTimesCloseCalled, "close() was expected to be" + + " called once, but was called " + overriddenClose.numTimesCloseCalled + + " time(s) on " + overriddenCloseAndEnd.getClass().getName()); + } + + /** + * Calls end() on the Deflater first and then calls close(). Verifies that close() was called + * just once and end() twice. + */ + @Test + public void testEndThenClose() throws Exception { + final Deflater simpleDeflater = new Deflater(); + compressEndThenClose(simpleDeflater); + + final OverrideClose overriddenClose = new OverrideClose(); + compressEndThenClose(overriddenClose); + // make sure close was called once + assertEquals(1, overriddenClose.numTimesCloseCalled, "close() was expected to be called" + + " once, but was called " + overriddenClose.numTimesCloseCalled + + " time(s) on " + overriddenClose.getClass().getName()); + + final OverrideEnd overriddenEnd = new OverrideEnd(); + compressEndThenClose(overriddenEnd); + // make sure end was called twice (once through the explicit end call and + // once through close()) + assertEquals(2, overriddenEnd.numTimesEndCalled, "end() was expected to be called twice," + + " but was called " + overriddenEnd.numTimesEndCalled + + " time(s) on " + overriddenEnd.getClass().getName()); + + final OverrideCloseAndEnd overriddenCloseAndEnd = new OverrideCloseAndEnd(); + compressEndThenClose(overriddenCloseAndEnd); + // make sure end was called twice (once through the explicit end call and + // once through close()) + assertEquals(2, overriddenCloseAndEnd.numTimesEndCalled, "end() was expected to be called" + + " twice, but was called " + overriddenCloseAndEnd.numTimesEndCalled + + " time(s) on " + overriddenCloseAndEnd.getClass().getName()); + assertEquals(1, overriddenCloseAndEnd.numTimesCloseCalled, "close() was expected to be " + + "called once, but was called " + overriddenClose.numTimesCloseCalled + + " time(s) on " + overriddenCloseAndEnd.getClass().getName()); + } + + private void closeMultipleTimesAfterCompressing(final int numTimes, final Deflater deflater) { + compress(deflater); + // call close() multiple times + for (int i = 0; i < numTimes; i++) { + deflater.close(); + } + } + + private void compressCloseThenEnd(final Deflater deflater) { + // compress the data then close() and then end() + try (final Deflater compressor = deflater) { + compress(compressor); + } + deflater.end(); + } + + private void compressEndThenClose(final Deflater deflater) { + // compress the data then end() and then close() + try (final Deflater compressor = deflater) { + compress(compressor); + // end() it first before it's (auto)closed by the try-with-resources + compressor.end(); + } + } + + private static byte[] compress(final Deflater deflater) { + deflater.setInput(data.getBytes(StandardCharsets.UTF_8)); + deflater.finish(); + final ByteArrayOutputStream compressedBaos = new ByteArrayOutputStream(); + while (!deflater.finished()) { + final byte[] tmpBuffer = new byte[100]; + final int numCompressed = deflater.deflate(tmpBuffer); + compressedBaos.write(tmpBuffer, 0, numCompressed); + } + return compressedBaos.toByteArray(); + } + + private static final class OverrideEnd extends Deflater { + private int numTimesEndCalled = 0; + + @Override + public void end() { + this.numTimesEndCalled++; + super.end(); + } + } + + private static final class OverrideClose extends Deflater { + private int numTimesCloseCalled = 0; + + @Override + public void close() { + this.numTimesCloseCalled++; + super.close(); + } + } + + private static final class OverrideCloseAndEnd extends Deflater { + private int numTimesEndCalled = 0; + private int numTimesCloseCalled = 0; + + @Override + public void end() { + this.numTimesEndCalled++; + super.end(); + } + + @Override + public void close() { + this.numTimesCloseCalled++; + super.close(); + } + } +} \ No newline at end of file diff --git a/test/jdk/java/util/zip/InflaterClose.java b/test/jdk/java/util/zip/InflaterClose.java new file mode 100644 index 0000000000000..7c0e1606aded0 --- /dev/null +++ b/test/jdk/java/util/zip/InflaterClose.java @@ -0,0 +1,271 @@ +/* + * 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 + * 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.ByteArrayOutputStream; +import java.nio.charset.StandardCharsets; +import java.util.zip.DataFormatException; +import java.util.zip.Deflater; +import java.util.zip.Inflater; + +import org.junit.jupiter.api.Test; +import static java.nio.charset.StandardCharsets.US_ASCII; +import static org.junit.jupiter.api.Assertions.assertEquals; + +/* + * @test + * @bug 8225763 + * @summary Test that the close() and end() methods on java.util.zip.Inflater + * @run junit InflaterClose + */ +public class InflaterClose { + + private static final String originalStr = "foobarhelloworld!!!!"; + private static final byte[] originalBytes = originalStr.getBytes(US_ASCII); + private static final byte[] compressedData = compress(); + + /** + * Closes the Inflater multiple times and then expects close() and end() to be called that + * many times. + */ + @Test + public void testCloseMultipleTimes() throws Exception { + final int numTimes = 3; + final Inflater simpleInflater = new Inflater(); + final String inflatedData = closeMultipleTimesAfterInflating(numTimes, simpleInflater); + assertValidInflatedData(inflatedData, simpleInflater.getClass()); + + final OverrideClose overriddenClose = new OverrideClose(); + final String ocInflatedData = closeMultipleTimesAfterInflating(numTimes, overriddenClose); + assertValidInflatedData(ocInflatedData, overriddenClose.getClass()); + // make sure close was called numTimes + assertEquals(numTimes, overriddenClose.numTimesCloseCalled, "close() was expected to be" + + " called " + numTimes + ", but was called " + overriddenClose.numTimesCloseCalled + + " time(s) on " + overriddenClose.getClass().getName()); + + final OverrideEnd overriddenEnd = new OverrideEnd(); + final String oeInflatedData = closeMultipleTimesAfterInflating(numTimes, overriddenEnd); + assertValidInflatedData(oeInflatedData, overriddenEnd.getClass()); + // make sure end was called called numTimes + assertEquals(numTimes, overriddenEnd.numTimesEndCalled, "end() was expected to be called " + + numTimes + ", but was called " + overriddenEnd.numTimesEndCalled + " time(s) on " + + overriddenEnd.getClass().getName()); + + final OverrideCloseAndEnd overriddenCloseAndEnd = new OverrideCloseAndEnd(); + final String oceInflatedData = closeMultipleTimesAfterInflating(numTimes, + overriddenCloseAndEnd); + assertValidInflatedData(oceInflatedData, overriddenCloseAndEnd.getClass()); + // make sure end was called called numTimes + assertEquals(numTimes, overriddenCloseAndEnd.numTimesEndCalled, "end() was expected" + + " to be called " + numTimes + ", but was called " + + overriddenCloseAndEnd.numTimesEndCalled + + " time(s) on " + overriddenCloseAndEnd.getClass().getName()); + assertEquals(numTimes, overriddenCloseAndEnd.numTimesCloseCalled, "close() was expected" + + " to be called " + numTimes + ", but was called " + + overriddenCloseAndEnd.numTimesCloseCalled + " time(s) on " + + overriddenCloseAndEnd.getClass().getName()); + } + + /** + * Closes the Inflater first and then calls end(). Verifies that close() was called + * just once but end() was called twice (once internally through close() and once + * explicitly) + */ + @Test + public void testCloseThenEnd() throws Exception { + final Inflater simpleInflater = new Inflater(); + final String inflatedData = inflateCloseThenEnd(simpleInflater); + assertValidInflatedData(inflatedData, simpleInflater.getClass()); + + final OverrideClose overriddenClose = new OverrideClose(); + final String ocInflatedData = inflateCloseThenEnd(overriddenClose); + assertValidInflatedData(ocInflatedData, overriddenClose.getClass()); + // make sure close was called once + assertEquals(1, overriddenClose.numTimesCloseCalled, "close() was expected to be called" + + " once, but was called " + overriddenClose.numTimesCloseCalled + " time(s) on " + + overriddenClose.getClass().getName()); + + final OverrideEnd overriddenEnd = new OverrideEnd(); + final String oeInflatedData = inflateCloseThenEnd(overriddenEnd); + assertValidInflatedData(oeInflatedData, overriddenEnd.getClass()); + // make sure end was called twice (once through close() and then explicitly) + assertEquals(2, overriddenEnd.numTimesEndCalled, "end() was expected to be called twice," + + " but was called " + overriddenEnd.numTimesEndCalled + " time(s) on " + + overriddenEnd.getClass().getName()); + + final OverrideCloseAndEnd overriddenCloseAndEnd = new OverrideCloseAndEnd(); + final String oceInflatedData = inflateCloseThenEnd(overriddenCloseAndEnd); + assertValidInflatedData(oceInflatedData, overriddenCloseAndEnd.getClass()); + // make sure end was called twice (once through close and once explicitly) + // and close was called once + assertEquals(2, overriddenCloseAndEnd.numTimesEndCalled, "end() was expected to be called" + + " twice, but was called " + overriddenCloseAndEnd.numTimesEndCalled + + " time(s) on " + overriddenCloseAndEnd.getClass().getName()); + assertEquals(1, overriddenCloseAndEnd.numTimesCloseCalled, "close() was expected to be" + + " called once, but was called " + overriddenClose.numTimesCloseCalled + + " time(s) on " + overriddenCloseAndEnd.getClass().getName()); + } + + /** + * Calls end() on the Inflater first and then calls close(). Verifies that close() was called + * just once and end() twice. + */ + @Test + public void testEndThenClose() throws Exception { + final Inflater simpleInflater = new Inflater(); + final String inflatedData = inflateThenEndThenClose(simpleInflater); + assertValidInflatedData(inflatedData, simpleInflater.getClass()); + + final OverrideClose overriddenClose = new OverrideClose(); + final String ocInflatedData = inflateThenEndThenClose(overriddenClose); + assertValidInflatedData(ocInflatedData, overriddenClose.getClass()); + // make sure close was called once + assertEquals(1, overriddenClose.numTimesCloseCalled, "close() was expected to be" + + " called once, but was called " + overriddenClose.numTimesCloseCalled + + " time(s) on " + overriddenClose.getClass().getName()); + + final OverrideEnd overriddenEnd = new OverrideEnd(); + final String oeInflatedData = inflateThenEndThenClose(overriddenEnd); + assertValidInflatedData(oeInflatedData, overriddenEnd.getClass()); + // make sure end was called twice (once through the explicit end call and + // once through close()) + assertEquals(2, overriddenEnd.numTimesEndCalled, "end() was expected to be called twice," + + " but was called " + overriddenEnd.numTimesEndCalled + " time(s) on " + + overriddenEnd.getClass().getName()); + + final OverrideCloseAndEnd overriddenCloseAndEnd = new OverrideCloseAndEnd(); + final String oceInflatedData = inflateThenEndThenClose(overriddenCloseAndEnd); + assertValidInflatedData(oceInflatedData, overriddenCloseAndEnd.getClass()); + // make sure end was called twice (once through the explicit end call and + // once through close()) + assertEquals(2, overriddenCloseAndEnd.numTimesEndCalled, "end() was expected to be called" + + " twice, but was called " + overriddenCloseAndEnd.numTimesEndCalled + + " time(s) on " + overriddenCloseAndEnd.getClass().getName()); + assertEquals(1, overriddenCloseAndEnd.numTimesCloseCalled, "close() was expected to be" + + " called once, but was called " + overriddenClose.numTimesCloseCalled + + " time(s) on " + overriddenCloseAndEnd.getClass().getName()); + } + + + private String closeMultipleTimesAfterInflating(final int numTimes, final Inflater inflater) + throws DataFormatException { + // inflate() then call close() multiple times + final byte[] inflatedData = inflate(inflater, compressedData); + // call close() + for (int i = 0; i < numTimes; i++) { + inflater.close(); + } + return new String(inflatedData, StandardCharsets.UTF_8); + } + + private String inflateCloseThenEnd(final Inflater inflater) throws Exception { + final byte[] inflatedData; + // inflate then close() and then end() + try (final Inflater inflt = inflater) { + inflatedData = inflate(inflt, compressedData); + } + // end() the already closed inflater + inflater.end(); + return new String(inflatedData, StandardCharsets.UTF_8); + } + + private String inflateThenEndThenClose(final Inflater inflater) throws Exception { + final byte[] inflatedData; + // inflate then end() and then close() + try (final Inflater inflt = inflater) { + inflatedData = inflate(inflt, compressedData); + // end() it first before it's (auto)closed by the try-with-resources + inflt.end(); + } + return new String(inflatedData, StandardCharsets.UTF_8); + } + + private static byte[] inflate(final Inflater inflater, final byte[] compressedData) + throws DataFormatException { + final ByteArrayOutputStream inflatedData = new ByteArrayOutputStream(); + inflater.setInput(compressedData); + while (!inflater.finished()) { + byte[] tmpBuffer = new byte[100]; + final int numDecompressed = inflater.inflate(tmpBuffer); + inflatedData.write(tmpBuffer, 0, numDecompressed); + } + return inflatedData.toByteArray(); + } + + private static byte[] compress() { + final ByteArrayOutputStream compressedBaos = new ByteArrayOutputStream(); + try (final Deflater deflater = new Deflater()) { + deflater.setInput(originalBytes); + deflater.finish(); + while (!deflater.finished()) { + final byte[] tmpBuffer = new byte[100]; + final int numCompressed = deflater.deflate(tmpBuffer); + compressedBaos.write(tmpBuffer, 0, numCompressed); + } + } + return compressedBaos.toByteArray(); + } + + private static void assertValidInflatedData(final String inflatedData, + final Class inflaterType) { + assertEquals(originalStr, inflatedData, "Unexpected inflated data " + inflatedData + + " generated by " + inflaterType.getName() + ", expected " + originalStr); + } + + private static final class OverrideEnd extends Inflater { + private int numTimesEndCalled = 0; + + @Override + public void end() { + this.numTimesEndCalled++; + super.end(); + } + } + + private static final class OverrideClose extends Inflater { + private int numTimesCloseCalled = 0; + + @Override + public void close() { + this.numTimesCloseCalled++; + super.close(); + } + } + + private static final class OverrideCloseAndEnd extends Inflater { + private int numTimesEndCalled = 0; + private int numTimesCloseCalled = 0; + + @Override + public void end() { + this.numTimesEndCalled++; + super.end(); + } + + @Override + public void close() { + this.numTimesCloseCalled++; + super.close(); + } + } +} \ No newline at end of file diff --git a/test/jdk/java/util/zip/TotalInOut.java b/test/jdk/java/util/zip/TotalInOut.java index c7f22a63b31aa..92ab981def851 100644 --- a/test/jdk/java/util/zip/TotalInOut.java +++ b/test/jdk/java/util/zip/TotalInOut.java @@ -27,7 +27,7 @@ * @key randomness */ -import java.io.*; + import java.util.*; import java.util.zip.*; @@ -40,39 +40,40 @@ static void realMain (String[] args) throws Throwable { if (args.length > 0 && "large".equals(args[0])) dataSize = 5L * 1024L * 1024L * 1024L; // 5GB - Deflater deflater = new Deflater(); - Inflater inflater = new Inflater(); + try (final Deflater deflater = new Deflater(); + final Inflater inflater = new Inflater()) { - byte[] dataIn = new byte[BUF_SIZE]; - byte[] dataOut = new byte[BUF_SIZE]; - byte[] tmp = new byte[BUF_SIZE]; + byte[] dataIn = new byte[BUF_SIZE]; + byte[] dataOut = new byte[BUF_SIZE]; + byte[] tmp = new byte[BUF_SIZE]; - Random r = new Random(); - r.nextBytes(dataIn); - long bytesReadDef = 0; - long bytesWrittenDef = 0; - long bytesReadInf = 0; - long bytesWrittenInf = 0; + Random r = new Random(); + r.nextBytes(dataIn); + long bytesReadDef = 0; + long bytesWrittenDef = 0; + long bytesReadInf = 0; + long bytesWrittenInf = 0; - deflater.setInput(dataIn, 0, dataIn.length); - while (bytesReadDef < dataSize || bytesWrittenInf < dataSize) { - int len = r.nextInt(BUF_SIZE/2) + BUF_SIZE / 2; - if (deflater.needsInput()) { - bytesReadDef += dataIn.length; - check(bytesReadDef == deflater.getBytesRead()); - deflater.setInput(dataIn, 0, dataIn.length); - } - int n = deflater.deflate(tmp, 0, len); - bytesWrittenDef += n; - check(bytesWrittenDef == deflater.getBytesWritten()); + deflater.setInput(dataIn, 0, dataIn.length); + while (bytesReadDef < dataSize || bytesWrittenInf < dataSize) { + int len = r.nextInt(BUF_SIZE / 2) + BUF_SIZE / 2; + if (deflater.needsInput()) { + bytesReadDef += dataIn.length; + check(bytesReadDef == deflater.getBytesRead()); + deflater.setInput(dataIn, 0, dataIn.length); + } + int n = deflater.deflate(tmp, 0, len); + bytesWrittenDef += n; + check(bytesWrittenDef == deflater.getBytesWritten()); - inflater.setInput(tmp, 0, n); - bytesReadInf += n; - while (!inflater.needsInput()) { - bytesWrittenInf += inflater.inflate(dataOut, 0, dataOut.length); - check(bytesWrittenInf == inflater.getBytesWritten()); + inflater.setInput(tmp, 0, n); + bytesReadInf += n; + while (!inflater.needsInput()) { + bytesWrittenInf += inflater.inflate(dataOut, 0, dataOut.length); + check(bytesWrittenInf == inflater.getBytesWritten()); + } + check(bytesReadInf == inflater.getBytesRead()); } - check(bytesReadInf == inflater.getBytesRead()); } } diff --git a/test/jdk/javax/management/Introspector/InvokeGettersTest.java b/test/jdk/javax/management/Introspector/InvokeGettersTest.java index 6036069a6f5b2..71e22ca3d711f 100644 --- a/test/jdk/javax/management/Introspector/InvokeGettersTest.java +++ b/test/jdk/javax/management/Introspector/InvokeGettersTest.java @@ -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 @@ -23,8 +23,8 @@ /* * @test - * @bug 6317101 - * @summary Test that the jmx.invoke.getters system property works + * @bug 6317101 8344976 + * @summary Test invocation after removal of the jmx.invoke.getters system property * @author Eamonn McManus * * @run clean InvokeGettersTest @@ -63,10 +63,7 @@ public static void main(String[] args) throws Exception { ObjectName on = new ObjectName("a:b=c"); mbs.registerMBean(new Thing(), on); if (test(mbs, on, false)) - System.out.println("OK: invoke without jmx.invoke.getters"); - System.setProperty("jmx.invoke.getters", "true"); - if (test(mbs, on, true)) - System.out.println("OK: invoke with jmx.invoke.getters"); + System.out.println("OK"); if (failure == null) System.out.println("TEST PASSED"); else @@ -117,7 +114,7 @@ private static boolean test(MBeanServer mbs, ObjectName on, System.out.println("isTrue got expected exception: " + e); } - // Following cases should fail whether or not jmx.invoke.getters is set + // Following cases should fail final Object[][] badInvokes = { {"isWhatsit", null, null}, {"getWhatsit", new Object[] {5}, new String[] {"int"}}, diff --git a/test/jdk/javax/management/MBeanServer/MBeanFallbackTest.java b/test/jdk/javax/management/MBeanServer/MBeanFallbackTest.java deleted file mode 100644 index 6cf508598de96..0000000000000 --- a/test/jdk/javax/management/MBeanServer/MBeanFallbackTest.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import javax.management.MBeanServer; -import javax.management.MBeanServerFactory; -import javax.management.NotCompliantMBeanException; -import javax.management.ObjectName; - -/* - * @test - * @bug 8010285 - * @summary Test fallback for private MBean interfaces. - * It needs to be a separate class because the "jdk.jmx.mbeans.allowNonPublic" - * system property must be set before c.s.j.m.MBeanAnalyzer has been loaded. - * @author Jaroslav Bachorik - * - * @run clean MBeanFallbackTest - * @run build MBeanFallbackTest - * @run main/othervm -Djdk.jmx.mbeans.allowNonPublic=true MBeanFallbackTest - */ -public class MBeanFallbackTest { - private static interface PrivateMBean { - public int[] getInts(); - } - - public static class Private implements PrivateMBean { - public int[] getInts() { - return new int[]{1,2,3}; - } - } - - private static int failures = 0; - - public static void main(String[] args) throws Exception { - testPrivate(PrivateMBean.class, new Private()); - - if (failures == 0) - System.out.println("Test passed"); - else - throw new Exception("TEST FAILURES: " + failures); - } - - private static void fail(String msg) { - failures++; - System.out.println("FAIL: " + msg); - } - - private static void success(String msg) { - System.out.println("OK: " + msg); - } - - private static void testPrivate(Class iface, Object bean) throws Exception { - try { - System.out.println("Registering a private MBean " + - iface.getName() + " ..."); - - MBeanServer mbs = MBeanServerFactory.newMBeanServer(); - ObjectName on = new ObjectName("test:type=Compliant"); - - mbs.registerMBean(bean, on); - success("Registered a private MBean - " + iface.getName()); - } catch (Exception e) { - Throwable t = e; - while (t != null && !(t instanceof NotCompliantMBeanException)) { - t = t.getCause(); - } - if (t != null) { - fail("MBean not registered"); - } else { - throw e; - } - } - } -} diff --git a/test/jdk/javax/management/modelmbean/ModelMBeanInfoSupport/policy b/test/jdk/javax/management/modelmbean/ModelMBeanInfoSupport/policy deleted file mode 100644 index ac5336ce882d9..0000000000000 --- a/test/jdk/javax/management/modelmbean/ModelMBeanInfoSupport/policy +++ /dev/null @@ -1,14 +0,0 @@ -grant { - permission javax.management.MBeanServerPermission "createMBeanServer"; - permission javax.management.MBeanPermission "javax.management.modelmbean.RequiredModelMBean#-[-]", "instantiate"; - permission javax.management.MBeanPermission "javax.management.modelmbean.RequiredModelMBean#-[*:*]", "registerMBean"; - permission javax.management.MBeanPermission "javax.management.modelmbean.RequiredModelMBean#*[*:*]", "getAttribute"; - permission javax.management.MBeanPermission "javax.management.modelmbean.RequiredModelMBean#*[*:*]", "setAttribute"; - permission javax.management.MBeanPermission "javax.management.modelmbean.RequiredModelMBean#*[*:*]", "invoke"; - permission javax.management.MBeanPermission "GetAllDescriptorsTest$Resource#-[*:*]", "registerMBean"; - permission javax.management.MBeanPermission "GetAllDescriptorsTest$Resource#*[*:*]", "invoke"; - permission javax.management.MBeanPermission "GetAllDescriptorsTest$Resource#*[*:*]", "getAttribute"; - permission javax.management.MBeanPermission "GetAllDescriptorsTest$Resource#*[*:*]", "setAttribute"; - permission javax.management.MBeanPermission "GetAllDescriptorsTest$Resource#*[*:*]", "getMBeanInfo"; - -}; diff --git a/test/jdk/javax/management/mxbean/MXBeanFallbackTest.java b/test/jdk/javax/management/mxbean/MXBeanFallbackTest.java deleted file mode 100644 index 00fd1c454c2e5..0000000000000 --- a/test/jdk/javax/management/mxbean/MXBeanFallbackTest.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 8010285 - * @summary Test for the private MXBean interface fallback. - * It needs to be a separate class because the "jdk.jmx.mbeans.allowNonPublic" - * system property must be set before c.s.j.m.MBeanAnalyzer has been loaded. - * @author Jaroslav Bachorik - * - * @run clean MXBeanFallbackTest - * @run build MXBeanFallbackTest - * @run main/othervm -Djdk.jmx.mbeans.allowNonPublic=true MXBeanFallbackTest - */ - -import javax.management.MBeanServer; -import javax.management.MBeanServerFactory; -import javax.management.NotCompliantMBeanException; -import javax.management.ObjectName; - -public class MXBeanFallbackTest { - public static void main(String[] args) throws Exception { - testPrivateMXBean("Private", new Private()); - - if (failures == 0) - System.out.println("Test passed"); - else - throw new Exception("TEST FAILURES: " + failures); - } - - private static int failures = 0; - - private static interface PrivateMXBean { - public int[] getInts(); - } - - public static class Private implements PrivateMXBean { - public int[] getInts() { - return new int[]{1,2,3}; - } - } - - private static void testPrivateMXBean(String type, Object bean) throws Exception { - System.out.println(type + " MXBean test..."); - MBeanServer mbs = MBeanServerFactory.newMBeanServer(); - ObjectName on = new ObjectName("test:type=" + type); - try { - mbs.registerMBean(bean, on); - success("Private MXBean registered"); - } catch (NotCompliantMBeanException e) { - failure("Failed to register the private MXBean - " + - bean.getClass().getInterfaces()[0].getName()); - } - } - - private static void success(String what) { - System.out.println("OK: " + what); - } - - private static void failure(String what) { - System.out.println("FAILED: " + what); - failures++; - } -} diff --git a/test/jdk/javax/management/mxbean/SameObjectTwoNamesTest.java b/test/jdk/javax/management/mxbean/SameObjectTwoNamesTest.java index 10022c592f708..130289e10da38 100644 --- a/test/jdk/javax/management/mxbean/SameObjectTwoNamesTest.java +++ b/test/jdk/javax/management/mxbean/SameObjectTwoNamesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, 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 @@ -30,7 +30,6 @@ * @author Eamonn McManus * * @run main SameObjectTwoNamesTest - * @run main/othervm -Djmx.mxbean.multiname=true SameObjectTwoNamesTest */ import javax.management.InstanceAlreadyExistsException; @@ -41,8 +40,6 @@ public class SameObjectTwoNamesTest { public static void main(String[] args) throws Exception { - boolean expectException = - (System.getProperty("jmx.mxbean.multiname") == null); try { ObjectName objectName1 = new ObjectName("test:index=1"); ObjectName objectName2 = new ObjectName("test:index=2"); @@ -53,19 +50,10 @@ public static void main(String[] args) throws Exception { mbs.registerMBean(mxBeanObject, objectName2); - if (expectException) { - throw new Exception("TEST FAILED: " + - "InstanceAlreadyExistsException was not thrown"); - } else - System.out.println("Correctly got no exception with compat property"); + throw new Exception("TEST FAILED: InstanceAlreadyExistsException was not thrown"); } catch (InstanceAlreadyExistsException e) { - if (expectException) { - System.out.println("Got expected InstanceAlreadyExistsException:"); - e.printStackTrace(System.out); - } else { - throw new Exception( - "TEST FAILED: Got exception even though compat property set", e); - } + System.out.println("Got expected InstanceAlreadyExistsException:"); + e.printStackTrace(System.out); } System.out.println("TEST PASSED"); } diff --git a/test/jdk/javax/management/openmbean/TabularDataOrderTest.java b/test/jdk/javax/management/openmbean/TabularDataOrderTest.java index 68e9fefdc7cd8..0a1a02c949ffa 100644 --- a/test/jdk/javax/management/openmbean/TabularDataOrderTest.java +++ b/test/jdk/javax/management/openmbean/TabularDataOrderTest.java @@ -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 @@ -57,8 +57,6 @@ public class TabularDataOrderTest { private static String failure; - private static final String COMPAT_PROP_NAME = "jmx.tabular.data.hash.map"; - private static final String[] intNames = { "unus", "duo", "tres", "quatuor", "quinque", "sex", "septem", "octo", "novem", "decim", @@ -129,44 +127,6 @@ public static void main(String[] args) throws Exception { if (!ordered) fail("Order not preserved"); - // Now test the undocumented property that causes HashMap to be used - // instead of LinkedHashMap, in case serializing to a 1.3 client. - // We serialize and deserialize in case the implementation handles - // this at serialization time. Then we look at object fields; that's - // not guaranteed to work but at worst it will fail spuriously and - // we'll have to update the test. - System.out.println("Testing compatible behaviour"); - System.setProperty(COMPAT_PROP_NAME, "true"); - td = makeTable(); - System.out.println(td); - ByteArrayOutputStream bout = new ByteArrayOutputStream(); - ObjectOutputStream oout = new ObjectOutputStream(bout); - oout.writeObject(td); - oout.close(); - byte[] bytes = bout.toByteArray(); - ByteArrayInputStream bin = new ByteArrayInputStream(bytes); - ObjectInputStream oin = new ObjectInputStream(bin); - td = (TabularData) oin.readObject(); - boolean found = false; - for (Field f : td.getClass().getDeclaredFields()) { - if (Modifier.isStatic(f.getModifiers())) - continue; - f.setAccessible(true); - Object x = f.get(td); - if (x != null && x.getClass() == HashMap.class) { - found = true; - System.out.println( - x.getClass().getName() + " TabularDataSupport." + - f.getName() + " = " + x); - break; - } - } - if (!found) { - fail("TabularDataSupport does not contain HashMap though " + - COMPAT_PROP_NAME + "=true"); - } - System.clearProperty(COMPAT_PROP_NAME); - System.out.println("Testing MXBean behaviour"); MBeanServer mbs = MBeanServerFactory.newMBeanServer(); ObjectName name = new ObjectName("a:b=c"); diff --git a/test/jdk/javax/management/proxy/JMXProxyFallbackTest.java b/test/jdk/javax/management/proxy/JMXProxyFallbackTest.java deleted file mode 100644 index c68a93654afca..0000000000000 --- a/test/jdk/javax/management/proxy/JMXProxyFallbackTest.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import javax.management.JMX; -import javax.management.MBeanServer; -import javax.management.MBeanServerFactory; -import javax.management.NotCompliantMBeanException; -import javax.management.ObjectName; - -/* - * @test - * @bug 8010285 - * @summary Tests the fallback for creating JMX proxies for private interfaces - * It needs to be a separate class because the "jdk.jmx.mbeans.allowNonPublic" - * system property must be set before c.s.j.m.MBeanAnalyzer has been loaded. - * @author Jaroslav Bachorik - * - * @run clean JMXProxyFallbackTest - * @run build JMXProxyFallbackTest - * @run main/othervm -Djdk.jmx.mbeans.allowNonPublic=true JMXProxyFallbackTest - */ -public class JMXProxyFallbackTest { - private static interface PrivateMBean { - public int[] getInts(); - } - - private static interface PrivateMXBean { - public int[] getInts(); - } - - public static class Private implements PrivateMXBean, PrivateMBean { - public int[] getInts() { - return new int[]{1,2,3}; - } - } - - private static int failures = 0; - - public static void main(String[] args) throws Exception { - testPrivate(PrivateMBean.class); - testPrivate(PrivateMXBean.class); - - if (failures == 0) - System.out.println("Test passed"); - else - throw new Exception("TEST FAILURES: " + failures); - } - - private static void fail(String msg) { - failures++; - System.out.println("FAIL: " + msg); - } - - private static void success(String msg) { - System.out.println("OK: " + msg); - } - - private static void testPrivate(Class iface) throws Exception { - try { - System.out.println("Creating a proxy for private M(X)Bean " + - iface.getName() + " ..."); - - MBeanServer mbs = MBeanServerFactory.newMBeanServer(); - ObjectName on = new ObjectName("test:type=Proxy"); - - JMX.newMBeanProxy(mbs, on, iface); - success("Created a proxy for private M(X)Bean - " + iface.getName()); - } catch (Exception e) { - Throwable t = e; - while (t != null && !(t instanceof NotCompliantMBeanException)) { - t = t.getCause(); - } - if (t != null) { - fail("Proxy not created"); - } else { - throw e; - } - } - } -} diff --git a/test/jdk/javax/management/remote/mandatory/notif/NotifBufferSizePropertyNameTest.java b/test/jdk/javax/management/remote/mandatory/notif/NotifBufferSizePropertyNameTest.java index 94a0690428239..8f4fe0a24f0da 100644 --- a/test/jdk/javax/management/remote/mandatory/notif/NotifBufferSizePropertyNameTest.java +++ b/test/jdk/javax/management/remote/mandatory/notif/NotifBufferSizePropertyNameTest.java @@ -1,5 +1,5 @@ /* - * 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,7 @@ /* * @test NotifBufferSizePropertyNameTest - * @bug 6174229 + * @bug 6174229 8345045 * @summary Verify the property name specifying server notification buffer size. * @author Shanliang JIANG * @@ -52,35 +52,25 @@ public void handleNotification(Notification n, Object hb) { }; public static void main(String[] args) throws Exception { - System.out.println( - "Verify the property name specifying the server notification buffer size."); + System.out.println("Verify the property name specifying the server notification buffer size."); oname = new ObjectName ("Default:name=NotificationEmitter"); url = new JMXServiceURL("rmi", null, 0); Map env = new HashMap(2); - System.out.println("Test the new property name."); + System.out.println("Test the property name."); env.put("jmx.remote.x.notification.buffer.size", String.valueOf(bufferSize)); test(env); - System.out.println("Test the old property name."); - env.remove("jmx.remote.x.notification.buffer.size"); - env.put("jmx.remote.x.buffer.size", String.valueOf(bufferSize)); - test(env); - + // Recognition of the old, incorrect property "jmx.remote.x.buffer.size" has been dropped. + // Do not test old name is recognised, but do test it does not interfere with correct name: System.out.println("Test that the new property name overwrite the old one."); env.put("jmx.remote.x.notification.buffer.size", String.valueOf(bufferSize)); env.put("jmx.remote.x.buffer.size", String.valueOf(bufferSize*6)); test(env); - System.out.println("Test the old property name on system."); - System.setProperty("jmx.remote.x.buffer.size", String.valueOf(bufferSize)); - test(null); - - System.out.println( - "Test that the new property name overwrite the old one on system."); - System.setProperty("jmx.remote.x.notification.buffer.size", - String.valueOf(bufferSize)); + System.out.println("Test that the new property name overwrite the old one on system."); + System.setProperty("jmx.remote.x.notification.buffer.size", String.valueOf(bufferSize)); System.setProperty("jmx.remote.x.buffer.size", String.valueOf(bufferSize*6)); test(null); } diff --git a/test/jdk/javax/print/CUPSPrinterImageableAreaTest.java b/test/jdk/javax/print/CUPSPrinterImageableAreaTest.java new file mode 100644 index 0000000000000..b07cc39c6ff2e --- /dev/null +++ b/test/jdk/javax/print/CUPSPrinterImageableAreaTest.java @@ -0,0 +1,338 @@ +/* + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, BELLSOFT. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Graphics2D; +import java.awt.Graphics; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import java.awt.LayoutManager; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.print.PageFormat; +import java.awt.print.Paper; +import java.awt.print.Printable; +import java.awt.print.PrinterException; +import java.awt.print.PrinterJob; +import java.util.ArrayList; +import java.util.List; +import javax.print.PrintService; +import javax.print.PrintServiceLookup; +import javax.print.attribute.HashPrintRequestAttributeSet; +import javax.print.attribute.PrintRequestAttributeSet; +import javax.print.attribute.Size2DSyntax; +import javax.print.attribute.standard.Media; +import javax.print.attribute.standard.MediaPrintableArea; +import javax.print.attribute.standard.MediaSize; +import javax.print.attribute.standard.MediaSizeName; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import javax.swing.plaf.basic.BasicComboBoxRenderer; + +/* + * @test + * @bug 8344119 + * @key printer + * @requires (os.family == "linux" | os.family == "mac") + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @summary CUPSPrinter imageable area + * @run main/manual CUPSPrinterImageableAreaTest + */ + +public class CUPSPrinterImageableAreaTest { + + private static final List ALLOWED_MEDIA_LIST = List.of(MediaSizeName.ISO_A4, MediaSizeName.NA_LETTER); + private static final double DPI = 72.0; + private static final double MM_PER_INCH = 2.54; + private static final String INSTRUCTIONS = """ + +
+ The test checks that the media margins fetched from the printer's PPD file are correct.
+ Press the 'Print sample' button to print a test page.
+ Required paper size and expected margins will be shown on the print dialog. + A passing test will print the page with a black rectangle along the printable area. + Ensure that all sides of the rectangle are printed.
+ Click 'Pass' button, or click 'Fail' button if the test failed. +
+ + """; + private static final String PAPER_INSTRUCTIONS_FORMAT = """ + + Required paper size:
  • %s
+ Expected margins:
  • left: %.1f
  • +
  • bottom: %.1f
  • +
  • right: %.1f
  • +
  • top: %.1f
  • +
+ """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .instructions(INSTRUCTIONS) + .testUI(createTestUI()) + .columns(55) + .build() + .awaitAndCheck(); + } + + private static JFrame createTestUI() { + final TestServiceData[] testServiceList = getTestServiceList(); + if (testServiceList.length == 0) { + throw new RuntimeException("Print services support borderless print only"); + } + + final JFrame frame = new JFrame("CUPS Printer imageable area test"); + JPanel pnlRoot = new JPanel(); + JLabel lblPrintServices = new JLabel("Select a print service for the test"); + JComboBox cbPrintServices = new JComboBox<>(); + JPanel pnlInstruction = new JPanel(); + JLabel lblInstruction = new JLabel(); + JButton btnPrint = new JButton("Print sample"); + + lblPrintServices.setLabelFor(cbPrintServices); + lblPrintServices.setAlignmentX(SwingConstants.LEFT); + + lblInstruction.setPreferredSize(new Dimension(250, 150)); + pnlInstruction.setBackground(Color.white); + pnlInstruction.add(lblInstruction); + + cbPrintServices.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + int selectedIndex = cbPrintServices.getSelectedIndex(); + if (selectedIndex < 0) { + lblInstruction.setText(""); + btnPrint.setEnabled(false); + return; + } + + TestServiceData testServiceData = testServiceList[selectedIndex]; + PageFormat pageFormat = testServiceData.pageFormat; + // margins: left, bottom, right, top + double[] margins = new double[]{ + pageFormat.getImageableX(), + pageFormat.getHeight() - pageFormat.getImageableHeight() - pageFormat.getImageableY(), + pageFormat.getWidth() - pageFormat.getImageableWidth() - pageFormat.getImageableX(), + pageFormat.getImageableY() + }; + String printServiceInstructions = PAPER_INSTRUCTIONS_FORMAT.formatted( + testServiceData.mediaSizeName.toString(), inchesToMM(margins[0]), + inchesToMM(margins[1]), inchesToMM(margins[2]), inchesToMM(margins[3])); + lblInstruction.setText(printServiceInstructions); + btnPrint.setEnabled(true); + } + }); + + DefaultComboBoxModel model = new DefaultComboBoxModel<>(); + for(TestServiceData tsd : testServiceList) { + model.addElement(tsd.printService.getName()); + } + cbPrintServices.setModel(model); + cbPrintServices.setSelectedIndex(-1); + PrintService defaultPrintService = PrintServiceLookup.lookupDefaultPrintService(); + if (defaultPrintService != null && model.getIndexOf(defaultPrintService.getName()) >= 0) { + cbPrintServices.setSelectedItem(defaultPrintService.getName()); + } else { + cbPrintServices.setSelectedIndex(0); + } + + btnPrint.setPreferredSize(new Dimension(200, 80)); + btnPrint.addActionListener((e) -> { + int selectedIndex = cbPrintServices.getSelectedIndex(); + if (selectedIndex < 0) { + return; + } + btnPrint.setEnabled(false); + cbPrintServices.setEnabled(false); + TestServiceData testServiceData = testServiceList[selectedIndex]; + PrinterJob job = PrinterJob.getPrinterJob(); + try { + job.setPrintService(testServiceData.printService); + job.setPrintable(new RectPrintable(), testServiceData.pageFormat); + job.print(); + } catch (PrinterException ex) { + throw new RuntimeException(ex); + } + }); + + LayoutManager layout = new GridBagLayout(); + pnlRoot.setLayout(layout); + + addGridBagComponent(pnlRoot, lblPrintServices, 0); + addGridBagComponent(pnlRoot, cbPrintServices, 1); + addGridBagComponent(pnlRoot, pnlInstruction, 2); + addGridBagComponent(pnlRoot, btnPrint, 3); + + frame.add(pnlRoot); + frame.pack(); + frame.setResizable(false); + return frame; + } + + private static TestServiceData[] getTestServiceList() { + PrintService[] printServices = PrintServiceLookup.lookupPrintServices(null, null); + if (printServices == null || printServices.length == 0) { + throw new RuntimeException("Print services not found"); + } + + List testServiceList = new ArrayList<>(); + for (PrintService ps : printServices) { + try { + MediaSizeName msn = getTestMediaSizeName(ps); + PageFormat pf = createTestPageFormat(msn, ps); + testServiceList.add(new TestServiceData(ps, msn, pf)); + } catch (Exception ignore) { //in case if can't create required PageFormat + } + } + return testServiceList.toArray(TestServiceData[]::new); + } + + private static MediaSizeName getTestMediaSizeName(PrintService printService) { + //Use printer's default media or one of the alloed medias + Media testMedia = (Media) printService.getDefaultAttributeValue(Media.class); + if (testMedia == null) { + Media[] medias = (Media[]) printService + .getSupportedAttributeValues(Media.class, null, null); + if (medias == null || medias.length == 0) { + throw new RuntimeException("Medias not found"); + } + for (Media media : medias) { + if (ALLOWED_MEDIA_LIST.contains(media)) { + testMedia = media; + break; + } + } + } + if (!(testMedia instanceof MediaSizeName)) { + throw new RuntimeException("Test media not found"); + } + return (MediaSizeName) testMedia; + } + + private static PageFormat createTestPageFormat(MediaSizeName testMedia, PrintService printService) { + MediaSize ms = MediaSize.getMediaSizeForName(testMedia); + if (ms == null) { + throw new RuntimeException("Media size not defined"); + } + + MediaPrintableArea mpa = getMaximumMediaPrintableArea(testMedia, ms, printService); + if (mpa == null) { + throw new RuntimeException("Media printable area not defined"); + } + + PageFormat pageFormat = new PageFormat(); + pageFormat.setOrientation(PageFormat.PORTRAIT); + Paper paper = new Paper(); + paper.setSize(ms.getX(MediaSize.INCH) * DPI, ms.getY(MediaSize.INCH) * DPI); + paper.setImageableArea(mpa.getX(MediaPrintableArea.INCH) * DPI, + mpa.getY(MediaPrintableArea.INCH) * DPI, + mpa.getWidth(MediaPrintableArea.INCH) * DPI, + mpa.getHeight(MediaPrintableArea.INCH) * DPI); + pageFormat.setPaper(paper); + return pageFormat; + } + + private static MediaPrintableArea getMaximumMediaPrintableArea(MediaSizeName msn, MediaSize ms, + PrintService printService) { + final float paperSizeX = ms.getX(Size2DSyntax.MM); + final float paperSizeY = ms.getY(Size2DSyntax.MM); + final float sizeDev = 0.2f; + + PrintRequestAttributeSet attrs = new HashPrintRequestAttributeSet(); + attrs.add(msn); + MediaPrintableArea[] mpas = (MediaPrintableArea[]) printService + .getSupportedAttributeValues(MediaPrintableArea.class, null, attrs); + if (mpas == null || mpas.length == 0) { + throw new RuntimeException("Printable area not found"); + } + + MediaPrintableArea mpa = null; + for (MediaPrintableArea area : mpas) { + float mpaSize = area.getWidth(MediaPrintableArea.MM) * area.getHeight(MediaPrintableArea.MM); + //do not use borderless printable area + if (sizeDev >= Math.abs(paperSizeX - area.getWidth(MediaPrintableArea.MM)) && + sizeDev >= Math.abs(paperSizeY - area.getHeight(MediaPrintableArea.MM))) { + continue; + } + if (mpa == null) { + mpa = area; + } else if (mpaSize > (area.getWidth(MediaPrintableArea.MM) * area.getHeight(MediaPrintableArea.MM))) { + mpa = area; + } + } + return mpa; + } + + private static double inchesToMM(double inches) { + return inches / MM_PER_INCH; + } + + private static void addGridBagComponent(JPanel p, Component c, int y) { + GridBagConstraints constraints = new GridBagConstraints(); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.insets = new Insets(4, 4, 4, 4); + constraints.gridx = 0; + constraints.gridy = y; + p.add(c, constraints); + } + + private static class RectPrintable implements Printable { + + @Override + public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException { + if (pageIndex == 0) { + Graphics2D g = (Graphics2D) graphics; + g.setStroke(new BasicStroke(3)); + g.drawRect((int) pageFormat.getImageableX(), (int) pageFormat.getImageableY(), + (int) pageFormat.getImageableWidth(), (int) pageFormat.getImageableHeight()); + return PAGE_EXISTS; + } + return NO_SUCH_PAGE; + } + } + + private static class TestServiceData { + + final PrintService printService; + final MediaSizeName mediaSizeName; + final PageFormat pageFormat; + + private TestServiceData(PrintService printService, MediaSizeName mediaSizeName, PageFormat pageFormat) { + this.printService = printService; + this.mediaSizeName = mediaSizeName; + this.pageFormat = pageFormat; + } + } +} diff --git a/test/jdk/javax/swing/JColorChooser/Test8152419.java b/test/jdk/javax/swing/JColorChooser/Test8152419.java index 65615acbdee37..48067a4d2bad1 100644 --- a/test/jdk/javax/swing/JColorChooser/Test8152419.java +++ b/test/jdk/javax/swing/JColorChooser/Test8152419.java @@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,11 +21,12 @@ * questions. */ - /* -* @test -* @bug 8152419 -* @summary To Verify JColorChooser tab selection -* @run main/manual Test8152419 +/* + * @test + * @bug 8152419 + * @library /test/lib + * @summary To Verify JColorChooser tab selection + * @run main/manual Test8152419 */ import java.awt.Color; @@ -43,9 +44,17 @@ import javax.swing.UIManager; import javax.swing.border.EmptyBorder; +import jtreg.SkippedException; + public class Test8152419 { public static void main(String args[]) throws Exception { + // ColorChooser UI design is different for GTK L&F. + // There are no tabs available for GTK L&F, skip the testing. + if (UIManager.getLookAndFeel().getName().contains("GTK")) { + throw new SkippedException("Test not applicable for GTK L&F"); + } + final CountDownLatch latch = new CountDownLatch(1); JColorChooserTest test = new JColorChooserTest(latch); diff --git a/test/jdk/javax/swing/JRadioButton/ButtonGroupFocus/ButtonGroupFocusTest.java b/test/jdk/javax/swing/JRadioButton/ButtonGroupFocus/ButtonGroupFocusTest.java index c696b166dd085..633b0356f85df 100644 --- a/test/jdk/javax/swing/JRadioButton/ButtonGroupFocus/ButtonGroupFocusTest.java +++ b/test/jdk/javax/swing/JRadioButton/ButtonGroupFocus/ButtonGroupFocusTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 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 @@ -28,26 +28,53 @@ * @run main ButtonGroupFocusTest */ -import javax.swing.*; -import java.awt.*; +import java.awt.AWTEvent; +import java.awt.Container; +import java.awt.FlowLayout; +import java.awt.KeyboardFocusManager; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; import java.awt.event.KeyEvent; +import java.awt.image.BufferedImage; +import java.io.File; +import java.util.concurrent.CountDownLatch; -public class ButtonGroupFocusTest { +import javax.imageio.ImageIO; +import javax.swing.ButtonGroup; +import javax.swing.JFrame; +import javax.swing.JRadioButton; +import javax.swing.SwingUtilities; + +import static java.awt.KeyboardFocusManager.getCurrentKeyboardFocusManager; +import static java.util.concurrent.TimeUnit.MILLISECONDS; +import static java.util.concurrent.TimeUnit.SECONDS; + +public final class ButtonGroupFocusTest { private static JRadioButton button1; private static JRadioButton button2; private static JRadioButton button3; private static JRadioButton button4; private static JRadioButton button5; - private static Robot robot; + + private static final CountDownLatch button2FocusLatch = new CountDownLatch(1); + private static final CountDownLatch button3FocusLatch = new CountDownLatch(1); + private static final CountDownLatch button4FocusLatch = new CountDownLatch(1); + + private static final CountDownLatch button2FocusLatch2 = new CountDownLatch(2); + + private static final long FOCUS_TIMEOUT = 4; + private static JFrame frame; public static void main(String[] args) throws Exception { - robot = new Robot(); - robot.setAutoDelay(100); + final Robot robot = new Robot(); SwingUtilities.invokeAndWait(() -> { - frame = new JFrame(); + frame = new JFrame("ButtonGroupFocusTest"); Container contentPane = frame.getContentPane(); contentPane.setLayout(new FlowLayout()); button1 = new JRadioButton("Button 1"); @@ -60,6 +87,7 @@ public static void main(String[] args) throws Exception { contentPane.add(button4); button5 = new JRadioButton("Button 5"); contentPane.add(button5); + ButtonGroup group = new ButtonGroup(); group.add(button1); group.add(button2); @@ -69,52 +97,96 @@ public static void main(String[] args) throws Exception { group.add(button4); group.add(button5); + button2.addFocusListener(new LatchFocusListener(button2FocusLatch)); + button3.addFocusListener(new LatchFocusListener(button3FocusLatch)); + button4.addFocusListener(new LatchFocusListener(button4FocusLatch)); + + button2.addFocusListener(new LatchFocusListener(button2FocusLatch2)); + button2.setSelected(true); + // Debugging aid: log focus owner changes... + KeyboardFocusManager focusManager = getCurrentKeyboardFocusManager(); + focusManager.addPropertyChangeListener("focusOwner", + e -> System.out.println(e.getPropertyName() + + "\n\t" + e.getOldValue() + + "\n\t" + e.getNewValue())); + + // ...and dispatched key events + Toolkit.getDefaultToolkit().addAWTEventListener( + e -> System.out.println("Dispatched " + e), + AWTEvent.KEY_EVENT_MASK); + frame.pack(); + frame.setLocationRelativeTo(null); frame.setVisible(true); }); - robot.waitForIdle(); - robot.delay(200); - - SwingUtilities.invokeAndWait(() -> { - if( !button2.hasFocus() ) { - frame.dispose(); - throw new RuntimeException( - "Button 2 should get focus after activation"); + try { + if (!button2FocusLatch.await(FOCUS_TIMEOUT, SECONDS)) { + throw new RuntimeException("Button 2 should get focus " + + "after activation"); } - }); + robot.waitForIdle(); + robot.delay(200); - robot.keyPress(KeyEvent.VK_TAB); - robot.keyRelease(KeyEvent.VK_TAB); + System.out.println("\n\n*** Tab 1st"); + robot.keyPress(KeyEvent.VK_TAB); + robot.keyRelease(KeyEvent.VK_TAB); - robot.waitForIdle(); - robot.delay(200); + if (!button4FocusLatch.await(FOCUS_TIMEOUT, SECONDS)) { + throw new RuntimeException("Button 4 should get focus"); + } + robot.waitForIdle(); + robot.delay(200); - SwingUtilities.invokeAndWait(() -> { - if( !button4.hasFocus() ) { - frame.dispose(); - throw new RuntimeException( - "Button 4 should get focus"); + if (button2FocusLatch2.await(1, MILLISECONDS)) { + throw new RuntimeException("Focus moved back to Button 2"); } - button3.setSelected(true); - }); - robot.keyPress(KeyEvent.VK_TAB); - robot.keyRelease(KeyEvent.VK_TAB); + SwingUtilities.invokeAndWait(() -> button3.setSelected(true)); + robot.waitForIdle(); + robot.delay(200); - robot.waitForIdle(); - robot.delay(200); + System.out.println("\n\n*** Tab 2nd"); + robot.keyPress(KeyEvent.VK_TAB); + robot.keyRelease(KeyEvent.VK_TAB); - SwingUtilities.invokeAndWait(() -> { - if( !button3.hasFocus() ) { - frame.dispose(); - throw new RuntimeException( - "selected Button 3 should get focus"); + if (!button3FocusLatch.await(FOCUS_TIMEOUT, SECONDS)) { + throw new RuntimeException("Selected Button 3 should get focus"); } - }); + } catch (Exception e) { + BufferedImage image = robot.createScreenCapture(getFrameBounds()); + ImageIO.write(image, "png", + new File("image.png")); + + SwingUtilities.invokeAndWait(() -> + System.err.println("Current focus owner: " + + getCurrentKeyboardFocusManager() + .getFocusOwner())); + + throw e; + } finally { + SwingUtilities.invokeAndWait(frame::dispose); + } + } + + private static Rectangle getFrameBounds() throws Exception { + Rectangle[] bounds = new Rectangle[1]; + SwingUtilities.invokeAndWait(() -> bounds[0] = frame.getBounds()); + return bounds[0]; + } + + private static final class LatchFocusListener extends FocusAdapter { + private final CountDownLatch focusGainedLatch; + + private LatchFocusListener(CountDownLatch focusGainedLatch) { + this.focusGainedLatch = focusGainedLatch; + } - SwingUtilities.invokeLater(frame::dispose); + @Override + public void focusGained(FocusEvent e) { + focusGainedLatch.countDown(); + } } } diff --git a/test/jdk/javax/swing/JScrollBar/4865918/bug4865918.java b/test/jdk/javax/swing/JScrollBar/4865918/bug4865918.java index bc5ddb4b62771..96b1034c943de 100644 --- a/test/jdk/javax/swing/JScrollBar/4865918/bug4865918.java +++ b/test/jdk/javax/swing/JScrollBar/4865918/bug4865918.java @@ -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 @@ -23,17 +23,15 @@ /* * @test - * @key headful * @bug 4865918 + * @requires (os.family != "mac") * @summary REGRESSION:JCK1.4a-runtime api/javax_swing/interactive/JScrollBarTests.html#JScrollBar * @run main bug4865918 */ import java.awt.Dimension; -import java.awt.Robot; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import javax.swing.JFrame; import javax.swing.JScrollBar; import javax.swing.SwingUtilities; import java.util.concurrent.CountDownLatch; @@ -44,30 +42,23 @@ public class bug4865918 { private static TestScrollBar sbar; - private static JFrame frame; private static final CountDownLatch mousePressLatch = new CountDownLatch(1); public static void main(String[] argv) throws Exception { - try { - Robot robot = new Robot(); - SwingUtilities.invokeAndWait(() -> createAndShowGUI()); - - robot.waitForIdle(); - robot.delay(1000); - - SwingUtilities.invokeAndWait(() -> sbar.pressMouse()); - if (!mousePressLatch.await(2, TimeUnit.SECONDS)) { - throw new RuntimeException("Timed out waiting for mouse press"); - } + String osName = System.getProperty("os.name"); + if (osName.toLowerCase().contains("os x")) { + System.out.println("This test is not for MacOS, considered passed."); + return; + } + SwingUtilities.invokeAndWait(() -> setupTest()); - robot.waitForIdle(); - robot.delay(200); + SwingUtilities.invokeAndWait(() -> sbar.pressMouse()); + if (!mousePressLatch.await(2, TimeUnit.SECONDS)) { + throw new RuntimeException("Timed out waiting for mouse press"); + } - if (getValue() != 9) { - throw new RuntimeException("The scrollbar block increment is incorrect"); - } - } finally { - if (frame != null) SwingUtilities.invokeAndWait(() -> frame.dispose()); + if (getValue() != 9) { + throw new RuntimeException("The scrollbar block increment is incorrect"); } } @@ -78,12 +69,11 @@ private static int getValue() throws Exception { result[0] = sbar.getValue(); }); + System.out.println("value " + result[0]); return result[0]; } - private static void createAndShowGUI() { - frame = new JFrame("bug4865918"); - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + private static void setupTest() { sbar = new TestScrollBar(JScrollBar.HORIZONTAL, -1, 10, -100, 100); sbar.setPreferredSize(new Dimension(200, 20)); @@ -94,11 +84,6 @@ public void mousePressed(MouseEvent e) { } }); - frame.getContentPane().add(sbar); - frame.pack(); - frame.setLocationRelativeTo(null); - frame.setVisible(true); - frame.toFront(); } static class TestScrollBar extends JScrollBar { diff --git a/test/jdk/javax/swing/JTabbedPane/8134116/Bug8134116.java b/test/jdk/javax/swing/JTabbedPane/8134116/Bug8134116.java index 97164c253ddae..6a39d7b96fab7 100644 --- a/test/jdk/javax/swing/JTabbedPane/8134116/Bug8134116.java +++ b/test/jdk/javax/swing/JTabbedPane/8134116/Bug8134116.java @@ -1,13 +1,43 @@ +/* + * 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ -import java.awt.*; +import java.awt.Component; +import java.awt.Rectangle; import java.awt.event.KeyEvent; import java.util.ArrayList; import java.util.List; + import javax.accessibility.Accessible; import javax.accessibility.AccessibleContext; import javax.accessibility.AccessibleState; import javax.accessibility.AccessibleStateSet; -import javax.swing.*; +import javax.swing.Icon; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTabbedPane; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; import javax.swing.plaf.nimbus.NimbusLookAndFeel; /* @@ -22,7 +52,7 @@ public class Bug8134116 { private static volatile Exception exception = null; private static JFrame frame; - public static void main(String args[]) throws Exception { + public static void main(String[] args) throws Exception { try { UIManager.setLookAndFeel(new NimbusLookAndFeel()); diff --git a/test/jdk/javax/swing/text/Caret/8163124/CaretFloatingPointAPITest.java b/test/jdk/javax/swing/text/Caret/8163124/CaretFloatingPointAPITest.java index 19d6d6a86079d..c02fcfcfb9073 100644 --- a/test/jdk/javax/swing/text/Caret/8163124/CaretFloatingPointAPITest.java +++ b/test/jdk/javax/swing/text/Caret/8163124/CaretFloatingPointAPITest.java @@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -222,11 +222,11 @@ public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.draw(new Line2D.Float(c, cy, c, cy + ch)); - g2d.draw(new Line2D.Float(cx, cy, cx + cw, cy)); - g2d.draw(new Line2D.Float(cx, cy + ch, cx + cw, cy + ch)); } void repaint(Rectangle r) { + r.width += 1; + r.height += 1; component.repaint(r); } @@ -424,6 +424,8 @@ protected void adjustVisibility(Rectangle nloc) { protected synchronized void damage(Rectangle r) { if (r != null && component != null) { + r.width += 1; + r.height += 1; component.repaint(r); } } diff --git a/test/jdk/javax/xml/jaxp/common/8323740/InitializerTest.java b/test/jdk/javax/xml/jaxp/common/8323740/InitializerTest.java new file mode 100644 index 0000000000000..3cf685331b1b9 --- /dev/null +++ b/test/jdk/javax/xml/jaxp/common/8323740/InitializerTest.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024, Google LLC. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import org.testng.annotations.Test; + +import java.util.Objects; + +/** + * @test + * + * @bug 8323740 + * @summary test that class initializers don't crash + * @run testng/othervm InitializerTest + */ +public class InitializerTest { + + @Test + public void testXMLOutputFactory() throws Exception { + String name = "com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl"; + Objects.requireNonNull(Class.forName(name)); + } +} diff --git a/test/jdk/jdk/classfile/SnippetsTest.java b/test/jdk/jdk/classfile/SnippetsTest.java index 2b84820e9b948..d15dbc0ca3d64 100644 --- a/test/jdk/jdk/classfile/SnippetsTest.java +++ b/test/jdk/jdk/classfile/SnippetsTest.java @@ -42,6 +42,7 @@ public class SnippetsTest { @ParameterizedTest @ValueSource(strings = { "src/java.base/share/classes/java/lang/classfile/snippet-files/PackageSnippets.java", + "src/java.base/share/classes/java/lang/classfile/attribute/snippet-files/PackageSnippets.java", "src/java.base/share/classes/java/lang/classfile/constantpool/snippet-files/PackageSnippets.java", "src/java.base/share/classes/jdk/internal/classfile/components/snippet-files/PackageSnippets.java" }) diff --git a/test/jdk/jdk/internal/reflect/CallerSensitive/CheckCSMs.java b/test/jdk/jdk/internal/reflect/CallerSensitive/CheckCSMs.java index e1790e6e17456..48886db87c666 100644 --- a/test/jdk/jdk/internal/reflect/CallerSensitive/CheckCSMs.java +++ b/test/jdk/jdk/internal/reflect/CallerSensitive/CheckCSMs.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 @@ -68,14 +68,11 @@ public class CheckCSMs { // The goal is to remove this list of Non-final instance @CS methods // over time. Do not add any new one to this list. - private static final Set KNOWN_NON_FINAL_CSMS = - Set.of("java/lang/Runtime#load (Ljava/lang/String;)V", - "java/lang/Runtime#loadLibrary (Ljava/lang/String;)V" - ); + private static final Set KNOWN_NON_FINAL_CSMS = Set.of(); // These non-static non-final methods must not have @CallerSensitiveAdapter // methods that takes an additional caller class parameter. - private static Set UNSUPPORTED_VIRTUAL_METHODS = Set.of(); + private static final Set UNSUPPORTED_VIRTUAL_METHODS = Set.of(); public static void main(String[] args) throws Exception { if (args.length > 0 && args[0].equals("--list")) { diff --git a/test/jdk/jdk/jfr/api/consumer/TestChunkInputStreamAvailable.java b/test/jdk/jdk/jfr/api/consumer/TestChunkInputStreamAvailable.java index 07f796d47d329..e4eaccc0057c3 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestChunkInputStreamAvailable.java +++ b/test/jdk/jdk/jfr/api/consumer/TestChunkInputStreamAvailable.java @@ -1,4 +1,5 @@ /* + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021, Alibaba Group Holding Limited. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +24,7 @@ /** * @test TestChunkInputStreamAvailable - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestChunkInputStreamAvailable diff --git a/test/jdk/jdk/jfr/api/consumer/TestChunkInputStreamBulkRead.java b/test/jdk/jdk/jfr/api/consumer/TestChunkInputStreamBulkRead.java index 15bf1b7707c6d..5733f2f0cf654 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestChunkInputStreamBulkRead.java +++ b/test/jdk/jdk/jfr/api/consumer/TestChunkInputStreamBulkRead.java @@ -1,4 +1,5 @@ /* + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2024, Palantir Technologies, Inc. and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,7 +24,7 @@ /** * @test TestChunkInputStreamBulkRead - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestChunkInputStreamBulkRead diff --git a/test/jdk/jdk/jfr/api/consumer/TestFieldAccess.java b/test/jdk/jdk/jfr/api/consumer/TestFieldAccess.java index 3a35ca6d7512b..bb2e145467ce7 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestFieldAccess.java +++ b/test/jdk/jdk/jfr/api/consumer/TestFieldAccess.java @@ -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 @@ -35,7 +35,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestFieldAccess diff --git a/test/jdk/jdk/jfr/api/consumer/TestGetStackTrace.java b/test/jdk/jdk/jfr/api/consumer/TestGetStackTrace.java index fa26270ccebb2..9dcdfaf84e0dd 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestGetStackTrace.java +++ b/test/jdk/jdk/jfr/api/consumer/TestGetStackTrace.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 @@ -42,7 +42,7 @@ /** * @test * @summary Verifies that a recorded JFR event has the correct stack trace info - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestGetStackTrace diff --git a/test/jdk/jdk/jfr/api/consumer/TestHiddenMethod.java b/test/jdk/jdk/jfr/api/consumer/TestHiddenMethod.java index ad68e016a1a10..969016ebf35ea 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestHiddenMethod.java +++ b/test/jdk/jdk/jfr/api/consumer/TestHiddenMethod.java @@ -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 @@ -39,7 +39,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @library /test/lib diff --git a/test/jdk/jdk/jfr/api/consumer/TestMethodGetModifiers.java b/test/jdk/jdk/jfr/api/consumer/TestMethodGetModifiers.java index 9b5505c55deb9..d98fbdfcfd542 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestMethodGetModifiers.java +++ b/test/jdk/jdk/jfr/api/consumer/TestMethodGetModifiers.java @@ -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 @@ -40,7 +40,7 @@ /** * @test * @summary Verifies that a recorded method has the correct modifier - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm -Xint jdk.jfr.api.consumer.TestMethodGetModifiers diff --git a/test/jdk/jdk/jfr/api/consumer/TestReadTwice.java b/test/jdk/jdk/jfr/api/consumer/TestReadTwice.java index 97ef76ece85b5..8990ffaa03d2b 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestReadTwice.java +++ b/test/jdk/jdk/jfr/api/consumer/TestReadTwice.java @@ -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 @@ -37,7 +37,7 @@ /** * @test * @summary Reads the recorded file two times and verifies that both reads are the same - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestReadTwice diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordedClass.java b/test/jdk/jdk/jfr/api/consumer/TestRecordedClass.java index 19c637049197c..003e8c91edd00 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestRecordedClass.java +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordedClass.java @@ -35,7 +35,7 @@ /** * @test * @summary Verifies methods of RecordedClass - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestRecordedClass diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordedClassLoader.java b/test/jdk/jdk/jfr/api/consumer/TestRecordedClassLoader.java index a7b03149ce92e..f58c4051d3c27 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestRecordedClassLoader.java +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordedClassLoader.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 @@ -37,7 +37,7 @@ /** * @test * @summary Verifies the methods of the RecordedClassLoader - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestRecordedClassLoader diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordedEvent.java b/test/jdk/jdk/jfr/api/consumer/TestRecordedEvent.java index 9223d2ef5ad0f..1bfeb8accec1e 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestRecordedEvent.java +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordedEvent.java @@ -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 @@ -38,7 +38,7 @@ /** * @test * @summary Verifies the methods of the RecordedEvent - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestRecordedEvent diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordedEventGetThread.java b/test/jdk/jdk/jfr/api/consumer/TestRecordedEventGetThread.java index d3d581bc374ba..f05846b7284d4 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestRecordedEventGetThread.java +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordedEventGetThread.java @@ -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 @@ -35,7 +35,7 @@ /** * @test * @summary Tests that the RecordedEvent.getThread() returns th expected info - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestRecordedEventGetThread diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordedEventGetThreadOther.java b/test/jdk/jdk/jfr/api/consumer/TestRecordedEventGetThreadOther.java index daaec8c05576b..2e5e767b0e10e 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestRecordedEventGetThreadOther.java +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordedEventGetThreadOther.java @@ -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 @@ -37,7 +37,7 @@ /** * @test * @summary Tests that the RecordedEvent.getThread() returns th expected info - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestRecordedEventGetThreadOther diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordedFrame.java b/test/jdk/jdk/jfr/api/consumer/TestRecordedFrame.java index 611ed0e688f47..2e6abd960a826 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestRecordedFrame.java +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordedFrame.java @@ -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 @@ -39,7 +39,7 @@ /** * @test * @summary Simple test for RecordedFrame APIs - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestRecordedFrame diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordedFrameType.java b/test/jdk/jdk/jfr/api/consumer/TestRecordedFrameType.java index a44bdd371f073..c988f37bd0b4d 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestRecordedFrameType.java +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordedFrameType.java @@ -39,7 +39,7 @@ /** * @test * @summary Test jdk.jfr.consumer.RecordedFrame::getType() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR & vm.compiler1.enabled * @library /test/lib * @build jdk.test.whitebox.WhiteBox diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordedFullStackTrace.java b/test/jdk/jdk/jfr/api/consumer/TestRecordedFullStackTrace.java index 18fcb30038205..7506932981137 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestRecordedFullStackTrace.java +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordedFullStackTrace.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 @@ -40,7 +40,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestRecordedFullStackTrace diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordedInstantEventTimestamp.java b/test/jdk/jdk/jfr/api/consumer/TestRecordedInstantEventTimestamp.java index 8c37fe8743b2f..c4f2966d40a5b 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestRecordedInstantEventTimestamp.java +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordedInstantEventTimestamp.java @@ -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 @@ -34,7 +34,7 @@ /** * @test * @summary Tests that an instant event gets recorded with its start time equal to its end time - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestRecordedInstantEventTimestamp diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordedMethodDescriptor.java b/test/jdk/jdk/jfr/api/consumer/TestRecordedMethodDescriptor.java index 884697c26a531..a80203543960c 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestRecordedMethodDescriptor.java +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordedMethodDescriptor.java @@ -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 @@ -41,7 +41,7 @@ /** * @test * @summary Verifies that the method descriptor is correct - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestRecordedMethodDescriptor diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordedObject.java b/test/jdk/jdk/jfr/api/consumer/TestRecordedObject.java index 17878ff7e6ce6..772a0ca641954 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestRecordedObject.java +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordedObject.java @@ -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 @@ -49,7 +49,7 @@ /** * @test * @summary Verifies the methods of the RecordedObject - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestRecordedObject diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordedThreadGroupParent.java b/test/jdk/jdk/jfr/api/consumer/TestRecordedThreadGroupParent.java index dae9b8fc11a8d..e5b40a34d1ef3 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestRecordedThreadGroupParent.java +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordedThreadGroupParent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -34,7 +34,7 @@ /** * @test * @summary Tests getParent method in RecordedThreadGroup - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestRecordedThreadGroupParent diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordingFile.java b/test/jdk/jdk/jfr/api/consumer/TestRecordingFile.java index a81262f9405c8..5aeee69cadc2e 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestRecordingFile.java +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordingFile.java @@ -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 @@ -50,7 +50,7 @@ /** * @test * @summary Verifies that all methods in RecordingFIle are working - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm -Xlog:jfr*=info jdk.jfr.api.consumer.TestRecordingFile diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordingFileReadEventEof.java b/test/jdk/jdk/jfr/api/consumer/TestRecordingFileReadEventEof.java index 1c98f293c243d..c92b2362ce4b3 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestRecordingFileReadEventEof.java +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordingFileReadEventEof.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 @@ -34,7 +34,7 @@ /** * @test * @summary Verifies that RecordingFile.readEvent() throws EOF when past the last record - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestRecordingFileReadEventEof diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordingFileSanitization.java b/test/jdk/jdk/jfr/api/consumer/TestRecordingFileSanitization.java index 75e01f82cd403..dfa39b4ad8595 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestRecordingFileSanitization.java +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordingFileSanitization.java @@ -35,7 +35,7 @@ /** * @test * @summary Verifies that all traces of sensitive data is removed - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestRecordingFileSanitization diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordingFileWrite.java b/test/jdk/jdk/jfr/api/consumer/TestRecordingFileWrite.java index f4cf5a20805fd..5fc0dab0d30aa 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestRecordingFileWrite.java +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordingFileWrite.java @@ -39,7 +39,7 @@ /** * @test * @summary Tests RecordingFile::write(Path, Predicate) - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestRecordingFileWrite diff --git a/test/jdk/jdk/jfr/api/consumer/TestRecordingInternals.java b/test/jdk/jdk/jfr/api/consumer/TestRecordingInternals.java index 75513f5b7b44f..efa36c799878b 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestRecordingInternals.java +++ b/test/jdk/jdk/jfr/api/consumer/TestRecordingInternals.java @@ -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 @@ -33,7 +33,7 @@ /** * @test * @summary Tests that chunks are read in order and constant pools from multiple chunks can be read - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestRecordingInternals diff --git a/test/jdk/jdk/jfr/api/consumer/TestSingleRecordedEvent.java b/test/jdk/jdk/jfr/api/consumer/TestSingleRecordedEvent.java index f8bd63b915a68..1580647b43c72 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestSingleRecordedEvent.java +++ b/test/jdk/jdk/jfr/api/consumer/TestSingleRecordedEvent.java @@ -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 @@ -35,7 +35,7 @@ /** * @test * @summary Verifies that a single JFR event is recorded as expected - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestSingleRecordedEvent diff --git a/test/jdk/jdk/jfr/api/consumer/TestToString.java b/test/jdk/jdk/jfr/api/consumer/TestToString.java index 3c36317662471..7f75a55e0f1ba 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestToString.java +++ b/test/jdk/jdk/jfr/api/consumer/TestToString.java @@ -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 @@ -35,7 +35,7 @@ /** * @test * @summary Sanity checks that RecordedEvent#toString returns something valid - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestToString diff --git a/test/jdk/jdk/jfr/api/consumer/TestValueDescriptorRecorded.java b/test/jdk/jdk/jfr/api/consumer/TestValueDescriptorRecorded.java index 4fc90c10cf1e5..aa6ac255ba0c0 100644 --- a/test/jdk/jdk/jfr/api/consumer/TestValueDescriptorRecorded.java +++ b/test/jdk/jdk/jfr/api/consumer/TestValueDescriptorRecorded.java @@ -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 @@ -38,7 +38,7 @@ /** * @test * @summary Verifies that the recorded value descriptors are correct - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.TestValueDescriptorRecorded diff --git a/test/jdk/jdk/jfr/api/consumer/filestream/TestMultipleChunk.java b/test/jdk/jdk/jfr/api/consumer/filestream/TestMultipleChunk.java index d0fed7477ebc1..5efe203161405 100644 --- a/test/jdk/jdk/jfr/api/consumer/filestream/TestMultipleChunk.java +++ b/test/jdk/jdk/jfr/api/consumer/filestream/TestMultipleChunk.java @@ -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 @@ -34,7 +34,7 @@ /** * @test * @summary Verifies that it is possible to stream contents from a multichunked file - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.filestream.TestMultipleChunk diff --git a/test/jdk/jdk/jfr/api/consumer/filestream/TestOrdered.java b/test/jdk/jdk/jfr/api/consumer/filestream/TestOrdered.java index 58f23350dd07e..a2c127afdce13 100644 --- a/test/jdk/jdk/jfr/api/consumer/filestream/TestOrdered.java +++ b/test/jdk/jdk/jfr/api/consumer/filestream/TestOrdered.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 @@ -40,7 +40,7 @@ /** * @test * @summary Test EventStream::setOrdered(...) - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.filestream.TestOrdered diff --git a/test/jdk/jdk/jfr/api/consumer/filestream/TestReuse.java b/test/jdk/jdk/jfr/api/consumer/filestream/TestReuse.java index ff26fd7269d67..7d34f00c891bc 100644 --- a/test/jdk/jdk/jfr/api/consumer/filestream/TestReuse.java +++ b/test/jdk/jdk/jfr/api/consumer/filestream/TestReuse.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 @@ -39,7 +39,7 @@ /** * @test * @summary Test EventStream::setReuse(...) - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.filestream.TestReuse diff --git a/test/jdk/jdk/jfr/api/consumer/log/TestContent.java b/test/jdk/jdk/jfr/api/consumer/log/TestContent.java index c6ef6f960f54e..75a2b98ac96f6 100644 --- a/test/jdk/jdk/jfr/api/consumer/log/TestContent.java +++ b/test/jdk/jdk/jfr/api/consumer/log/TestContent.java @@ -32,7 +32,7 @@ * @test * @summary Tests that the event payload is printed when using * -Xlog:jfr+event=trace - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.jfr.api.consumer.log.LogAnalyzer diff --git a/test/jdk/jdk/jfr/api/consumer/log/TestDiskOnOff.java b/test/jdk/jdk/jfr/api/consumer/log/TestDiskOnOff.java index 0f8f0cf3ba7b0..220820e3c9955 100644 --- a/test/jdk/jdk/jfr/api/consumer/log/TestDiskOnOff.java +++ b/test/jdk/jdk/jfr/api/consumer/log/TestDiskOnOff.java @@ -27,7 +27,7 @@ /** * @test * @summary Tests that event logging can't be turned on and off - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.jfr.api.consumer.log.LogAnalyzer diff --git a/test/jdk/jdk/jfr/api/consumer/log/TestDynamicStart.java b/test/jdk/jdk/jfr/api/consumer/log/TestDynamicStart.java index b24e96c53bb56..e598d4302a1c7 100644 --- a/test/jdk/jdk/jfr/api/consumer/log/TestDynamicStart.java +++ b/test/jdk/jdk/jfr/api/consumer/log/TestDynamicStart.java @@ -35,7 +35,7 @@ * @test * @summary Tests that log responds to log level changes after JVM has * started - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.jfr.api.consumer.log.LogAnalyzer diff --git a/test/jdk/jdk/jfr/api/consumer/log/TestMemoryDiskTransition.java b/test/jdk/jdk/jfr/api/consumer/log/TestMemoryDiskTransition.java index 133318e837df2..6ffb22a38ebe8 100644 --- a/test/jdk/jdk/jfr/api/consumer/log/TestMemoryDiskTransition.java +++ b/test/jdk/jdk/jfr/api/consumer/log/TestMemoryDiskTransition.java @@ -27,7 +27,7 @@ /** * @test * @summary Tests that transition between disk=true/false works - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.jfr.api.consumer.log.LogAnalyzer diff --git a/test/jdk/jdk/jfr/api/consumer/log/TestMemoryOnly.java b/test/jdk/jdk/jfr/api/consumer/log/TestMemoryOnly.java index d9faa0805ffae..618dbaffad893 100644 --- a/test/jdk/jdk/jfr/api/consumer/log/TestMemoryOnly.java +++ b/test/jdk/jdk/jfr/api/consumer/log/TestMemoryOnly.java @@ -27,7 +27,7 @@ /** * @test * @summary Tests that a stream is not started if disk=false - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.jfr.api.consumer.log.LogAnalyzer diff --git a/test/jdk/jdk/jfr/api/consumer/log/TestSystemEvents.java b/test/jdk/jdk/jfr/api/consumer/log/TestSystemEvents.java index 01b57ed32757b..8d90684e5235a 100644 --- a/test/jdk/jdk/jfr/api/consumer/log/TestSystemEvents.java +++ b/test/jdk/jdk/jfr/api/consumer/log/TestSystemEvents.java @@ -30,7 +30,7 @@ /** * @test * @summary Tests that only system events are emitted - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.jfr.api.consumer.log.LogAnalyzer diff --git a/test/jdk/jdk/jfr/api/consumer/log/TestTruncation.java b/test/jdk/jdk/jfr/api/consumer/log/TestTruncation.java index 84075053793c2..d2f6bf5b051cc 100644 --- a/test/jdk/jdk/jfr/api/consumer/log/TestTruncation.java +++ b/test/jdk/jdk/jfr/api/consumer/log/TestTruncation.java @@ -31,7 +31,7 @@ /** * @test * @summary Tests that large output is truncated - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.jfr.api.consumer.log.LogAnalyzer diff --git a/test/jdk/jdk/jfr/api/consumer/log/TestUserEvents.java b/test/jdk/jdk/jfr/api/consumer/log/TestUserEvents.java index a6d2074645bad..62feb2b9dbd44 100644 --- a/test/jdk/jdk/jfr/api/consumer/log/TestUserEvents.java +++ b/test/jdk/jdk/jfr/api/consumer/log/TestUserEvents.java @@ -30,7 +30,7 @@ /** * @test * @summary Tests that only user events are emitted - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.jfr.api.consumer.log.LogAnalyzer diff --git a/test/jdk/jdk/jfr/api/consumer/log/TestVerbosity.java b/test/jdk/jdk/jfr/api/consumer/log/TestVerbosity.java index 0533a0177f343..841f990a8d396 100644 --- a/test/jdk/jdk/jfr/api/consumer/log/TestVerbosity.java +++ b/test/jdk/jdk/jfr/api/consumer/log/TestVerbosity.java @@ -32,7 +32,7 @@ /** * @test * @summary Tests output from various tag sets and levels - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.jfr.api.consumer.log.LogAnalyzer diff --git a/test/jdk/jdk/jfr/api/consumer/log/TestWithStreaming.java b/test/jdk/jdk/jfr/api/consumer/log/TestWithStreaming.java index fc5cd7b4fe042..78b4e959182c4 100644 --- a/test/jdk/jdk/jfr/api/consumer/log/TestWithStreaming.java +++ b/test/jdk/jdk/jfr/api/consumer/log/TestWithStreaming.java @@ -35,7 +35,7 @@ /** * @test * @summary Checks that it is possible to stream together with log stream - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.jfr.api.consumer.log.LogAnalyzer diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestAwaitTermination.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestAwaitTermination.java index 6d99f9dbb69f5..4477dc4f90190 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestAwaitTermination.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestAwaitTermination.java @@ -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 @@ -32,7 +32,7 @@ /** * @test * @summary Test RecordingStream::awaitTermination(...) - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestAwaitTermination diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestBasics.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestBasics.java index 1dbfeefa968c8..3adbbd1af43a6 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestBasics.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestBasics.java @@ -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 @@ -31,7 +31,7 @@ /** * @test * @summary Basic/sanity test for JFR event streaming - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestBasics diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestClose.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestClose.java index 8b3fbe88b90d0..c7e6c6e592284 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestClose.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestClose.java @@ -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 @@ -35,7 +35,7 @@ /** * @test * @summary Tests RecordingStream::close() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -Xlog:jfr+streaming+system=trace jdk.jfr.api.consumer.recordingstream.TestClose diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestConstructor.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestConstructor.java index 5cfc21d698c22..0597300d83f7f 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestConstructor.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestConstructor.java @@ -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 @@ -33,7 +33,7 @@ /** * @test * @summary Tests RecordingStream::RecordingStream() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestConstructor diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestDisable.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestDisable.java index e0eccf9198ecc..73345f346e30f 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestDisable.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestDisable.java @@ -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 @@ -33,7 +33,7 @@ /** * @test * @summary Tests RecordingStream::disable(...) - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestDisable diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestDump.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestDump.java index 86c131aa246b9..cf4dad5477e24 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestDump.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestDump.java @@ -41,7 +41,7 @@ /** * @test * @summary Tests RecordingStream::dump(Path) - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestDump diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestEnable.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestEnable.java index 27ca64b790701..cde7d74ae0846 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestEnable.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestEnable.java @@ -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 @@ -33,7 +33,7 @@ /** * @test * @summary Tests RecordingStream::enable(...) - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestEnable diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestMaxAge.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestMaxAge.java index 8803272e919de..64dbfa4173b28 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestMaxAge.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestMaxAge.java @@ -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 @@ -31,7 +31,7 @@ /** * @test * @summary Tests RecordingStream::setMaxAge(...) - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestMaxAge diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnClose.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnClose.java index 9840511823269..3da0c62b8c8ad 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnClose.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnClose.java @@ -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 @@ -32,7 +32,7 @@ /** * @test * @summary Tests RecordingStream::onClose(...) - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestOnClose diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnErrorAsync.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnErrorAsync.java index 7939a634d4d54..4e7effae9a2a7 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnErrorAsync.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnErrorAsync.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 @@ -36,7 +36,7 @@ * @test * @summary Tests RecordingStream::onError(...) when using * RecordingStream:startAsync - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestOnErrorAsync diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnErrorSync.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnErrorSync.java index 2936070c3bf2f..4bf0ed0f6f696 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnErrorSync.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnErrorSync.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 @@ -36,7 +36,7 @@ /** * @test * @summary Tests RecordingStream::onError(...) when using RecordingStream:start - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestOnErrorSync diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnEvent.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnEvent.java index 390df2a2f562c..fa65553939901 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnEvent.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnEvent.java @@ -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 @@ -32,7 +32,7 @@ /** * @test * @summary Tests RecordingStream::onEvent(...) - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -Xlog:jfr+system+streaming=debug jdk.jfr.api.consumer.recordingstream.TestOnEvent diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnFlush.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnFlush.java index d895110274983..5f623f7ae5c81 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnFlush.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnFlush.java @@ -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 @@ -31,7 +31,7 @@ /** * @test * @summary Tests RecordingStream::onFlush(...) - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestOnFlush diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnMetadata.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnMetadata.java index 79ca66344549d..e8085736613e7 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnMetadata.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestOnMetadata.java @@ -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 @@ -46,7 +46,7 @@ /** * @test * @summary Tests RecordingStream::onMetadata(...) - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestOnMetadata diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestRecordingName.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestRecordingName.java index 813150e0d19db..18f2337547836 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestRecordingName.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestRecordingName.java @@ -31,7 +31,7 @@ * @test * @bug 8257424 * @summary Tests recording name for RecordingStrream -* @key jfr +* @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestRecordingName diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestRecursive.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestRecursive.java index fb62d62b6c965..49cc9fc644f34 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestRecursive.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestRecursive.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, 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 @@ -37,7 +37,7 @@ /** * @test * @summary Tests that events are not emitted in handlers - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @build jdk.jfr.api.consumer.recordingstream.EventProducer diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestRemove.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestRemove.java index fc4ca6e272ee2..d8d0aeacfa085 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestRemove.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestRemove.java @@ -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 @@ -35,7 +35,7 @@ /** * @test * @summary Tests RecordingStrream::remove(...) - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestRemove diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetEndTime.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetEndTime.java index 478e7a7f77edb..1e7a630e08459 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetEndTime.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetEndTime.java @@ -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 @@ -44,7 +44,7 @@ /** * @test * @summary Tests EventStream::setEndTime - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:-UseFastUnorderedTimeStamps jdk.jfr.api.consumer.recordingstream.TestSetEndTime diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetMaxAge.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetMaxAge.java index b8c2674e5c19c..80e05a6995c89 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetMaxAge.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetMaxAge.java @@ -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 @@ -31,7 +31,7 @@ /** * @test * @summary Tests RecordingStrream::setMaxAge - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestSetMaxAge diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetMaxSize.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetMaxSize.java index 8b350084e485c..764082b2f9ed7 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetMaxSize.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetMaxSize.java @@ -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 @@ -29,7 +29,7 @@ /** * @test * @summary Tests RecordingStrream::setMaxSize -* @key jfr +* @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestSetMaxSize diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetSettings.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetSettings.java index 9f55c26540bca..e9cc19734e3b0 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetSettings.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetSettings.java @@ -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 @@ -35,7 +35,7 @@ /** * @test * @summary Tests RecordingStream::setSettings - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm -Xlog:jfr+system+parser jdk.jfr.api.consumer.recordingstream.TestSetSettings diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetStartTime.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetStartTime.java index 06b28aaa79c36..95807cb2deba8 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetStartTime.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestSetStartTime.java @@ -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 @@ -38,7 +38,7 @@ /** * @test * @summary Tests EventStream::setStartTime - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestSetStartTime diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestStart.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestStart.java index 719411b2fa0ae..f14d2cdceec64 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestStart.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestStart.java @@ -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 @@ -32,7 +32,7 @@ /** * @test * @summary Tests RecordingStream::start() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @build jdk.jfr.api.consumer.recordingstream.EventProducer diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestStartAsync.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestStartAsync.java index 362fd1301150d..087b55801cdd8 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestStartAsync.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestStartAsync.java @@ -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 @@ -31,7 +31,7 @@ /** * @test * @summary Tests RecordingStream::startAsync() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestStartAsync diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestStop.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestStop.java index 36bbaa3c557db..5f23943e6cb00 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestStop.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestStop.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 @@ -37,7 +37,7 @@ /** * @test * @summary Tests RecordingStream::stop() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @build jdk.jfr.api.consumer.recordingstream.EventProducer diff --git a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestStoppedRecording.java b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestStoppedRecording.java index c0593f4d97bbf..a8bcb7f33687e 100644 --- a/test/jdk/jdk/jfr/api/consumer/recordingstream/TestStoppedRecording.java +++ b/test/jdk/jdk/jfr/api/consumer/recordingstream/TestStoppedRecording.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 @@ -33,7 +33,7 @@ * @test * @summary Tests that a RecordingStream is closed if the underlying Recording * is stopped. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.recordingstream.TestStoppedRecording diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestBaseRepositoryAfterStart.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestBaseRepositoryAfterStart.java index 6c4e5b8061559..2e0aceb3825dc 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestBaseRepositoryAfterStart.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestBaseRepositoryAfterStart.java @@ -32,7 +32,7 @@ * @test * @summary Test that it is possible to start a stream against a directory, * specified on command, line before the application starts - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.jfr.api.consumer.streaming.Application diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestBaseRepositoryBeforeStart.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestBaseRepositoryBeforeStart.java index 10f87402778d7..180a00988436d 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestBaseRepositoryBeforeStart.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestBaseRepositoryBeforeStart.java @@ -32,7 +32,7 @@ * @test * @summary Test that it is possible to start a stream against a directory, * specified on command line, after the application starts - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.jfr.api.consumer.streaming.Application diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestBaseRepositoryLastModified.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestBaseRepositoryLastModified.java index 2ca1c474acc83..6a9e8376ed2ba 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestBaseRepositoryLastModified.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestBaseRepositoryLastModified.java @@ -31,7 +31,7 @@ /** * @test * @summary Test that a stream starts against the latest created repository - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.jfr.api.consumer.streaming.Application diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestBaseRepositoryMultipleProcesses.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestBaseRepositoryMultipleProcesses.java index 6bda427b38734..95f6c5d4e5955 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestBaseRepositoryMultipleProcesses.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestBaseRepositoryMultipleProcesses.java @@ -33,7 +33,7 @@ * @summary Test that it is possible to start a stream against a directory, * specified on command line, where multiple processes starts * simultaneously - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.jfr.api.consumer.streaming.Application diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestChunkGap.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestChunkGap.java index 052914f08db21..bf5507815d6d1 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestChunkGap.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestChunkGap.java @@ -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 @@ -35,7 +35,7 @@ * @test * @summary Tests that a stream can gracefully handle chunk being removed in the * middle - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.streaming.TestChunkGap diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestCrossProcessStreaming.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestCrossProcessStreaming.java index 313b5f026e1e2..b4bc1fec8f834 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestCrossProcessStreaming.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestCrossProcessStreaming.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 @@ -42,7 +42,7 @@ * @test * @summary Test scenario where JFR event producer is in a different process * with respect to the JFR event stream consumer. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.attach diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestEmptyChunks.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestEmptyChunks.java index 15de9597d637a..76940a99775c8 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestEmptyChunks.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestEmptyChunks.java @@ -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 @@ -32,7 +32,7 @@ /** * @test * @summary Test that it is possible to iterate over chunk without normal events - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.streaming.TestEmptyChunks diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestEnableEvents.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestEnableEvents.java index 6e68872c464eb..99df63105a248 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestEnableEvents.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestEnableEvents.java @@ -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 @@ -35,7 +35,7 @@ * @test * @summary Verifies that it is possible to stream contents from specified event * settings - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestEventRegistration.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestEventRegistration.java index 1934f4802afe9..d61fb197f75a7 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestEventRegistration.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestEventRegistration.java @@ -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 @@ -33,7 +33,7 @@ /** * @test * @summary Test that it is possible to register new metadata in a chunk - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.streaming.TestEventRegistration diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestFilledChunks.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestFilledChunks.java index 18bfa57a4b18c..423e3969af8e3 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestFilledChunks.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestFilledChunks.java @@ -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 @@ -31,7 +31,7 @@ /** * @test * @summary Test that it is possible to iterate over chunk with normal events - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.streaming.TestFilledChunks diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestFiltering.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestFiltering.java index a591faf34440a..d493a4475be79 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestFiltering.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestFiltering.java @@ -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 @@ -32,7 +32,7 @@ /** * @test * @summary Verifies that it is possible to filter a stream for an event - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.streaming.TestFiltering diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestInProcessMigration.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestInProcessMigration.java index 955226ec3fb24..5b9aeb50fa281 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestInProcessMigration.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestInProcessMigration.java @@ -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 @@ -38,7 +38,7 @@ * @test * @summary Verifies that is possible to stream from an in-process repository * that is being moved. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.consumer.streaming.TestInProcessMigration diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestJVMCrash.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestJVMCrash.java index e1a95380477ea..3586421d41eab 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestJVMCrash.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestJVMCrash.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, 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 @@ -31,7 +31,7 @@ /** * @test * @summary Test that a stream ends/closes when an application crashes. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr jdk.attach java.base/jdk.internal.misc diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestJVMExit.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestJVMExit.java index 27dfb0224c1ac..9485919c8e354 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestJVMExit.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestJVMExit.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 @@ -30,7 +30,7 @@ /** * @test * @summary Test that a stream ends/closes when an application exists. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr jdk.attach java.base/jdk.internal.misc diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestLatestEvent.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestLatestEvent.java index 4515ae9832a01..43c0559d47322 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestLatestEvent.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestLatestEvent.java @@ -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 @@ -44,7 +44,7 @@ /** * @test * @summary Verifies that EventStream::openRepository() read from the latest flush - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.streaming.TestLatestEvent diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestOutOfProcessMigration.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestOutOfProcessMigration.java index a21d5a3fda44a..0067467cf1bb0 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestOutOfProcessMigration.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestOutOfProcessMigration.java @@ -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 @@ -36,7 +36,7 @@ * @test * @summary Verifies that a out-of-process stream is closed when the repository * is changed. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr jdk.attach java.base/jdk.internal.misc diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestRecordingBefore.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestRecordingBefore.java index e79b6de6738e3..c5eca13cef46f 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestRecordingBefore.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestRecordingBefore.java @@ -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 @@ -34,7 +34,7 @@ * @test * @summary Verifies that it is possible to start a stream when there are * already chunk in the repository - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.streaming.TestRecordingBefore diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestRemovedChunks.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestRemovedChunks.java index 05a8d8c5e51a0..f279f3acdfd2a 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestRemovedChunks.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestRemovedChunks.java @@ -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 @@ -32,7 +32,7 @@ /** * @test * @summary Tests that a stream can gracefully handle chunk being removed - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm -Xlog:jfr*=info jdk.jfr.api.consumer.streaming.TestRemovedChunks diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestRepositoryProperty.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestRepositoryProperty.java index e1fa206477f5a..e5151e8a496b3 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestRepositoryProperty.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestRepositoryProperty.java @@ -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 @@ -39,7 +39,7 @@ * @test * @summary Verifies that it is possible to access JFR repository from a system * property - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.attach diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestStartMultiChunk.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestStartMultiChunk.java index baae06b8ec713..fbc27b051b0b8 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestStartMultiChunk.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestStartMultiChunk.java @@ -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 @@ -36,7 +36,7 @@ * @test * @summary Verifies that it is possible to stream contents of ongoing * recordings - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm -Xlog:jfr+system+streaming=trace diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestStartSingleChunk.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestStartSingleChunk.java index b97c8a7645318..92eeb5282c46a 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestStartSingleChunk.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestStartSingleChunk.java @@ -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 @@ -34,7 +34,7 @@ * @test * @summary Verifies that it is possible to stream contents of ongoing * recordings - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm -Xlog:jfr+system+streaming=trace diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestUnstarted.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestUnstarted.java index 998a8681519e5..1e947c092edc5 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestUnstarted.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestUnstarted.java @@ -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 @@ -29,7 +29,7 @@ * @test * @summary Verifies that it is possible to open a stream when a repository doesn't * exists - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.consumer.streaming.TestUnstarted diff --git a/test/jdk/jdk/jfr/api/event/TestAbstractEvent.java b/test/jdk/jdk/jfr/api/event/TestAbstractEvent.java index 1d6ac835be9a4..d1b320b94bffb 100644 --- a/test/jdk/jdk/jfr/api/event/TestAbstractEvent.java +++ b/test/jdk/jdk/jfr/api/event/TestAbstractEvent.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 @@ -38,7 +38,7 @@ /** * @test * @summary Tests that abstract events are not part of metadata - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.TestAbstractEvent diff --git a/test/jdk/jdk/jfr/api/event/TestBeginEnd.java b/test/jdk/jdk/jfr/api/event/TestBeginEnd.java index 698b4f94ca286..4dfafa321ef93 100644 --- a/test/jdk/jdk/jfr/api/event/TestBeginEnd.java +++ b/test/jdk/jdk/jfr/api/event/TestBeginEnd.java @@ -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 @@ -33,7 +33,7 @@ /** * @test * @summary Test for RecordedEvent.getDuration() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.TestBeginEnd diff --git a/test/jdk/jdk/jfr/api/event/TestClinitRegistration.java b/test/jdk/jdk/jfr/api/event/TestClinitRegistration.java index 99a851eba7f5e..099fb8e721606 100644 --- a/test/jdk/jdk/jfr/api/event/TestClinitRegistration.java +++ b/test/jdk/jdk/jfr/api/event/TestClinitRegistration.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 @@ -38,7 +38,7 @@ /** * @test * @summary Test enable/disable event and verify recording has expected events. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.TestClinitRegistration diff --git a/test/jdk/jdk/jfr/api/event/TestClonedEvent.java b/test/jdk/jdk/jfr/api/event/TestClonedEvent.java index adad7269bbd1f..336dee9609932 100644 --- a/test/jdk/jdk/jfr/api/event/TestClonedEvent.java +++ b/test/jdk/jdk/jfr/api/event/TestClonedEvent.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 @@ -36,7 +36,7 @@ /** * @test * @summary Tests that a cloned event can be successfully committed. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.TestClonedEvent diff --git a/test/jdk/jdk/jfr/api/event/TestEnableDisable.java b/test/jdk/jdk/jfr/api/event/TestEnableDisable.java index a953feafabe06..6b7576d74b95c 100644 --- a/test/jdk/jdk/jfr/api/event/TestEnableDisable.java +++ b/test/jdk/jdk/jfr/api/event/TestEnableDisable.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 @@ -37,7 +37,7 @@ /** * @test * @summary Test enable/disable event and verify recording has expected events. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.TestEnableDisable diff --git a/test/jdk/jdk/jfr/api/event/TestEventDuration.java b/test/jdk/jdk/jfr/api/event/TestEventDuration.java index f043ee26c53f8..d8b30f4af8e40 100644 --- a/test/jdk/jdk/jfr/api/event/TestEventDuration.java +++ b/test/jdk/jdk/jfr/api/event/TestEventDuration.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 @@ -32,7 +32,7 @@ /** * @test * @summary Tests that a duration is recorded. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.TestEventDuration diff --git a/test/jdk/jdk/jfr/api/event/TestEventFactory.java b/test/jdk/jdk/jfr/api/event/TestEventFactory.java index 43c89f490b437..4aaf2e749babf 100644 --- a/test/jdk/jdk/jfr/api/event/TestEventFactory.java +++ b/test/jdk/jdk/jfr/api/event/TestEventFactory.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 @@ -38,7 +38,7 @@ /** * @test * @summary EventFactory simple test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.TestEventFactory diff --git a/test/jdk/jdk/jfr/api/event/TestEventFactoryRegisterTwice.java b/test/jdk/jdk/jfr/api/event/TestEventFactoryRegisterTwice.java index ed32b3586c2f8..479de103353f7 100644 --- a/test/jdk/jdk/jfr/api/event/TestEventFactoryRegisterTwice.java +++ b/test/jdk/jdk/jfr/api/event/TestEventFactoryRegisterTwice.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 @@ -34,7 +34,7 @@ /** * @test * @summary Verifies that EventFactory can register the same event twice - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.TestEventFactoryRegisterTwice diff --git a/test/jdk/jdk/jfr/api/event/TestEventFactoryRegistration.java b/test/jdk/jdk/jfr/api/event/TestEventFactoryRegistration.java index 313c8060972e3..15640f56b68db 100644 --- a/test/jdk/jdk/jfr/api/event/TestEventFactoryRegistration.java +++ b/test/jdk/jdk/jfr/api/event/TestEventFactoryRegistration.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 @@ -38,7 +38,7 @@ /** * @test * @summary EventFactory register/unregister API test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.TestEventFactoryRegistration diff --git a/test/jdk/jdk/jfr/api/event/TestExtends.java b/test/jdk/jdk/jfr/api/event/TestExtends.java index eae47911ba091..0121f2ce0911a 100644 --- a/test/jdk/jdk/jfr/api/event/TestExtends.java +++ b/test/jdk/jdk/jfr/api/event/TestExtends.java @@ -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 @@ -35,7 +35,7 @@ /** * @test * @summary Test with event class inheritance - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.TestExtends diff --git a/test/jdk/jdk/jfr/api/event/TestGetDuration.java b/test/jdk/jdk/jfr/api/event/TestGetDuration.java index b25969198edad..c4f6377f2194a 100644 --- a/test/jdk/jdk/jfr/api/event/TestGetDuration.java +++ b/test/jdk/jdk/jfr/api/event/TestGetDuration.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 @@ -37,7 +37,7 @@ /** * @test * @summary Test for RecordedEvent.getDuration() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.TestGetDuration diff --git a/test/jdk/jdk/jfr/api/event/TestIsEnabled.java b/test/jdk/jdk/jfr/api/event/TestIsEnabled.java index a94bea9ba62af..8474646608c5e 100644 --- a/test/jdk/jdk/jfr/api/event/TestIsEnabled.java +++ b/test/jdk/jdk/jfr/api/event/TestIsEnabled.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 @@ -31,7 +31,7 @@ /** * @test * @summary Test Event.isEnabled() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.TestIsEnabled diff --git a/test/jdk/jdk/jfr/api/event/TestIsEnabledMultiple.java b/test/jdk/jdk/jfr/api/event/TestIsEnabledMultiple.java index 66256c69e4b6f..69db35cbf4973 100644 --- a/test/jdk/jdk/jfr/api/event/TestIsEnabledMultiple.java +++ b/test/jdk/jdk/jfr/api/event/TestIsEnabledMultiple.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 @@ -31,7 +31,7 @@ /** * @test * @summary Test Event.isEnabled() with multiple recordings - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.TestIsEnabledMultiple diff --git a/test/jdk/jdk/jfr/api/event/TestOwnCommit.java b/test/jdk/jdk/jfr/api/event/TestOwnCommit.java index 6ca058cfcc4b8..0186d86d82dca 100644 --- a/test/jdk/jdk/jfr/api/event/TestOwnCommit.java +++ b/test/jdk/jdk/jfr/api/event/TestOwnCommit.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 @@ -35,7 +35,7 @@ /** * @test * @summary Use custom event that reuse method names begin, end and commit. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.TestOwnCommit diff --git a/test/jdk/jdk/jfr/api/event/TestShouldCommit.java b/test/jdk/jdk/jfr/api/event/TestShouldCommit.java index f28884b77a2d3..f26bb6c67fcf3 100644 --- a/test/jdk/jdk/jfr/api/event/TestShouldCommit.java +++ b/test/jdk/jdk/jfr/api/event/TestShouldCommit.java @@ -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 @@ -39,7 +39,7 @@ /** * @test * @summary Test jdk.jfr.Event::shouldCommit() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.TestShouldCommit diff --git a/test/jdk/jdk/jfr/api/event/TestStaticEnable.java b/test/jdk/jdk/jfr/api/event/TestStaticEnable.java index b1bc9bdab97f1..e7d116917b1b8 100644 --- a/test/jdk/jdk/jfr/api/event/TestStaticEnable.java +++ b/test/jdk/jdk/jfr/api/event/TestStaticEnable.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 @@ -34,7 +34,7 @@ /** * @test * @summary Enable an event from a static function in the event. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.TestStaticEnable diff --git a/test/jdk/jdk/jfr/api/event/dynamic/TestDynamicAnnotations.java b/test/jdk/jdk/jfr/api/event/dynamic/TestDynamicAnnotations.java index 18fb3cc586533..c98be5bdbe3a2 100644 --- a/test/jdk/jdk/jfr/api/event/dynamic/TestDynamicAnnotations.java +++ b/test/jdk/jdk/jfr/api/event/dynamic/TestDynamicAnnotations.java @@ -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 @@ -51,7 +51,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.dynamic.TestDynamicAnnotations diff --git a/test/jdk/jdk/jfr/api/event/dynamic/TestEventFactory.java b/test/jdk/jdk/jfr/api/event/dynamic/TestEventFactory.java index f61c81bb9ebdf..4385c459e3660 100644 --- a/test/jdk/jdk/jfr/api/event/dynamic/TestEventFactory.java +++ b/test/jdk/jdk/jfr/api/event/dynamic/TestEventFactory.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 @@ -53,7 +53,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.event.dynamic.TestEventFactory diff --git a/test/jdk/jdk/jfr/api/flightrecorder/TestAddListenerTwice.java b/test/jdk/jdk/jfr/api/flightrecorder/TestAddListenerTwice.java index 8b273e9b905cd..3a6d566fb1d1a 100644 --- a/test/jdk/jdk/jfr/api/flightrecorder/TestAddListenerTwice.java +++ b/test/jdk/jdk/jfr/api/flightrecorder/TestAddListenerTwice.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 @@ -29,7 +29,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.flightrecorder.TestAddListenerTwice diff --git a/test/jdk/jdk/jfr/api/flightrecorder/TestAddPeriodicEvent.java b/test/jdk/jdk/jfr/api/flightrecorder/TestAddPeriodicEvent.java index 78950a723da75..d838f31b8d9d9 100644 --- a/test/jdk/jdk/jfr/api/flightrecorder/TestAddPeriodicEvent.java +++ b/test/jdk/jdk/jfr/api/flightrecorder/TestAddPeriodicEvent.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 @@ -36,7 +36,7 @@ /** * @test * @summary - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.flightrecorder.TestAddPeriodicEvent diff --git a/test/jdk/jdk/jfr/api/flightrecorder/TestFlightRecorderListenerRecorderInitialized.java b/test/jdk/jdk/jfr/api/flightrecorder/TestFlightRecorderListenerRecorderInitialized.java index 9f9315ea1c407..72e2e3cc92935 100644 --- a/test/jdk/jdk/jfr/api/flightrecorder/TestFlightRecorderListenerRecorderInitialized.java +++ b/test/jdk/jdk/jfr/api/flightrecorder/TestFlightRecorderListenerRecorderInitialized.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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.flightrecorder.TestFlightRecorderListenerRecorderInitialized diff --git a/test/jdk/jdk/jfr/api/flightrecorder/TestGetEventTypes.java b/test/jdk/jdk/jfr/api/flightrecorder/TestGetEventTypes.java index 8a3abdb3046c2..248a4f385cfcf 100644 --- a/test/jdk/jdk/jfr/api/flightrecorder/TestGetEventTypes.java +++ b/test/jdk/jdk/jfr/api/flightrecorder/TestGetEventTypes.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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm/timeout=600 jdk.jfr.api.flightrecorder.TestGetEventTypes diff --git a/test/jdk/jdk/jfr/api/flightrecorder/TestGetPlatformRecorder.java b/test/jdk/jdk/jfr/api/flightrecorder/TestGetPlatformRecorder.java index bdbf0c53fa26e..52597f81b0d8c 100644 --- a/test/jdk/jdk/jfr/api/flightrecorder/TestGetPlatformRecorder.java +++ b/test/jdk/jdk/jfr/api/flightrecorder/TestGetPlatformRecorder.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 @@ -29,7 +29,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.flightrecorder.TestGetPlatformRecorder diff --git a/test/jdk/jdk/jfr/api/flightrecorder/TestGetRecordings.java b/test/jdk/jdk/jfr/api/flightrecorder/TestGetRecordings.java index d4318134c580e..e0c8f9f0432fd 100644 --- a/test/jdk/jdk/jfr/api/flightrecorder/TestGetRecordings.java +++ b/test/jdk/jdk/jfr/api/flightrecorder/TestGetRecordings.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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.flightrecorder.TestGetRecordings diff --git a/test/jdk/jdk/jfr/api/flightrecorder/TestGetSettings.java b/test/jdk/jdk/jfr/api/flightrecorder/TestGetSettings.java index 68472f04bc418..85aaa177cf4bf 100644 --- a/test/jdk/jdk/jfr/api/flightrecorder/TestGetSettings.java +++ b/test/jdk/jdk/jfr/api/flightrecorder/TestGetSettings.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 @@ -35,7 +35,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.flightrecorder.TestGetSettings diff --git a/test/jdk/jdk/jfr/api/flightrecorder/TestIsAvailable.java b/test/jdk/jdk/jfr/api/flightrecorder/TestIsAvailable.java index 6e2cf4cf94202..9665319e64300 100644 --- a/test/jdk/jdk/jfr/api/flightrecorder/TestIsAvailable.java +++ b/test/jdk/jdk/jfr/api/flightrecorder/TestIsAvailable.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 @@ -28,7 +28,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm -XX:+FlightRecorder jdk.jfr.api.flightrecorder.TestIsAvailable true diff --git a/test/jdk/jdk/jfr/api/flightrecorder/TestIsInitialized.java b/test/jdk/jdk/jfr/api/flightrecorder/TestIsInitialized.java index 8d8dda1eaac3a..ebb6be410458b 100644 --- a/test/jdk/jdk/jfr/api/flightrecorder/TestIsInitialized.java +++ b/test/jdk/jdk/jfr/api/flightrecorder/TestIsInitialized.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 @@ -29,7 +29,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.flightrecorder.TestIsInitialized diff --git a/test/jdk/jdk/jfr/api/flightrecorder/TestListener.java b/test/jdk/jdk/jfr/api/flightrecorder/TestListener.java index f039a60a2457c..90ceadfaf826c 100644 --- a/test/jdk/jdk/jfr/api/flightrecorder/TestListener.java +++ b/test/jdk/jdk/jfr/api/flightrecorder/TestListener.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 @@ -29,7 +29,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.flightrecorder.TestListener diff --git a/test/jdk/jdk/jfr/api/flightrecorder/TestListenerNull.java b/test/jdk/jdk/jfr/api/flightrecorder/TestListenerNull.java index dab7f551af4d4..cab7346fa60ef 100644 --- a/test/jdk/jdk/jfr/api/flightrecorder/TestListenerNull.java +++ b/test/jdk/jdk/jfr/api/flightrecorder/TestListenerNull.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 @@ -29,7 +29,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.flightrecorder.TestListenerNull diff --git a/test/jdk/jdk/jfr/api/flightrecorder/TestPeriodicEventsSameHook.java b/test/jdk/jdk/jfr/api/flightrecorder/TestPeriodicEventsSameHook.java index f6e7f6a234037..5556020dc0f0d 100644 --- a/test/jdk/jdk/jfr/api/flightrecorder/TestPeriodicEventsSameHook.java +++ b/test/jdk/jdk/jfr/api/flightrecorder/TestPeriodicEventsSameHook.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 @@ -29,7 +29,7 @@ /** * @test * @summary Check that an IllegalArgumentException is thrown if event is added twice - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.flightrecorder.TestPeriodicEventsSameHook diff --git a/test/jdk/jdk/jfr/api/flightrecorder/TestRecorderInitializationCallback.java b/test/jdk/jdk/jfr/api/flightrecorder/TestRecorderInitializationCallback.java index ccb2245551bcc..a97b7b865bfd7 100644 --- a/test/jdk/jdk/jfr/api/flightrecorder/TestRecorderInitializationCallback.java +++ b/test/jdk/jdk/jfr/api/flightrecorder/TestRecorderInitializationCallback.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 @@ -33,7 +33,7 @@ /** * @test * @summary Test Flight Recorder initialization callback is only called once - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.flightrecorder.TestRecorderInitializationCallback diff --git a/test/jdk/jdk/jfr/api/flightrecorder/TestRegisterUnregisterEvent.java b/test/jdk/jdk/jfr/api/flightrecorder/TestRegisterUnregisterEvent.java index 2a0088ec52a37..1481750c74c20 100644 --- a/test/jdk/jdk/jfr/api/flightrecorder/TestRegisterUnregisterEvent.java +++ b/test/jdk/jdk/jfr/api/flightrecorder/TestRegisterUnregisterEvent.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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.flightrecorder.TestRegisterUnregisterEvent diff --git a/test/jdk/jdk/jfr/api/flightrecorder/TestSettingsControl.java b/test/jdk/jdk/jfr/api/flightrecorder/TestSettingsControl.java index 0b54f218c43c3..e186db41bc2de 100644 --- a/test/jdk/jdk/jfr/api/flightrecorder/TestSettingsControl.java +++ b/test/jdk/jdk/jfr/api/flightrecorder/TestSettingsControl.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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.flightrecorder.TestSettingsControl diff --git a/test/jdk/jdk/jfr/api/flightrecorder/TestSnapshot.java b/test/jdk/jdk/jfr/api/flightrecorder/TestSnapshot.java index fbb41b7f15798..6070c68236dbd 100644 --- a/test/jdk/jdk/jfr/api/flightrecorder/TestSnapshot.java +++ b/test/jdk/jdk/jfr/api/flightrecorder/TestSnapshot.java @@ -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 @@ -40,7 +40,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.flightrecorder.TestSnapshot diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestCategory.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestCategory.java index 4bb0083a0f35d..dbd33d013ae02 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestCategory.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestCategory.java @@ -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 @@ -32,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestCategory diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestContentType.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestContentType.java index 0c72ae8057159..1c38c21c3ae7e 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestContentType.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestContentType.java @@ -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 @@ -39,7 +39,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestContentType diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestDescription.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestDescription.java index 57d86e85fdec1..6232346b871f6 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestDescription.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestDescription.java @@ -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 @@ -41,7 +41,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestDescription diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestDynamicAnnotation.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestDynamicAnnotation.java index 5b2cae9278191..726ac9070d6ed 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestDynamicAnnotation.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestDynamicAnnotation.java @@ -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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestDynamicAnnotation diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestEnabled.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestEnabled.java index b5e60cedb8a23..3aafd264ff5da 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestEnabled.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestEnabled.java @@ -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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestEnabled diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestExperimental.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestExperimental.java index 3420debafa02d..5f044d34e24ab 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestExperimental.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestExperimental.java @@ -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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestExperimental diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestFieldAnnotations.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestFieldAnnotations.java index 088639b674874..879ba0727f2a8 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestFieldAnnotations.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestFieldAnnotations.java @@ -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 @@ -39,7 +39,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestFieldAnnotations diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestFormatMissingValue.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestFormatMissingValue.java index b7b61d09abac2..90ecb9fa7d8c1 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestFormatMissingValue.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestFormatMissingValue.java @@ -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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Check that event values are properly formatted and sanity check * that extreme values don't throws exceptions * @requires vm.hasJFR diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestHasValue.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestHasValue.java index c5194f1381c59..a2367cc3fe258 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestHasValue.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestHasValue.java @@ -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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestHasValue diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestInheritedAnnotations.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestInheritedAnnotations.java index 16c7f20a9b57c..7434f51ca02cd 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestInheritedAnnotations.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestInheritedAnnotations.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 @@ -48,7 +48,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestInheritedAnnotations diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestLabel.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestLabel.java index ca1b74e10f2e1..0f8f853107286 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestLabel.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestLabel.java @@ -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 @@ -42,7 +42,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestLabel diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestMetadata.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestMetadata.java index 1287aa5e20d49..8939272b0f7b4 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestMetadata.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestMetadata.java @@ -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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestMetadata diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestName.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestName.java index 411f5da67e140..269ddbecc20ee 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestName.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestName.java @@ -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 @@ -45,7 +45,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestName diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestPeriod.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestPeriod.java index 893b1ab4720d9..bf679b05bbf24 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestPeriod.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestPeriod.java @@ -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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestLabel diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestRegistered.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestRegistered.java index 1c1177ac040cc..f9e89c2c12d05 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestRegistered.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestRegistered.java @@ -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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestRegistered diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestRegisteredFalseAndRunning.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestRegisteredFalseAndRunning.java index 95bfbf527e1d8..2f2246ac3364d 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestRegisteredFalseAndRunning.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestRegisteredFalseAndRunning.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 @@ -29,7 +29,7 @@ /** * @test Tests that commit doesn't throw exception when an event has not been registered. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestRegisteredFalseAndRunning diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestRelational.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestRelational.java index 7b2d6e896896e..d52364091752b 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestRelational.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestRelational.java @@ -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 @@ -40,7 +40,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestRelational diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestSimpleMetadataEvent.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestSimpleMetadataEvent.java index 720da6da9ba00..cbb9cc54af664 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestSimpleMetadataEvent.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestSimpleMetadataEvent.java @@ -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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestSimpleMetadataEvent diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestStackFilter.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestStackFilter.java index 2acd369b6cd8f..b7c3a67ae681c 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestStackFilter.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestStackFilter.java @@ -47,7 +47,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @modules jdk.jfr/jdk.jfr.events * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestStackTrace.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestStackTrace.java index 8223d313a08c2..11e651d40cd04 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestStackTrace.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestStackTrace.java @@ -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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestStackTrace diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestThreshold.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestThreshold.java index 2ff1c3410a017..8cbb276c14598 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestThreshold.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestThreshold.java @@ -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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestThreshold diff --git a/test/jdk/jdk/jfr/api/metadata/annotations/TestTypesIdentical.java b/test/jdk/jdk/jfr/api/metadata/annotations/TestTypesIdentical.java index 9faae6ba564cd..7983828152538 100644 --- a/test/jdk/jdk/jfr/api/metadata/annotations/TestTypesIdentical.java +++ b/test/jdk/jdk/jfr/api/metadata/annotations/TestTypesIdentical.java @@ -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 @@ -51,7 +51,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.annotations.TestTypesIdentical diff --git a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetAnnotation.java b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetAnnotation.java index 2af6870af5b53..b4a8e87735f74 100644 --- a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetAnnotation.java +++ b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetAnnotation.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 @@ -36,7 +36,7 @@ /** * @test * @summary Test getAnnotations() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.eventtype.TestGetAnnotation diff --git a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetAnnotationElements.java b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetAnnotationElements.java index 34b84779d3e6c..0ce8767f8c1d7 100644 --- a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetAnnotationElements.java +++ b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetAnnotationElements.java @@ -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 @@ -63,7 +63,7 @@ /** * @test * @summary Test for AnnotationElement.getAnnotationElements() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.eventtype.TestGetAnnotationElements diff --git a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetAnnotations.java b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetAnnotations.java index 895f9f4050fec..b86ef6dafaca3 100644 --- a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetAnnotations.java +++ b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetAnnotations.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 @@ -38,7 +38,7 @@ /** * @test * @summary Test getAnnotations() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.eventtype.TestGetAnnotations diff --git a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetCategory.java b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetCategory.java index ec92be1eb4e50..d4b70ff18b0bd 100644 --- a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetCategory.java +++ b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetCategory.java @@ -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 @@ -33,7 +33,7 @@ /** * @test * @summary Test setName(). - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.eventtype.TestGetCategory diff --git a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetDefaultValues.java b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetDefaultValues.java index be7264966c3e9..a5664af148407 100644 --- a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetDefaultValues.java +++ b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetDefaultValues.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 @@ -32,7 +32,7 @@ /** * @test * @summary Test getDefaultValues() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.metadata.eventtype.TestGetDefaultValues diff --git a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetDescription.java b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetDescription.java index 19eb83fcf6ec0..91732ed9a9b02 100644 --- a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetDescription.java +++ b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetDescription.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 @@ -37,7 +37,7 @@ /** * @test * @summary Test descriptive annotations for EventType - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.eventtype.TestGetDescription diff --git a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetEventType.java b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetEventType.java index 4dbd2e7cc6f0c..9e7571577a9ef 100644 --- a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetEventType.java +++ b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetEventType.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 @@ -30,7 +30,7 @@ /** * @test * @summary Test getEventType() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.eventtype.TestGetEventType diff --git a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetField.java b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetField.java index 28a39d649f7d9..aec07fdd136a8 100644 --- a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetField.java +++ b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetField.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 @@ -31,7 +31,7 @@ /** * @test * @summary Test getField() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.eventtype.TestGetField diff --git a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetFields.java b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetFields.java index 237239b603532..1c8d98132f561 100644 --- a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetFields.java +++ b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetFields.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 @@ -34,7 +34,7 @@ /** * @test * @summary Test getFields() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.eventtype.TestGetFields diff --git a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetSettings.java b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetSettings.java index f47d451edfb9b..ab5cccf8bd8bc 100644 --- a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetSettings.java +++ b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetSettings.java @@ -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 @@ -32,7 +32,7 @@ /** * @test * @summary Test getSettings() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.metadata.eventtype.TestGetSettings diff --git a/test/jdk/jdk/jfr/api/metadata/eventtype/TestUnloadingEventClass.java b/test/jdk/jdk/jfr/api/metadata/eventtype/TestUnloadingEventClass.java index d86a9d10452a5..07daab8fa4559 100644 --- a/test/jdk/jdk/jfr/api/metadata/eventtype/TestUnloadingEventClass.java +++ b/test/jdk/jdk/jfr/api/metadata/eventtype/TestUnloadingEventClass.java @@ -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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Test that verifies event metadata is removed when an event class is unloaded. * @requires vm.hasJFR * diff --git a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestDefaultValue.java b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestDefaultValue.java index 8ded0a5830d34..c88b21013484b 100644 --- a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestDefaultValue.java +++ b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestDefaultValue.java @@ -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 @@ -30,7 +30,7 @@ /** * @test * @summary Test SettingDescriptor.getName() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.metadata.settingdescriptor.TestDefaultValue diff --git a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetAnnotation.java b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetAnnotation.java index 70d58074fcb21..8c45e82c3cb42 100644 --- a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetAnnotation.java +++ b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetAnnotation.java @@ -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 @@ -34,7 +34,7 @@ /** * @test * @summary Test SettingDescriptor.getAnnotation(); - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.metadata.settingdescriptor.TestGetAnnotation diff --git a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetAnnotationElement.java b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetAnnotationElement.java index 74ffad14b727f..91a490e24c94c 100644 --- a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetAnnotationElement.java +++ b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetAnnotationElement.java @@ -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 @@ -37,7 +37,7 @@ /** * @test * @summary Test SettingDescriptor.getAnnotationElements() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.metadata.settingdescriptor.TestGetAnnotationElement diff --git a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetContentType.java b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetContentType.java index 2af0bb3af11b8..ba8e25dd44939 100644 --- a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetContentType.java +++ b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetContentType.java @@ -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 @@ -35,7 +35,7 @@ /** * @test * @summary Test SettingDescriptor.getContentType() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.metadata.settingdescriptor.TestGetDescription diff --git a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetDescription.java b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetDescription.java index 2e23b17962ad4..1b91361771425 100644 --- a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetDescription.java +++ b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetDescription.java @@ -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 @@ -32,7 +32,7 @@ /** * @test * @summary Test SettingDescriptor.getDescription() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.metadata.settingdescriptor.TestGetDescription diff --git a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetLabel.java b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetLabel.java index 961261bae196f..19b9f72c1d5c0 100644 --- a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetLabel.java +++ b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetLabel.java @@ -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 @@ -32,7 +32,7 @@ /** * @test * @summary Test SettingDescriptor.getLabel() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.metadata.settingdescriptor.TestGetLabel diff --git a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetName.java b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetName.java index 38b1fcb8085a2..f9ddc217bb73a 100644 --- a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetName.java +++ b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetName.java @@ -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 @@ -29,7 +29,7 @@ /** * @test * @summary Test SettingDescriptor.getName() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.metadata.settingdescriptor.TestGetName diff --git a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetTypeId.java b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetTypeId.java index b1d123855bf1d..16d35f8d5c73f 100644 --- a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetTypeId.java +++ b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetTypeId.java @@ -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 @@ -30,7 +30,7 @@ /** * @test * @summary Test SettingDescriptor.getTypeId() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.metadata.settingdescriptor.TestGetTypeId diff --git a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetTypeName.java b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetTypeName.java index 20d1ea957ecc3..98c7a3c0d0b5b 100644 --- a/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetTypeName.java +++ b/test/jdk/jdk/jfr/api/metadata/settingdescriptor/TestGetTypeName.java @@ -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 @@ -30,7 +30,7 @@ /** * @test * @summary Test SettingDescriptor.getTypeName(); - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.metadata.settingdescriptor.TestGetTypeName diff --git a/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestClasses.java b/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestClasses.java index 477beeab3b5d9..851ed0da7afaf 100644 --- a/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestClasses.java +++ b/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestClasses.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 @@ -34,7 +34,7 @@ /** * @test * @summary Test ValueDescriptor.getAnnotations() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.valuedescriptor.TestClasses diff --git a/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestConstructor.java b/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestConstructor.java index 056f216d677f5..c8d33bc000430 100644 --- a/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestConstructor.java +++ b/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestConstructor.java @@ -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 @@ -34,7 +34,7 @@ /** * @test * @summary Test ValueDescriptor.getAnnotations() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.valuedescriptor.TestConstructor diff --git a/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestGetAnnotations.java b/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestGetAnnotations.java index bc2a227a8f5ee..eefbb876c8b18 100644 --- a/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestGetAnnotations.java +++ b/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestGetAnnotations.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 @@ -38,7 +38,7 @@ /** * @test * @summary Test ValueDescriptor.getAnnotations() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.valuedescriptor.TestGetAnnotations diff --git a/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestGetFields.java b/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestGetFields.java index 0576615ba225a..a965e046643e3 100644 --- a/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestGetFields.java +++ b/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestGetFields.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 @@ -29,7 +29,7 @@ /** * @test * @summary Test ValueDescriptor.getAnnotations() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.valuedescriptor.TestGetFields diff --git a/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestIsArray.java b/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestIsArray.java index 983d7e29d5ca2..d3a002ea0161d 100644 --- a/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestIsArray.java +++ b/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestIsArray.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 @@ -31,7 +31,7 @@ /** * @test * @summary Test ValueDescriptor.isArray(). - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.valuedescriptor.TestIsArray diff --git a/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestSimpleTypes.java b/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestSimpleTypes.java index cf506197a1836..c75737426a39c 100644 --- a/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestSimpleTypes.java +++ b/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestSimpleTypes.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 @@ -39,7 +39,7 @@ /** * @test * @summary Test all basic types in ValueDescriptor. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.valuedescriptor.TestSimpleTypes diff --git a/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestValueDescriptorContentType.java b/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestValueDescriptorContentType.java index 73acc71db68f9..cc5f8e8256447 100644 --- a/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestValueDescriptorContentType.java +++ b/test/jdk/jdk/jfr/api/metadata/valuedescriptor/TestValueDescriptorContentType.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 @@ -38,7 +38,7 @@ /** * @test * @summary Test ValueDescriptor.getContentType() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.metadata.valuedescriptor.TestValueDescriptorContentType diff --git a/test/jdk/jdk/jfr/api/recorder/TestRecorderInitialized.java b/test/jdk/jdk/jfr/api/recorder/TestRecorderInitialized.java index c4f48b9ce7987..bc791e6cb3305 100644 --- a/test/jdk/jdk/jfr/api/recorder/TestRecorderInitialized.java +++ b/test/jdk/jdk/jfr/api/recorder/TestRecorderInitialized.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 @@ -29,7 +29,7 @@ /** * @test TestRecorderListener - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * diff --git a/test/jdk/jdk/jfr/api/recorder/TestRecorderListener.java b/test/jdk/jdk/jfr/api/recorder/TestRecorderListener.java index c6a1e853771ac..87790b57392bc 100644 --- a/test/jdk/jdk/jfr/api/recorder/TestRecorderListener.java +++ b/test/jdk/jdk/jfr/api/recorder/TestRecorderListener.java @@ -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 @@ -32,7 +32,7 @@ /** * @test TestRecorderListener * - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @run main/othervm jdk.jfr.api.recorder.TestRecorderListener */ diff --git a/test/jdk/jdk/jfr/api/recorder/TestRecorderListenerWithDump.java b/test/jdk/jdk/jfr/api/recorder/TestRecorderListenerWithDump.java index 0053c71019551..74d1f632ac541 100644 --- a/test/jdk/jdk/jfr/api/recorder/TestRecorderListenerWithDump.java +++ b/test/jdk/jdk/jfr/api/recorder/TestRecorderListenerWithDump.java @@ -9,7 +9,7 @@ /** * @test TestRecorderListenerWithDump * - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @run main/othervm jdk.jfr.api.recorder.TestRecorderListenerWithDump */ diff --git a/test/jdk/jdk/jfr/api/recorder/TestStartStopRecording.java b/test/jdk/jdk/jfr/api/recorder/TestStartStopRecording.java index 4f78f6888e29c..1b923ab8ad282 100644 --- a/test/jdk/jdk/jfr/api/recorder/TestStartStopRecording.java +++ b/test/jdk/jdk/jfr/api/recorder/TestStartStopRecording.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 @@ -35,7 +35,7 @@ /** * @test TestStartStopRecording * - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recorder.TestStartStopRecording diff --git a/test/jdk/jdk/jfr/api/recording/destination/TestDestFileExist.java b/test/jdk/jdk/jfr/api/recording/destination/TestDestFileExist.java index 42f5e277cedf3..22df06e164aad 100644 --- a/test/jdk/jdk/jfr/api/recording/destination/TestDestFileExist.java +++ b/test/jdk/jdk/jfr/api/recording/destination/TestDestFileExist.java @@ -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 @@ -39,7 +39,7 @@ /** * @test * @summary Set destination to an existing file. File should be overwritten. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.destination.TestDestFileExist diff --git a/test/jdk/jdk/jfr/api/recording/destination/TestDestFileReadOnly.java b/test/jdk/jdk/jfr/api/recording/destination/TestDestFileReadOnly.java index d7fc0bdd0aac8..94289f9397803 100644 --- a/test/jdk/jdk/jfr/api/recording/destination/TestDestFileReadOnly.java +++ b/test/jdk/jdk/jfr/api/recording/destination/TestDestFileReadOnly.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 @@ -34,7 +34,7 @@ /** * @test * @summary Set destination to a read-only file. Expects exception. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.destination.TestDestFileReadOnly diff --git a/test/jdk/jdk/jfr/api/recording/destination/TestDestInvalid.java b/test/jdk/jdk/jfr/api/recording/destination/TestDestInvalid.java index 93e2709c222f8..e3c099707f4c2 100644 --- a/test/jdk/jdk/jfr/api/recording/destination/TestDestInvalid.java +++ b/test/jdk/jdk/jfr/api/recording/destination/TestDestInvalid.java @@ -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 @@ -40,7 +40,7 @@ /** * @test * @summary Test setDestination to invalid paths - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.destination.TestDestInvalid diff --git a/test/jdk/jdk/jfr/api/recording/destination/TestDestLongPath.java b/test/jdk/jdk/jfr/api/recording/destination/TestDestLongPath.java index 9ab67cfc02e86..045362bea1443 100644 --- a/test/jdk/jdk/jfr/api/recording/destination/TestDestLongPath.java +++ b/test/jdk/jdk/jfr/api/recording/destination/TestDestLongPath.java @@ -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 @@ -38,7 +38,7 @@ /** * @test * @summary Set destination to a long path - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.destination.TestDestLongPath diff --git a/test/jdk/jdk/jfr/api/recording/destination/TestDestMultiple.java b/test/jdk/jdk/jfr/api/recording/destination/TestDestMultiple.java index bf7d3f3b0fbf5..4e3eef91c8563 100644 --- a/test/jdk/jdk/jfr/api/recording/destination/TestDestMultiple.java +++ b/test/jdk/jdk/jfr/api/recording/destination/TestDestMultiple.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 @@ -38,7 +38,7 @@ /** * @test * @summary Test setDestination with concurrent recordings - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm -Xlog:jfr=trace jdk.jfr.api.recording.destination.TestDestMultiple diff --git a/test/jdk/jdk/jfr/api/recording/destination/TestDestReadOnly.java b/test/jdk/jdk/jfr/api/recording/destination/TestDestReadOnly.java index 8c4a132cb7102..b6b2ddd8ce305 100644 --- a/test/jdk/jdk/jfr/api/recording/destination/TestDestReadOnly.java +++ b/test/jdk/jdk/jfr/api/recording/destination/TestDestReadOnly.java @@ -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 @@ -41,7 +41,7 @@ /** * @test * @summary Test setDestination to read-only dir - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.destination.TestDestReadOnly diff --git a/test/jdk/jdk/jfr/api/recording/destination/TestDestState.java b/test/jdk/jdk/jfr/api/recording/destination/TestDestState.java index 99ded47f5ea9e..233d898be10b2 100644 --- a/test/jdk/jdk/jfr/api/recording/destination/TestDestState.java +++ b/test/jdk/jdk/jfr/api/recording/destination/TestDestState.java @@ -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 @@ -37,7 +37,7 @@ /** * @test * @summary Call setDestination() when recording in different states - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.destination.TestDestState diff --git a/test/jdk/jdk/jfr/api/recording/destination/TestDestToDiskFalse.java b/test/jdk/jdk/jfr/api/recording/destination/TestDestToDiskFalse.java index 4930916a1d95b..1f264af21f80d 100644 --- a/test/jdk/jdk/jfr/api/recording/destination/TestDestToDiskFalse.java +++ b/test/jdk/jdk/jfr/api/recording/destination/TestDestToDiskFalse.java @@ -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 @@ -40,7 +40,7 @@ /** * @test * @summary Basic test for setDestination with disk=false - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.destination.TestDestToDiskFalse diff --git a/test/jdk/jdk/jfr/api/recording/destination/TestDestToDiskTrue.java b/test/jdk/jdk/jfr/api/recording/destination/TestDestToDiskTrue.java index 3684c6e65e8bb..b685c2c17bd2b 100644 --- a/test/jdk/jdk/jfr/api/recording/destination/TestDestToDiskTrue.java +++ b/test/jdk/jdk/jfr/api/recording/destination/TestDestToDiskTrue.java @@ -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 @@ -39,7 +39,7 @@ /** * @test * @summary Basic test for setDestination with disk=true - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.destination.TestDestToDiskTrue diff --git a/test/jdk/jdk/jfr/api/recording/destination/TestDestWithDuration.java b/test/jdk/jdk/jfr/api/recording/destination/TestDestWithDuration.java index ba305a18c2a56..eb9226fa2d8eb 100644 --- a/test/jdk/jdk/jfr/api/recording/destination/TestDestWithDuration.java +++ b/test/jdk/jdk/jfr/api/recording/destination/TestDestWithDuration.java @@ -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 @@ -40,7 +40,7 @@ /** * @test * @summary Test that recording is auto closed after duration - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.destination.TestDestWithDuration diff --git a/test/jdk/jdk/jfr/api/recording/dump/TestDump.java b/test/jdk/jdk/jfr/api/recording/dump/TestDump.java index 36706ecde3a31..1818cacca2062 100644 --- a/test/jdk/jdk/jfr/api/recording/dump/TestDump.java +++ b/test/jdk/jdk/jfr/api/recording/dump/TestDump.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 @@ -35,7 +35,7 @@ /** * @test * @summary Test copyTo and parse file - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.dump.TestDump diff --git a/test/jdk/jdk/jfr/api/recording/dump/TestDumpDevNull.java b/test/jdk/jdk/jfr/api/recording/dump/TestDumpDevNull.java index d74dd7fede294..b83f96868686a 100644 --- a/test/jdk/jdk/jfr/api/recording/dump/TestDumpDevNull.java +++ b/test/jdk/jdk/jfr/api/recording/dump/TestDumpDevNull.java @@ -29,7 +29,7 @@ /** * @test * @summary Tests that it's possible to dump to /dev/null without a livelock - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR & (os.family != "windows") * @library /test/lib * @run main/othervm -Xlog:jfr jdk.jfr.api.recording.dump.TestDumpDevNull diff --git a/test/jdk/jdk/jfr/api/recording/dump/TestDumpInvalid.java b/test/jdk/jdk/jfr/api/recording/dump/TestDumpInvalid.java index 7b69f552afe7d..41250336d8998 100644 --- a/test/jdk/jdk/jfr/api/recording/dump/TestDumpInvalid.java +++ b/test/jdk/jdk/jfr/api/recording/dump/TestDumpInvalid.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 @@ -38,7 +38,7 @@ /** * @test * @summary Test copyTo and parse file - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.dump.TestDumpInvalid diff --git a/test/jdk/jdk/jfr/api/recording/dump/TestDumpLongPath.java b/test/jdk/jdk/jfr/api/recording/dump/TestDumpLongPath.java index a1d2f714f4eee..d3b08cc8e048d 100644 --- a/test/jdk/jdk/jfr/api/recording/dump/TestDumpLongPath.java +++ b/test/jdk/jdk/jfr/api/recording/dump/TestDumpLongPath.java @@ -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 @@ -38,7 +38,7 @@ /** * @test * @summary Test copyTo and parse file - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.dump.TestDumpLongPath diff --git a/test/jdk/jdk/jfr/api/recording/dump/TestDumpMultiple.java b/test/jdk/jdk/jfr/api/recording/dump/TestDumpMultiple.java index 3eab84cb44af3..2b14700e179b1 100644 --- a/test/jdk/jdk/jfr/api/recording/dump/TestDumpMultiple.java +++ b/test/jdk/jdk/jfr/api/recording/dump/TestDumpMultiple.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 @@ -37,7 +37,7 @@ /** * @test * @summary Test copyTo and parse file - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.dump.TestDumpMultiple diff --git a/test/jdk/jdk/jfr/api/recording/dump/TestDumpReadOnly.java b/test/jdk/jdk/jfr/api/recording/dump/TestDumpReadOnly.java index 8ffbfa75952f8..9e05d8a2037ed 100644 --- a/test/jdk/jdk/jfr/api/recording/dump/TestDumpReadOnly.java +++ b/test/jdk/jdk/jfr/api/recording/dump/TestDumpReadOnly.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 @@ -36,7 +36,7 @@ /** * @test * @summary Test copyTo and parse file - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.dump.TestDumpReadOnly diff --git a/test/jdk/jdk/jfr/api/recording/dump/TestDumpState.java b/test/jdk/jdk/jfr/api/recording/dump/TestDumpState.java index 7b464ff85b18b..b315117f726da 100644 --- a/test/jdk/jdk/jfr/api/recording/dump/TestDumpState.java +++ b/test/jdk/jdk/jfr/api/recording/dump/TestDumpState.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 @@ -43,7 +43,7 @@ /** * @test * @summary call copyTo() with recording in all states. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.dump.TestDumpState diff --git a/test/jdk/jdk/jfr/api/recording/event/TestChunkPeriod.java b/test/jdk/jdk/jfr/api/recording/event/TestChunkPeriod.java index 71ffa1f3a9f3b..9ce6af5861577 100644 --- a/test/jdk/jdk/jfr/api/recording/event/TestChunkPeriod.java +++ b/test/jdk/jdk/jfr/api/recording/event/TestChunkPeriod.java @@ -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 @@ -38,7 +38,7 @@ /** * @test * @summary Test periodic setting that involves chunks. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.event.TestChunkPeriod diff --git a/test/jdk/jdk/jfr/api/recording/event/TestEnableClass.java b/test/jdk/jdk/jfr/api/recording/event/TestEnableClass.java index ea14efd1ce93f..cce06973d1c05 100644 --- a/test/jdk/jdk/jfr/api/recording/event/TestEnableClass.java +++ b/test/jdk/jdk/jfr/api/recording/event/TestEnableClass.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 @@ -29,7 +29,7 @@ /** * @test * @summary Simple enable Event class. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.event.TestEnableClass diff --git a/test/jdk/jdk/jfr/api/recording/event/TestEnableName.java b/test/jdk/jdk/jfr/api/recording/event/TestEnableName.java index c513fa64466ac..a1647918abb6e 100644 --- a/test/jdk/jdk/jfr/api/recording/event/TestEnableName.java +++ b/test/jdk/jdk/jfr/api/recording/event/TestEnableName.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 @@ -36,7 +36,7 @@ /** * @test * @summary Simple enable Event class. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.event.TestEnableName diff --git a/test/jdk/jdk/jfr/api/recording/event/TestEventTime.java b/test/jdk/jdk/jfr/api/recording/event/TestEventTime.java index 7ee9748520a79..54c735fff6963 100644 --- a/test/jdk/jdk/jfr/api/recording/event/TestEventTime.java +++ b/test/jdk/jdk/jfr/api/recording/event/TestEventTime.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 @@ -39,7 +39,7 @@ /** * @test * @summary Test getStartTime() and getEndTime(). Verify startTime <= endTime - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.event.TestEventTime diff --git a/test/jdk/jdk/jfr/api/recording/event/TestLoadEventAfterStart.java b/test/jdk/jdk/jfr/api/recording/event/TestLoadEventAfterStart.java index 4bd96871b454e..0586389d86a15 100644 --- a/test/jdk/jdk/jfr/api/recording/event/TestLoadEventAfterStart.java +++ b/test/jdk/jdk/jfr/api/recording/event/TestLoadEventAfterStart.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 @@ -37,7 +37,7 @@ /** * @test * @summary Load event class after recording started. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.test.lib.jfr.SimpleEvent diff --git a/test/jdk/jdk/jfr/api/recording/event/TestPeriod.java b/test/jdk/jdk/jfr/api/recording/event/TestPeriod.java index a3a76953fff08..e667fe010ef56 100644 --- a/test/jdk/jdk/jfr/api/recording/event/TestPeriod.java +++ b/test/jdk/jdk/jfr/api/recording/event/TestPeriod.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 @@ -36,7 +36,7 @@ /** * @test * @summary Test periodic events. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.event.TestPeriod diff --git a/test/jdk/jdk/jfr/api/recording/event/TestReEnableClass.java b/test/jdk/jdk/jfr/api/recording/event/TestReEnableClass.java index 57d274abaa774..82631f5dcfefd 100644 --- a/test/jdk/jdk/jfr/api/recording/event/TestReEnableClass.java +++ b/test/jdk/jdk/jfr/api/recording/event/TestReEnableClass.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 @@ -32,7 +32,7 @@ /** * @test * @summary Enable, disable, enable event during recording. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.event.TestReEnableClass diff --git a/test/jdk/jdk/jfr/api/recording/event/TestReEnableMultiple.java b/test/jdk/jdk/jfr/api/recording/event/TestReEnableMultiple.java index 4bbd0714c08f8..392450ee92ef0 100644 --- a/test/jdk/jdk/jfr/api/recording/event/TestReEnableMultiple.java +++ b/test/jdk/jdk/jfr/api/recording/event/TestReEnableMultiple.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 @@ -40,7 +40,7 @@ /** * @test * @summary Enable, disable, enable event during recording. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.event.TestReEnableMultiple diff --git a/test/jdk/jdk/jfr/api/recording/event/TestReEnableName.java b/test/jdk/jdk/jfr/api/recording/event/TestReEnableName.java index 45f254956d6ab..3b6092f384cb0 100644 --- a/test/jdk/jdk/jfr/api/recording/event/TestReEnableName.java +++ b/test/jdk/jdk/jfr/api/recording/event/TestReEnableName.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 @@ -36,7 +36,7 @@ /** * @test * @summary Enable/disable event by name during recording. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.event.TestReEnableName diff --git a/test/jdk/jdk/jfr/api/recording/event/TestRecordingEnableDisable.java b/test/jdk/jdk/jfr/api/recording/event/TestRecordingEnableDisable.java index dd9d5089ae4d9..e0751c98aa9e1 100644 --- a/test/jdk/jdk/jfr/api/recording/event/TestRecordingEnableDisable.java +++ b/test/jdk/jdk/jfr/api/recording/event/TestRecordingEnableDisable.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 @@ -37,7 +37,7 @@ /** * @test * @summary Enable, disable, enable event during recording. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.event.TestRecordingEnableDisable diff --git a/test/jdk/jdk/jfr/api/recording/event/TestShortPeriod.java b/test/jdk/jdk/jfr/api/recording/event/TestShortPeriod.java index e53fd90a75cac..a7c6d995bfb39 100644 --- a/test/jdk/jdk/jfr/api/recording/event/TestShortPeriod.java +++ b/test/jdk/jdk/jfr/api/recording/event/TestShortPeriod.java @@ -33,7 +33,7 @@ /** * @test Tests that periodic events are not disabled when using a very short * period - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.recording.event.TestShortPeriod diff --git a/test/jdk/jdk/jfr/api/recording/event/TestThreshold.java b/test/jdk/jdk/jfr/api/recording/event/TestThreshold.java index a0b42f66b892b..fdde42cdf5ad2 100644 --- a/test/jdk/jdk/jfr/api/recording/event/TestThreshold.java +++ b/test/jdk/jdk/jfr/api/recording/event/TestThreshold.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 @@ -35,7 +35,7 @@ /** * @test * @summary Test event threshold. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.event.TestThreshold diff --git a/test/jdk/jdk/jfr/api/recording/misc/TestGetId.java b/test/jdk/jdk/jfr/api/recording/misc/TestGetId.java index de4d17a741c45..979a59c7ca011 100644 --- a/test/jdk/jdk/jfr/api/recording/misc/TestGetId.java +++ b/test/jdk/jdk/jfr/api/recording/misc/TestGetId.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 @@ -32,7 +32,7 @@ /** * @test * @summary Verify that each recording get unique a id - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.misc.TestGetId diff --git a/test/jdk/jdk/jfr/api/recording/misc/TestGetSize.java b/test/jdk/jdk/jfr/api/recording/misc/TestGetSize.java index dc2176f59019d..ba540e6ae40c2 100644 --- a/test/jdk/jdk/jfr/api/recording/misc/TestGetSize.java +++ b/test/jdk/jdk/jfr/api/recording/misc/TestGetSize.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 @@ -36,7 +36,7 @@ /** * @test * @summary Test recording file size with Recording.getSize() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.misc.TestGetSize diff --git a/test/jdk/jdk/jfr/api/recording/misc/TestGetSizeToMem.java b/test/jdk/jdk/jfr/api/recording/misc/TestGetSizeToMem.java index 2b7ad3d4e6b2d..4529c9059c55f 100644 --- a/test/jdk/jdk/jfr/api/recording/misc/TestGetSizeToMem.java +++ b/test/jdk/jdk/jfr/api/recording/misc/TestGetSizeToMem.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 @@ -37,7 +37,7 @@ /** * @test * @summary Test recording file size with Recording.getSize() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.misc.TestGetSizeToMem diff --git a/test/jdk/jdk/jfr/api/recording/misc/TestGetStream.java b/test/jdk/jdk/jfr/api/recording/misc/TestGetStream.java index 3b353d0968be8..3db2549019974 100644 --- a/test/jdk/jdk/jfr/api/recording/misc/TestGetStream.java +++ b/test/jdk/jdk/jfr/api/recording/misc/TestGetStream.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 @@ -44,7 +44,7 @@ /** * @test * @summary A simple test for Recording.getStream() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.misc.TestGetStream diff --git a/test/jdk/jdk/jfr/api/recording/misc/TestRecordingBase.java b/test/jdk/jdk/jfr/api/recording/misc/TestRecordingBase.java index a17a7eb9959a0..4122a203db1f5 100644 --- a/test/jdk/jdk/jfr/api/recording/misc/TestRecordingBase.java +++ b/test/jdk/jdk/jfr/api/recording/misc/TestRecordingBase.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 @@ -41,7 +41,7 @@ /** * @test * @summary Basic tests for Recording - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.misc.TestRecordingBase diff --git a/test/jdk/jdk/jfr/api/recording/misc/TestRecordingCopy.java b/test/jdk/jdk/jfr/api/recording/misc/TestRecordingCopy.java index 8d539ed68c4e1..1234655f31ac7 100644 --- a/test/jdk/jdk/jfr/api/recording/misc/TestRecordingCopy.java +++ b/test/jdk/jdk/jfr/api/recording/misc/TestRecordingCopy.java @@ -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 @@ -36,7 +36,7 @@ /** * @test * @summary A simple test for Recording.copy() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.misc.TestRecordingCopy diff --git a/test/jdk/jdk/jfr/api/recording/options/TestDuration.java b/test/jdk/jdk/jfr/api/recording/options/TestDuration.java index 8f231ab77a038..d0bb1938f6b61 100644 --- a/test/jdk/jdk/jfr/api/recording/options/TestDuration.java +++ b/test/jdk/jdk/jfr/api/recording/options/TestDuration.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 @@ -34,7 +34,7 @@ /** * @test * @summary Test setDuration(). Verify recording is stopped automatically. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.options.TestDuration diff --git a/test/jdk/jdk/jfr/api/recording/options/TestName.java b/test/jdk/jdk/jfr/api/recording/options/TestName.java index c0042b4458ab1..a1b1747c70029 100644 --- a/test/jdk/jdk/jfr/api/recording/options/TestName.java +++ b/test/jdk/jdk/jfr/api/recording/options/TestName.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 @@ -31,7 +31,7 @@ /** * @test * @summary Test setName(). - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.options.TestName diff --git a/test/jdk/jdk/jfr/api/recording/settings/TestConfigurationGetContents.java b/test/jdk/jdk/jfr/api/recording/settings/TestConfigurationGetContents.java index 9365c7cf13ee7..ceea62bed2a71 100644 --- a/test/jdk/jdk/jfr/api/recording/settings/TestConfigurationGetContents.java +++ b/test/jdk/jdk/jfr/api/recording/settings/TestConfigurationGetContents.java @@ -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 @@ -33,7 +33,7 @@ /** * @test * @summary Verifies Configuration.getContents() for every configuration - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.settings.TestConfigurationGetContents diff --git a/test/jdk/jdk/jfr/api/recording/settings/TestCreateConfigFromPath.java b/test/jdk/jdk/jfr/api/recording/settings/TestCreateConfigFromPath.java index b64d0055dcb24..bd46c75c18be8 100644 --- a/test/jdk/jdk/jfr/api/recording/settings/TestCreateConfigFromPath.java +++ b/test/jdk/jdk/jfr/api/recording/settings/TestCreateConfigFromPath.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 @@ -36,7 +36,7 @@ /** * @test * @summary Test setName(). - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.settings.TestCreateConfigFromPath diff --git a/test/jdk/jdk/jfr/api/recording/settings/TestCreateConfigFromReader.java b/test/jdk/jdk/jfr/api/recording/settings/TestCreateConfigFromReader.java index e96fab76899fc..219a100385291 100644 --- a/test/jdk/jdk/jfr/api/recording/settings/TestCreateConfigFromReader.java +++ b/test/jdk/jdk/jfr/api/recording/settings/TestCreateConfigFromReader.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 @@ -36,7 +36,7 @@ /** * @test * @summary Test setName(). - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.settings.TestCreateConfigFromReader diff --git a/test/jdk/jdk/jfr/api/recording/settings/TestGetConfigurations.java b/test/jdk/jdk/jfr/api/recording/settings/TestGetConfigurations.java index 465a07ab021bd..73b9557591a29 100644 --- a/test/jdk/jdk/jfr/api/recording/settings/TestGetConfigurations.java +++ b/test/jdk/jdk/jfr/api/recording/settings/TestGetConfigurations.java @@ -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 @@ -31,7 +31,7 @@ * @test * @summary Verifies that there is the default config and that it has * the expected parameters - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.settings.TestGetConfigurations diff --git a/test/jdk/jdk/jfr/api/recording/settings/TestSettingsAvailability.java b/test/jdk/jdk/jfr/api/recording/settings/TestSettingsAvailability.java index e5d90e4b80bca..dc22644b4d034 100644 --- a/test/jdk/jdk/jfr/api/recording/settings/TestSettingsAvailability.java +++ b/test/jdk/jdk/jfr/api/recording/settings/TestSettingsAvailability.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 @@ -40,7 +40,7 @@ /** * @test * @summary Verifies that event types has the correct type of settings - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.settings.TestSettingsAvailability diff --git a/test/jdk/jdk/jfr/api/recording/state/TestOptionState.java b/test/jdk/jdk/jfr/api/recording/state/TestOptionState.java index 4e9dd4f2f7217..4b43f0fd5cbc2 100644 --- a/test/jdk/jdk/jfr/api/recording/state/TestOptionState.java +++ b/test/jdk/jdk/jfr/api/recording/state/TestOptionState.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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Test options in different states * @requires vm.hasJFR * @library /test/lib diff --git a/test/jdk/jdk/jfr/api/recording/state/TestState.java b/test/jdk/jdk/jfr/api/recording/state/TestState.java index 5c548977ad79e..724b885d280d8 100644 --- a/test/jdk/jdk/jfr/api/recording/state/TestState.java +++ b/test/jdk/jdk/jfr/api/recording/state/TestState.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 @@ -32,7 +32,7 @@ /** * @test * @summary Test Recording state - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.state.TestState diff --git a/test/jdk/jdk/jfr/api/recording/state/TestStateDuration.java b/test/jdk/jdk/jfr/api/recording/state/TestStateDuration.java index 5e8ef60b36720..ac54d69e4abe8 100644 --- a/test/jdk/jdk/jfr/api/recording/state/TestStateDuration.java +++ b/test/jdk/jdk/jfr/api/recording/state/TestStateDuration.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 @@ -35,7 +35,7 @@ /** * @test * @summary Test Recording state - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.state.TestStateDuration diff --git a/test/jdk/jdk/jfr/api/recording/state/TestStateIdenticalListeners.java b/test/jdk/jdk/jfr/api/recording/state/TestStateIdenticalListeners.java index 216ac64c79c34..295f5b3c0c91b 100644 --- a/test/jdk/jdk/jfr/api/recording/state/TestStateIdenticalListeners.java +++ b/test/jdk/jdk/jfr/api/recording/state/TestStateIdenticalListeners.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 @@ -32,7 +32,7 @@ /** * @test * @summary Test Recording state with concurrent recordings - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.state.TestStateIdenticalListeners diff --git a/test/jdk/jdk/jfr/api/recording/state/TestStateInvalid.java b/test/jdk/jdk/jfr/api/recording/state/TestStateInvalid.java index ba190c68d8538..5108fb0329104 100644 --- a/test/jdk/jdk/jfr/api/recording/state/TestStateInvalid.java +++ b/test/jdk/jdk/jfr/api/recording/state/TestStateInvalid.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 @@ -31,7 +31,7 @@ /** * @test * @summary Test start/stop/close recording from different recording states. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.state.TestStateInvalid diff --git a/test/jdk/jdk/jfr/api/recording/state/TestStateMultiple.java b/test/jdk/jdk/jfr/api/recording/state/TestStateMultiple.java index 21ccd7360742c..9745cab7351ec 100644 --- a/test/jdk/jdk/jfr/api/recording/state/TestStateMultiple.java +++ b/test/jdk/jdk/jfr/api/recording/state/TestStateMultiple.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 @@ -31,7 +31,7 @@ /** * @test * @summary Test Recording state with concurrent recordings - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.state.TestStateMultiple diff --git a/test/jdk/jdk/jfr/api/recording/state/TestStateScheduleStart.java b/test/jdk/jdk/jfr/api/recording/state/TestStateScheduleStart.java index 3708ded56f167..ba95407dad223 100644 --- a/test/jdk/jdk/jfr/api/recording/state/TestStateScheduleStart.java +++ b/test/jdk/jdk/jfr/api/recording/state/TestStateScheduleStart.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 @@ -34,7 +34,7 @@ /** * @test * @summary Test Recording state - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.api.recording.state.TestStateScheduleStart diff --git a/test/jdk/jdk/jfr/api/recording/time/TestTime.java b/test/jdk/jdk/jfr/api/recording/time/TestTime.java index 66e729f7568fa..3ece99b9e466d 100644 --- a/test/jdk/jdk/jfr/api/recording/time/TestTime.java +++ b/test/jdk/jdk/jfr/api/recording/time/TestTime.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 @@ -30,7 +30,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Test Recording.get*Time() * @requires vm.hasJFR * @library /test/lib diff --git a/test/jdk/jdk/jfr/api/recording/time/TestTimeDuration.java b/test/jdk/jdk/jfr/api/recording/time/TestTimeDuration.java index 7f71c0c900471..12b5368db8842 100644 --- a/test/jdk/jdk/jfr/api/recording/time/TestTimeDuration.java +++ b/test/jdk/jdk/jfr/api/recording/time/TestTimeDuration.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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Test Recording.setDuration() and Recording.get*Time() * @requires vm.hasJFR * @library /test/lib diff --git a/test/jdk/jdk/jfr/api/recording/time/TestTimeMultiple.java b/test/jdk/jdk/jfr/api/recording/time/TestTimeMultiple.java index 057d9150b6a74..aab608267b571 100644 --- a/test/jdk/jdk/jfr/api/recording/time/TestTimeMultiple.java +++ b/test/jdk/jdk/jfr/api/recording/time/TestTimeMultiple.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 @@ -30,7 +30,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Test recording times with concurrent recordings * @requires vm.hasJFR * @library /test/lib diff --git a/test/jdk/jdk/jfr/api/recording/time/TestTimeScheduleStart.java b/test/jdk/jdk/jfr/api/recording/time/TestTimeScheduleStart.java index 3698a683c50be..83d8399e41eda 100644 --- a/test/jdk/jdk/jfr/api/recording/time/TestTimeScheduleStart.java +++ b/test/jdk/jdk/jfr/api/recording/time/TestTimeScheduleStart.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 @@ -33,7 +33,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Test Recording.scheduleStart() and Recording.get*Time() * @requires vm.hasJFR * @library /test/lib diff --git a/test/jdk/jdk/jfr/api/settings/TestFilterEvents.java b/test/jdk/jdk/jfr/api/settings/TestFilterEvents.java index 67619fb10b4e9..ed20c44c688b8 100644 --- a/test/jdk/jdk/jfr/api/settings/TestFilterEvents.java +++ b/test/jdk/jdk/jfr/api/settings/TestFilterEvents.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 @@ -35,7 +35,7 @@ /** * @test * @summary The test uses SettingControl - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.settings.TestFilterEvents diff --git a/test/jdk/jdk/jfr/api/settings/TestSettingControl.java b/test/jdk/jdk/jfr/api/settings/TestSettingControl.java index 5543953482d63..ef38626eedb75 100644 --- a/test/jdk/jdk/jfr/api/settings/TestSettingControl.java +++ b/test/jdk/jdk/jfr/api/settings/TestSettingControl.java @@ -44,7 +44,7 @@ /** * @test * @summary Tests that methods on all SettingControls have expected behavior. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.api.settings.TestSettingControl diff --git a/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationInNewTLABEvent.java b/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationInNewTLABEvent.java index 1fe3425372280..9112cfbc247e5 100644 --- a/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationInNewTLABEvent.java +++ b/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationInNewTLABEvent.java @@ -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 @@ -36,7 +36,7 @@ /** * @test * @summary Test that event is triggered when an object is allocated in a new TLAB. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.test.whitebox.WhiteBox diff --git a/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationOutsideTLABEvent.java b/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationOutsideTLABEvent.java index d2f2a3a1bc4da..a7695b7684947 100644 --- a/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationOutsideTLABEvent.java +++ b/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationOutsideTLABEvent.java @@ -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 @@ -36,7 +36,7 @@ /** * @test * @summary Test that when an object is allocated outside a TLAB an event will be triggered. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.test.whitebox.WhiteBox diff --git a/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationSampleEvent.java b/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationSampleEvent.java index 2f7d3cc150303..6f22476bcbf37 100644 --- a/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationSampleEvent.java +++ b/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationSampleEvent.java @@ -33,7 +33,7 @@ /** * @test * @summary Tests ObjectAllocationSampleEvent - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm -XX:+UseTLAB -XX:TLABSize=2k -XX:-ResizeTLAB jdk.jfr.event.allocation.TestObjectAllocationSampleEvent diff --git a/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationSampleEventThrottling.java b/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationSampleEventThrottling.java index a38aae51c01ae..47f5b31f8816d 100644 --- a/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationSampleEventThrottling.java +++ b/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationSampleEventThrottling.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 @@ -38,7 +38,7 @@ /** * @test * @summary Test that when an object is allocated outside a TLAB an event will be triggered. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.test.whitebox.WhiteBox diff --git a/test/jdk/jdk/jfr/event/compiler/TestCodeCacheConfig.java b/test/jdk/jdk/jfr/event/compiler/TestCodeCacheConfig.java index cfc2115d68b6a..defc9cba1be0b 100644 --- a/test/jdk/jdk/jfr/event/compiler/TestCodeCacheConfig.java +++ b/test/jdk/jdk/jfr/event/compiler/TestCodeCacheConfig.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 @@ -34,7 +34,7 @@ /** * @test TestCodeCacheConfig - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.test.whitebox.WhiteBox diff --git a/test/jdk/jdk/jfr/event/compiler/TestCodeCacheStats.java b/test/jdk/jdk/jfr/event/compiler/TestCodeCacheStats.java index 2930b79883e01..2256e6a21fa8b 100644 --- a/test/jdk/jdk/jfr/event/compiler/TestCodeCacheStats.java +++ b/test/jdk/jdk/jfr/event/compiler/TestCodeCacheStats.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.compiler.TestCodeCacheStats diff --git a/test/jdk/jdk/jfr/event/compiler/TestCodeSweeper.java b/test/jdk/jdk/jfr/event/compiler/TestCodeSweeper.java index 62fb137b1cf03..dd227489a0c6e 100644 --- a/test/jdk/jdk/jfr/event/compiler/TestCodeSweeper.java +++ b/test/jdk/jdk/jfr/event/compiler/TestCodeSweeper.java @@ -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 @@ -49,7 +49,7 @@ */ /** * @test TestCodeSweeper - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.test.whitebox.WhiteBox diff --git a/test/jdk/jdk/jfr/event/compiler/TestCompilerCompile.java b/test/jdk/jdk/jfr/event/compiler/TestCompilerCompile.java index e13bcaa80b5cc..d39e006f5caa6 100644 --- a/test/jdk/jdk/jfr/event/compiler/TestCompilerCompile.java +++ b/test/jdk/jdk/jfr/event/compiler/TestCompilerCompile.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,7 +39,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.compMode == "Xmixed" * @library /test/lib diff --git a/test/jdk/jdk/jfr/event/compiler/TestCompilerConfig.java b/test/jdk/jdk/jfr/event/compiler/TestCompilerConfig.java index 0e4834ccfa118..cc5455f98d9de 100644 --- a/test/jdk/jdk/jfr/event/compiler/TestCompilerConfig.java +++ b/test/jdk/jdk/jfr/event/compiler/TestCompilerConfig.java @@ -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 @@ -32,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.compiler.TestCompilerConfig diff --git a/test/jdk/jdk/jfr/event/compiler/TestCompilerInlining.java b/test/jdk/jdk/jfr/event/compiler/TestCompilerInlining.java index 2d0ce579dd810..9694c054f6a0c 100644 --- a/test/jdk/jdk/jfr/event/compiler/TestCompilerInlining.java +++ b/test/jdk/jdk/jfr/event/compiler/TestCompilerInlining.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 @@ -54,7 +54,7 @@ /* * @test CompilerInliningTest * @bug 8073607 - * @key jfr + * @requires vm.flagless * @summary Verifies that corresponding JFR events are emitted in case of inlining. * @requires vm.hasJFR * @requires vm.compMode == "Xmixed" diff --git a/test/jdk/jdk/jfr/event/compiler/TestCompilerPhase.java b/test/jdk/jdk/jfr/event/compiler/TestCompilerPhase.java index 02e235a23cadd..33884d448bff3 100644 --- a/test/jdk/jdk/jfr/event/compiler/TestCompilerPhase.java +++ b/test/jdk/jdk/jfr/event/compiler/TestCompilerPhase.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 @@ -35,7 +35,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.compMode!="Xint" & vm.flavor == "server" & (vm.opt.TieredStopAtLevel == 4 | vm.opt.TieredStopAtLevel == null) * @library /test/lib diff --git a/test/jdk/jdk/jfr/event/compiler/TestCompilerQueueUtilization.java b/test/jdk/jdk/jfr/event/compiler/TestCompilerQueueUtilization.java index 081cb5296d596..d4e4e12eaa3c7 100644 --- a/test/jdk/jdk/jfr/event/compiler/TestCompilerQueueUtilization.java +++ b/test/jdk/jdk/jfr/event/compiler/TestCompilerQueueUtilization.java @@ -32,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.compMode!="Xint" * @library /test/lib diff --git a/test/jdk/jdk/jfr/event/compiler/TestCompilerStats.java b/test/jdk/jdk/jfr/event/compiler/TestCompilerStats.java index 389a7da25b4c5..053aedf94c8bf 100644 --- a/test/jdk/jdk/jfr/event/compiler/TestCompilerStats.java +++ b/test/jdk/jdk/jfr/event/compiler/TestCompilerStats.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2019, 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,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.compiler.TestCompilerStats diff --git a/test/jdk/jdk/jfr/event/compiler/TestDeoptimization.java b/test/jdk/jdk/jfr/event/compiler/TestDeoptimization.java index bd6d57b31762d..eb19965a64413 100644 --- a/test/jdk/jdk/jfr/event/compiler/TestDeoptimization.java +++ b/test/jdk/jdk/jfr/event/compiler/TestDeoptimization.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 @@ -48,7 +48,7 @@ public static void dummyMethod(boolean b) { /** * @test - * @key jfr + * @requires vm.flagless * @summary sanity test for Deoptimization event, depends on Compilation event * @requires vm.hasJFR * @requires vm.compMode == "Xmixed" diff --git a/test/jdk/jdk/jfr/event/diagnostics/TestHeapDump.java b/test/jdk/jdk/jfr/event/diagnostics/TestHeapDump.java index 20577d8257dee..14b0489505811 100644 --- a/test/jdk/jdk/jfr/event/diagnostics/TestHeapDump.java +++ b/test/jdk/jdk/jfr/event/diagnostics/TestHeapDump.java @@ -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 @@ -39,7 +39,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules java.management diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestG1ParallelPhases.java b/test/jdk/jdk/jfr/event/gc/collection/TestG1ParallelPhases.java index 86da3907e9d87..568104a7b50a2 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestG1ParallelPhases.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestG1ParallelPhases.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 @@ -51,7 +51,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "G1" | vm.gc == null * @library /test/lib /test/jdk /test/hotspot/jtreg diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithG1ConcurrentMark.java b/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithG1ConcurrentMark.java index e0ea218a07f0b..3cd8f6612bf44 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithG1ConcurrentMark.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithG1ConcurrentMark.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 @@ -26,7 +26,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "G1" | vm.gc == null diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithG1FullCollection.java b/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithG1FullCollection.java index 308a544adeb17..40c5129eb2303 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithG1FullCollection.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithG1FullCollection.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 @@ -26,7 +26,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "G1" | vm.gc == null diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithParallelOld.java b/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithParallelOld.java index 16217c0cbe1b7..785d761f4eeb9 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithParallelOld.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithParallelOld.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 @@ -26,7 +26,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "Parallel" | vm.gc == null diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithSerial.java b/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithSerial.java index 344c61043a2e1..f8f95070c1ca9 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithSerial.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithSerial.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 @@ -26,7 +26,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "Serial" | vm.gc == null diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithG1ConcurrentMark.java b/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithG1ConcurrentMark.java index 2282783ae1498..fcd33cbb1b50d 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithG1ConcurrentMark.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithG1ConcurrentMark.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -25,7 +25,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires (vm.gc == "G1" | vm.gc == null) diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithG1FullCollection.java b/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithG1FullCollection.java index 5c3da24fa1b9b..a698497cf956d 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithG1FullCollection.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithG1FullCollection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -25,7 +25,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires (vm.gc == "G1" | vm.gc == null) diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithParallelOld.java b/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithParallelOld.java index 9f95ca364f84f..c06b046f47325 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithParallelOld.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithParallelOld.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -25,7 +25,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "Parallel" | vm.gc == null diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithSerial.java b/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithSerial.java index 6499f18c16425..6fc675a93e78e 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithSerial.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithSerial.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -25,7 +25,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "Serial" | vm.gc == null diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestGCGarbageCollectionEvent.java b/test/jdk/jdk/jfr/event/gc/collection/TestGCGarbageCollectionEvent.java index e228f7fd067ed..ff23291fa41fd 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestGCGarbageCollectionEvent.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestGCGarbageCollectionEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm -Xlog:gc*=debug -XX:+UnlockExperimentalVMOptions -XX:-UseFastUnorderedTimeStamps jdk.jfr.event.gc.collection.TestGCGarbageCollectionEvent diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestGCWithFasttime.java b/test/jdk/jdk/jfr/event/gc/collection/TestGCWithFasttime.java index edce5e76190c5..d6b271e4669c8 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestGCWithFasttime.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestGCWithFasttime.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -33,7 +33,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "Parallel" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestGarbageCollectionEventWithZMajor.java b/test/jdk/jdk/jfr/event/gc/collection/TestGarbageCollectionEventWithZMajor.java index 5305cfd8d67b9..e2dd258818ba7 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestGarbageCollectionEventWithZMajor.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestGarbageCollectionEventWithZMajor.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 @@ -36,7 +36,7 @@ /** * @test * @requires vm.hasJFR & vm.gc.Z - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk * @run main/othervm -Xmx50m -XX:+UseZGC -XX:+UnlockExperimentalVMOptions -XX:-UseFastUnorderedTimeStamps -Xlog:gc* jdk.jfr.event.gc.collection.TestGarbageCollectionEventWithZMajor */ diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestGarbageCollectionEventWithZMinor.java b/test/jdk/jdk/jfr/event/gc/collection/TestGarbageCollectionEventWithZMinor.java index 65c177d3a6812..8e0d48682fccd 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestGarbageCollectionEventWithZMinor.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestGarbageCollectionEventWithZMinor.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 @@ -39,9 +39,9 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR & vm.gc.Z - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk * @build jdk.test.whitebox.WhiteBox * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestSystemGC.java b/test/jdk/jdk/jfr/event/gc/collection/TestSystemGC.java index c5614ad1cbe0c..c22670e4528fe 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestSystemGC.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestSystemGC.java @@ -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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -XX:+ExplicitGCInvokesConcurrent jdk.jfr.event.gc.collection.TestSystemGC true diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestYoungGarbageCollectionEventWithDefNew.java b/test/jdk/jdk/jfr/event/gc/collection/TestYoungGarbageCollectionEventWithDefNew.java index 95c1a9c40ee9f..c6798c770a65e 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestYoungGarbageCollectionEventWithDefNew.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestYoungGarbageCollectionEventWithDefNew.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -25,7 +25,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "Serial" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestYoungGarbageCollectionEventWithG1New.java b/test/jdk/jdk/jfr/event/gc/collection/TestYoungGarbageCollectionEventWithG1New.java index 931721011aa4a..5f026fc50e8e2 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestYoungGarbageCollectionEventWithG1New.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestYoungGarbageCollectionEventWithG1New.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -25,7 +25,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "G1" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestYoungGarbageCollectionEventWithParallelScavenge.java b/test/jdk/jdk/jfr/event/gc/collection/TestYoungGarbageCollectionEventWithParallelScavenge.java index b731f1936bb92..f9adb6a45a6f5 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestYoungGarbageCollectionEventWithParallelScavenge.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestYoungGarbageCollectionEventWithParallelScavenge.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -25,7 +25,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "Parallel" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestZOldGarbageCollectionEvent.java b/test/jdk/jdk/jfr/event/gc/collection/TestZOldGarbageCollectionEvent.java index 38e5ca49e608b..77abb19922bfe 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestZOldGarbageCollectionEvent.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestZOldGarbageCollectionEvent.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 @@ -36,7 +36,7 @@ /** * @test * @requires vm.hasJFR & vm.gc.Z - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk * @run main/othervm -Xmx50m -XX:+UseZGC -XX:+UnlockExperimentalVMOptions -XX:-UseFastUnorderedTimeStamps -Xlog:gc* jdk.jfr.event.gc.collection.TestZOldGarbageCollectionEvent */ diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestZYoungGarbageCollectionEvent.java b/test/jdk/jdk/jfr/event/gc/collection/TestZYoungGarbageCollectionEvent.java index 40c0a2adec32c..10c1407b96aaa 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestZYoungGarbageCollectionEvent.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestZYoungGarbageCollectionEvent.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 @@ -36,7 +36,7 @@ /** * @test * @requires vm.hasJFR & vm.gc.Z - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk * @run main/othervm -Xmx50m -XX:+UseZGC -XX:+UnlockExperimentalVMOptions -XX:-UseFastUnorderedTimeStamps -Xlog:gc* jdk.jfr.event.gc.collection.TestZYoungGarbageCollectionEvent */ diff --git a/test/jdk/jdk/jfr/event/gc/configuration/TestGCConfigurationEvent.java b/test/jdk/jdk/jfr/event/gc/configuration/TestGCConfigurationEvent.java index e459b0f2e7bae..7b7cc8a43766a 100644 --- a/test/jdk/jdk/jfr/event/gc/configuration/TestGCConfigurationEvent.java +++ b/test/jdk/jdk/jfr/event/gc/configuration/TestGCConfigurationEvent.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 @@ -35,7 +35,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires (vm.gc == "Parallel" | vm.gc == null) * & vm.opt.ExplicitGCInvokesConcurrent != true diff --git a/test/jdk/jdk/jfr/event/gc/configuration/TestGCConfigurationEventWithDefaultPauseTarget.java b/test/jdk/jdk/jfr/event/gc/configuration/TestGCConfigurationEventWithDefaultPauseTarget.java index c3a2803033810..6e411cf910553 100644 --- a/test/jdk/jdk/jfr/event/gc/configuration/TestGCConfigurationEventWithDefaultPauseTarget.java +++ b/test/jdk/jdk/jfr/event/gc/configuration/TestGCConfigurationEventWithDefaultPauseTarget.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 @@ -35,7 +35,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:-UseFastUnorderedTimeStamps jdk.jfr.event.gc.configuration.TestGCConfigurationEventWithDefaultPauseTarget diff --git a/test/jdk/jdk/jfr/event/gc/configuration/TestGCHeapConfigurationEventWith32BitOops.java b/test/jdk/jdk/jfr/event/gc/configuration/TestGCHeapConfigurationEventWith32BitOops.java index 0a61a288cc218..9ef90afb06336 100644 --- a/test/jdk/jdk/jfr/event/gc/configuration/TestGCHeapConfigurationEventWith32BitOops.java +++ b/test/jdk/jdk/jfr/event/gc/configuration/TestGCHeapConfigurationEventWith32BitOops.java @@ -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 @@ -30,7 +30,7 @@ /* * @test TestGCHeapConfigurationEventWith32BitOops - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "Parallel" | vm.gc == null * @requires os.family == "linux" | os.family == "windows" diff --git a/test/jdk/jdk/jfr/event/gc/configuration/TestGCHeapConfigurationEventWithHeapBasedOops.java b/test/jdk/jdk/jfr/event/gc/configuration/TestGCHeapConfigurationEventWithHeapBasedOops.java index a6fdcbde6b18e..5346c7a71038c 100644 --- a/test/jdk/jdk/jfr/event/gc/configuration/TestGCHeapConfigurationEventWithHeapBasedOops.java +++ b/test/jdk/jdk/jfr/event/gc/configuration/TestGCHeapConfigurationEventWithHeapBasedOops.java @@ -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 @@ -28,7 +28,7 @@ /* * @test TestGCHeapConfigurationEventWith32BitOops - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "Parallel" | vm.gc == null * @requires os.family == "linux" | os.family == "windows" diff --git a/test/jdk/jdk/jfr/event/gc/configuration/TestGCHeapConfigurationEventWithZeroBasedOops.java b/test/jdk/jdk/jfr/event/gc/configuration/TestGCHeapConfigurationEventWithZeroBasedOops.java index d63ca856bc34a..62d858eef984f 100644 --- a/test/jdk/jdk/jfr/event/gc/configuration/TestGCHeapConfigurationEventWithZeroBasedOops.java +++ b/test/jdk/jdk/jfr/event/gc/configuration/TestGCHeapConfigurationEventWithZeroBasedOops.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2019, 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 @@ -28,7 +28,7 @@ /* * @test TestGCHeapConfigurationEventWithZeroBasedOops - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "Parallel" | vm.gc == null * @requires os.family == "linux" | os.family == "windows" diff --git a/test/jdk/jdk/jfr/event/gc/configuration/TestGCSurvivorConfigurationEvent.java b/test/jdk/jdk/jfr/event/gc/configuration/TestGCSurvivorConfigurationEvent.java index fde69412a7af6..2a282660b03f4 100644 --- a/test/jdk/jdk/jfr/event/gc/configuration/TestGCSurvivorConfigurationEvent.java +++ b/test/jdk/jdk/jfr/event/gc/configuration/TestGCSurvivorConfigurationEvent.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 @@ -35,7 +35,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "Parallel" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/configuration/TestGCTLABConfigurationEvent.java b/test/jdk/jdk/jfr/event/gc/configuration/TestGCTLABConfigurationEvent.java index b69e4fb8490c7..cabf6ac1fab8c 100644 --- a/test/jdk/jdk/jfr/event/gc/configuration/TestGCTLABConfigurationEvent.java +++ b/test/jdk/jdk/jfr/event/gc/configuration/TestGCTLABConfigurationEvent.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 @@ -35,7 +35,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "Parallel" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/configuration/TestGCYoungGenerationConfigurationEventWithMinAndMaxSize.java b/test/jdk/jdk/jfr/event/gc/configuration/TestGCYoungGenerationConfigurationEventWithMinAndMaxSize.java index d347378b6063d..b58bb2ae7bf20 100644 --- a/test/jdk/jdk/jfr/event/gc/configuration/TestGCYoungGenerationConfigurationEventWithMinAndMaxSize.java +++ b/test/jdk/jdk/jfr/event/gc/configuration/TestGCYoungGenerationConfigurationEventWithMinAndMaxSize.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 @@ -30,7 +30,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run driver jdk.jfr.event.gc.configuration.TestGCYoungGenerationConfigurationEventWithMinAndMaxSize diff --git a/test/jdk/jdk/jfr/event/gc/configuration/TestGCYoungGenerationConfigurationEventWithNewRatio.java b/test/jdk/jdk/jfr/event/gc/configuration/TestGCYoungGenerationConfigurationEventWithNewRatio.java index 0c78f1e9541fb..c360ae3fa86d8 100644 --- a/test/jdk/jdk/jfr/event/gc/configuration/TestGCYoungGenerationConfigurationEventWithNewRatio.java +++ b/test/jdk/jdk/jfr/event/gc/configuration/TestGCYoungGenerationConfigurationEventWithNewRatio.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -28,7 +28,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:-UseFastUnorderedTimeStamps -XX:NewRatio=4 jdk.jfr.event.gc.configuration.TestGCYoungGenerationConfigurationEventWithNewRatio diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestEvacuationFailedEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestEvacuationFailedEvent.java index 584900620d4ec..41cfbf97b95e0 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestEvacuationFailedEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestEvacuationFailedEvent.java @@ -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 @@ -36,7 +36,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @bug 8263461 * @requires vm.hasJFR * diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestEvacuationInfoEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestEvacuationInfoEvent.java index 420f083758db0..0ec33a9d5eecd 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestEvacuationInfoEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestEvacuationInfoEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -36,7 +36,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "G1" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestG1AIHOPEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestG1AIHOPEvent.java index deed6b6462646..6570bbdd6afa4 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestG1AIHOPEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestG1AIHOPEvent.java @@ -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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "G1" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestG1ConcurrentModeFailureEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestG1ConcurrentModeFailureEvent.java index dade7aea8b68e..d178a429560a1 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestG1ConcurrentModeFailureEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestG1ConcurrentModeFailureEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "G1" | vm.gc == null diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestG1EvacMemoryStatsEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestG1EvacMemoryStatsEvent.java index e32cfda41a9b4..56798b09db30d 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestG1EvacMemoryStatsEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestG1EvacMemoryStatsEvent.java @@ -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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "G1" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestG1HeapRegionTypeChangeEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestG1HeapRegionTypeChangeEvent.java index b716295b507d7..399d82aa0f0c3 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestG1HeapRegionTypeChangeEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestG1HeapRegionTypeChangeEvent.java @@ -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 @@ -38,7 +38,7 @@ * @bug 8149650 * @requires vm.hasJFR * @requires vm.gc == "G1" | vm.gc == null - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk * @run main/othervm -XX:NewSize=2m -XX:MaxNewSize=2m -Xmx32m -XX:G1HeapRegionSize=1m -XX:+UseG1GC jdk.jfr.event.gc.detailed.TestG1HeapRegionTypeChangeEvent */ diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestG1IHOPEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestG1IHOPEvent.java index 4a5bce6a69f49..20ec6fa76f479 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestG1IHOPEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestG1IHOPEvent.java @@ -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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "G1" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestG1InvalidHeapRegionTypeChangeEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestG1InvalidHeapRegionTypeChangeEvent.java index 023020f2a296b..7939a769ccb8c 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestG1InvalidHeapRegionTypeChangeEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestG1InvalidHeapRegionTypeChangeEvent.java @@ -39,7 +39,7 @@ * @requires vm.hasJFR * @requires vm.gc == "G1" | vm.gc == null * @requires vm.debug - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk * @summary Make sure that there are no Old->Old and Free->Free events sent. * @run main/othervm -XX:+G1GCAllocationFailureALot -XX:NewSize=2m -XX:MaxNewSize=2m -XX:MaxTenuringThreshold=1 diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestG1MMUEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestG1MMUEvent.java index 967a3bc03d5b5..49b4a72147230 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestG1MMUEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestG1MMUEvent.java @@ -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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "G1" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestGCCPUTimeEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestGCCPUTimeEvent.java index 9e7d7ca54137e..cd9f0046cbbef 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestGCCPUTimeEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestGCCPUTimeEvent.java @@ -32,7 +32,7 @@ /** * @test id=Serial - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc.Serial * @library /test/lib /test/jdk @@ -43,7 +43,7 @@ /** * @test id=Parallel - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc.Parallel * @library /test/lib /test/jdk @@ -54,7 +54,7 @@ /** * @test id=G1 - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc.G1 * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestGCHeapMemoryPoolUsageEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestGCHeapMemoryPoolUsageEvent.java index 6d5308408d622..1286c53d938ad 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestGCHeapMemoryPoolUsageEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestGCHeapMemoryPoolUsageEvent.java @@ -33,7 +33,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -XX:-ExplicitGCInvokesConcurrent jdk.jfr.event.gc.detailed.TestGCHeapMemoryPoolUsageEvent diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestGCHeapMemoryUsageEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestGCHeapMemoryUsageEvent.java index 7f1d96a3993b0..d54ca7a723d04 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestGCHeapMemoryUsageEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestGCHeapMemoryUsageEvent.java @@ -33,7 +33,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -XX:-ExplicitGCInvokesConcurrent jdk.jfr.event.gc.detailed.TestGCHeapMemoryUsageEvent diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestGCLockerEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestGCLockerEvent.java index 596af47de39bc..1ad0fbd86b8d6 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestGCLockerEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestGCLockerEvent.java @@ -24,7 +24,7 @@ /** * @test TestGCLockerEvent - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc.Serial | vm.gc.Parallel * @requires vm.gc != null diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestGCPhaseConcurrent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestGCPhaseConcurrent.java index 66e3e026536af..fde4cd9c2d605 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestGCPhaseConcurrent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestGCPhaseConcurrent.java @@ -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 @@ -32,7 +32,7 @@ /** * @test id=Z - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk /test/hotspot/jtreg * @requires vm.hasJFR & vm.gc.Z * @run main/othervm -XX:+UseZGC -Xmx32M jdk.jfr.event.gc.detailed.TestGCPhaseConcurrent Z @@ -40,7 +40,7 @@ /** * @test TestGCPhaseConcurrent - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk /test/hotspot/jtreg * @requires vm.hasJFR & vm.gc.Shenandoah * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx32M jdk.jfr.event.gc.detailed.TestGCPhaseConcurrent Shenandoah diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestPromotionEventWithG1.java b/test/jdk/jdk/jfr/event/gc/detailed/TestPromotionEventWithG1.java index ac646e7c14a05..3e76369940232 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestPromotionEventWithG1.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestPromotionEventWithG1.java @@ -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 @@ -25,7 +25,7 @@ /** * @test * @bug 8212766 - * @key jfr + * @requires vm.flagless * @summary Test that events are created when an object is aged or promoted during a GC and the copying of the object requires a new PLAB or direct heap allocation * @requires vm.hasJFR * diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestPromotionEventWithParallelScavenge.java b/test/jdk/jdk/jfr/event/gc/detailed/TestPromotionEventWithParallelScavenge.java index 30b18a9df4a2a..13de75ff583d0 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestPromotionEventWithParallelScavenge.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestPromotionEventWithParallelScavenge.java @@ -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 @@ -24,7 +24,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Test that events are created when an object is aged or promoted during a GC and the copying of the object requires a new PLAB or direct heap allocation * @requires vm.hasJFR * diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestPromotionFailedEventWithDefNew.java b/test/jdk/jdk/jfr/event/gc/detailed/TestPromotionFailedEventWithDefNew.java index 53382ea8ba269..b239f6f78ba77 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestPromotionFailedEventWithDefNew.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestPromotionFailedEventWithDefNew.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -25,7 +25,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "Serial" | vm.gc == null diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestPromotionFailedEventWithParallelScavenge.java b/test/jdk/jdk/jfr/event/gc/detailed/TestPromotionFailedEventWithParallelScavenge.java index 98abeabdacb4b..4880640b77265 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestPromotionFailedEventWithParallelScavenge.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestPromotionFailedEventWithParallelScavenge.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -25,7 +25,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "Parallel" | vm.gc == null diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestShenandoahEvacuationInformationEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestShenandoahEvacuationInformationEvent.java index 33310ab721a5a..4f2334284cc9d 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestShenandoahEvacuationInformationEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestShenandoahEvacuationInformationEvent.java @@ -39,7 +39,7 @@ * @test * @bug 8221507 * @requires vm.hasJFR & vm.gc.Shenandoah - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk * @run main/othervm -Xmx64m -XX:+UnlockExperimentalVMOptions -XX:ShenandoahRegionSize=1m -XX:+UseShenandoahGC -XX:ShenandoahGCMode=generational jdk.jfr.event.gc.detailed.TestShenandoahEvacuationInformationEvent */ diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestShenandoahHeapRegionInformationEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestShenandoahHeapRegionInformationEvent.java index 2f220571b7d2d..88538928145e4 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestShenandoahHeapRegionInformationEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestShenandoahHeapRegionInformationEvent.java @@ -38,7 +38,7 @@ * @test * @bug 8221507 * @requires vm.hasJFR & vm.gc.Shenandoah - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk * @run main/othervm -Xmx32m -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGarbageThreshold=1 jdk.jfr.event.gc.detailed.TestShenandoahHeapRegionInformationEvent */ diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestShenandoahHeapRegionStateChangeEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestShenandoahHeapRegionStateChangeEvent.java index 3162497f52c64..dfd0c0f86bcb6 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestShenandoahHeapRegionStateChangeEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestShenandoahHeapRegionStateChangeEvent.java @@ -38,7 +38,7 @@ * @test * @bug 8221507 * @requires vm.hasJFR & vm.gc.Shenandoah - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk * @run main/othervm -Xmx32m -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGarbageThreshold=1 jdk.jfr.event.gc.detailed.TestShenandoahHeapRegionStateChangeEvent */ diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestTenuringDistributionEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestTenuringDistributionEvent.java index 9002373caef9e..843219d61d2b7 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestTenuringDistributionEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestTenuringDistributionEvent.java @@ -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 @@ -37,7 +37,7 @@ * @bug 8009538 * @requires vm.hasJFR * @requires vm.gc == "G1" | vm.gc == null - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk * @run main/othervm -XX:NewSize=2m -XX:MaxNewSize=2m -Xmx32m -XX:+UseG1GC -XX:+NeverTenure jdk.jfr.event.gc.detailed.TestTenuringDistributionEvent */ diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestZAllocationStallEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestZAllocationStallEvent.java index b17c678ec5533..b2f20450d0d86 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestZAllocationStallEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestZAllocationStallEvent.java @@ -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 @@ -34,7 +34,7 @@ /** * @test * @requires vm.hasJFR & vm.gc.Z - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk /test/hotspot/jtreg * @run main/othervm -XX:+UseZGC -Xmx32M -Xlog:gc*:gc.log::filecount=0 jdk.jfr.event.gc.detailed.TestZAllocationStallEvent */ diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestZPageAllocationEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestZPageAllocationEvent.java index c17e19193db63..83caddbbaafbc 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestZPageAllocationEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestZPageAllocationEvent.java @@ -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 @@ -34,7 +34,7 @@ /** * @test * @requires vm.hasJFR & vm.gc.Z - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk /test/hotspot/jtreg * @run main/othervm -XX:+UseZGC -Xmx32M jdk.jfr.event.gc.detailed.TestZPageAllocationEvent */ diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestZRelocationSetEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestZRelocationSetEvent.java index baae61d5cd81f..e64d6f83ab822 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestZRelocationSetEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestZRelocationSetEvent.java @@ -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 @@ -34,7 +34,7 @@ /** * @test * @requires vm.hasJFR & vm.gc.Z - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk /test/hotspot/jtreg * @run main/othervm -XX:+UseZGC -Xmx32M jdk.jfr.event.gc.detailed.TestZRelocationSetEvent */ diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestZRelocationSetGroupEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestZRelocationSetGroupEvent.java index 0e93aed8b8eb8..29e1de24224c3 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestZRelocationSetGroupEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestZRelocationSetGroupEvent.java @@ -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 @@ -34,7 +34,7 @@ /** * @test * @requires vm.hasJFR & vm.gc.Z - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk /test/hotspot/jtreg * @run main/othervm -XX:+UseZGC -Xmx32M jdk.jfr.event.gc.detailed.TestZRelocationSetGroupEvent */ diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestZUncommitEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestZUncommitEvent.java index 1aa2ba6af0b6d..f77ada9bf1bf4 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestZUncommitEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestZUncommitEvent.java @@ -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 @@ -36,7 +36,7 @@ /** * @test id=Z * @requires vm.hasJFR & vm.gc.Z - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk /test/hotspot/jtreg * @run main/othervm -XX:+UseZGC -Xms32M -Xmx128M -Xlog:gc,gc+heap -XX:+ZUncommit -XX:ZUncommitDelay=1 jdk.jfr.event.gc.detailed.TestZUncommitEvent */ diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestZUnmapEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestZUnmapEvent.java index fabbdce9c94ea..93ed6253de28b 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestZUnmapEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestZUnmapEvent.java @@ -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 @@ -34,7 +34,7 @@ /** * @test id=Z * @requires vm.hasJFR & vm.gc.Z - * @key jfr + * @requires vm.flagless * @library /test/lib /test/jdk /test/hotspot/jtreg * @run main/othervm -XX:+UseZGC -Xmx32M jdk.jfr.event.gc.detailed.TestZUnmapEvent */ diff --git a/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryCommittedSize.java b/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryCommittedSize.java index 2606757721f8a..33578d854b6c0 100644 --- a/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryCommittedSize.java +++ b/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryCommittedSize.java @@ -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 @@ -36,7 +36,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "Parallel" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventDefNewSerial.java b/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventDefNewSerial.java index b46d52e46f18d..f70d7a85f168f 100644 --- a/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventDefNewSerial.java +++ b/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventDefNewSerial.java @@ -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 @@ -26,7 +26,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "Serial" | vm.gc == null * @library /test/lib /test/jdk @@ -36,7 +36,7 @@ /** * @test * @bug 8264008 - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR & vm.bits == 64 * @requires vm.gc == "Serial" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventG1.java b/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventG1.java index fc30a8dec7345..edecfaf14065e 100644 --- a/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventG1.java +++ b/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventG1.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -26,7 +26,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires (vm.gc == "G1" | vm.gc == null) * & vm.opt.ExplicitGCInvokesConcurrent != true diff --git a/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventPSParOld.java b/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventPSParOld.java index 475c0ff84fe7e..306b23f88b786 100644 --- a/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventPSParOld.java +++ b/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventPSParOld.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -26,7 +26,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "Parallel" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithG1ConcurrentMark.java b/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithG1ConcurrentMark.java index 3fe9e0f360d90..eb69289aa5e2d 100644 --- a/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithG1ConcurrentMark.java +++ b/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithG1ConcurrentMark.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -26,7 +26,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires (vm.gc == "G1" | vm.gc == null) * & vm.opt.ExplicitGCInvokesConcurrent != false diff --git a/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithG1FullCollection.java b/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithG1FullCollection.java index 54b8ebc33e4bc..6e91cf4c64452 100644 --- a/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithG1FullCollection.java +++ b/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithG1FullCollection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -26,7 +26,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires (vm.gc == "G1" | vm.gc == null) * & vm.opt.ExplicitGCInvokesConcurrent != true diff --git a/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithParallelOld.java b/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithParallelOld.java index 8d88c8d6d8e66..2a17e540be86f 100644 --- a/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithParallelOld.java +++ b/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithParallelOld.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -26,7 +26,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "Parallel" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithSerial.java b/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithSerial.java index 6401a0002e2c5..888eb08902720 100644 --- a/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithSerial.java +++ b/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithSerial.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -26,7 +26,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "Serial" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountEvent.java b/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountEvent.java index 2f7c7513b258e..a9034ba0eaad2 100644 --- a/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountEvent.java +++ b/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -35,7 +35,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "Serial" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithDefNew.java b/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithDefNew.java index 5e3ce6928c9a1..bc26ad792d0a7 100644 --- a/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithDefNew.java +++ b/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithDefNew.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -26,7 +26,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "Serial" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithG1ConcurrentMark.java b/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithG1ConcurrentMark.java index 7a635d4812e12..33547a1ca6766 100644 --- a/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithG1ConcurrentMark.java +++ b/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithG1ConcurrentMark.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -26,7 +26,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires (vm.gc == "G1" | vm.gc == null) * & vm.opt.ExplicitGCInvokesConcurrent != false diff --git a/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithG1FullCollection.java b/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithG1FullCollection.java index b06d68c5cc313..2bf13facffcbf 100644 --- a/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithG1FullCollection.java +++ b/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithG1FullCollection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -26,7 +26,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires (vm.gc == "G1" | vm.gc == null) * & vm.opt.ExplicitGCInvokesConcurrent != true diff --git a/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithG1New.java b/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithG1New.java index 16e87232a51a2..139e95980a50d 100644 --- a/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithG1New.java +++ b/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithG1New.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -26,7 +26,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "G1" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithParallelOld.java b/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithParallelOld.java index a2810a8c8b225..5faae179fe0f2 100644 --- a/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithParallelOld.java +++ b/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithParallelOld.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -26,7 +26,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "Parallel" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithParallelScavenge.java b/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithParallelScavenge.java index 21ae0a319a8ea..ce9dd0b936cdd 100644 --- a/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithParallelScavenge.java +++ b/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithParallelScavenge.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -26,7 +26,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc == "Parallel" | vm.gc == null * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/gc/stacktrace/TestDefNewAllocationPendingStackTrace.java b/test/jdk/jdk/jfr/event/gc/stacktrace/TestDefNewAllocationPendingStackTrace.java index 4f83b37765d89..8741d433570ed 100644 --- a/test/jdk/jdk/jfr/event/gc/stacktrace/TestDefNewAllocationPendingStackTrace.java +++ b/test/jdk/jdk/jfr/event/gc/stacktrace/TestDefNewAllocationPendingStackTrace.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 @@ -24,7 +24,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "null" | vm.gc == "Serial" diff --git a/test/jdk/jdk/jfr/event/gc/stacktrace/TestG1HumongousAllocationPendingStackTrace.java b/test/jdk/jdk/jfr/event/gc/stacktrace/TestG1HumongousAllocationPendingStackTrace.java index 0cc00bb1e4b76..a61a87fd53958 100644 --- a/test/jdk/jdk/jfr/event/gc/stacktrace/TestG1HumongousAllocationPendingStackTrace.java +++ b/test/jdk/jdk/jfr/event/gc/stacktrace/TestG1HumongousAllocationPendingStackTrace.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 @@ -24,7 +24,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "null" | vm.gc == "G1" diff --git a/test/jdk/jdk/jfr/event/gc/stacktrace/TestG1OldAllocationPendingStackTrace.java b/test/jdk/jdk/jfr/event/gc/stacktrace/TestG1OldAllocationPendingStackTrace.java index e74528c20e181..1346c36c04f36 100644 --- a/test/jdk/jdk/jfr/event/gc/stacktrace/TestG1OldAllocationPendingStackTrace.java +++ b/test/jdk/jdk/jfr/event/gc/stacktrace/TestG1OldAllocationPendingStackTrace.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 @@ -24,7 +24,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "null" | vm.gc == "G1" diff --git a/test/jdk/jdk/jfr/event/gc/stacktrace/TestG1YoungAllocationPendingStackTrace.java b/test/jdk/jdk/jfr/event/gc/stacktrace/TestG1YoungAllocationPendingStackTrace.java index 0454d8fe77f00..8c951919feb2f 100644 --- a/test/jdk/jdk/jfr/event/gc/stacktrace/TestG1YoungAllocationPendingStackTrace.java +++ b/test/jdk/jdk/jfr/event/gc/stacktrace/TestG1YoungAllocationPendingStackTrace.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 @@ -24,7 +24,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "null" | vm.gc == "G1" diff --git a/test/jdk/jdk/jfr/event/gc/stacktrace/TestMarkSweepCompactAllocationPendingStackTrace.java b/test/jdk/jdk/jfr/event/gc/stacktrace/TestMarkSweepCompactAllocationPendingStackTrace.java index 07a1c63fda1f4..8b3261e3a00ae 100644 --- a/test/jdk/jdk/jfr/event/gc/stacktrace/TestMarkSweepCompactAllocationPendingStackTrace.java +++ b/test/jdk/jdk/jfr/event/gc/stacktrace/TestMarkSweepCompactAllocationPendingStackTrace.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 @@ -24,7 +24,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "null" | vm.gc == "Serial" diff --git a/test/jdk/jdk/jfr/event/gc/stacktrace/TestMetaspaceG1GCAllocationPendingStackTrace.java b/test/jdk/jdk/jfr/event/gc/stacktrace/TestMetaspaceG1GCAllocationPendingStackTrace.java index 5a0cc9288b604..06c0d23788b42 100644 --- a/test/jdk/jdk/jfr/event/gc/stacktrace/TestMetaspaceG1GCAllocationPendingStackTrace.java +++ b/test/jdk/jdk/jfr/event/gc/stacktrace/TestMetaspaceG1GCAllocationPendingStackTrace.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,7 +23,7 @@ package jdk.jfr.event.gc.stacktrace; /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "null" | vm.gc == "G1" diff --git a/test/jdk/jdk/jfr/event/gc/stacktrace/TestMetaspaceParallelGCAllocationPendingStackTrace.java b/test/jdk/jdk/jfr/event/gc/stacktrace/TestMetaspaceParallelGCAllocationPendingStackTrace.java index 8e71c8d55a83c..13bfc7c9ea6bb 100644 --- a/test/jdk/jdk/jfr/event/gc/stacktrace/TestMetaspaceParallelGCAllocationPendingStackTrace.java +++ b/test/jdk/jdk/jfr/event/gc/stacktrace/TestMetaspaceParallelGCAllocationPendingStackTrace.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 @@ -24,7 +24,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "null" | vm.gc == "Parallel" diff --git a/test/jdk/jdk/jfr/event/gc/stacktrace/TestMetaspaceSerialGCAllocationPendingStackTrace.java b/test/jdk/jdk/jfr/event/gc/stacktrace/TestMetaspaceSerialGCAllocationPendingStackTrace.java index 4d9a53e9afd32..36bf59741ee26 100644 --- a/test/jdk/jdk/jfr/event/gc/stacktrace/TestMetaspaceSerialGCAllocationPendingStackTrace.java +++ b/test/jdk/jdk/jfr/event/gc/stacktrace/TestMetaspaceSerialGCAllocationPendingStackTrace.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 @@ -24,7 +24,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "null" | vm.gc == "Serial" diff --git a/test/jdk/jdk/jfr/event/gc/stacktrace/TestParallelMarkSweepAllocationPendingStackTrace.java b/test/jdk/jdk/jfr/event/gc/stacktrace/TestParallelMarkSweepAllocationPendingStackTrace.java index 733b493548121..93e6b5b17e791 100644 --- a/test/jdk/jdk/jfr/event/gc/stacktrace/TestParallelMarkSweepAllocationPendingStackTrace.java +++ b/test/jdk/jdk/jfr/event/gc/stacktrace/TestParallelMarkSweepAllocationPendingStackTrace.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 @@ -24,7 +24,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "null" | vm.gc == "Parallel" diff --git a/test/jdk/jdk/jfr/event/gc/stacktrace/TestParallelScavengeAllocationPendingStackTrace.java b/test/jdk/jdk/jfr/event/gc/stacktrace/TestParallelScavengeAllocationPendingStackTrace.java index 341a3e53aa8c6..7771965dc97b9 100644 --- a/test/jdk/jdk/jfr/event/gc/stacktrace/TestParallelScavengeAllocationPendingStackTrace.java +++ b/test/jdk/jdk/jfr/event/gc/stacktrace/TestParallelScavengeAllocationPendingStackTrace.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 @@ -24,7 +24,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @requires vm.gc == "null" | vm.gc == "Parallel" diff --git a/test/jdk/jdk/jfr/event/io/TestAsynchronousFileChannelEvents.java b/test/jdk/jdk/jfr/event/io/TestAsynchronousFileChannelEvents.java index f1ddba369eb41..e0752c6d319dd 100644 --- a/test/jdk/jdk/jfr/event/io/TestAsynchronousFileChannelEvents.java +++ b/test/jdk/jdk/jfr/event/io/TestAsynchronousFileChannelEvents.java @@ -40,7 +40,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.event.io.TestAsynchronousFileChannelEvents diff --git a/test/jdk/jdk/jfr/event/io/TestDeserializationEvent.java b/test/jdk/jdk/jfr/event/io/TestDeserializationEvent.java index 28b26165e2f70..04e5126ca0055 100644 --- a/test/jdk/jdk/jfr/event/io/TestDeserializationEvent.java +++ b/test/jdk/jdk/jfr/event/io/TestDeserializationEvent.java @@ -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 @@ -49,7 +49,7 @@ * @test * @bug 8261160 * @summary Add a deserialization JFR event - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run testng/othervm jdk.jfr.event.io.TestDeserializationEvent diff --git a/test/jdk/jdk/jfr/event/io/TestDisabledEvents.java b/test/jdk/jdk/jfr/event/io/TestDisabledEvents.java index 0b523b80523b8..5a6835c4ce2fb 100644 --- a/test/jdk/jdk/jfr/event/io/TestDisabledEvents.java +++ b/test/jdk/jdk/jfr/event/io/TestDisabledEvents.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 @@ -41,7 +41,7 @@ /** * @test * @summary Test with FlightRecorder enabled but with the events disabled. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.event.io.TestDisabledEvents diff --git a/test/jdk/jdk/jfr/event/io/TestFileChannelEvents.java b/test/jdk/jdk/jfr/event/io/TestFileChannelEvents.java index 11ae0a12e4fb5..490e16d3e52b4 100644 --- a/test/jdk/jdk/jfr/event/io/TestFileChannelEvents.java +++ b/test/jdk/jdk/jfr/event/io/TestFileChannelEvents.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 @@ -40,7 +40,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.event.io.TestFileChannelEvents diff --git a/test/jdk/jdk/jfr/event/io/TestFileReadOnly.java b/test/jdk/jdk/jfr/event/io/TestFileReadOnly.java index 6986c43e3fe1b..f28c20d888173 100644 --- a/test/jdk/jdk/jfr/event/io/TestFileReadOnly.java +++ b/test/jdk/jdk/jfr/event/io/TestFileReadOnly.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 @@ -41,7 +41,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.event.io.TestFileReadOnly diff --git a/test/jdk/jdk/jfr/event/io/TestFileStreamEvents.java b/test/jdk/jdk/jfr/event/io/TestFileStreamEvents.java index d557a8dfd7de2..a710335e63d95 100644 --- a/test/jdk/jdk/jfr/event/io/TestFileStreamEvents.java +++ b/test/jdk/jdk/jfr/event/io/TestFileStreamEvents.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 @@ -39,7 +39,7 @@ /** * @test TestFileStreamEvents - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.event.io.TestFileStreamEvents diff --git a/test/jdk/jdk/jfr/event/io/TestInstrumentation.java b/test/jdk/jdk/jfr/event/io/TestInstrumentation.java index beef8437a3442..37a196237e810 100644 --- a/test/jdk/jdk/jfr/event/io/TestInstrumentation.java +++ b/test/jdk/jdk/jfr/event/io/TestInstrumentation.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 @@ -51,7 +51,7 @@ /* * @test * @summary Test that will instrument the same classes that JFR will also instrument. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/io/TestRandomAccessFileEvents.java b/test/jdk/jdk/jfr/event/io/TestRandomAccessFileEvents.java index 47fbc62d08d20..4da995533f8b3 100644 --- a/test/jdk/jdk/jfr/event/io/TestRandomAccessFileEvents.java +++ b/test/jdk/jdk/jfr/event/io/TestRandomAccessFileEvents.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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.event.io.TestRandomAccessFileEvents diff --git a/test/jdk/jdk/jfr/event/io/TestRandomAccessFileThread.java b/test/jdk/jdk/jfr/event/io/TestRandomAccessFileThread.java index a815a1231ce41..54b989cbf3c8b 100644 --- a/test/jdk/jdk/jfr/event/io/TestRandomAccessFileThread.java +++ b/test/jdk/jdk/jfr/event/io/TestRandomAccessFileThread.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 @@ -44,7 +44,7 @@ /** * @test * @summary Verify the event time stamp and thread name - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:-UseFastUnorderedTimeStamps jdk.jfr.event.io.TestRandomAccessFileThread diff --git a/test/jdk/jdk/jfr/event/io/TestSerializationMisdeclarationEvent.java b/test/jdk/jdk/jfr/event/io/TestSerializationMisdeclarationEvent.java index 7c7b8366a0468..b746d50689e2e 100644 --- a/test/jdk/jdk/jfr/event/io/TestSerializationMisdeclarationEvent.java +++ b/test/jdk/jdk/jfr/event/io/TestSerializationMisdeclarationEvent.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 @@ -50,7 +50,7 @@ * @bug 8275338 8324220 * @summary Check generation of JFR events for misdeclared fields and methods * relevant to serialization - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run junit/othervm jdk.jfr.event.io.TestSerializationMisdeclarationEvent diff --git a/test/jdk/jdk/jfr/event/io/TestSocketAdapterEvents.java b/test/jdk/jdk/jfr/event/io/TestSocketAdapterEvents.java index 9ac57b839fb2c..77a083ad8fe9d 100644 --- a/test/jdk/jdk/jfr/event/io/TestSocketAdapterEvents.java +++ b/test/jdk/jdk/jfr/event/io/TestSocketAdapterEvents.java @@ -48,7 +48,7 @@ * @test * @bug 8310978 * @summary test socket read/write events on socket adaptors - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.event.io.TestSocketAdapterEvents diff --git a/test/jdk/jdk/jfr/event/io/TestSocketChannelEvents.java b/test/jdk/jdk/jfr/event/io/TestSocketChannelEvents.java index fc045e55caa6e..1a40edde0fd94 100644 --- a/test/jdk/jdk/jfr/event/io/TestSocketChannelEvents.java +++ b/test/jdk/jdk/jfr/event/io/TestSocketChannelEvents.java @@ -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 @@ -44,7 +44,7 @@ /** * @test * @summary test socket read/write events on SocketChannel - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.event.io.TestSocketChannelEvents diff --git a/test/jdk/jdk/jfr/event/io/TestSocketEvents.java b/test/jdk/jdk/jfr/event/io/TestSocketEvents.java index d73c5010cf7d0..144b9592b2206 100644 --- a/test/jdk/jdk/jfr/event/io/TestSocketEvents.java +++ b/test/jdk/jdk/jfr/event/io/TestSocketEvents.java @@ -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 @@ /** * @test * @summary test socket read/write events on Socket - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.event.io.TestSocketEvents diff --git a/test/jdk/jdk/jfr/event/metadata/TestDefaultConfigurations.java b/test/jdk/jdk/jfr/event/metadata/TestDefaultConfigurations.java index 3b8b0d975eb6f..3a14937e21d37 100644 --- a/test/jdk/jdk/jfr/event/metadata/TestDefaultConfigurations.java +++ b/test/jdk/jdk/jfr/event/metadata/TestDefaultConfigurations.java @@ -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 @@ -53,7 +53,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @library /test/lib diff --git a/test/jdk/jdk/jfr/event/metadata/TestEventMetadata.java b/test/jdk/jdk/jfr/event/metadata/TestEventMetadata.java index afdb84952f429..e3255909fccb7 100644 --- a/test/jdk/jdk/jfr/event/metadata/TestEventMetadata.java +++ b/test/jdk/jdk/jfr/event/metadata/TestEventMetadata.java @@ -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 @@ -35,7 +35,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.metadata.TestEventMetadata diff --git a/test/jdk/jdk/jfr/event/metadata/TestLookForUntestedEvents.java b/test/jdk/jdk/jfr/event/metadata/TestLookForUntestedEvents.java index 981579ba341e6..5b8aacfb1d228 100644 --- a/test/jdk/jdk/jfr/event/metadata/TestLookForUntestedEvents.java +++ b/test/jdk/jdk/jfr/event/metadata/TestLookForUntestedEvents.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 @@ -42,7 +42,7 @@ /** * @test Check for JFR events not covered by tests - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main jdk.jfr.event.metadata.TestLookForUntestedEvents diff --git a/test/jdk/jdk/jfr/event/oldobject/TestAllocationTime.java b/test/jdk/jdk/jfr/event/oldobject/TestAllocationTime.java index ce3e3057699a3..0ce109368a56f 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestAllocationTime.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestAllocationTime.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 @@ -37,7 +37,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal.test diff --git a/test/jdk/jdk/jfr/event/oldobject/TestArrayInformation.java b/test/jdk/jdk/jfr/event/oldobject/TestArrayInformation.java index 028024fdd284f..393a734aa26a1 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestArrayInformation.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestArrayInformation.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 @@ -36,7 +36,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal.test diff --git a/test/jdk/jdk/jfr/event/oldobject/TestCircularReference.java b/test/jdk/jdk/jfr/event/oldobject/TestCircularReference.java index b3dbfef090c45..a601cefad40d5 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestCircularReference.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestCircularReference.java @@ -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 @@ -33,7 +33,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal.test diff --git a/test/jdk/jdk/jfr/event/oldobject/TestClassLoaderLeak.java b/test/jdk/jdk/jfr/event/oldobject/TestClassLoaderLeak.java index 6f7337d37777d..b9aab92b9242e 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestClassLoaderLeak.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestClassLoaderLeak.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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.flagless * @comment Marked as flagless until JDK-8322597 is fixed diff --git a/test/jdk/jdk/jfr/event/oldobject/TestFieldInformation.java b/test/jdk/jdk/jfr/event/oldobject/TestFieldInformation.java index fb0f5eebd7fb7..0d3e1dcc2e564 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestFieldInformation.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestFieldInformation.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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal.test diff --git a/test/jdk/jdk/jfr/event/oldobject/TestG1.java b/test/jdk/jdk/jfr/event/oldobject/TestG1.java index 79df63953c557..4c3d65a3ecea4 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestG1.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestG1.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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc.G1 * @summary Test leak profiler with G1 GC diff --git a/test/jdk/jdk/jfr/event/oldobject/TestHeapDeep.java b/test/jdk/jdk/jfr/event/oldobject/TestHeapDeep.java index b7cbb233f311e..7461a9f1503c2 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestHeapDeep.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestHeapDeep.java @@ -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 @@ -33,7 +33,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal.test diff --git a/test/jdk/jdk/jfr/event/oldobject/TestHeapShallow.java b/test/jdk/jdk/jfr/event/oldobject/TestHeapShallow.java index 8d8b7f3c97aa3..bca93871cd901 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestHeapShallow.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestHeapShallow.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 @@ -32,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal.test diff --git a/test/jdk/jdk/jfr/event/oldobject/TestLargeRootSet.java b/test/jdk/jdk/jfr/event/oldobject/TestLargeRootSet.java index 4fe432e649327..c2a4cc5264ce5 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestLargeRootSet.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestLargeRootSet.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 @@ -43,7 +43,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal.test diff --git a/test/jdk/jdk/jfr/event/oldobject/TestLastKnownHeapUsage.java b/test/jdk/jdk/jfr/event/oldobject/TestLastKnownHeapUsage.java index d51c52ab7e36c..36fdef6c86b93 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestLastKnownHeapUsage.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestLastKnownHeapUsage.java @@ -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 @@ -37,7 +37,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal.test diff --git a/test/jdk/jdk/jfr/event/oldobject/TestListenerLeak.java b/test/jdk/jdk/jfr/event/oldobject/TestListenerLeak.java index 92610283525a6..fd895fae91b92 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestListenerLeak.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestListenerLeak.java @@ -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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal.test diff --git a/test/jdk/jdk/jfr/event/oldobject/TestMetadataRetention.java b/test/jdk/jdk/jfr/event/oldobject/TestMetadataRetention.java index b84160a0ac5a4..1747939390b2e 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestMetadataRetention.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestMetadataRetention.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 @@ -43,7 +43,7 @@ * @test * @summary The test verifies that an old object sample maintains references to "stale" metadata * @requires vm.hasJFR - * @key jfr + * @requires vm.flagless * @modules jdk.jfr/jdk.jfr.internal.test * @library /test/lib /test/jdk * @build jdk.jfr.event.oldobject.TestMetadataObject @@ -86,7 +86,7 @@ public static void main(String[] args) throws Throwable { // System.gc() will trigger class unloading if -XX:+ExplicitGCInvokesConcurrent // is NOT set. If this flag is set G1 will never unload classes on System.gc(). - // As far as the "jfr" key guarantees no VM flags are set from the + // As far as the vm.flagless guarantees no VM flags are set from the // outside it should be enough with System.gc(). System.gc(); diff --git a/test/jdk/jdk/jfr/event/oldobject/TestObjectAge.java b/test/jdk/jdk/jfr/event/oldobject/TestObjectAge.java index cd3ff53576250..6346326d620f0 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestObjectAge.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestObjectAge.java @@ -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 @@ -35,7 +35,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal.test diff --git a/test/jdk/jdk/jfr/event/oldobject/TestObjectDescription.java b/test/jdk/jdk/jfr/event/oldobject/TestObjectDescription.java index 447d2bb9cecf4..60f85e6ba7293 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestObjectDescription.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestObjectDescription.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 @@ -39,7 +39,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc != "Shenandoah" * @requires vm.flagless diff --git a/test/jdk/jdk/jfr/event/oldobject/TestObjectSize.java b/test/jdk/jdk/jfr/event/oldobject/TestObjectSize.java index 7b8a1003edd34..c10da3b498c3f 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestObjectSize.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestObjectSize.java @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal.test diff --git a/test/jdk/jdk/jfr/event/oldobject/TestParallel.java b/test/jdk/jdk/jfr/event/oldobject/TestParallel.java index 547619c128356..e41b86e51d635 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestParallel.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestParallel.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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc.Parallel * @summary Test leak profiler with Parallel GC diff --git a/test/jdk/jdk/jfr/event/oldobject/TestReferenceChainLimit.java b/test/jdk/jdk/jfr/event/oldobject/TestReferenceChainLimit.java index 640819e9bc69a..be8cb03fb39c5 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestReferenceChainLimit.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestReferenceChainLimit.java @@ -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 @@ -32,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal.test diff --git a/test/jdk/jdk/jfr/event/oldobject/TestSanityDefault.java b/test/jdk/jdk/jfr/event/oldobject/TestSanityDefault.java index 30186db8def5b..b03f5e94f7bb2 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestSanityDefault.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestSanityDefault.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 @@ -33,7 +33,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.flagless * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/oldobject/TestSerial.java b/test/jdk/jdk/jfr/event/oldobject/TestSerial.java index 8ed4d51c19d8c..4e6ee3c39d33e 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestSerial.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestSerial.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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.gc.Serial * @summary Test leak profiler with Serial GC diff --git a/test/jdk/jdk/jfr/event/oldobject/TestShenandoah.java b/test/jdk/jdk/jfr/event/oldobject/TestShenandoah.java index 6d3483910301b..14b3dec5eb374 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestShenandoah.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestShenandoah.java @@ -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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR & vm.gc.Shenandoah * @summary Test leak profiler with Shenandoah * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/event/oldobject/TestThreadLocalLeak.java b/test/jdk/jdk/jfr/event/oldobject/TestThreadLocalLeak.java index c82636e9146e9..3ccc6952cdc12 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestThreadLocalLeak.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestThreadLocalLeak.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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal.test diff --git a/test/jdk/jdk/jfr/event/oldobject/TestZ.java b/test/jdk/jdk/jfr/event/oldobject/TestZ.java index 8aff89ce7de64..9ae406c93697c 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestZ.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestZ.java @@ -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 @@ -35,7 +35,7 @@ /** * @test * @requires vm.hasJFR & vm.gc.Z - * @key jfr + * @requires vm.flagless * @summary Test leak profiler with ZGC * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal.test diff --git a/test/jdk/jdk/jfr/event/os/TestCPUInformation.java b/test/jdk/jdk/jfr/event/os/TestCPUInformation.java index c5166580010df..5a9e631141c1a 100644 --- a/test/jdk/jdk/jfr/event/os/TestCPUInformation.java +++ b/test/jdk/jdk/jfr/event/os/TestCPUInformation.java @@ -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 @@ -32,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.os.TestCPUInformation diff --git a/test/jdk/jdk/jfr/event/os/TestCPULoad.java b/test/jdk/jdk/jfr/event/os/TestCPULoad.java index efc9b39adf50e..09ceb0a79b786 100644 --- a/test/jdk/jdk/jfr/event/os/TestCPULoad.java +++ b/test/jdk/jdk/jfr/event/os/TestCPULoad.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -30,10 +30,9 @@ import jdk.test.lib.jfr.EventNames; import jdk.test.lib.jfr.Events; - /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.os.TestCPULoad @@ -41,13 +40,32 @@ public class TestCPULoad { private final static String EVENT_NAME = EventNames.CPULoad; + public static boolean isPrime(int num) { + if (num <= 1) return false; + for (int i = 2; i <= Math.sqrt(num); i++) { + if (num % i == 0) return false; + } + return true; + } + + public static int burnCpuCycles(int limit) { + int primeCount = 0; + for (int i = 2; i < limit; i++) { + if (isPrime(i)) { + primeCount++; + } + } + return primeCount; + } + public static void main(String[] args) throws Throwable { Recording recording = new Recording(); recording.enable(EVENT_NAME); recording.start(); - // Need to sleep so a time delta can be calculated - Thread.sleep(100); + // burn some cycles to check increase of CPU related counters + int pn = burnCpuCycles(2500000); recording.stop(); + System.out.println("Found " + pn + " primes while burning cycles"); List events = Events.fromRecording(recording); if (events.isEmpty()) { diff --git a/test/jdk/jdk/jfr/event/os/TestCPUTimeStampCounter.java b/test/jdk/jdk/jfr/event/os/TestCPUTimeStampCounter.java index fd37ef195a54f..464de5557bedb 100644 --- a/test/jdk/jdk/jfr/event/os/TestCPUTimeStampCounter.java +++ b/test/jdk/jdk/jfr/event/os/TestCPUTimeStampCounter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.os.TestCPUTimeStampCounter diff --git a/test/jdk/jdk/jfr/event/os/TestInitialEnvironmentVariable.java b/test/jdk/jdk/jfr/event/os/TestInitialEnvironmentVariable.java index d8fd9a6e67344..e869a3da3c7db 100644 --- a/test/jdk/jdk/jfr/event/os/TestInitialEnvironmentVariable.java +++ b/test/jdk/jdk/jfr/event/os/TestInitialEnvironmentVariable.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 @@ -39,7 +39,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main jdk.jfr.event.os.TestInitialEnvironmentVariable diff --git a/test/jdk/jdk/jfr/event/os/TestOSInfo.java b/test/jdk/jdk/jfr/event/os/TestOSInfo.java index ce7565e3f5182..5dfce35683bef 100644 --- a/test/jdk/jdk/jfr/event/os/TestOSInfo.java +++ b/test/jdk/jdk/jfr/event/os/TestOSInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.os.TestOSInfo diff --git a/test/jdk/jdk/jfr/event/os/TestPhysicalMemoryEvent.java b/test/jdk/jdk/jfr/event/os/TestPhysicalMemoryEvent.java index 13e0522727842..79810a58b3a81 100644 --- a/test/jdk/jdk/jfr/event/os/TestPhysicalMemoryEvent.java +++ b/test/jdk/jdk/jfr/event/os/TestPhysicalMemoryEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.os.TestPhysicalMemoryEvent diff --git a/test/jdk/jdk/jfr/event/os/TestProcessStart.java b/test/jdk/jdk/jfr/event/os/TestProcessStart.java index bcf216857bb9b..2d1d80f59418d 100644 --- a/test/jdk/jdk/jfr/event/os/TestProcessStart.java +++ b/test/jdk/jdk/jfr/event/os/TestProcessStart.java @@ -36,7 +36,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.os.TestProcessStart diff --git a/test/jdk/jdk/jfr/event/os/TestSwapSpaceEvent.java b/test/jdk/jdk/jfr/event/os/TestSwapSpaceEvent.java index 5ea2ed139eafa..cf92db85ace79 100644 --- a/test/jdk/jdk/jfr/event/os/TestSwapSpaceEvent.java +++ b/test/jdk/jdk/jfr/event/os/TestSwapSpaceEvent.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,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires (os.family != "linux") * @library /test/lib @@ -41,7 +41,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires (os.family == "linux") * @library /test/lib diff --git a/test/jdk/jdk/jfr/event/os/TestSystemProcess.java b/test/jdk/jdk/jfr/event/os/TestSystemProcess.java index 0af7a7ff37949..a76060bac9d8d 100644 --- a/test/jdk/jdk/jfr/event/os/TestSystemProcess.java +++ b/test/jdk/jdk/jfr/event/os/TestSystemProcess.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.os.TestSystemProcess diff --git a/test/jdk/jdk/jfr/event/os/TestThreadContextSwitches.java b/test/jdk/jdk/jfr/event/os/TestThreadContextSwitches.java index 00b846b87e2bb..7b3dfc79ce956 100644 --- a/test/jdk/jdk/jfr/event/os/TestThreadContextSwitches.java +++ b/test/jdk/jdk/jfr/event/os/TestThreadContextSwitches.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.os.TestThreadContextSwitches diff --git a/test/jdk/jdk/jfr/event/os/TestVirtualizationInfo.java b/test/jdk/jdk/jfr/event/os/TestVirtualizationInfo.java index 0c3c86d5829ec..2c30e102c73f8 100644 --- a/test/jdk/jdk/jfr/event/os/TestVirtualizationInfo.java +++ b/test/jdk/jdk/jfr/event/os/TestVirtualizationInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2019, 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,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.os.TestVirtualizationInfo diff --git a/test/jdk/jdk/jfr/event/profiling/TestFullStackTrace.java b/test/jdk/jdk/jfr/event/profiling/TestFullStackTrace.java index b7abbc0a587f1..424b519c1e042 100644 --- a/test/jdk/jdk/jfr/event/profiling/TestFullStackTrace.java +++ b/test/jdk/jdk/jfr/event/profiling/TestFullStackTrace.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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.profiling.TestFullStackTrace diff --git a/test/jdk/jdk/jfr/event/profiling/TestNative.java b/test/jdk/jdk/jfr/event/profiling/TestNative.java index 21949bcc31306..e7e076051f45f 100644 --- a/test/jdk/jdk/jfr/event/profiling/TestNative.java +++ b/test/jdk/jdk/jfr/event/profiling/TestNative.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 @@ -32,7 +32,7 @@ /* * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/event/profiling/TestSamplingLongPeriod.java b/test/jdk/jdk/jfr/event/profiling/TestSamplingLongPeriod.java index c2cd4cb7bd16a..2402a948ef988 100644 --- a/test/jdk/jdk/jfr/event/profiling/TestSamplingLongPeriod.java +++ b/test/jdk/jdk/jfr/event/profiling/TestSamplingLongPeriod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022, 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 @@ -31,7 +31,7 @@ /* * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/event/runtime/TestActiveRecordingEvent.java b/test/jdk/jdk/jfr/event/runtime/TestActiveRecordingEvent.java index e786e8c933d0d..778acf48306e0 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestActiveRecordingEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestActiveRecordingEvent.java @@ -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 @@ -44,7 +44,7 @@ /** * @test * @summary Tests that the recording properties are properly reflected in the ActiveRecording event - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.runtime.TestActiveRecordingEvent diff --git a/test/jdk/jdk/jfr/event/runtime/TestActiveSettingEvent.java b/test/jdk/jdk/jfr/event/runtime/TestActiveSettingEvent.java index 2b55a012d44d8..92298eaece0ff 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestActiveSettingEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestActiveSettingEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022, 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 @@ -45,7 +45,7 @@ /** * @test * @summary Tests that active setting are available in the ActiveSettingevent - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.runtime.TestActiveSettingEvent diff --git a/test/jdk/jdk/jfr/event/runtime/TestAgentEvent.java b/test/jdk/jdk/jfr/event/runtime/TestAgentEvent.java index 240868d567077..ca7b6dfc0f112 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestAgentEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestAgentEvent.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 @@ -44,7 +44,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Tests Agent Loaded event by starting native and Java agents * @requires vm.hasJFR & vm.jvmti * diff --git a/test/jdk/jdk/jfr/event/runtime/TestClassDefineEvent.java b/test/jdk/jdk/jfr/event/runtime/TestClassDefineEvent.java index 3681e73b52707..b0522741a1e49 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestClassDefineEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestClassDefineEvent.java @@ -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 @@ -36,7 +36,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules java.base/jdk.internal.misc diff --git a/test/jdk/jdk/jfr/event/runtime/TestClassLoadEvent.java b/test/jdk/jdk/jfr/event/runtime/TestClassLoadEvent.java index ec72253bc0662..102ff92db719a 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestClassLoadEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestClassLoadEvent.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 @@ -37,7 +37,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules java.base/jdk.internal.misc diff --git a/test/jdk/jdk/jfr/event/runtime/TestClassLoaderStatsEvent.java b/test/jdk/jdk/jfr/event/runtime/TestClassLoaderStatsEvent.java index 62b9ef1eccdb5..f73876e677c3a 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestClassLoaderStatsEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestClassLoaderStatsEvent.java @@ -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 @@ -42,7 +42,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules java.base/jdk.internal.misc diff --git a/test/jdk/jdk/jfr/event/runtime/TestClassLoadingStatisticsEvent.java b/test/jdk/jdk/jfr/event/runtime/TestClassLoadingStatisticsEvent.java index 8bbbdcbc447a7..6184a6f627e01 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestClassLoadingStatisticsEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestClassLoadingStatisticsEvent.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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules java.base/jdk.internal.misc diff --git a/test/jdk/jdk/jfr/event/runtime/TestClassRedefinition.java b/test/jdk/jdk/jfr/event/runtime/TestClassRedefinition.java index 23c2f2cbc3a5b..5367d76dbf564 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestClassRedefinition.java +++ b/test/jdk/jdk/jfr/event/runtime/TestClassRedefinition.java @@ -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 @@ -40,7 +40,7 @@ /** * @test * @summary Tests ClassRedefinition event by redefining classes in a Java agent - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules java.instrument diff --git a/test/jdk/jdk/jfr/event/runtime/TestClassUnloadEvent.java b/test/jdk/jdk/jfr/event/runtime/TestClassUnloadEvent.java index 6507b7e53bfe3..f25b9a69650eb 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestClassUnloadEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestClassUnloadEvent.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 @@ -38,7 +38,7 @@ /** * @test * @summary The test verifies that a class unload event is created when class is unloaded - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules java.base/jdk.internal.misc diff --git a/test/jdk/jdk/jfr/event/runtime/TestDeprecatedEvent.java b/test/jdk/jdk/jfr/event/runtime/TestDeprecatedEvent.java index 183d82bc5e201..e2ecea43a8802 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestDeprecatedEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestDeprecatedEvent.java @@ -40,7 +40,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @modules jdk.jfr/jdk.jfr.internal.test * @library /test/lib diff --git a/test/jdk/jdk/jfr/event/runtime/TestDirectBufferStatisticsEvent.java b/test/jdk/jdk/jfr/event/runtime/TestDirectBufferStatisticsEvent.java index 777f2d5fca2be..b007083dde91f 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestDirectBufferStatisticsEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestDirectBufferStatisticsEvent.java @@ -36,7 +36,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules java.base/jdk.internal.misc diff --git a/test/jdk/jdk/jfr/event/runtime/TestDumpReason.java b/test/jdk/jdk/jfr/event/runtime/TestDumpReason.java index 83af0de239d3d..f801829d8eb3f 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestDumpReason.java +++ b/test/jdk/jdk/jfr/event/runtime/TestDumpReason.java @@ -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 @@ -41,7 +41,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules java.base/jdk.internal.misc jdk.jfr diff --git a/test/jdk/jdk/jfr/event/runtime/TestExceptionEvents.java b/test/jdk/jdk/jfr/event/runtime/TestExceptionEvents.java index 46488f0221a97..8c447ac44bf35 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestExceptionEvents.java +++ b/test/jdk/jdk/jfr/event/runtime/TestExceptionEvents.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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.runtime.TestExceptionEvents diff --git a/test/jdk/jdk/jfr/event/runtime/TestExceptionSubclass.java b/test/jdk/jdk/jfr/event/runtime/TestExceptionSubclass.java index f6917faa8e2f9..0c55b27364eb9 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestExceptionSubclass.java +++ b/test/jdk/jdk/jfr/event/runtime/TestExceptionSubclass.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -27,7 +27,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @bug 8013122 * @requires vm.hasJFR * @library /test/lib diff --git a/test/jdk/jdk/jfr/event/runtime/TestFinalizerStatisticsEvent.java b/test/jdk/jdk/jfr/event/runtime/TestFinalizerStatisticsEvent.java index 8256a62b5712b..ead77f467acb3 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestFinalizerStatisticsEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestFinalizerStatisticsEvent.java @@ -36,7 +36,7 @@ * @test * @bug 8266936 8276422 * @summary The test verifies that classes overriding finalize() are represented as events. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -Xlog:class+unload,finalizer -Xmx16m jdk.jfr.event.runtime.TestFinalizerStatisticsEvent diff --git a/test/jdk/jdk/jfr/event/runtime/TestFlush.java b/test/jdk/jdk/jfr/event/runtime/TestFlush.java index ad8706a649379..5c450eab05f85 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestFlush.java +++ b/test/jdk/jdk/jfr/event/runtime/TestFlush.java @@ -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 @@ -41,7 +41,7 @@ /** * @test * @summary Verifies at the metalevel that stream contents are written to ongoing recordings - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm -Xlog:jfr+system+streaming=trace jdk.jfr.event.runtime.TestFlush diff --git a/test/jdk/jdk/jfr/event/runtime/TestJavaBlockedEvent.java b/test/jdk/jdk/jfr/event/runtime/TestJavaBlockedEvent.java index 23fb1cd84332c..c29cebc3d1ddf 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestJavaBlockedEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestJavaBlockedEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -40,7 +40,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * diff --git a/test/jdk/jdk/jfr/event/runtime/TestJavaMonitorInflateEvent.java b/test/jdk/jdk/jfr/event/runtime/TestJavaMonitorInflateEvent.java index 596b50f5b0cd2..5b7fb3e19cad2 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestJavaMonitorInflateEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestJavaMonitorInflateEvent.java @@ -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 @@ -38,7 +38,7 @@ /** * @test TestJavaMonitorInflateEvent - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.runtime.TestJavaMonitorInflateEvent diff --git a/test/jdk/jdk/jfr/event/runtime/TestJavaMonitorWaitEvent.java b/test/jdk/jdk/jfr/event/runtime/TestJavaMonitorWaitEvent.java index a9cbd04019264..d16503f1fdc75 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestJavaMonitorWaitEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestJavaMonitorWaitEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.runtime.TestJavaMonitorWaitEvent diff --git a/test/jdk/jdk/jfr/event/runtime/TestJavaMonitorWaitTimeOut.java b/test/jdk/jdk/jfr/event/runtime/TestJavaMonitorWaitTimeOut.java index 0e200f68f9ee6..379b9a97a298f 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestJavaMonitorWaitTimeOut.java +++ b/test/jdk/jdk/jfr/event/runtime/TestJavaMonitorWaitTimeOut.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -35,7 +35,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.runtime.TestJavaMonitorWaitTimeOut diff --git a/test/jdk/jdk/jfr/event/runtime/TestJavaThreadStatisticsEvent.java b/test/jdk/jdk/jfr/event/runtime/TestJavaThreadStatisticsEvent.java index 4a6c991ec3cc9..92d86b1163cd1 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestJavaThreadStatisticsEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestJavaThreadStatisticsEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 +37,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.runtime.TestJavaThreadStatisticsEvent diff --git a/test/jdk/jdk/jfr/event/runtime/TestJavaThreadStatisticsEventBean.java b/test/jdk/jdk/jfr/event/runtime/TestJavaThreadStatisticsEventBean.java index 1702d5cd2352b..dae73cb76b55d 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestJavaThreadStatisticsEventBean.java +++ b/test/jdk/jdk/jfr/event/runtime/TestJavaThreadStatisticsEventBean.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 +37,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * diff --git a/test/jdk/jdk/jfr/event/runtime/TestModuleEvents.java b/test/jdk/jdk/jfr/event/runtime/TestModuleEvents.java index dc877e1cafc47..4998cb29d3dc2 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestModuleEvents.java +++ b/test/jdk/jdk/jfr/event/runtime/TestModuleEvents.java @@ -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 @@ -37,7 +37,7 @@ /** * @test * @summary Tests the JFR events related to modules - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires !vm.graal.enabled * @library /test/lib diff --git a/test/jdk/jdk/jfr/event/runtime/TestNativeLibrariesEvent.java b/test/jdk/jdk/jfr/event/runtime/TestNativeLibrariesEvent.java index 571809ddab40c..132cc7e73b80d 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestNativeLibrariesEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestNativeLibrariesEvent.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 @@ -38,7 +38,7 @@ /** * @test * @bug 8216559 - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.runtime.TestNativeLibrariesEvent diff --git a/test/jdk/jdk/jfr/event/runtime/TestNativeLibraryLoadEvent.java b/test/jdk/jdk/jfr/event/runtime/TestNativeLibraryLoadEvent.java index 240045c1d6089..e0931d7453f1a 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestNativeLibraryLoadEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestNativeLibraryLoadEvent.java @@ -39,7 +39,7 @@ /** * @test * @bug 8313251 - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.runtime.TestNativeLibraryLoadEvent diff --git a/test/jdk/jdk/jfr/event/runtime/TestNativeMemoryUsageEvents.java b/test/jdk/jdk/jfr/event/runtime/TestNativeMemoryUsageEvents.java index b1a564cb4a0cf..9373f7455913b 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestNativeMemoryUsageEvents.java +++ b/test/jdk/jdk/jfr/event/runtime/TestNativeMemoryUsageEvents.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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.opt.NativeMemoryTracking == null * @requires vm.hasJFR * @library /test/lib diff --git a/test/jdk/jdk/jfr/event/runtime/TestNetworkUtilizationEvent.java b/test/jdk/jdk/jfr/event/runtime/TestNetworkUtilizationEvent.java index a1b5485a5bd7c..ac33c39a1a2d7 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestNetworkUtilizationEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestNetworkUtilizationEvent.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 @@ -39,7 +39,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * diff --git a/test/jdk/jdk/jfr/event/runtime/TestRedefineClasses.java b/test/jdk/jdk/jfr/event/runtime/TestRedefineClasses.java index 40fc583872f44..c4c73ec3d5787 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestRedefineClasses.java +++ b/test/jdk/jdk/jfr/event/runtime/TestRedefineClasses.java @@ -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 @@ -39,7 +39,7 @@ * @test * @summary Tests RedefinitionClasses event by redefining a class in a Java * agent - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules java.instrument diff --git a/test/jdk/jdk/jfr/event/runtime/TestResidentSetSizeEvent.java b/test/jdk/jdk/jfr/event/runtime/TestResidentSetSizeEvent.java index facf222279c78..8b9bd99bf5ebe 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestResidentSetSizeEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestResidentSetSizeEvent.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 @@ -36,7 +36,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr diff --git a/test/jdk/jdk/jfr/event/runtime/TestRetransformClasses.java b/test/jdk/jdk/jfr/event/runtime/TestRetransformClasses.java index a02f97366c3be..582422d8c8031 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestRetransformClasses.java +++ b/test/jdk/jdk/jfr/event/runtime/TestRetransformClasses.java @@ -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 @@ -41,7 +41,7 @@ * @test * @summary Tests the RetransformClasses event by redefining a class in a Java * agent - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules java.instrument diff --git a/test/jdk/jdk/jfr/event/runtime/TestSafepointEvents.java b/test/jdk/jdk/jfr/event/runtime/TestSafepointEvents.java index 8ea0181b0dd40..0dccbc4495a45 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestSafepointEvents.java +++ b/test/jdk/jdk/jfr/event/runtime/TestSafepointEvents.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 @@ -38,7 +38,7 @@ /** * @test TestSafepointEvents - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @build jdk.test.whitebox.WhiteBox diff --git a/test/jdk/jdk/jfr/event/runtime/TestShutdownEvent.java b/test/jdk/jdk/jfr/event/runtime/TestShutdownEvent.java index d680dde023d7a..61d99fbec4f27 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestShutdownEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestShutdownEvent.java @@ -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 @@ /** * @test * @summary Test Shutdown event - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr diff --git a/test/jdk/jdk/jfr/event/runtime/TestSizeTFlags.java b/test/jdk/jdk/jfr/event/runtime/TestSizeTFlags.java index 3eaf4cccf6cc3..0c53d7c91a73a 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestSizeTFlags.java +++ b/test/jdk/jdk/jfr/event/runtime/TestSizeTFlags.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 @@ -37,7 +37,7 @@ * @bug 8058552 * @requires vm.hasJFR * @requires vm.gc == "G1" | vm.gc == null - * @key jfr + * @requires vm.flagless * @summary Test checks that flags of type size_t are being sent to the jfr * @library /test/lib * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:-UseFastUnorderedTimeStamps -XX:+UseG1GC -XX:+UseTLAB -XX:MinTLABSize=3k -XX:YoungPLABSize=3k -XX:MaxDirectMemorySize=5M jdk.jfr.event.runtime.TestSizeTFlags diff --git a/test/jdk/jdk/jfr/event/runtime/TestSyncOnValueBasedClassEvent.java b/test/jdk/jdk/jfr/event/runtime/TestSyncOnValueBasedClassEvent.java index f20175da37fd9..7ad50c83399dd 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestSyncOnValueBasedClassEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestSyncOnValueBasedClassEvent.java @@ -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 @@ -36,7 +36,7 @@ * @test * @bug 8242263 * @requires vm.hasJFR - * @key jfr + * @requires vm.flagless * @library /test/lib * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:DiagnoseSyncOnValueBasedClasses=2 jdk.jfr.event.runtime.TestSyncOnValueBasedClassEvent */ diff --git a/test/jdk/jdk/jfr/event/runtime/TestSystemPropertyEvent.java b/test/jdk/jdk/jfr/event/runtime/TestSystemPropertyEvent.java index 9cb506c45cb45..7adc1fabc2393 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestSystemPropertyEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestSystemPropertyEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.runtime.TestSystemPropertyEvent diff --git a/test/jdk/jdk/jfr/event/runtime/TestTableStatisticsEvent.java b/test/jdk/jdk/jfr/event/runtime/TestTableStatisticsEvent.java index 1f5884c4b46e1..9652b5d501ce5 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestTableStatisticsEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestTableStatisticsEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, 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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules java.base/jdk.internal.misc diff --git a/test/jdk/jdk/jfr/event/runtime/TestThreadAllocationEvent.java b/test/jdk/jdk/jfr/event/runtime/TestThreadAllocationEvent.java index 192559cd69b3d..69511a4b52159 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestThreadAllocationEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestThreadAllocationEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr diff --git a/test/jdk/jdk/jfr/event/runtime/TestThreadCpuTimeEvent.java b/test/jdk/jdk/jfr/event/runtime/TestThreadCpuTimeEvent.java index a6520614eab85..e6cd9d95d16a3 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestThreadCpuTimeEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestThreadCpuTimeEvent.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 @@ -41,7 +41,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr diff --git a/test/jdk/jdk/jfr/event/runtime/TestThreadDumpEvent.java b/test/jdk/jdk/jfr/event/runtime/TestThreadDumpEvent.java index b583d48692668..302874880c29f 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestThreadDumpEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestThreadDumpEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -35,7 +35,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.runtime.TestThreadDumpEvent diff --git a/test/jdk/jdk/jfr/event/runtime/TestThreadEndEvent.java b/test/jdk/jdk/jfr/event/runtime/TestThreadEndEvent.java index 160702de36098..0b70cd5bcbc20 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestThreadEndEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestThreadEndEvent.java @@ -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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR & vm.continuations * @library /test/lib * @compile TestThreadEndEvent.java LatchedThread.java diff --git a/test/jdk/jdk/jfr/event/runtime/TestThreadParkEvent.java b/test/jdk/jdk/jfr/event/runtime/TestThreadParkEvent.java index d65a407430636..3887af38aeba7 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestThreadParkEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestThreadParkEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -40,7 +40,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * diff --git a/test/jdk/jdk/jfr/event/runtime/TestThreadSleepEvent.java b/test/jdk/jdk/jfr/event/runtime/TestThreadSleepEvent.java index c084808ce79ae..e372766b95dab 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestThreadSleepEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestThreadSleepEvent.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 @@ -37,7 +37,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR & vm.continuations * @library /test/lib * @run main/othervm jdk.jfr.event.runtime.TestThreadSleepEvent diff --git a/test/jdk/jdk/jfr/event/runtime/TestThreadStartEvent.java b/test/jdk/jdk/jfr/event/runtime/TestThreadStartEvent.java index 9e8f7b13e31f0..5b0a6ea68a39c 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestThreadStartEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestThreadStartEvent.java @@ -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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR & vm.continuations * @library /test/lib * @compile TestThreadStartEvent.java LatchedThread.java diff --git a/test/jdk/jdk/jfr/event/runtime/TestVMInfoEvent.java b/test/jdk/jdk/jfr/event/runtime/TestVMInfoEvent.java index 82a052739791b..2571530a47097 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestVMInfoEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestVMInfoEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2019, 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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.gc == "Serial" | vm.gc == null * @requires vm.hasJFR * @library /test/lib diff --git a/test/jdk/jdk/jfr/event/runtime/TestVMOperation.java b/test/jdk/jdk/jfr/event/runtime/TestVMOperation.java index 31fb306c04d79..d9ed619ac3621 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestVMOperation.java +++ b/test/jdk/jdk/jfr/event/runtime/TestVMOperation.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 @@ -36,7 +36,7 @@ * @test * @requires vm.hasJFR * @requires vm.gc == "Parallel" | vm.gc == null - * @key jfr + * @requires vm.flagless * @library /test/lib * @run main/othervm -XX:+UseParallelGC jdk.jfr.event.runtime.TestVMOperation */ diff --git a/test/jdk/jdk/jfr/event/runtime/TestVirtualThreadEndEvent.java b/test/jdk/jdk/jfr/event/runtime/TestVirtualThreadEndEvent.java index 355ef163e6fdd..7de0b321864db 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestVirtualThreadEndEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestVirtualThreadEndEvent.java @@ -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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR & vm.continuations * @library /test/lib * @compile TestVirtualThreadEndEvent.java LatchedThread.java diff --git a/test/jdk/jdk/jfr/event/runtime/TestVirtualThreadStartEvent.java b/test/jdk/jdk/jfr/event/runtime/TestVirtualThreadStartEvent.java index 7b4bdb4b28e7f..cc1f38b8a7272 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestVirtualThreadStartEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestVirtualThreadStartEvent.java @@ -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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR & vm.continuations * @library /test/lib * @compile TestVirtualThreadStartEvent.java LatchedThread.java diff --git a/test/jdk/jdk/jfr/event/runtime/TestVmFlagChangedEvent.java b/test/jdk/jdk/jfr/event/runtime/TestVmFlagChangedEvent.java index a386adc8ac2ff..a24996f0e5562 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestVmFlagChangedEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestVmFlagChangedEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2019, 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,7 +37,7 @@ /** * @test TestVmFlagChangedEvent - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr diff --git a/test/jdk/jdk/jfr/event/security/TestInitialSecurityPropertyEvent.java b/test/jdk/jdk/jfr/event/security/TestInitialSecurityPropertyEvent.java index bebd44782d21b..bed89be84c2ae 100644 --- a/test/jdk/jdk/jfr/event/security/TestInitialSecurityPropertyEvent.java +++ b/test/jdk/jdk/jfr/event/security/TestInitialSecurityPropertyEvent.java @@ -38,7 +38,7 @@ * @test * @bug 8292177 * @summary InitialSecurityProperty JFR event - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules java.base/jdk.internal.access diff --git a/test/jdk/jdk/jfr/event/security/TestSecurityPropertyModificationEvent.java b/test/jdk/jdk/jfr/event/security/TestSecurityPropertyModificationEvent.java index ff5919b25909a..4ede92aee4166 100644 --- a/test/jdk/jdk/jfr/event/security/TestSecurityPropertyModificationEvent.java +++ b/test/jdk/jdk/jfr/event/security/TestSecurityPropertyModificationEvent.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 @@ -37,7 +37,7 @@ * @test * @bug 8148188 * @summary Enhance the security libraries to record events of interest - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.security.TestSecurityPropertyModificationEvent diff --git a/test/jdk/jdk/jfr/event/security/TestSecurityProviderServiceEvent.java b/test/jdk/jdk/jfr/event/security/TestSecurityProviderServiceEvent.java index df801c5190742..70ed6f3d867d9 100644 --- a/test/jdk/jdk/jfr/event/security/TestSecurityProviderServiceEvent.java +++ b/test/jdk/jdk/jfr/event/security/TestSecurityProviderServiceEvent.java @@ -42,7 +42,7 @@ * @test * @bug 8254711 * @summary Add JFR events for security crypto algorithms - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr/jdk.jfr.events diff --git a/test/jdk/jdk/jfr/event/security/TestTLSHandshakeEvent.java b/test/jdk/jdk/jfr/event/security/TestTLSHandshakeEvent.java index 7c5240a2a72e5..559290f50b47f 100644 --- a/test/jdk/jdk/jfr/event/security/TestTLSHandshakeEvent.java +++ b/test/jdk/jdk/jfr/event/security/TestTLSHandshakeEvent.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 @@ -35,7 +35,7 @@ * @test * @bug 8148188 * @summary Enhance the security libraries to record events of interest - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.event.security.TestTLSHandshakeEvent diff --git a/test/jdk/jdk/jfr/event/security/TestX509CertificateEvent.java b/test/jdk/jdk/jfr/event/security/TestX509CertificateEvent.java index e7e905830a44b..60b1406a0dc5f 100644 --- a/test/jdk/jdk/jfr/event/security/TestX509CertificateEvent.java +++ b/test/jdk/jdk/jfr/event/security/TestX509CertificateEvent.java @@ -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 @@ -37,7 +37,7 @@ * @test * @bug 8148188 8292033 * @summary Enhance the security libraries to record events of interest - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @modules java.base/sun.security.x509 java.base/sun.security.tools.keytool * @library /test/lib diff --git a/test/jdk/jdk/jfr/event/security/TestX509ValidationEvent.java b/test/jdk/jdk/jfr/event/security/TestX509ValidationEvent.java index 651a6390f6857..92dc99ef8c713 100644 --- a/test/jdk/jdk/jfr/event/security/TestX509ValidationEvent.java +++ b/test/jdk/jdk/jfr/event/security/TestX509ValidationEvent.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 @@ -36,7 +36,7 @@ * @test * @bug 8148188 * @summary Enhance the security libraries to record events of interest - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr/jdk.jfr.events java.base/sun.security.x509 java.base/sun.security.tools.keytool diff --git a/test/jdk/jdk/jfr/javaagent/TestEventInstrumentation.java b/test/jdk/jdk/jfr/javaagent/TestEventInstrumentation.java index d5997f1ad4666..1a5ad27725b8c 100644 --- a/test/jdk/jdk/jfr/javaagent/TestEventInstrumentation.java +++ b/test/jdk/jdk/jfr/javaagent/TestEventInstrumentation.java @@ -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 @@ -48,7 +48,7 @@ * @test * @summary Verify that a subclass of the JFR Event class * can be successfully instrumented. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jartool/sun.tools.jar diff --git a/test/jdk/jdk/jfr/javaagent/TestLoadedAgent.java b/test/jdk/jdk/jfr/javaagent/TestLoadedAgent.java index deb38d5e8db86..92b88336b3e0d 100644 --- a/test/jdk/jdk/jfr/javaagent/TestLoadedAgent.java +++ b/test/jdk/jdk/jfr/javaagent/TestLoadedAgent.java @@ -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 @@ -23,7 +23,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Tests emitting events in a dynamically loaded Java agent * @requires vm.hasJFR * diff --git a/test/jdk/jdk/jfr/javaagent/TestPremainAgent.java b/test/jdk/jdk/jfr/javaagent/TestPremainAgent.java index 19a39ff7ef07a..388779fcc7f84 100644 --- a/test/jdk/jdk/jfr/javaagent/TestPremainAgent.java +++ b/test/jdk/jdk/jfr/javaagent/TestPremainAgent.java @@ -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 @@ -23,7 +23,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Tests emitting event before main using a Java agent * @requires vm.hasJFR * diff --git a/test/jdk/jdk/jfr/jcmd/TestFilenameExpansion.java b/test/jdk/jdk/jfr/jcmd/TestFilenameExpansion.java index 9b9f67ba0faa0..789d5cbe5bd36 100644 --- a/test/jdk/jdk/jfr/jcmd/TestFilenameExpansion.java +++ b/test/jdk/jdk/jfr/jcmd/TestFilenameExpansion.java @@ -34,7 +34,7 @@ /** * @test * @summary The test verifies JFR.start/dump/stop commands - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jcmd.TestFilenameExpansion diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdChangeLogLevel.java b/test/jdk/jdk/jfr/jcmd/TestJcmdChangeLogLevel.java index dfb755a7f215f..c4ef5ecfa74fa 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdChangeLogLevel.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdChangeLogLevel.java @@ -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 @@ -35,7 +35,7 @@ /** * @test TestJcmdLogLevelChange - * @key jfr + * @requires vm.flagless * @summary Test changing log level * @requires vm.hasJFR * diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdConfigure.java b/test/jdk/jdk/jfr/jcmd/TestJcmdConfigure.java index 2780f396f0562..f64c99bedbcbf 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdConfigure.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdConfigure.java @@ -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 @@ -25,12 +25,12 @@ import java.io.File; import java.nio.file.Files; +import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import jdk.jfr.internal.Repository; -import jdk.jfr.internal.SecuritySupport.SafePath; import jdk.jfr.internal.Options; import jdk.test.lib.Asserts; import jdk.test.lib.Utils; @@ -38,7 +38,7 @@ /** * @test * @summary The test verifies JFR.configure command - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal @@ -131,17 +131,17 @@ private static void testRepository(){ try { JcmdHelper.jcmd("JFR.configure", REPOSITORYPATH_SETTING_1); - SafePath initialPath = Repository.getRepository().getRepositoryPath(); + Path initialPath = Repository.getRepository().getRepositoryPath(); JcmdHelper.jcmd("JFR.configure", REPOSITORYPATH_SETTING_1); - SafePath samePath = Repository.getRepository().getRepositoryPath(); + Path samePath = Repository.getRepository().getRepositoryPath(); Asserts.assertTrue(samePath.equals(initialPath)); List lines = Files.readAllLines(Paths.get(JFR_UNIFIED_LOG_FILE)); Asserts.assertTrue(lines.stream().anyMatch(l->l.contains(findWhat))); JcmdHelper.jcmd("JFR.configure", REPOSITORYPATH_SETTING_2); - SafePath changedPath = Repository.getRepository().getRepositoryPath(); + Path changedPath = Repository.getRepository().getRepositoryPath(); Asserts.assertFalse(changedPath.equals(initialPath)); diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdConfigureReadOnly.java b/test/jdk/jdk/jfr/jcmd/TestJcmdConfigureReadOnly.java index 6ddf3a752342d..9eefbd183b2e4 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdConfigureReadOnly.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdConfigureReadOnly.java @@ -28,7 +28,7 @@ /** * @test * @summary The test verifies JFR.configure command can only set certain options before JFR is started. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jcmd.TestJcmdConfigureReadOnly diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdDump.java b/test/jdk/jdk/jfr/jcmd/TestJcmdDump.java index 6f4be44ff6377..2bc7aa857e3d5 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdDump.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdDump.java @@ -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 @@ -41,7 +41,7 @@ /** * @test * @summary The test verifies JFR.dump command - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -XX:FlightRecorderOptions:maxchunksize=1M jdk.jfr.jcmd.TestJcmdDump diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdDumpGeneratedFilename.java b/test/jdk/jdk/jfr/jcmd/TestJcmdDumpGeneratedFilename.java index 4612e7c7c8c9d..eca991eaab610 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdDumpGeneratedFilename.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdDumpGeneratedFilename.java @@ -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 @@ -35,7 +35,7 @@ /** * @test * @summary The test verifies JFR.dump command - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jcmd.TestJcmdDumpGeneratedFilename diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdDumpLimited.java b/test/jdk/jdk/jfr/jcmd/TestJcmdDumpLimited.java index ce4b11937c611..8b8ba050245e8 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdDumpLimited.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdDumpLimited.java @@ -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 @@ -44,7 +44,7 @@ /** * @test * @summary The test verifies JFR.dump command - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jcmd.TestJcmdDumpLimited diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdDumpPathToGCRoots.java b/test/jdk/jdk/jfr/jcmd/TestJcmdDumpPathToGCRoots.java index 5d469c698c190..499bf9452be68 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdDumpPathToGCRoots.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdDumpPathToGCRoots.java @@ -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 @@ -45,7 +45,7 @@ * @requires vm.hasJFR * @modules jdk.jfr/jdk.jfr.internal.test * @library /test/lib /test/jdk - * @key jfr + * @requires vm.flagless * * @run main/othervm -XX:TLABSize=2k jdk.jfr.jcmd.TestJcmdDumpPathToGCRoots */ diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdDumpWithFileName.java b/test/jdk/jdk/jfr/jcmd/TestJcmdDumpWithFileName.java index 93265dc677cf5..268d250418da1 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdDumpWithFileName.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdDumpWithFileName.java @@ -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 @@ -34,7 +34,7 @@ /** * @test * @bug 8220657 - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jcmd.TestJcmdDumpWithFileName diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdLegacy.java b/test/jdk/jdk/jfr/jcmd/TestJcmdLegacy.java index a6aa2143f41dc..33e5d9542efe6 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdLegacy.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdLegacy.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 @@ -38,7 +38,7 @@ /** * @test TestClassId - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdOptionSpecifiedOnce.java b/test/jdk/jdk/jfr/jcmd/TestJcmdOptionSpecifiedOnce.java index bb057cce3867e..a9b9bcc58725f 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdOptionSpecifiedOnce.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdOptionSpecifiedOnce.java @@ -25,7 +25,7 @@ /** * @test * @summary The test verifies that options can only be specified once with jcmd JFR - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal.dcmd diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdPreserveRepository.java b/test/jdk/jdk/jfr/jcmd/TestJcmdPreserveRepository.java index 374c760ae9b47..9f42bef6e7e87 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdPreserveRepository.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdPreserveRepository.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 @@ -35,7 +35,7 @@ /** * @test * @summary Test verifies that files are left after preserve-repository has been set using jcmd JFR.configure - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jcmd.TestJcmdPreserveRepository diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdSaveToFile.java b/test/jdk/jdk/jfr/jcmd/TestJcmdSaveToFile.java index b6542420bd5c0..b7ce317f9288b 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdSaveToFile.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdSaveToFile.java @@ -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 @@ -31,7 +31,7 @@ /** * @test * @summary The test verifies that recording can be written to a file both with JFR.start and JFR.stop - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jcmd.TestJcmdSaveToFile diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdStartDirNotExist.java b/test/jdk/jdk/jfr/jcmd/TestJcmdStartDirNotExist.java index 49035cff8f45c..e683880195b39 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdStartDirNotExist.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdStartDirNotExist.java @@ -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 @@ -31,7 +31,7 @@ /** * @test * @summary Verify error when starting with a dir that does not exist. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jcmd.TestJcmdStartDirNotExist diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdStartFlushInterval.java b/test/jdk/jdk/jfr/jcmd/TestJcmdStartFlushInterval.java index 0d6e8fa076065..046ecd190f813 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdStartFlushInterval.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdStartFlushInterval.java @@ -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 @@ -32,7 +32,7 @@ /** * @test * @summary Start a recording with a flush interval - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr:open diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdStartGeneratedFilename.java b/test/jdk/jdk/jfr/jcmd/TestJcmdStartGeneratedFilename.java index d3e4dd7b2c2b6..bf365b9c248f1 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdStartGeneratedFilename.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdStartGeneratedFilename.java @@ -38,7 +38,7 @@ /** * @test * @summary Verify that a filename is generated - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jcmd.TestJcmdStartGeneratedFilename diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdStartInvaldFile.java b/test/jdk/jdk/jfr/jcmd/TestJcmdStartInvaldFile.java index 718ee55a839a7..e8e40557eab5e 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdStartInvaldFile.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdStartInvaldFile.java @@ -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 @@ -28,7 +28,7 @@ /** * @test * @summary Verify error when starting with invalid file. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jcmd.TestJcmdStartInvaldFile diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdStartPathToGCRoots.java b/test/jdk/jdk/jfr/jcmd/TestJcmdStartPathToGCRoots.java index ff87d2b68a112..5e116480aa89f 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdStartPathToGCRoots.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdStartPathToGCRoots.java @@ -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 @@ -35,7 +35,7 @@ * @summary Start a recording with or without path-to-gc-roots * @requires vm.hasJFR * @library /test/lib /test/jdk - * @key jfr + * @requires vm.flagless * * @run main/othervm jdk.jfr.jcmd.TestJcmdStartPathToGCRoots */ diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdStartReadOnlyFile.java b/test/jdk/jdk/jfr/jcmd/TestJcmdStartReadOnlyFile.java index c1727c9ef974c..d74c29ae7bf03 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdStartReadOnlyFile.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdStartReadOnlyFile.java @@ -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 @@ -32,7 +32,7 @@ /** * @test * @summary Verify error when starting with read-only file. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jcmd.TestJcmdStartReadOnlyFile diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdStartStopDefault.java b/test/jdk/jdk/jfr/jcmd/TestJcmdStartStopDefault.java index 5985b85b167b3..374234fe07b06 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdStartStopDefault.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdStartStopDefault.java @@ -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 @@ -35,7 +35,7 @@ /** * @test * @summary Start a recording without name. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jcmd.TestJcmdStartStopDefault diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdStartWithOptions.java b/test/jdk/jdk/jfr/jcmd/TestJcmdStartWithOptions.java index fe8db5f773aa0..41c144c16ee75 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdStartWithOptions.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdStartWithOptions.java @@ -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 @@ -33,7 +33,7 @@ /** * @test * @summary The test verifies that recording can be started with options delay|duration|maxage|maxsize - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -XX:FlightRecorderOptions:maxchunksize=2097152 jdk.jfr.jcmd.TestJcmdStartWithOptions diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdStartWithSettings.java b/test/jdk/jdk/jfr/jcmd/TestJcmdStartWithSettings.java index d0e502c52a361..afe405ef29dfe 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdStartWithSettings.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdStartWithSettings.java @@ -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 @@ -36,7 +36,7 @@ /** * @test * @summary The test verifies that recording can be started with setting file(s) - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jcmd.TestJcmdStartWithSettings diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdStopInvalidFile.java b/test/jdk/jdk/jfr/jcmd/TestJcmdStopInvalidFile.java index 63f201c08bd31..dc74674ca9901 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdStopInvalidFile.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdStopInvalidFile.java @@ -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 @@ -28,7 +28,7 @@ /** * @test * @summary Verify error when stopping with invalid file. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jcmd.TestJcmdStopInvalidFile diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdStopReadOnlyFile.java b/test/jdk/jdk/jfr/jcmd/TestJcmdStopReadOnlyFile.java index 10401bdf12f36..a91f11a55d682 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdStopReadOnlyFile.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdStopReadOnlyFile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 +32,7 @@ /** * @test * @summary Verify error when stopping with read-only file. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jcmd.TestJcmdStopReadOnlyFile diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdStopWithoutFilename.java b/test/jdk/jdk/jfr/jcmd/TestJcmdStopWithoutFilename.java index 3cd7a572427fb..a4a8051937ffb 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdStopWithoutFilename.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdStopWithoutFilename.java @@ -28,7 +28,7 @@ /** * @test * @summary The test verifies JFR.stop - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jcmd.TestJcmdStopWithoutFilename diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdView.java b/test/jdk/jdk/jfr/jcmd/TestJcmdView.java index 44db54e785038..92e5c950f9bfb 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdView.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdView.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 @@ -33,7 +33,7 @@ /** * @test * @summary The test verifies JFR.view command - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires (vm.gc == "G1" | vm.gc == null) * & vm.opt.ExplicitGCInvokesConcurrent != false diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdViewMissingData.java b/test/jdk/jdk/jfr/jcmd/TestJcmdViewMissingData.java index 9ba7e9119d923..b7a22b1adcca5 100644 --- a/test/jdk/jdk/jfr/jcmd/TestJcmdViewMissingData.java +++ b/test/jdk/jdk/jfr/jcmd/TestJcmdViewMissingData.java @@ -30,7 +30,7 @@ /** * @test * @summary The test verifies JFR.view command - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jcmd.TestJcmdViewMissingData diff --git a/test/jdk/jdk/jfr/jmx/TestClone.java b/test/jdk/jdk/jfr/jmx/TestClone.java index 9e1c2d4e9a5fb..586a58a607c88 100644 --- a/test/jdk/jdk/jfr/jmx/TestClone.java +++ b/test/jdk/jdk/jfr/jmx/TestClone.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -40,7 +40,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestClone diff --git a/test/jdk/jdk/jfr/jmx/TestCloneRepeat.java b/test/jdk/jdk/jfr/jmx/TestCloneRepeat.java index 61458b676c93e..099aec3b4782f 100644 --- a/test/jdk/jdk/jfr/jmx/TestCloneRepeat.java +++ b/test/jdk/jdk/jfr/jmx/TestCloneRepeat.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 +39,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestCloneRepeat diff --git a/test/jdk/jdk/jfr/jmx/TestConfigurationInfo.java b/test/jdk/jdk/jfr/jmx/TestConfigurationInfo.java index 450caaa93edf7..4b6f786ee6108 100644 --- a/test/jdk/jdk/jfr/jmx/TestConfigurationInfo.java +++ b/test/jdk/jdk/jfr/jmx/TestConfigurationInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestConfigurationInfo diff --git a/test/jdk/jdk/jfr/jmx/TestCopyTo.java b/test/jdk/jdk/jfr/jmx/TestCopyTo.java index 3da3e266fca08..6ed7f14547e63 100644 --- a/test/jdk/jdk/jfr/jmx/TestCopyTo.java +++ b/test/jdk/jdk/jfr/jmx/TestCopyTo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -35,7 +35,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestCopyTo diff --git a/test/jdk/jdk/jfr/jmx/TestCopyToInvalidPath.java b/test/jdk/jdk/jfr/jmx/TestCopyToInvalidPath.java index 032e1c3dc9b2c..d868eb4c3dd8a 100644 --- a/test/jdk/jdk/jfr/jmx/TestCopyToInvalidPath.java +++ b/test/jdk/jdk/jfr/jmx/TestCopyToInvalidPath.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestCopyToInvalidPath diff --git a/test/jdk/jdk/jfr/jmx/TestCopyToReadOnlyDir.java b/test/jdk/jdk/jfr/jmx/TestCopyToReadOnlyDir.java index faaae63fbb27d..c9364f2b43c1b 100644 --- a/test/jdk/jdk/jfr/jmx/TestCopyToReadOnlyDir.java +++ b/test/jdk/jdk/jfr/jmx/TestCopyToReadOnlyDir.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestCopyToReadOnlyDir diff --git a/test/jdk/jdk/jfr/jmx/TestCopyToRunning.java b/test/jdk/jdk/jfr/jmx/TestCopyToRunning.java index a8afc2110f1f3..82e453057249c 100644 --- a/test/jdk/jdk/jfr/jmx/TestCopyToRunning.java +++ b/test/jdk/jdk/jfr/jmx/TestCopyToRunning.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Copy a recording to file while it is running. * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/TestEventTypes.java b/test/jdk/jdk/jfr/jmx/TestEventTypes.java index 4f284b399ce66..a7d0219661d95 100644 --- a/test/jdk/jdk/jfr/jmx/TestEventTypes.java +++ b/test/jdk/jdk/jfr/jmx/TestEventTypes.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -42,7 +42,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Verifies that EventTypes from jmx and FlightRecorder are the same. * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/TestFlightRecorderMXBeanLeak.java b/test/jdk/jdk/jfr/jmx/TestFlightRecorderMXBeanLeak.java index d2096fde915d1..54f4fa141234f 100644 --- a/test/jdk/jdk/jfr/jmx/TestFlightRecorderMXBeanLeak.java +++ b/test/jdk/jdk/jfr/jmx/TestFlightRecorderMXBeanLeak.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 @@ -39,7 +39,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Verifies that attributes in FlightRecorderMXBean can be inspected * without causing a memory leak. * @requires vm.hasJFR diff --git a/test/jdk/jdk/jfr/jmx/TestGetRecordings.java b/test/jdk/jdk/jfr/jmx/TestGetRecordings.java index 339953fcbf451..af930be5f1776 100644 --- a/test/jdk/jdk/jfr/jmx/TestGetRecordings.java +++ b/test/jdk/jdk/jfr/jmx/TestGetRecordings.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 @@ -30,7 +30,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -Djdk.attach.allowAttachSelf=true -Dcom.sun.management.jmxremote jdk.jfr.jmx.TestGetRecordings diff --git a/test/jdk/jdk/jfr/jmx/TestGetRecordingsMultiple.java b/test/jdk/jdk/jfr/jmx/TestGetRecordingsMultiple.java index cbaaeda98a0a1..8788097228773 100644 --- a/test/jdk/jdk/jfr/jmx/TestGetRecordingsMultiple.java +++ b/test/jdk/jdk/jfr/jmx/TestGetRecordingsMultiple.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestGetRecordingsMultiple diff --git a/test/jdk/jdk/jfr/jmx/TestMultipleRecordings.java b/test/jdk/jdk/jfr/jmx/TestMultipleRecordings.java index 4d1619ed30d1f..316a4104db6d7 100644 --- a/test/jdk/jdk/jfr/jmx/TestMultipleRecordings.java +++ b/test/jdk/jdk/jfr/jmx/TestMultipleRecordings.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestMultipleRecordings diff --git a/test/jdk/jdk/jfr/jmx/TestNotificationListener.java b/test/jdk/jdk/jfr/jmx/TestNotificationListener.java index 950e5fa6d59c3..a27059a2faee2 100644 --- a/test/jdk/jdk/jfr/jmx/TestNotificationListener.java +++ b/test/jdk/jdk/jfr/jmx/TestNotificationListener.java @@ -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 @@ -33,7 +33,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestNotificationListener diff --git a/test/jdk/jdk/jfr/jmx/TestPredefinedConfiguration.java b/test/jdk/jdk/jfr/jmx/TestPredefinedConfiguration.java index 6aa6d6bbbbd43..d329ceae73442 100644 --- a/test/jdk/jdk/jfr/jmx/TestPredefinedConfiguration.java +++ b/test/jdk/jdk/jfr/jmx/TestPredefinedConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -33,7 +33,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestPredefinedConfiguration diff --git a/test/jdk/jdk/jfr/jmx/TestPredefinedConfigurationInvalid.java b/test/jdk/jdk/jfr/jmx/TestPredefinedConfigurationInvalid.java index d68bacbcbd07b..32d5f30540c15 100644 --- a/test/jdk/jdk/jfr/jmx/TestPredefinedConfigurationInvalid.java +++ b/test/jdk/jdk/jfr/jmx/TestPredefinedConfigurationInvalid.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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestPredefinedConfigurationInvalid diff --git a/test/jdk/jdk/jfr/jmx/TestRecordingOptions.java b/test/jdk/jdk/jfr/jmx/TestRecordingOptions.java index 6cab6b4a2ebcc..8f048ace3c3b7 100644 --- a/test/jdk/jdk/jfr/jmx/TestRecordingOptions.java +++ b/test/jdk/jdk/jfr/jmx/TestRecordingOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -33,7 +33,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestRecordingOptions diff --git a/test/jdk/jdk/jfr/jmx/TestRecordingSettings.java b/test/jdk/jdk/jfr/jmx/TestRecordingSettings.java index 026485e494249..d7c0387e8cf09 100644 --- a/test/jdk/jdk/jfr/jmx/TestRecordingSettings.java +++ b/test/jdk/jdk/jfr/jmx/TestRecordingSettings.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -33,7 +33,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestRecordingSettings diff --git a/test/jdk/jdk/jfr/jmx/TestRecordingSettingsInvalid.java b/test/jdk/jdk/jfr/jmx/TestRecordingSettingsInvalid.java index 669b30cf36be1..a29bd3a61d1fd 100644 --- a/test/jdk/jdk/jfr/jmx/TestRecordingSettingsInvalid.java +++ b/test/jdk/jdk/jfr/jmx/TestRecordingSettingsInvalid.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Verify exception when setting invalid settings. * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/TestRecordingSettingsMultiple.java b/test/jdk/jdk/jfr/jmx/TestRecordingSettingsMultiple.java index c1ab3d80f380a..c383e1b2fd51f 100644 --- a/test/jdk/jdk/jfr/jmx/TestRecordingSettingsMultiple.java +++ b/test/jdk/jdk/jfr/jmx/TestRecordingSettingsMultiple.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -30,7 +30,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestRecordingSettingsMultiple diff --git a/test/jdk/jdk/jfr/jmx/TestRecordingState.java b/test/jdk/jdk/jfr/jmx/TestRecordingState.java index de9b316ef2c4e..05d57f01b4417 100644 --- a/test/jdk/jdk/jfr/jmx/TestRecordingState.java +++ b/test/jdk/jdk/jfr/jmx/TestRecordingState.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestRecordingState diff --git a/test/jdk/jdk/jfr/jmx/TestRecordingStateInvalid.java b/test/jdk/jdk/jfr/jmx/TestRecordingStateInvalid.java index 91e5384eb4b18..dbfc6783c5412 100644 --- a/test/jdk/jdk/jfr/jmx/TestRecordingStateInvalid.java +++ b/test/jdk/jdk/jfr/jmx/TestRecordingStateInvalid.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -33,7 +33,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestRecordingStateInvalid diff --git a/test/jdk/jdk/jfr/jmx/TestSetConfiguration.java b/test/jdk/jdk/jfr/jmx/TestSetConfiguration.java index e3a6c9addf02a..168633d15208b 100644 --- a/test/jdk/jdk/jfr/jmx/TestSetConfiguration.java +++ b/test/jdk/jdk/jfr/jmx/TestSetConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestSetConfiguration diff --git a/test/jdk/jdk/jfr/jmx/TestSetConfigurationInvalid.java b/test/jdk/jdk/jfr/jmx/TestSetConfigurationInvalid.java index ec5bcffdc9a6c..82c3681b1bf84 100644 --- a/test/jdk/jdk/jfr/jmx/TestSetConfigurationInvalid.java +++ b/test/jdk/jdk/jfr/jmx/TestSetConfigurationInvalid.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Verify Exception when setting invalid config. * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/TestSnapshot.java b/test/jdk/jdk/jfr/jmx/TestSnapshot.java index b4eb13216b5cb..09cd515c4ae6f 100644 --- a/test/jdk/jdk/jfr/jmx/TestSnapshot.java +++ b/test/jdk/jdk/jfr/jmx/TestSnapshot.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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestSnapshot diff --git a/test/jdk/jdk/jfr/jmx/TestStartRecording.java b/test/jdk/jdk/jfr/jmx/TestStartRecording.java index 52a43b1f80eac..1ff3eab6d533e 100644 --- a/test/jdk/jdk/jfr/jmx/TestStartRecording.java +++ b/test/jdk/jdk/jfr/jmx/TestStartRecording.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestStartRecording diff --git a/test/jdk/jdk/jfr/jmx/TestStream.java b/test/jdk/jdk/jfr/jmx/TestStream.java index 3763054ae3ba7..53d0ba473b368 100644 --- a/test/jdk/jdk/jfr/jmx/TestStream.java +++ b/test/jdk/jdk/jfr/jmx/TestStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -35,7 +35,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestStream diff --git a/test/jdk/jdk/jfr/jmx/TestStreamClosed.java b/test/jdk/jdk/jfr/jmx/TestStreamClosed.java index 5f6c49544caf9..3533f7c94e75c 100644 --- a/test/jdk/jdk/jfr/jmx/TestStreamClosed.java +++ b/test/jdk/jdk/jfr/jmx/TestStreamClosed.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -31,7 +31,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Call readStream() after closeStream() * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/TestStreamMultiple.java b/test/jdk/jdk/jfr/jmx/TestStreamMultiple.java index f973376574abf..85518790b1ffb 100644 --- a/test/jdk/jdk/jfr/jmx/TestStreamMultiple.java +++ b/test/jdk/jdk/jfr/jmx/TestStreamMultiple.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.TestStreamMultiple diff --git a/test/jdk/jdk/jfr/jmx/TestWrongId.java b/test/jdk/jdk/jfr/jmx/TestWrongId.java index 8a88b970248f0..598a7f05a37f7 100644 --- a/test/jdk/jdk/jfr/jmx/TestWrongId.java +++ b/test/jdk/jdk/jfr/jmx/TestWrongId.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Call functions with invalid argument id. Verify Exception. * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/info/TestConfigurationInfo.java b/test/jdk/jdk/jfr/jmx/info/TestConfigurationInfo.java index c82f064ae4268..5158d2f7ce132 100644 --- a/test/jdk/jdk/jfr/jmx/info/TestConfigurationInfo.java +++ b/test/jdk/jdk/jfr/jmx/info/TestConfigurationInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -36,7 +36,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Test for ConfigurationInfo. Compare infos from java API and jmx API. * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/info/TestEventTypeInfo.java b/test/jdk/jdk/jfr/jmx/info/TestEventTypeInfo.java index 001147e8e5ccf..79421d6ef563f 100644 --- a/test/jdk/jdk/jfr/jmx/info/TestEventTypeInfo.java +++ b/test/jdk/jdk/jfr/jmx/info/TestEventTypeInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Test for EventTypeInfo * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/info/TestRecordingInfo.java b/test/jdk/jdk/jfr/jmx/info/TestRecordingInfo.java index a653af76dc0c7..7aaff146f2b02 100644 --- a/test/jdk/jdk/jfr/jmx/info/TestRecordingInfo.java +++ b/test/jdk/jdk/jfr/jmx/info/TestRecordingInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 +39,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Test for RecordingInfo * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/info/TestSettingDescriptorInfo.java b/test/jdk/jdk/jfr/jmx/info/TestSettingDescriptorInfo.java index 59d5aaa5fa99b..fbfaa250351f6 100644 --- a/test/jdk/jdk/jfr/jmx/info/TestSettingDescriptorInfo.java +++ b/test/jdk/jdk/jfr/jmx/info/TestSettingDescriptorInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, 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,7 +37,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Test for SettingDescriptorInfo. Compare infos from java API and jmx API. * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/streaming/TestClose.java b/test/jdk/jdk/jfr/jmx/streaming/TestClose.java index d742422e69cb8..08c302d6d4b1c 100644 --- a/test/jdk/jdk/jfr/jmx/streaming/TestClose.java +++ b/test/jdk/jdk/jfr/jmx/streaming/TestClose.java @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Tests that a RemoteRecordingStream can be closed * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/streaming/TestDelegated.java b/test/jdk/jdk/jfr/jmx/streaming/TestDelegated.java index 04a9139b12272..e20f92c301415 100644 --- a/test/jdk/jdk/jfr/jmx/streaming/TestDelegated.java +++ b/test/jdk/jdk/jfr/jmx/streaming/TestDelegated.java @@ -35,7 +35,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Sanity test methods that delegates to an ordinary stream * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/streaming/TestDumpOrder.java b/test/jdk/jdk/jfr/jmx/streaming/TestDumpOrder.java index 0c6d8fe313d68..7535960366cee 100644 --- a/test/jdk/jdk/jfr/jmx/streaming/TestDumpOrder.java +++ b/test/jdk/jdk/jfr/jmx/streaming/TestDumpOrder.java @@ -42,7 +42,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Tests that chunks arrive in the same order they were committed * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/streaming/TestEnableDisable.java b/test/jdk/jdk/jfr/jmx/streaming/TestEnableDisable.java index 6a07c57ff7879..06e9691cfa216 100644 --- a/test/jdk/jdk/jfr/jmx/streaming/TestEnableDisable.java +++ b/test/jdk/jdk/jfr/jmx/streaming/TestEnableDisable.java @@ -35,7 +35,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Tests that event settings for a RemoteRecordingStream can be changed * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/streaming/TestMaxSize.java b/test/jdk/jdk/jfr/jmx/streaming/TestMaxSize.java index 7bf389c75ad85..b79fbc2bcf04c 100644 --- a/test/jdk/jdk/jfr/jmx/streaming/TestMaxSize.java +++ b/test/jdk/jdk/jfr/jmx/streaming/TestMaxSize.java @@ -37,7 +37,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Tests that max size can be set for a RemoteRecordingStream * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/streaming/TestMetadataEvent.java b/test/jdk/jdk/jfr/jmx/streaming/TestMetadataEvent.java index 935ef292a5590..3e0e8773f0ad6 100644 --- a/test/jdk/jdk/jfr/jmx/streaming/TestMetadataEvent.java +++ b/test/jdk/jdk/jfr/jmx/streaming/TestMetadataEvent.java @@ -36,7 +36,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Sanity tests RemoteRecordingStream::onMetadata * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/streaming/TestMultipleChunks.java b/test/jdk/jdk/jfr/jmx/streaming/TestMultipleChunks.java index e91a58da7b81e..942f64a5da4c3 100644 --- a/test/jdk/jdk/jfr/jmx/streaming/TestMultipleChunks.java +++ b/test/jdk/jdk/jfr/jmx/streaming/TestMultipleChunks.java @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Tests that a RemoteRecordingStream can stream over multiple chunks * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/streaming/TestNew.java b/test/jdk/jdk/jfr/jmx/streaming/TestNew.java index 9cf7a0cd16fc0..d2489730b032b 100644 --- a/test/jdk/jdk/jfr/jmx/streaming/TestNew.java +++ b/test/jdk/jdk/jfr/jmx/streaming/TestNew.java @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Test constructors of RemoteRecordingStream * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/streaming/TestRemoteDump.java b/test/jdk/jdk/jfr/jmx/streaming/TestRemoteDump.java index 51e0c815dc0b7..9390857c09e5a 100644 --- a/test/jdk/jdk/jfr/jmx/streaming/TestRemoteDump.java +++ b/test/jdk/jdk/jfr/jmx/streaming/TestRemoteDump.java @@ -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 @@ -47,7 +47,7 @@ /** * @test * @summary Tests RecordingStream::dump(Path) - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.jmx.streaming.TestRemoteDump diff --git a/test/jdk/jdk/jfr/jmx/streaming/TestRotate.java b/test/jdk/jdk/jfr/jmx/streaming/TestRotate.java index cf78ea399e760..8a7c7428a99bf 100644 --- a/test/jdk/jdk/jfr/jmx/streaming/TestRotate.java +++ b/test/jdk/jdk/jfr/jmx/streaming/TestRotate.java @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Tests that streaming can work over chunk rotations * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/streaming/TestSetSettings.java b/test/jdk/jdk/jfr/jmx/streaming/TestSetSettings.java index d0a9acab9cdff..2d1cb50dcfc42 100644 --- a/test/jdk/jdk/jfr/jmx/streaming/TestSetSettings.java +++ b/test/jdk/jdk/jfr/jmx/streaming/TestSetSettings.java @@ -37,7 +37,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Tests that a RemoteRecordingStream can be configured using * setSettings * @requires vm.hasJFR diff --git a/test/jdk/jdk/jfr/jmx/streaming/TestStart.java b/test/jdk/jdk/jfr/jmx/streaming/TestStart.java index 0755e99cb041b..6d4bfc10f81ae 100644 --- a/test/jdk/jdk/jfr/jmx/streaming/TestStart.java +++ b/test/jdk/jdk/jfr/jmx/streaming/TestStart.java @@ -32,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Sanity tests RemoteRecordingStream::start() * @requires vm.hasJFR * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/jmx/streaming/TestStop.java b/test/jdk/jdk/jfr/jmx/streaming/TestStop.java index 83656cba8a759..572577786a198 100644 --- a/test/jdk/jdk/jfr/jmx/streaming/TestStop.java +++ b/test/jdk/jdk/jfr/jmx/streaming/TestStop.java @@ -40,7 +40,7 @@ /** * @test * @summary Tests RemoteRecordingStream::stop() - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @build jdk.jfr.api.consumer.recordingstream.EventProducer diff --git a/test/jdk/jdk/jfr/jvm/MyCommitRegisteredFalseEvent.java b/test/jdk/jdk/jfr/jvm/MyCommitRegisteredFalseEvent.java index d09d3067dafa8..5da979ad6450b 100644 --- a/test/jdk/jdk/jfr/jvm/MyCommitRegisteredFalseEvent.java +++ b/test/jdk/jdk/jfr/jvm/MyCommitRegisteredFalseEvent.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 @@ -28,7 +28,7 @@ @Registered(false) public class MyCommitRegisteredFalseEvent extends E implements Runnable { public void myCommit() { - PlaceholderEventWriterFactory.getEventWriter(4711L); + PlaceholderEventWriter.getEventWriter(); throw new RuntimeException("Should not reach here"); } diff --git a/test/jdk/jdk/jfr/jvm/MyCommitRegisteredTrueEvent.java b/test/jdk/jdk/jfr/jvm/MyCommitRegisteredTrueEvent.java index 87014bcd72b48..0af8a8f41ccef 100644 --- a/test/jdk/jdk/jfr/jvm/MyCommitRegisteredTrueEvent.java +++ b/test/jdk/jdk/jfr/jvm/MyCommitRegisteredTrueEvent.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 @@ -28,7 +28,7 @@ @Registered(true) public class MyCommitRegisteredTrueEvent extends E implements Runnable { public void myCommit() { - PlaceholderEventWriterFactory.getEventWriter(4711L); + PlaceholderEventWriter.getEventWriter(); throw new RuntimeException("Should not reach here"); } diff --git a/test/jdk/jdk/jfr/jvm/NonEvent.java b/test/jdk/jdk/jfr/jvm/NonEvent.java index 9134d25c08c98..e98d995acdbff 100644 --- a/test/jdk/jdk/jfr/jvm/NonEvent.java +++ b/test/jdk/jdk/jfr/jvm/NonEvent.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 @@ -25,7 +25,7 @@ // Class used by TestGetEventWriter public class NonEvent implements Runnable { public void commit() { - PlaceholderEventWriter ew = PlaceholderEventWriterFactory.getEventWriter(4711L); + PlaceholderEventWriter ew = PlaceholderEventWriter.getEventWriter();; throw new RuntimeException("Should not reach here " + ew); } diff --git a/test/jdk/jdk/jfr/jvm/PlaceholderEventWriter.java b/test/jdk/jdk/jfr/jvm/PlaceholderEventWriter.java index 8f0c543334757..87cffc5127592 100644 --- a/test/jdk/jdk/jfr/jvm/PlaceholderEventWriter.java +++ b/test/jdk/jdk/jfr/jvm/PlaceholderEventWriter.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 @@ -30,4 +30,8 @@ // will be replaced with "jdk.jfr.internal.event.EventWriter" public class PlaceholderEventWriter { + public static PlaceholderEventWriter getEventWriter() { + return null; + } + } diff --git a/test/jdk/jdk/jfr/jvm/RegisteredFalseEvent.java b/test/jdk/jdk/jfr/jvm/RegisteredFalseEvent.java index 6174bace86628..d20a045450036 100644 --- a/test/jdk/jdk/jfr/jvm/RegisteredFalseEvent.java +++ b/test/jdk/jdk/jfr/jvm/RegisteredFalseEvent.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 @@ -28,7 +28,7 @@ @Registered(false) public class RegisteredFalseEvent extends E { public void commit() { - PlaceholderEventWriterFactory.getEventWriter(4711L); + PlaceholderEventWriter.getEventWriter(); throw new RuntimeException("Should not reach here"); } } \ No newline at end of file diff --git a/test/jdk/jdk/jfr/jvm/RegisteredTrueEvent.java b/test/jdk/jdk/jfr/jvm/RegisteredTrueEvent.java index 3fe2ce8a1190f..fb2964e68e9f8 100644 --- a/test/jdk/jdk/jfr/jvm/RegisteredTrueEvent.java +++ b/test/jdk/jdk/jfr/jvm/RegisteredTrueEvent.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 @@ -28,7 +28,7 @@ @Registered(true) public class RegisteredTrueEvent extends E { public void commit() { - PlaceholderEventWriterFactory.getEventWriter(4711L); + PlaceholderEventWriter.getEventWriter(); throw new RuntimeException("Should not reach here"); } } \ No newline at end of file diff --git a/test/jdk/jdk/jfr/jvm/StaticCommitEvent.java b/test/jdk/jdk/jfr/jvm/StaticCommitEvent.java index 6adeb6cb9c51e..8c07c5bf9b6ae 100644 --- a/test/jdk/jdk/jfr/jvm/StaticCommitEvent.java +++ b/test/jdk/jdk/jfr/jvm/StaticCommitEvent.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 @@ -30,7 +30,7 @@ public class StaticCommitEvent implements Runnable { int value; public static void commit(long start, long duration, String message, int value) { - PlaceholderEventWriterFactory.getEventWriter(4711L); + PlaceholderEventWriter.getEventWriter(); throw new RuntimeException("Should not reach here"); } diff --git a/test/jdk/jdk/jfr/jvm/TestBeginAndEnd.java b/test/jdk/jdk/jfr/jvm/TestBeginAndEnd.java index c85b0966b6e8f..e25d216ab5fd5 100644 --- a/test/jdk/jdk/jfr/jvm/TestBeginAndEnd.java +++ b/test/jdk/jdk/jfr/jvm/TestBeginAndEnd.java @@ -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 @@ -28,7 +28,7 @@ /** * @test TestBeginAndEnd - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @modules jdk.jfr/jdk.jfr.internal * @run main/othervm jdk.jfr.jvm.TestBeginAndEnd diff --git a/test/jdk/jdk/jfr/jvm/TestChunkIntegrity.java b/test/jdk/jdk/jfr/jvm/TestChunkIntegrity.java index aba19bd37b707..c66d323d11da2 100644 --- a/test/jdk/jdk/jfr/jvm/TestChunkIntegrity.java +++ b/test/jdk/jdk/jfr/jvm/TestChunkIntegrity.java @@ -56,7 +56,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm/timeout=300 jdk.jfr.jvm.TestChunkIntegrity diff --git a/test/jdk/jdk/jfr/jvm/TestClassId.java b/test/jdk/jdk/jfr/jvm/TestClassId.java index 058183472e846..b82abb64d5022 100644 --- a/test/jdk/jdk/jfr/jvm/TestClassId.java +++ b/test/jdk/jdk/jfr/jvm/TestClassId.java @@ -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 @@ -32,7 +32,7 @@ /** * @test TestClassId - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/jvm/TestClearStaleConstants.java b/test/jdk/jdk/jfr/jvm/TestClearStaleConstants.java index 70e34bcd5140d..81f2a34a6b857 100644 --- a/test/jdk/jdk/jfr/jvm/TestClearStaleConstants.java +++ b/test/jdk/jdk/jfr/jvm/TestClearStaleConstants.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 @@ -39,7 +39,7 @@ /** * @test * @bug 8231081 - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @modules jdk.jfr/jdk.jfr.internal * @library /test/lib /test/jdk @@ -49,7 +49,7 @@ /** * System.gc() will trigger class unloading if -XX:+ExplicitGCInvokesConcurrent is NOT set. * If this flag is set G1 will never unload classes on System.gc() and - * As far as the "jfr" key guarantees no VM flags are set from the outside + * As far as the vm.flagless guarantees no VM flags are set from the outside * it should be enough with System.gc(). */ public final class TestClearStaleConstants { diff --git a/test/jdk/jdk/jfr/jvm/TestCounterTime.java b/test/jdk/jdk/jfr/jvm/TestCounterTime.java index f06fdd0eed676..6cd60eae8945a 100644 --- a/test/jdk/jdk/jfr/jvm/TestCounterTime.java +++ b/test/jdk/jdk/jfr/jvm/TestCounterTime.java @@ -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 @@ -30,7 +30,7 @@ /** * @test TestCounterTime - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/jvm/TestCreateNative.java b/test/jdk/jdk/jfr/jvm/TestCreateNative.java index 1050856161d66..9ebbe7891b380 100644 --- a/test/jdk/jdk/jfr/jvm/TestCreateNative.java +++ b/test/jdk/jdk/jfr/jvm/TestCreateNative.java @@ -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,7 +31,7 @@ /** * @test * @summary Checks that the JVM can rollback on native initialization failures. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/jvm/TestDumpOnCrash.java b/test/jdk/jdk/jfr/jvm/TestDumpOnCrash.java index 29e21ddd89d7d..a7e620b203c15 100644 --- a/test/jdk/jdk/jfr/jvm/TestDumpOnCrash.java +++ b/test/jdk/jdk/jfr/jvm/TestDumpOnCrash.java @@ -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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Verifies that data associated with a running recording can be evacuated to an hs_err_pidXXX.jfr when the VM crashes * @requires vm.hasJFR * diff --git a/test/jdk/jdk/jfr/jvm/TestEventDuration.java b/test/jdk/jdk/jfr/jvm/TestEventDuration.java index 53a7af9e323cf..1b0a44d843a30 100644 --- a/test/jdk/jdk/jfr/jvm/TestEventDuration.java +++ b/test/jdk/jdk/jfr/jvm/TestEventDuration.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 @@ -30,7 +30,7 @@ /** * @test Tests that the event duration is zero after a chunk rotation - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/jvm/TestEventWriterLog.java b/test/jdk/jdk/jfr/jvm/TestEventWriterLog.java index 9e68d0501dfd9..ca56a3feb416e 100644 --- a/test/jdk/jdk/jfr/jvm/TestEventWriterLog.java +++ b/test/jdk/jdk/jfr/jvm/TestEventWriterLog.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 @@ -24,7 +24,7 @@ /* * @test TestEventWriterLog * @summary Test that log message of JFR when handle bytecodes - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm TestEventWriterLog diff --git a/test/jdk/jdk/jfr/jvm/TestFatEvent.java b/test/jdk/jdk/jfr/jvm/TestFatEvent.java index 93e8a838de12f..3e10074cce9c7 100644 --- a/test/jdk/jdk/jfr/jvm/TestFatEvent.java +++ b/test/jdk/jdk/jfr/jvm/TestFatEvent.java @@ -36,7 +36,7 @@ /** * @test TestFatEvent - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm -Dprop1=12345678901234567890123456789012345678901234567890 diff --git a/test/jdk/jdk/jfr/jvm/TestFormatDuration.java b/test/jdk/jdk/jfr/jvm/TestFormatDuration.java index 0fb1bbe07c557..a0d5b729fcfce 100644 --- a/test/jdk/jdk/jfr/jvm/TestFormatDuration.java +++ b/test/jdk/jdk/jfr/jvm/TestFormatDuration.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 @@ -30,7 +30,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr/jdk.jfr.internal.util diff --git a/test/jdk/jdk/jfr/jvm/TestGetAllEventClasses.java b/test/jdk/jdk/jfr/jvm/TestGetAllEventClasses.java index b758520ac81b2..2849258868a95 100644 --- a/test/jdk/jdk/jfr/jvm/TestGetAllEventClasses.java +++ b/test/jdk/jdk/jfr/jvm/TestGetAllEventClasses.java @@ -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 @@ -31,7 +31,7 @@ /** * @test TestGetAllEventClasses - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/jvm/TestGetEventWriter.java b/test/jdk/jdk/jfr/jvm/TestGetEventWriter.java index 298114b14e14a..a22e59a39fe8c 100644 --- a/test/jdk/jdk/jfr/jvm/TestGetEventWriter.java +++ b/test/jdk/jdk/jfr/jvm/TestGetEventWriter.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 @@ -39,14 +39,13 @@ /** * @test id=default - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.internal.vm.ci/jdk.vm.ci.meta * jdk.internal.vm.ci/jdk.vm.ci.runtime * * @compile PlaceholderEventWriter.java - * @compile PlaceholderEventWriterFactory.java * @compile E.java * @compile NonEvent.java * @compile RegisteredTrueEvent.java @@ -72,7 +71,7 @@ /** * @test id=jvmci - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.jvmci * @library /test/lib @@ -80,7 +79,6 @@ * jdk.internal.vm.ci/jdk.vm.ci.runtime * * @compile PlaceholderEventWriter.java - * @compile PlaceholderEventWriterFactory.java * @compile E.java * @compile NonEvent.java * @compile RegisteredTrueEvent.java @@ -105,10 +103,10 @@ public static void main(String... args) throws Throwable { InitializationEvent e = new InitializationEvent(); e.commit(); } - // Make sure EventWriterFactory can be accessed. - Class clazz = Class.forName("jdk.jfr.internal.event.EventWriterFactory"); + // Make sure EventWriter class can be accessed. + Class clazz = Class.forName("jdk.jfr.internal.event.EventWriter"); if (clazz == null) { - throw new Exception("Test error, not able to access jdk.jfr.internal.event.EventWriterFactory class"); + throw new Exception("Test error, not able to access jdk.jfr.internal.event.EventWriter class"); } testRegisteredTrueEvent(); testRegisteredFalseEvent(); @@ -122,7 +120,7 @@ public static void main(String... args) throws Throwable { // The class does not inherit jdk.jfr.Event and, as such, does not implement the // API. It has its own stand-alone "commit()V", which is not an override, that - // attempts to resolve and link against EventWriterFactory. This user implementation + // attempts to resolve and link against EventWriter. This user implementation // is not blessed for linkage. private static void testNonEvent() throws Throwable { Runnable e = newEventObject("NonEvent"); @@ -178,7 +176,7 @@ private static void testRegisteredFalseEvent() throws Throwable { } // The user has implemented another method, "myCommit()V", not an override nor - // overload. that attempts to resolve and link EventWriterFactory. This will fail, + // overload. that attempts to resolve and link EventWriter. This will fail, // because "myCommit()V" is not blessed for linkage. private static void testMyCommitRegisteredTrue() throws Throwable { Runnable e = newEventObject("MyCommitRegisteredTrueEvent"); @@ -230,10 +228,9 @@ static class MethodHandleEvent extends Event { public void myCommit() throws Throwable { try { Class ew = Class.forName("jdk.jfr.internal.event.EventWriter"); - MethodType t = MethodType.methodType(ew, List.of(long.class)); - Class factory = Class.forName("jdk.jfr.internal.event.EventWriterFactory"); - MethodHandle mh = MethodHandles.lookup().findStatic(factory, "getEventWriter", t); - mh.invoke(Long.valueOf(4711)); // throws IllegalAccessException + MethodType t = MethodType.methodType(ew, List.of()); + MethodHandle mh = MethodHandles.lookup().findStatic(ew, "getEventWriter", t); + mh.invoke(); // throws IllegalAccessException } catch (ClassNotFoundException | SecurityException e) { throw new RuntimeException(e); } @@ -262,8 +259,8 @@ static class ReflectionEvent extends Event { public void myCommit() throws Throwable { Class c; try { - c = Class.forName("jdk.jfr.internal.event.EventWriterFactory"); - Method m = c.getMethod("getEventWriter", new Class[] {long.class}); + c = Class.forName("jdk.jfr.internal.event.EventWriter"); + Method m = c.getMethod("getEventWriter", new Class[0]); m.invoke(null, Long.valueOf(4711)); // throws InternalError } catch (ClassNotFoundException | SecurityException e) { throw new RuntimeException(e); @@ -283,7 +280,7 @@ private static void testReflectionEvent() throws Throwable { } catch (InternalError ie) { if (ie.getCause() instanceof IllegalAccessException iaex) { if (iaex.getCause() instanceof IllegalAccessError iae) { - if (iae.getMessage().contains("getEventWriter(long)")) { + if (iae.getMessage().contains("getEventWriter()")) { // OK, as expected return; } @@ -345,7 +342,6 @@ private static T newEventObject(String name) throws Throwable { byte[] bytes = is.readAllBytes(); is.close(); bytes = replace(bytes, "jdk/jfr/jvm/E", "jdk/jfr/Event"); - bytes = replace(bytes, "jdk/jfr/jvm/PlaceholderEventWriterFactory", "jdk/jfr/internal/event/EventWriterFactory"); bytes = replace(bytes, "jdk/jfr/jvm/PlaceholderEventWriter", "jdk/jfr/internal/event/EventWriter"); BytesClassLoader bc = new BytesClassLoader(bytes, fullName); Class clazz = bc.loadClass(fullName); @@ -372,7 +368,7 @@ private static void maybeCheckJVMCI(Class eventClass, String commitName) thro } /** - * Checks that JVMCI prevents unblessed access to {@code EventWriterFactory.getEventWriter(long)}. + * Checks that JVMCI prevents unblessed access to {@code EventWriter.getEventWriter()}. */ private static void checkJVMCI(Class eventClass, String commitName) throws Throwable { MetaAccessProvider metaAccess = JVMCI.getRuntime().getHostJVMCIBackend().getMetaAccess(); @@ -380,7 +376,7 @@ private static void checkJVMCI(Class eventClass, String commitName) throws Th ConstantPool cp = commit.getConstantPool(); // Search for first INVOKESTATIC instruction in commit method which is expected - // to be the call to jdk.jfr.internal.event.EventWriterFactory.getEventWriter(long). + // to be the call to jdk.jfr.internal.event.EventWriter.getEventWriter(). final int INVOKESTATIC = 184; byte[] code = commit.getCode(); for (int bci = 0; bci < code.length; bci++) { diff --git a/test/jdk/jdk/jfr/jvm/TestGetEventWriterPackage.java b/test/jdk/jdk/jfr/jvm/TestGetEventWriterPackage.java index 065458d4ac778..3d96330f6ac2f 100644 --- a/test/jdk/jdk/jfr/jvm/TestGetEventWriterPackage.java +++ b/test/jdk/jdk/jfr/jvm/TestGetEventWriterPackage.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 @@ -31,7 +31,7 @@ import jdk.jfr.Registered; /** * @test Tests that a module can't execute code in jdk.jfr.internal.event unless an event has been registered. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm diff --git a/test/jdk/jdk/jfr/jvm/TestGetEventWriterReflection.java b/test/jdk/jdk/jfr/jvm/TestGetEventWriterReflection.java index 2e0f87020e680..dae4e9a67b5a3 100644 --- a/test/jdk/jdk/jfr/jvm/TestGetEventWriterReflection.java +++ b/test/jdk/jdk/jfr/jvm/TestGetEventWriterReflection.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 @@ -29,7 +29,7 @@ import jdk.jfr.Registered; /** * @test Tests that reflective access works as (normally) expected - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * diff --git a/test/jdk/jdk/jfr/jvm/TestGetStackTraceId.java b/test/jdk/jdk/jfr/jvm/TestGetStackTraceId.java index 8a23e55140886..637a5f3920d36 100644 --- a/test/jdk/jdk/jfr/jvm/TestGetStackTraceId.java +++ b/test/jdk/jdk/jfr/jvm/TestGetStackTraceId.java @@ -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 @@ -29,7 +29,7 @@ /** * @test TestGetStackTraceId - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/jvm/TestHiddenWait.java b/test/jdk/jdk/jfr/jvm/TestHiddenWait.java index b064285329c0f..aaefc60527ce2 100644 --- a/test/jdk/jdk/jfr/jvm/TestHiddenWait.java +++ b/test/jdk/jdk/jfr/jvm/TestHiddenWait.java @@ -38,7 +38,7 @@ /** * @test TestHiddenWait - * @key jfr + * @requires vm.flagless * @summary Checks that JFR code don't emit noise in the form of ThreadSleep and JavaMonitorWait events. * @requires vm.hasJFR * @library /test/lib diff --git a/test/jdk/jdk/jfr/jvm/TestJFRIntrinsic.java b/test/jdk/jdk/jfr/jvm/TestJFRIntrinsic.java index 6d3ea8d015a89..a846eac2350c8 100644 --- a/test/jdk/jdk/jfr/jvm/TestJFRIntrinsic.java +++ b/test/jdk/jdk/jfr/jvm/TestJFRIntrinsic.java @@ -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 @@ -24,7 +24,7 @@ /** * @test * @summary Intrinsic for JFR - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * diff --git a/test/jdk/jdk/jfr/jvm/TestJavaEvent.java b/test/jdk/jdk/jfr/jvm/TestJavaEvent.java index 0a2f2ecaf5b61..8a006dd9eafd9 100644 --- a/test/jdk/jdk/jfr/jvm/TestJavaEvent.java +++ b/test/jdk/jdk/jfr/jvm/TestJavaEvent.java @@ -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 @@ -41,7 +41,7 @@ /** * @test TestGetThreadId - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/jvm/TestLargeJavaEvent512k.java b/test/jdk/jdk/jfr/jvm/TestLargeJavaEvent512k.java index eacffb7a13b29..530004d3ebddc 100644 --- a/test/jdk/jdk/jfr/jvm/TestLargeJavaEvent512k.java +++ b/test/jdk/jdk/jfr/jvm/TestLargeJavaEvent512k.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 @@ -43,7 +43,7 @@ /** * @test TestLargeJavaEvent512k - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/jvm/TestLargeJavaEvent64k.java b/test/jdk/jdk/jfr/jvm/TestLargeJavaEvent64k.java index 0de03efb35c59..b71ed0ec36130 100644 --- a/test/jdk/jdk/jfr/jvm/TestLargeJavaEvent64k.java +++ b/test/jdk/jdk/jfr/jvm/TestLargeJavaEvent64k.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 @@ -43,7 +43,7 @@ /** * @test TestLargeJavaEvent64k - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/jvm/TestLogImplementation.java b/test/jdk/jdk/jfr/jvm/TestLogImplementation.java index d9d42074b7b98..faa7bc18a3c8b 100644 --- a/test/jdk/jdk/jfr/jvm/TestLogImplementation.java +++ b/test/jdk/jdk/jfr/jvm/TestLogImplementation.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 @@ -30,7 +30,7 @@ /** * @test TestLogImplementation - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/jvm/TestLogOutput.java b/test/jdk/jdk/jfr/jvm/TestLogOutput.java index 18527abb90b01..5580270027a4d 100644 --- a/test/jdk/jdk/jfr/jvm/TestLogOutput.java +++ b/test/jdk/jdk/jfr/jvm/TestLogOutput.java @@ -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 @@ -31,7 +31,7 @@ /** * @test TestLogOutput - * @key jfr + * @requires vm.flagless * @summary Sanity test jfr logging output * @requires vm.hasJFR * @library /test/lib diff --git a/test/jdk/jdk/jfr/jvm/TestLongStringsInPool.java b/test/jdk/jdk/jfr/jvm/TestLongStringsInPool.java index 8ce3fd3859fdb..45b66d508cda1 100644 --- a/test/jdk/jdk/jfr/jvm/TestLongStringsInPool.java +++ b/test/jdk/jdk/jfr/jvm/TestLongStringsInPool.java @@ -36,7 +36,7 @@ /** * @test * @summary Verify that duplicate longer strings doesn't take up unneccessary space - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.jvm.TestLongStringsInPool diff --git a/test/jdk/jdk/jfr/jvm/TestModularImage.java b/test/jdk/jdk/jfr/jvm/TestModularImage.java index 0f10150af601a..fe49b460f188e 100644 --- a/test/jdk/jdk/jfr/jvm/TestModularImage.java +++ b/test/jdk/jdk/jfr/jvm/TestModularImage.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 @@ -38,12 +38,18 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Checks that a JDK image with and without the jdk.jfr module behaves * as expected * @requires vm.hasJFR * @library /test/lib - * @run driver jdk.jfr.jvm.TestModularImage + * @modules jdk.compiler jdk.jlink + * @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 jdk.jfr.jvm.TestModularImage */ public class TestModularImage { private static final String STARTED_RECORDING = "Started recording"; diff --git a/test/jdk/jdk/jfr/jvm/TestPid.java b/test/jdk/jdk/jfr/jvm/TestPid.java index 20a8b42f8a54c..f71042d1c847f 100644 --- a/test/jdk/jdk/jfr/jvm/TestPid.java +++ b/test/jdk/jdk/jfr/jvm/TestPid.java @@ -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 @@ -29,7 +29,7 @@ /** * @test TestPid - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/jvm/TestPrimitiveClasses.java b/test/jdk/jdk/jfr/jvm/TestPrimitiveClasses.java index bb0163bc925f0..548bb3fc19e44 100644 --- a/test/jdk/jdk/jfr/jvm/TestPrimitiveClasses.java +++ b/test/jdk/jdk/jfr/jvm/TestPrimitiveClasses.java @@ -34,7 +34,7 @@ /** * @test TestPrimitiveClasses - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.jvm.TestPrimitiveClasses diff --git a/test/jdk/jdk/jfr/jvm/TestThreadExclusion.java b/test/jdk/jdk/jfr/jvm/TestThreadExclusion.java index 411710881cad4..000923d26785b 100644 --- a/test/jdk/jdk/jfr/jvm/TestThreadExclusion.java +++ b/test/jdk/jdk/jfr/jvm/TestThreadExclusion.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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR & vm.continuations * @library /test/lib * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/jvm/TestUnloadEventClassCount.java b/test/jdk/jdk/jfr/jvm/TestUnloadEventClassCount.java index ddb7ec3c757a7..23b45f0b5f728 100644 --- a/test/jdk/jdk/jfr/jvm/TestUnloadEventClassCount.java +++ b/test/jdk/jdk/jfr/jvm/TestUnloadEventClassCount.java @@ -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 @@ -32,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Unit test for JVM#getUnloadedEventClassCount * @requires vm.hasJFR * diff --git a/test/jdk/jdk/jfr/jvm/TestUnsupportedVM.java b/test/jdk/jdk/jfr/jvm/TestUnsupportedVM.java index 81a83222c75f9..a3dbeef6d5c9b 100644 --- a/test/jdk/jdk/jfr/jvm/TestUnsupportedVM.java +++ b/test/jdk/jdk/jfr/jvm/TestUnsupportedVM.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2019, 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 @@ -68,7 +68,7 @@ /** * @test TestUnsupportedVM - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @modules jdk.jfr diff --git a/test/jdk/jdk/jfr/jvm/TestVerifyInstrumentation.java b/test/jdk/jdk/jfr/jvm/TestVerifyInstrumentation.java index e003a4b3e4849..ec9e64972ec3c 100644 --- a/test/jdk/jdk/jfr/jvm/TestVerifyInstrumentation.java +++ b/test/jdk/jdk/jfr/jvm/TestVerifyInstrumentation.java @@ -29,7 +29,7 @@ /** * @test * @bug 8316271 - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm -Xverify:all jdk.jfr.jvm.TestVerifyInstrumentation diff --git a/test/jdk/jdk/jfr/jvm/TestVirtualThreadExclusion.java b/test/jdk/jdk/jfr/jvm/TestVirtualThreadExclusion.java index e7a4713c223fc..c2a820aaf9ad1 100644 --- a/test/jdk/jdk/jfr/jvm/TestVirtualThreadExclusion.java +++ b/test/jdk/jdk/jfr/jvm/TestVirtualThreadExclusion.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 @@ -38,7 +38,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR & vm.continuations * @library /test/lib * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/jvm/TestWaste.java b/test/jdk/jdk/jfr/jvm/TestWaste.java index afa2dda4ee12c..c755ca4c3d02d 100644 --- a/test/jdk/jdk/jfr/jvm/TestWaste.java +++ b/test/jdk/jdk/jfr/jvm/TestWaste.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 @@ -43,7 +43,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal.test diff --git a/test/jdk/jdk/jfr/startupargs/TestBadOptionValues.java b/test/jdk/jdk/jfr/startupargs/TestBadOptionValues.java index 50514e0202441..bae1dcd08cbe6 100644 --- a/test/jdk/jdk/jfr/startupargs/TestBadOptionValues.java +++ b/test/jdk/jdk/jfr/startupargs/TestBadOptionValues.java @@ -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 @@ -30,7 +30,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @library /test/lib diff --git a/test/jdk/jdk/jfr/startupargs/TestDumpOnExit.java b/test/jdk/jdk/jfr/startupargs/TestDumpOnExit.java index bca93044fc906..66b27e5978d2f 100644 --- a/test/jdk/jdk/jfr/startupargs/TestDumpOnExit.java +++ b/test/jdk/jdk/jfr/startupargs/TestDumpOnExit.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,7 +39,7 @@ /** * @test * @summary Start a FlightRecording with dumponexit. Verify dump exists. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.startupargs.TestDumpOnExit diff --git a/test/jdk/jdk/jfr/startupargs/TestEventSettings.java b/test/jdk/jdk/jfr/startupargs/TestEventSettings.java index 41e59523339c4..37af394affdfe 100644 --- a/test/jdk/jdk/jfr/startupargs/TestEventSettings.java +++ b/test/jdk/jdk/jfr/startupargs/TestEventSettings.java @@ -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 @@ -32,7 +32,7 @@ /** * @test * @summary Start a recording with custom settings - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/startupargs/TestFlushInterval.java b/test/jdk/jdk/jfr/startupargs/TestFlushInterval.java index 83c4d07c23bb7..25beb590879f4 100644 --- a/test/jdk/jdk/jfr/startupargs/TestFlushInterval.java +++ b/test/jdk/jdk/jfr/startupargs/TestFlushInterval.java @@ -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 @@ -33,7 +33,7 @@ /** * @test * @summary Start a recording with a flush interval - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/startupargs/TestJFCWarnings.java b/test/jdk/jdk/jfr/startupargs/TestJFCWarnings.java index cf0cb0212169b..092ec73546f21 100644 --- a/test/jdk/jdk/jfr/startupargs/TestJFCWarnings.java +++ b/test/jdk/jdk/jfr/startupargs/TestJFCWarnings.java @@ -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 @@ -28,7 +28,7 @@ /** * @test * @summary Start a recording with custom settings - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/startupargs/TestMemoryOptions.java b/test/jdk/jdk/jfr/startupargs/TestMemoryOptions.java index 9c90d04691ab1..6827c663ee37b 100644 --- a/test/jdk/jdk/jfr/startupargs/TestMemoryOptions.java +++ b/test/jdk/jdk/jfr/startupargs/TestMemoryOptions.java @@ -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 @@ -33,7 +33,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/startupargs/TestMultipleStartupRecordings.java b/test/jdk/jdk/jfr/startupargs/TestMultipleStartupRecordings.java index 24be874a87f60..c70f98105689e 100644 --- a/test/jdk/jdk/jfr/startupargs/TestMultipleStartupRecordings.java +++ b/test/jdk/jdk/jfr/startupargs/TestMultipleStartupRecordings.java @@ -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 @@ -29,7 +29,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * * @library /test/lib diff --git a/test/jdk/jdk/jfr/startupargs/TestOldObjectQueueSize.java b/test/jdk/jdk/jfr/startupargs/TestOldObjectQueueSize.java index 0613906aface7..f85baed6f9003 100644 --- a/test/jdk/jdk/jfr/startupargs/TestOldObjectQueueSize.java +++ b/test/jdk/jdk/jfr/startupargs/TestOldObjectQueueSize.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,7 +38,7 @@ * @requires vm.hasJFR * @modules jdk.jfr/jdk.jfr.internal.test * @library /test/lib - * @key jfr + * @requires vm.flagless * * @run main/othervm -XX:TLABSize=2k -XX:FlightRecorderOptions:old-object-queue-size=0 jdk.jfr.startupargs.TestOldObjectQueueSize off * @run main/othervm -XX:TLABSize=2k -Xlog:gc+tlab=trace -XX:FlightRecorderOptions:old-object-queue-size=10000 jdk.jfr.startupargs.TestOldObjectQueueSize many diff --git a/test/jdk/jdk/jfr/startupargs/TestOptionsWithLocale.java b/test/jdk/jdk/jfr/startupargs/TestOptionsWithLocale.java index 3a4d3f207326a..27c1533ca3b2c 100644 --- a/test/jdk/jdk/jfr/startupargs/TestOptionsWithLocale.java +++ b/test/jdk/jdk/jfr/startupargs/TestOptionsWithLocale.java @@ -12,7 +12,7 @@ * @test * @summary Checks that locale is respected when using -XX:FlightRecorderOptions * See JDK-8244508 - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @modules jdk.jfr * @library /test/lib diff --git a/test/jdk/jdk/jfr/startupargs/TestPreserveRepository.java b/test/jdk/jdk/jfr/startupargs/TestPreserveRepository.java index 4f4ee195e1fae..74023639f47c8 100644 --- a/test/jdk/jdk/jfr/startupargs/TestPreserveRepository.java +++ b/test/jdk/jdk/jfr/startupargs/TestPreserveRepository.java @@ -31,7 +31,7 @@ /** * @test * @summary Tests that -XX:FlightRecorderOptions:preserve-repository works - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @modules jdk.jfr * @library /test/lib diff --git a/test/jdk/jdk/jfr/startupargs/TestRepositoryPath.java b/test/jdk/jdk/jfr/startupargs/TestRepositoryPath.java index a5052b42d6d93..fcddff8aca471 100644 --- a/test/jdk/jdk/jfr/startupargs/TestRepositoryPath.java +++ b/test/jdk/jdk/jfr/startupargs/TestRepositoryPath.java @@ -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 @@ -32,7 +32,7 @@ /** * @test * @summary Set repository path. Verify recording created in repo. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -XX:StartFlightRecording:name=TestStartRecording,settings=profile -XX:FlightRecorderOptions:repository=./repo jdk.jfr.startupargs.TestRepositoryPath diff --git a/test/jdk/jdk/jfr/startupargs/TestRepositoryPathLong.java b/test/jdk/jdk/jfr/startupargs/TestRepositoryPathLong.java index 4dda1ab23d2e1..73bc600d782b3 100644 --- a/test/jdk/jdk/jfr/startupargs/TestRepositoryPathLong.java +++ b/test/jdk/jdk/jfr/startupargs/TestRepositoryPathLong.java @@ -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 @@ -32,7 +32,7 @@ /** * @test * @summary Set repository path. Verify recording created in repo. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -XX:StartFlightRecording:name=myrec,settings=profile -XX:FlightRecorderOptions:repository=./subdirectory/subdirectory1/subdirectory2/subdirectory3/subdirectory4/subdirectory5/subdirectory6/subdirectory7/subdirectory8/subdirectory9/subdirectory10/subdirectory11/subdirectory12/subdirectory13/subdirectory14/subdirectory15 jdk.jfr.startupargs.TestRepositoryPathLong diff --git a/test/jdk/jdk/jfr/startupargs/TestRetransform.java b/test/jdk/jdk/jfr/startupargs/TestRetransform.java index 2e4067ae5441d..5d26a4bb0a98b 100644 --- a/test/jdk/jdk/jfr/startupargs/TestRetransform.java +++ b/test/jdk/jdk/jfr/startupargs/TestRetransform.java @@ -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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm -XX:FlightRecorderOptions:retransform=false jdk.jfr.startupargs.TestRetransform diff --git a/test/jdk/jdk/jfr/startupargs/TestRetransformUsingLog.java b/test/jdk/jdk/jfr/startupargs/TestRetransformUsingLog.java index 186a87a12c2d2..02636e4b715d1 100644 --- a/test/jdk/jdk/jfr/startupargs/TestRetransformUsingLog.java +++ b/test/jdk/jdk/jfr/startupargs/TestRetransformUsingLog.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 @@ -34,7 +34,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.startupargs.TestRetransformUsingLog diff --git a/test/jdk/jdk/jfr/startupargs/TestStartDelay.java b/test/jdk/jdk/jfr/startupargs/TestStartDelay.java index 7036e373a416c..5470ae7936ee8 100644 --- a/test/jdk/jdk/jfr/startupargs/TestStartDelay.java +++ b/test/jdk/jdk/jfr/startupargs/TestStartDelay.java @@ -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 @@ -34,7 +34,7 @@ /** * @test * @summary Start a recording with delay. Verify recording starts later. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -XX:StartFlightRecording:name=TestStartDelay,delay=5000s jdk.jfr.startupargs.TestStartDelay diff --git a/test/jdk/jdk/jfr/startupargs/TestStartDelayRunning.java b/test/jdk/jdk/jfr/startupargs/TestStartDelayRunning.java index b74714b9bdd6c..b7563c35c3670 100644 --- a/test/jdk/jdk/jfr/startupargs/TestStartDelayRunning.java +++ b/test/jdk/jdk/jfr/startupargs/TestStartDelayRunning.java @@ -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 @@ -33,7 +33,7 @@ /** * @test * @summary Verify that a recopding with a delay is started. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -XX:StartFlightRecording:name=TestStartDelay,delay=1s jdk.jfr.startupargs.TestStartDelayRunning diff --git a/test/jdk/jdk/jfr/startupargs/TestStartDuration.java b/test/jdk/jdk/jfr/startupargs/TestStartDuration.java index d9697492d94fb..fcc2f4abdd571 100644 --- a/test/jdk/jdk/jfr/startupargs/TestStartDuration.java +++ b/test/jdk/jdk/jfr/startupargs/TestStartDuration.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 @@ -36,7 +36,7 @@ /** * @test * @summary Start a recording with duration. Verify recording stops. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires vm.flagless * @library /test/lib /test/jdk diff --git a/test/jdk/jdk/jfr/startupargs/TestStartHelp.java b/test/jdk/jdk/jfr/startupargs/TestStartHelp.java index 4d4edbf68dc36..0b3b5869cad5b 100644 --- a/test/jdk/jdk/jfr/startupargs/TestStartHelp.java +++ b/test/jdk/jdk/jfr/startupargs/TestStartHelp.java @@ -30,7 +30,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main jdk.jfr.startupargs.TestStartHelp diff --git a/test/jdk/jdk/jfr/startupargs/TestStartMaxAgeSize.java b/test/jdk/jdk/jfr/startupargs/TestStartMaxAgeSize.java index 95a6b436ddb26..df9af580b401b 100644 --- a/test/jdk/jdk/jfr/startupargs/TestStartMaxAgeSize.java +++ b/test/jdk/jdk/jfr/startupargs/TestStartMaxAgeSize.java @@ -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 @@ -33,7 +33,7 @@ /** * @test * @summary Start a recording with delay. Verify recording starts later. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -XX:StartFlightRecording:name=TestStartMaxAgeSize,maxage=10s,maxsize=1000000 jdk.jfr.startupargs.TestStartMaxAgeSize diff --git a/test/jdk/jdk/jfr/startupargs/TestStartName.java b/test/jdk/jdk/jfr/startupargs/TestStartName.java index 7ab4a7d0f7e98..7dd11125f8f49 100644 --- a/test/jdk/jdk/jfr/startupargs/TestStartName.java +++ b/test/jdk/jdk/jfr/startupargs/TestStartName.java @@ -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 @@ -30,7 +30,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main jdk.jfr.startupargs.TestStartName diff --git a/test/jdk/jdk/jfr/startupargs/TestStartNoSettings.java b/test/jdk/jdk/jfr/startupargs/TestStartNoSettings.java index ac5f5efa5c195..61188f224e0c0 100644 --- a/test/jdk/jdk/jfr/startupargs/TestStartNoSettings.java +++ b/test/jdk/jdk/jfr/startupargs/TestStartNoSettings.java @@ -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 @@ -32,7 +32,7 @@ /** * @test * @summary Start a FlightRecording without any settings (not even default). - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib * @run main/othervm jdk.jfr.startupargs.TestStartNoSettings diff --git a/test/jdk/jdk/jfr/startupargs/TestStartRecording.java b/test/jdk/jdk/jfr/startupargs/TestStartRecording.java index 7eb24cc8fa69e..6b3239951c7f3 100644 --- a/test/jdk/jdk/jfr/startupargs/TestStartRecording.java +++ b/test/jdk/jdk/jfr/startupargs/TestStartRecording.java @@ -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 @@ -33,7 +33,7 @@ /** * @test * @summary Start a recording with -XX:StartFlightRecording. Dump recording with jcmd. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm -XX:StartFlightRecording:name=TestStartRecording,settings=profile jdk.jfr.startupargs.TestStartRecording diff --git a/test/jdk/jdk/jfr/startupargs/TestStartupMessage.java b/test/jdk/jdk/jfr/startupargs/TestStartupMessage.java index b919f80e9da0c..4a934ebb36da3 100644 --- a/test/jdk/jdk/jfr/startupargs/TestStartupMessage.java +++ b/test/jdk/jdk/jfr/startupargs/TestStartupMessage.java @@ -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 @@ -32,7 +32,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main jdk.jfr.startupargs.TestStartupMessage diff --git a/test/jdk/jdk/jfr/startupargs/TestStartupOptionSpecifiedOnce.java b/test/jdk/jdk/jfr/startupargs/TestStartupOptionSpecifiedOnce.java index 756402b0c607f..11749504eba0c 100644 --- a/test/jdk/jdk/jfr/startupargs/TestStartupOptionSpecifiedOnce.java +++ b/test/jdk/jdk/jfr/startupargs/TestStartupOptionSpecifiedOnce.java @@ -26,7 +26,7 @@ /** * @test The test verifies that options can only be specified once with --XX:StartFlightRecording - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main jdk.jfr.startupargs.TestStartupOptionSpecifiedOnce diff --git a/test/jdk/jdk/jfr/threading/TestDeepVirtualStackTrace.java b/test/jdk/jdk/jfr/threading/TestDeepVirtualStackTrace.java index 3fecd91ea62c2..2be7262600639 100644 --- a/test/jdk/jdk/jfr/threading/TestDeepVirtualStackTrace.java +++ b/test/jdk/jdk/jfr/threading/TestDeepVirtualStackTrace.java @@ -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 @@ -38,7 +38,7 @@ * @test * @summary Tests emitting an event, both in Java and native, in a virtual * thread with the maximum number of allowed stack frames for JFR - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR & vm.continuations * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/threading/TestManyVirtualThreads.java b/test/jdk/jdk/jfr/threading/TestManyVirtualThreads.java index f0c3b52cf144c..228abb6439e2a 100644 --- a/test/jdk/jdk/jfr/threading/TestManyVirtualThreads.java +++ b/test/jdk/jdk/jfr/threading/TestManyVirtualThreads.java @@ -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 @@ -40,7 +40,7 @@ /** * @test * @summary Tests starting virtual threads from a set of ordinary threads - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR & vm.continuations * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/threading/TestNestedVirtualThreads.java b/test/jdk/jdk/jfr/threading/TestNestedVirtualThreads.java index 26be901804a50..15901be949049 100644 --- a/test/jdk/jdk/jfr/threading/TestNestedVirtualThreads.java +++ b/test/jdk/jdk/jfr/threading/TestNestedVirtualThreads.java @@ -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 @@ -37,7 +37,7 @@ * @test * @summary Tests committing an event in a virtual thread created by a virtual * thread - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR & vm.continuations * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal diff --git a/test/jdk/jdk/jfr/threading/TestStringPoolVirtualThreadPinning.java b/test/jdk/jdk/jfr/threading/TestStringPoolVirtualThreadPinning.java index 0dc1ef8566139..ef2a3698edcac 100644 --- a/test/jdk/jdk/jfr/threading/TestStringPoolVirtualThreadPinning.java +++ b/test/jdk/jdk/jfr/threading/TestStringPoolVirtualThreadPinning.java @@ -41,7 +41,7 @@ * @test * @bug 8338417 * @summary Tests pinning of virtual threads when the JFR string pool monitor is contended. - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR & vm.continuations * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.threading.TestStringPoolVirtualThreadPinning diff --git a/test/jdk/jdk/jfr/tool/TestAssemble.java b/test/jdk/jdk/jfr/tool/TestAssemble.java index ccc95498de437..43c862d8999ae 100644 --- a/test/jdk/jdk/jfr/tool/TestAssemble.java +++ b/test/jdk/jdk/jfr/tool/TestAssemble.java @@ -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 @@ -35,14 +35,13 @@ import jdk.jfr.consumer.RecordedEvent; import jdk.jfr.consumer.RecordingFile; import jdk.jfr.internal.Repository; -import jdk.jfr.internal.SecuritySupport.SafePath; import jdk.test.lib.Asserts; import jdk.test.lib.process.OutputAnalyzer; /** * @test * @summary Test jfr reconstruct - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @modules jdk.jfr/jdk.jfr.internal @@ -80,7 +79,7 @@ public static void main(String[] args) throws Throwable { expectedCount += countEventInRecording(tmp); } - SafePath repository = Repository.getRepository().getRepositoryPath(); + Path repository = Repository.getRepository().getRepositoryPath(); Path destinationPath = Paths.get("reconstructed.jfr"); String directory = repository.toString(); diff --git a/test/jdk/jdk/jfr/tool/TestConfigure.java b/test/jdk/jdk/jfr/tool/TestConfigure.java index 90f6f39be00be..e200054319eaa 100644 --- a/test/jdk/jdk/jfr/tool/TestConfigure.java +++ b/test/jdk/jdk/jfr/tool/TestConfigure.java @@ -34,7 +34,7 @@ /** * @test * @summary Test jfr configure - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.tool.TestConfigure diff --git a/test/jdk/jdk/jfr/tool/TestDisassemble.java b/test/jdk/jdk/jfr/tool/TestDisassemble.java index da7f9489665bf..68088fdc5bb90 100644 --- a/test/jdk/jdk/jfr/tool/TestDisassemble.java +++ b/test/jdk/jdk/jfr/tool/TestDisassemble.java @@ -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 @@ -40,7 +40,7 @@ * @test * @bug 8253050 * @summary Test jfr split - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.tool.TestDisassemble diff --git a/test/jdk/jdk/jfr/tool/TestHelp.java b/test/jdk/jdk/jfr/tool/TestHelp.java index 91bd7d82a2bed..b0113fca5bf91 100644 --- a/test/jdk/jdk/jfr/tool/TestHelp.java +++ b/test/jdk/jdk/jfr/tool/TestHelp.java @@ -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 @@ -28,7 +28,7 @@ /** * @test * @summary Test help - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.tool.TestHelp diff --git a/test/jdk/jdk/jfr/tool/TestMetadata.java b/test/jdk/jdk/jfr/tool/TestMetadata.java index c321f4e3fe66a..76afc110f5d62 100644 --- a/test/jdk/jdk/jfr/tool/TestMetadata.java +++ b/test/jdk/jdk/jfr/tool/TestMetadata.java @@ -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 @@ -42,7 +42,7 @@ /** * @test * @summary Test jfr info - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.tool.TestMetadata diff --git a/test/jdk/jdk/jfr/tool/TestPrint.java b/test/jdk/jdk/jfr/tool/TestPrint.java index 6f7e89f83552b..fcedca3bcb9de 100644 --- a/test/jdk/jdk/jfr/tool/TestPrint.java +++ b/test/jdk/jdk/jfr/tool/TestPrint.java @@ -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 @@ -33,7 +33,7 @@ /** * @test * @summary Test jfr print - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.tool.TestPrint diff --git a/test/jdk/jdk/jfr/tool/TestPrintDefault.java b/test/jdk/jdk/jfr/tool/TestPrintDefault.java index 215845e6c990c..8dd04c61e047d 100644 --- a/test/jdk/jdk/jfr/tool/TestPrintDefault.java +++ b/test/jdk/jdk/jfr/tool/TestPrintDefault.java @@ -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 @@ -29,7 +29,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Tests print --json * @requires vm.hasJFR * diff --git a/test/jdk/jdk/jfr/tool/TestPrintJSON.java b/test/jdk/jdk/jfr/tool/TestPrintJSON.java index 6a8977a672e66..3d79c75300f35 100644 --- a/test/jdk/jdk/jfr/tool/TestPrintJSON.java +++ b/test/jdk/jdk/jfr/tool/TestPrintJSON.java @@ -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 @@ -42,7 +42,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Tests print --json * @requires vm.hasJFR * diff --git a/test/jdk/jdk/jfr/tool/TestPrintXML.java b/test/jdk/jdk/jfr/tool/TestPrintXML.java index c8d60166d4c89..2c1c4a518e2b6 100644 --- a/test/jdk/jdk/jfr/tool/TestPrintXML.java +++ b/test/jdk/jdk/jfr/tool/TestPrintXML.java @@ -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 @@ -61,7 +61,7 @@ /** * @test - * @key jfr + * @requires vm.flagless * @summary Tests print --xml * @requires vm.hasJFR * diff --git a/test/jdk/jdk/jfr/tool/TestScrub.java b/test/jdk/jdk/jfr/tool/TestScrub.java index ba02f7d31268c..43b9fca7ee4c0 100644 --- a/test/jdk/jdk/jfr/tool/TestScrub.java +++ b/test/jdk/jdk/jfr/tool/TestScrub.java @@ -40,7 +40,7 @@ /** * @test * @summary Test jfr scrub - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.tool.TestScrub diff --git a/test/jdk/jdk/jfr/tool/TestSummary.java b/test/jdk/jdk/jfr/tool/TestSummary.java index 641d951f63ca2..550de0c081144 100644 --- a/test/jdk/jdk/jfr/tool/TestSummary.java +++ b/test/jdk/jdk/jfr/tool/TestSummary.java @@ -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 @@ -32,7 +32,7 @@ /** * @test * @summary Test jfr info - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.tool.TestSummary diff --git a/test/jdk/jdk/jfr/tool/TestView.java b/test/jdk/jdk/jfr/tool/TestView.java index 89c74133286f9..89c45c3e06862 100644 --- a/test/jdk/jdk/jfr/tool/TestView.java +++ b/test/jdk/jdk/jfr/tool/TestView.java @@ -31,7 +31,7 @@ /** * @test * @summary Test jfr view - * @key jfr + * @requires vm.flagless * @requires vm.hasJFR * @requires (vm.gc == "G1" | vm.gc == null) * & vm.opt.ExplicitGCInvokesConcurrent != false diff --git a/test/jdk/sun/security/pkcs11/PKCS11Test.java b/test/jdk/sun/security/pkcs11/PKCS11Test.java index 237436094ac6e..b624afd69fb3c 100644 --- a/test/jdk/sun/security/pkcs11/PKCS11Test.java +++ b/test/jdk/sun/security/pkcs11/PKCS11Test.java @@ -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 @@ -37,7 +37,6 @@ import java.security.InvalidAlgorithmParameterException; import java.security.KeyPairGenerator; import java.security.NoSuchProviderException; -import java.security.Policy; import java.security.Provider; import java.security.ProviderException; import java.security.SecureRandom; diff --git a/test/jdk/sun/security/pkcs11/nss/p11-nss-sensitive.txt b/test/jdk/sun/security/pkcs11/nss/p11-nss-sensitive.txt index 4579dd593982d..df891c7097a0f 100644 --- a/test/jdk/sun/security/pkcs11/nss/p11-nss-sensitive.txt +++ b/test/jdk/sun/security/pkcs11/nss/p11-nss-sensitive.txt @@ -49,10 +49,12 @@ attributes(*,CKO_PRIVATE_KEY,CKK_DH) = { # Make all private keys sensitive attributes(*,CKO_PRIVATE_KEY,*) = { CKA_SENSITIVE = true + CKA_EXTRACTABLE = false } # Make all secret keys sensitive attributes(*,CKO_SECRET_KEY,*) = { CKA_SENSITIVE = true + CKA_EXTRACTABLE = false } diff --git a/test/jdk/sun/security/provider/FileInputStreamPool/FileInputStreamPoolTest.java b/test/jdk/sun/security/provider/FileInputStreamPool/FileInputStreamPoolTest.java index 860b2d99910ac..32bdea4e153c2 100644 --- a/test/jdk/sun/security/provider/FileInputStreamPool/FileInputStreamPoolTest.java +++ b/test/jdk/sun/security/provider/FileInputStreamPool/FileInputStreamPoolTest.java @@ -25,7 +25,6 @@ * @test * @bug 8047769 * @modules java.base/java.io:open - * java.base/java.lang.ref:open * java.base/sun.security.provider:open * @summary SecureRandom should be more frugal with file descriptors */ @@ -133,11 +132,9 @@ public static void main(String[] args) throws Exception { /** * A proxy for (package)private static methods: * sun.security.provider.FileInputStreamPool.getInputStream - * java.lang.ref.Reference.waitForReferenceProcessing */ static class TestProxy { private static final Method getInputStreamMethod; - private static final Method waitForReferenceProcessingMethod; private static final Field inField; static { @@ -149,10 +146,6 @@ static class TestProxy { "getInputStream", File.class); getInputStreamMethod.setAccessible(true); - waitForReferenceProcessingMethod = - Reference.class.getDeclaredMethod("waitForReferenceProcessing"); - waitForReferenceProcessingMethod.setAccessible(true); - inField = FilterInputStream.class.getDeclaredField("in"); inField.setAccessible(true); } catch (Exception e) { @@ -180,25 +173,6 @@ static InputStream FileInputStreamPool_getInputStream(File file) } } - static boolean Reference_waitForReferenceProcessing() { - try { - return (boolean) waitForReferenceProcessingMethod.invoke(null); - } catch (InvocationTargetException e) { - Throwable te = e.getTargetException(); - if (te instanceof InterruptedException) { - return true; - } else if (te instanceof RuntimeException) { - throw (RuntimeException) te; - } else if (te instanceof Error) { - throw (Error) te; - } else { - throw new UndeclaredThrowableException(te); - } - } catch (IllegalAccessException e) { - throw new RuntimeException(e); - } - } - static FileInputStream FilterInputStream_getInField(FilterInputStream fis) { try { return (FileInputStream) inField.get(fis); diff --git a/test/jdk/sun/security/provider/certpath/OCSP/OCSPReadTimeoutDefault.java b/test/jdk/sun/security/provider/certpath/OCSP/OCSPReadTimeoutDefault.java new file mode 100644 index 0000000000000..312435b002622 --- /dev/null +++ b/test/jdk/sun/security/provider/certpath/OCSP/OCSPReadTimeoutDefault.java @@ -0,0 +1,70 @@ +/* + * 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 8347506 + * @summary Compatible OCSP readtimeout property with OCSP timeout + * @modules java.base/sun.security.provider.certpath + * @run main/othervm + * --add-opens java.base/sun.security.provider.certpath=ALL-UNNAMED + * OCSPReadTimeoutDefault 15000 + * @run main/othervm + * --add-opens java.base/sun.security.provider.certpath=ALL-UNNAMED + * -Dcom.sun.security.ocsp.timeout=6 + * OCSPReadTimeoutDefault 6000 + * @run main/othervm + * --add-opens java.base/sun.security.provider.certpath=ALL-UNNAMED + * -Dcom.sun.security.ocsp.timeout=6 -Dcom.sun.security.ocsp.readtimeout=1 + * OCSPReadTimeoutDefault 1000 + */ + +import java.lang.reflect.*; + +public class OCSPReadTimeoutDefault { + + public static void main(String[] args) throws Exception { + if (args == null || args.length < 1) { + throw new RuntimeException("Missing mandatory readtimeout value"); + } + + int expectedReadTimeout = Integer.parseInt(args[0]); + + Class ocspClazz = sun.security.provider.certpath.OCSP.class; + System.out.println("OCSP Class: " + ocspClazz); + + Field cto = ocspClazz.getDeclaredField("CONNECT_TIMEOUT"); + Field rto = ocspClazz.getDeclaredField("READ_TIMEOUT"); + cto.setAccessible(true); + rto.setAccessible(true); + int ctoVal = cto.getInt(null); + int rtoVal = rto.getInt(null); + + System.out.println("Expected read timeout: " + expectedReadTimeout); + System.out.println("CTOVal: " + ctoVal + ", RTOVal: " + rtoVal); + if (rtoVal != expectedReadTimeout) { + throw new RuntimeException("Expected read timeout value of " + + expectedReadTimeout + ", found " + rtoVal); + } + } +} \ No newline at end of file diff --git a/test/jdk/sun/security/provider/hss/TestHSS.java b/test/jdk/sun/security/provider/hss/TestHSS.java index 0af911f806be5..8056855cc1aca 100644 --- a/test/jdk/sun/security/provider/hss/TestHSS.java +++ b/test/jdk/sun/security/provider/hss/TestHSS.java @@ -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,7 @@ /* * @test - * @bug 8298127 + * @bug 8298127 8347596 * @library /test/lib * @summary tests for HSS/LMS provider * @modules java.base/sun.security.util @@ -40,6 +40,7 @@ import java.security.spec.X509EncodedKeySpec; import java.util.HexFormat; +import jdk.test.lib.Asserts; import sun.security.util.*; import jdk.test.lib.util.SerializationUtils; @@ -61,9 +62,7 @@ public static void main(String[] args) throws Exception { i++; } - if (!serializeTest()) { - throw new RuntimeException("serializeTest failed"); - } + serializeTest(); System.out.println("All tests passed"); } @@ -88,7 +87,7 @@ static boolean kat(TestCase t) throws Exception { } } - static boolean serializeTest() throws Exception { + static void serializeTest() throws Exception { final ObjectIdentifier oid; var pk = decode(""" 00000002 @@ -106,7 +105,19 @@ static boolean serializeTest() throws Exception { throw new AssertionError(e); } - var keyBits = new DerOutputStream().putOctetString(pk).toByteArray(); + // Encoding without inner OCTET STRING + var pk0 = makeKey(oid, pk); + // Encoding with inner OCTET STRING + var pk1 = makeKey(oid, new DerOutputStream().putOctetString(pk).toByteArray()); + Asserts.assertEquals(pk0, pk1); + + PublicKey pk2 = (PublicKey) SerializationUtils + .deserialize(SerializationUtils.serialize(pk1)); + Asserts.assertEquals(pk1, pk2); + } + + static PublicKey makeKey(ObjectIdentifier oid, byte[] keyBits) + throws Exception { var oidBytes = new DerOutputStream().write(DerValue.tag_Sequence, new DerOutputStream().putOID(oid)); var x509encoding = new DerOutputStream().write(DerValue.tag_Sequence, @@ -115,11 +126,7 @@ static boolean serializeTest() throws Exception { .toByteArray(); var x509KeySpec = new X509EncodedKeySpec(x509encoding); - var pk1 = KeyFactory.getInstance(ALG).generatePublic(x509KeySpec); - - PublicKey pk2 = (PublicKey) SerializationUtils - .deserialize(SerializationUtils.serialize(pk1)); - return pk2.equals(pk1); + return KeyFactory.getInstance(ALG).generatePublic(x509KeySpec); } static boolean verify(byte[] pk, byte[] sig, byte[] msg) throws Exception { diff --git a/test/jdk/sun/security/ssl/SSLEngineImpl/SSLEngineKeyLimit.java b/test/jdk/sun/security/ssl/SSLEngineImpl/SSLEngineKeyLimit.java index d6ec20c93d2ed..65311e9770154 100644 --- a/test/jdk/sun/security/ssl/SSLEngineImpl/SSLEngineKeyLimit.java +++ b/test/jdk/sun/security/ssl/SSLEngineImpl/SSLEngineKeyLimit.java @@ -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 @@ -109,8 +109,8 @@ public static void main(String args[]) throws Exception { } p.close(); - System.setProperty("test.java.opts", - "-Dtest.src=" + System.getProperty("test.src") + + System.setProperty("test.java.opts", System.getProperty("test.java.opts") + + " -Dtest.src=" + System.getProperty("test.src") + " -Dtest.jdk=" + System.getProperty("test.jdk") + " -Djavax.net.debug=ssl,handshake" + " -Djava.security.properties=" + f.getName()); diff --git a/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTClient.java b/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTClient.java index 57f61a6cd8a64..ff086e35a074b 100644 --- a/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTClient.java +++ b/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTClient.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 @@ -65,8 +65,8 @@ public static void main(String[] args) throws Exception { sb.append(" "); }); String params = sb.toString(); - System.setProperty("test.java.opts", - "-Dtest.src=" + System.getProperty("test.src") + + System.setProperty("test.java.opts", System.getProperty("test.java.opts") + + " -Dtest.src=" + System.getProperty("test.src") + " -Dtest.jdk=" + System.getProperty("test.jdk") + " -Dtest.root=" + System.getProperty("test.root") + " -Djavax.net.debug=ssl,handshake " + params diff --git a/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTNoSessionCreation.java b/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTNoSessionCreation.java index f80270afd37dd..9a615f9b8846b 100644 --- a/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTNoSessionCreation.java +++ b/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTNoSessionCreation.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 @@ -51,8 +51,8 @@ public static void main(String[] args) throws Exception { StringBuilder sb = new StringBuilder(); Arrays.stream(args).forEach(a -> sb.append(a).append(" ")); String params = sb.toString(); - System.setProperty("test.java.opts", - "-Dtest.src=" + System.getProperty("test.src") + + System.setProperty("test.java.opts", System.getProperty("test.java.opts") + + " -Dtest.src=" + System.getProperty("test.src") + " -Dtest.jdk=" + System.getProperty("test.jdk") + " -Dtest.root=" + System.getProperty("test.root") + " -Djavax.net.debug=ssl,handshake " + params); diff --git a/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTParallel.java b/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTParallel.java index bff14113ea582..34c9cc940d5ea 100644 --- a/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTParallel.java +++ b/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTParallel.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 @@ -102,8 +102,8 @@ public static void main(String[] args) throws Exception { sb.append(" ").append(args[i]); } String params = sb.toString(); - System.setProperty("test.java.opts", - "-Dtest.src=" + System.getProperty("test.src") + + System.setProperty("test.java.opts", System.getProperty("test.java.opts") + + " -Dtest.src=" + System.getProperty("test.src") + " -Dtest.jdk=" + System.getProperty("test.jdk") + " -Dtest.root=" + System.getProperty("test.root") + " -Djavax.net.debug=ssl,handshake " + diff --git a/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTSequence.java b/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTSequence.java index 888dba56a5023..645650674eadf 100644 --- a/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTSequence.java +++ b/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTSequence.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 @@ -60,8 +60,8 @@ public static void main(String[] args) throws Exception { StringBuilder sb = new StringBuilder(); Arrays.stream(args).forEach(a -> sb.append(a).append(" ")); String params = sb.toString(); - System.setProperty("test.java.opts", - "-Dtest.src=" + System.getProperty("test.src") + + System.setProperty("test.java.opts", System.getProperty("test.java.opts") + + " -Dtest.src=" + System.getProperty("test.src") + " -Dtest.jdk=" + System.getProperty("test.jdk") + " -Dtest.root=" + System.getProperty("test.root") + " -Djavax.net.debug=ssl,handshake " + params diff --git a/test/jdk/sun/security/ssl/SSLSessionImpl/ResumptionUpdateBoundValues.java b/test/jdk/sun/security/ssl/SSLSessionImpl/ResumptionUpdateBoundValues.java index ea7f4895785f0..87db7eed2963d 100644 --- a/test/jdk/sun/security/ssl/SSLSessionImpl/ResumptionUpdateBoundValues.java +++ b/test/jdk/sun/security/ssl/SSLSessionImpl/ResumptionUpdateBoundValues.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 @@ -179,8 +179,8 @@ SBListener doClientSide() throws Exception { public static void main(String[] args) throws Exception { if (args.length == 0) { - System.setProperty("test.java.opts", - "-Dtest.src=" + System.getProperty("test.src") + + System.setProperty("test.java.opts", System.getProperty("test.java.opts") + + " -Dtest.src=" + System.getProperty("test.src") + " -Dtest.jdk=" + System.getProperty("test.jdk") + " -Djavax.net.debug=ssl,handshake"); diff --git a/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketKeyLimit.java b/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketKeyLimit.java index f0519a94249d6..fc26b60e4d45d 100644 --- a/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketKeyLimit.java +++ b/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketKeyLimit.java @@ -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 @@ -125,8 +125,8 @@ public static void main(String args[]) throws Exception { } p.close(); System.out.println("Keyusage path = " + f.getAbsolutePath()); - System.setProperty("test.java.opts", - "-Dtest.src=" + System.getProperty("test.src") + + System.setProperty("test.java.opts", System.getProperty("test.java.opts") + + " -Dtest.src=" + System.getProperty("test.src") + " -Dtest.jdk=" + System.getProperty("test.jdk") + " -Djavax.net.debug=ssl,handshake" + " -Djava.security.properties=" + f.getName()); diff --git a/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/Camerfirma.java b/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/Camerfirma.java new file mode 100644 index 0000000000000..50a723441a519 --- /dev/null +++ b/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/Camerfirma.java @@ -0,0 +1,75 @@ +/* + * 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. + */ + +import java.io.File; +import java.security.Security; +import java.time.*; +import java.util.*; +import javax.net.ssl.*; + +/** + * @test + * @bug 8346587 + * @summary Check that TLS Server certificates chaining back to distrusted + * Camerfirma roots are invalid + * @library /test/lib + * @modules java.base/sun.security.validator + * @run main/othervm Camerfirma after policyOn invalid + * @run main/othervm Camerfirma after policyOff valid + * @run main/othervm Camerfirma before policyOn valid + * @run main/othervm Camerfirma before policyOff valid + */ + +public class Camerfirma { + + private static final String certPath = "chains" + File.separator + "camerfirma"; + + // Each of the roots have a test certificate chain stored in a file + // named "-chain.pem". + private static String[] rootsToTest = new String[] { + "camerfirmachamberscommerceca", "camerfirmachambersca", + "camerfirmachambersignca"}; + + // Date after the restrictions take effect + private static final ZonedDateTime DISTRUST_DATE = + LocalDate.of(2025, 04, 16).atStartOfDay(ZoneOffset.UTC); + + public static void main(String[] args) throws Exception { + + // All of the test certificates are signed with SHA-1 so we need + // to remove the constraint that disallows SHA-1 certificates. + String prop = Security.getProperty("jdk.certpath.disabledAlgorithms"); + String newProp = prop.replace(", SHA1 jdkCA & usage TLSServer", ""); + Security.setProperty("jdk.certpath.disabledAlgorithms", newProp); + + Distrust distrust = new Distrust(args); + + X509TrustManager[] tms = new X509TrustManager[]{ + distrust.getTMF("PKIX", null), + distrust.getTMF("SunX509", null) + }; + + Date notBefore = distrust.getNotBefore(DISTRUST_DATE); + distrust.testCertificateChain(certPath, notBefore, tms, rootsToTest); + } +} diff --git a/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/Distrust.java b/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/Distrust.java index 18178f65ec116..3430a1b8276f3 100644 --- a/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/Distrust.java +++ b/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/Distrust.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 @@ -198,7 +198,13 @@ public boolean[] getIssuerUniqueID() { public boolean[] getSubjectUniqueID() { return cert.getSubjectUniqueID(); } - public boolean[] getKeyUsage() { return cert.getKeyUsage(); } + public boolean[] getKeyUsage() { + // Turn on the Digital Signature bit. Some certs that we want + // to use as test certs don't have this bit turned on. + boolean[] withDigitalSignature = cert.getKeyUsage(); + withDigitalSignature[0] = true; + return withDigitalSignature; + } public int getBasicConstraints() { return cert.getBasicConstraints(); } public byte[] getEncoded() throws CertificateEncodingException { return cert.getEncoded(); diff --git a/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/chains/camerfirma/camerfirmachambersca-chain.pem b/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/chains/camerfirma/camerfirmachambersca-chain.pem new file mode 100644 index 0000000000000..f23c6dafeddf0 --- /dev/null +++ b/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/chains/camerfirma/camerfirmachambersca-chain.pem @@ -0,0 +1,64 @@ +Owner: CN=Camerfirma Corporate Server II - 2015, + L=Madrid (see current address at https://www.camerfirma.com/address), + SERIALNUMBER=A82743287, + O=AC Camerfirma S.A., OU=AC CAMERFIRMA, C=ES +Issuer: CN=Chambers of Commerce Root - 2008, + O=AC Camerfirma S.A., SERIALNUMBER=A82743287, + L=Madrid (see current address at www.camerfirma.com/address), C=EU +Serial number: 621ff31c489ba136 +Valid from: Thu Jan 15 01:21:16 PST 2015 until: Tue Dec 15 01:21:16 PST 2037 +Certificate fingerprints: + SHA1: FE:72:7A:78:EA:0C:03:35:CD:DA:9C:2E:D7:5F:D4:D4:6F:35:C2:EF + SHA256: 66:EA:E2:70:9B:54:CD:D1:69:31:77:B1:33:2F:F0:36:CD:D0:F7:23:DB:30:39:ED:31:15:55:A6:CB:F5:FF:3E +Signature algorithm name: SHA256withRSA +Subject Public Key Algorithm: 4096-bit RSA key +Version: 3 + +-----BEGIN CERTIFICATE----- +MIIIkzCCBnugAwIBAgIIYh/zHEiboTYwDQYJKoZIhvcNAQELBQAwga4xCzAJBgNV +BAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNlZSBjdXJyZW50IGFkZHJlc3MgYXQg +d3d3LmNhbWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQFEwlBODI3NDMyODcx +GzAZBgNVBAoTEkFDIENhbWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJlcnMg +b2YgQ29tbWVyY2UgUm9vdCAtIDIwMDgwHhcNMTUwMTE1MDkyMTE2WhcNMzcxMjE1 +MDkyMTE2WjCB0zELMAkGA1UEBhMCRVMxFjAUBgNVBAsMDUFDIENBTUVSRklSTUEx +GzAZBgNVBAoMEkFDIENhbWVyZmlybWEgUy5BLjESMBAGA1UEBRMJQTgyNzQzMjg3 +MUswSQYDVQQHDEJNYWRyaWQgKHNlZSBjdXJyZW50IGFkZHJlc3MgYXQgaHR0cHM6 +Ly93d3cuY2FtZXJmaXJtYS5jb20vYWRkcmVzcykxLjAsBgNVBAMMJUNhbWVyZmly +bWEgQ29ycG9yYXRlIFNlcnZlciBJSSAtIDIwMTUwggIiMA0GCSqGSIb3DQEBAQUA +A4ICDwAwggIKAoICAQC3ndKNpFufVq9v+15dRoT9oVkgwEfDdsPw0Ly0R+eM5MOk +35zEil/+hqEMbQmcvosAh6I8iAskkXasqh+SMbMIjvXbDyNILeGzsoP0uz3btHM7 +oN3yHXDhhd1NGNocP54Wehe9+RE3WP0yEEo+D2YmMwUHuv4KiXtveiPksv+Xkkz5 +auqppPMaYlD6y49AEsGY2zOEUI8PO4+tOxUKhvsiMuW817vH3VdmMwOjRe0SdYAi +YLQIiyqJGNdEo3u+fw8UXxaJSRXhmF+jUn5DvdzWWNAxxwAKy95EPlpLQsx/7t2W +2ntoELPHGJk4V+/yA0d2olLEqBADkRtP2HiC0wly+zp7OGmjtfjbqLrVjmo/mLP3 +zpmYbpUtubrHiY0rlW6wo5FZLcTUvcAxFjxLWVIELPjnTebOuHvoJTb97rhA1Oqq +woq5FWJHFI9idzXzFLO0LX/4ugI9LZWxmvWW0O4CePtnhp0aNE/GgAw6lMx7bjZe +DXxxQnUDEE/mAqOHRUCnvRUSKVbuBBE0oz5fz3nUwcWVVgrm/jkgqTX4EqnZe+yB +mKV6hFEYV+1oVh7kzNN4Hg7nzGuByS7cCuBEwULFhfUja1Bu9EqgndJ3CV0XCWIA +XVhJnPNPi6y4W11jLJ7XSGSz3sCh21g0Gpgi2pXHGDB65Jc/QJHZ5ZaHCrzFnwID +AQABo4ICjDCCAogwEgYDVR0TAQH/BAgwBgEB/wIBAjAdBgNVHQ4EFgQUY+nw8FYA +aGWwIWwOXNcZCJ0INGUwgeMGA1UdIwSB2zCB2IAU+SSsD7K1+HnA+mCIG8TZTQKe +FxmhgbSkgbEwga4xCzAJBgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNlZSBj +dXJyZW50IGFkZHJlc3MgYXQgd3d3LmNhbWVyZmlybWEuY29tL2FkZHJlc3MpMRIw +EAYDVQQFEwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENhbWVyZmlybWEgUy5BLjEp +MCcGA1UEAxMgQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDiCCQCj2kJ+ +pLGu2jB6BggrBgEFBQcBAQRuMGwwQgYIKwYBBQUHMAKGNmh0dHA6Ly93d3cuY2Ft +ZXJmaXJtYS5jb20vY2VydHMvcm9vdF9jaGFtYmVycy0yMDA4LmNydDAmBggrBgEF +BQcwAYYaaHR0cDovL29jc3AuY2FtZXJmaXJtYS5jb20wDgYDVR0PAQH/BAQDAgEG +MCcGA1UdJQQgMB4GCCsGAQUFBwMEBggrBgEFBQcDAgYIKwYBBQUHAwEwPgYDVR0g +BDcwNTAzBgRVHSAAMCswKQYIKwYBBQUHAgEWHWh0dHBzOi8vcG9saWN5LmNhbWVy +ZmlybWEuY29tMHgGA1UdHwRxMG8wNaAzoDGGL2h0dHA6Ly9jcmwuY2FtZXJmaXJt +YS5jb20vY2hhbWJlcnNyb290LTIwMDguY3JsMDagNKAyhjBodHRwOi8vY3JsMS5j +YW1lcmZpcm1hLmNvbS9jaGFtYmVyc3Jvb3QtMjAwOC5jcmwwDQYJKoZIhvcNAQEL +BQADggIBAKhqaZwalwf89f4wPqfcE/lrsHdx8+q9RG46ouBXhTJMqXjwstXOZSL4 +3Dqs3GaVuMPIM9OG7CK0I93mAt+FWtr49ACFTyPBxPg/knrZ4RHyEto+/6w0WZ9H +owNw0aUg3ZAkhIvMRPVou8PrVukqj2lGKIh3hRdrbHwYwwmKKNlWBoC9gWk3mTYU +zfNt/KTzQCCl5+s6YDa+XInMLWaGd/pE/e++a22vY24cv7kN3NAFMjAMELPwh9ic +zLoPX8B52r+GgwpKY0c0hZdVTii6psLQ+BenyMlh+6lHRBOlTCSRtNi16o7H8fRq +CY2wyQi7N+EmdY1DhvECCi1nLbOnIx1bSAW0cVwPVrjQ/vsAxPNc3SGe/Xnanm3a +zAgFspzeuAhxxG0VKOvtPBnPQNsQ0cK664+IrWRsfa6aYhEfKvfsn5o4HpBWDobf +zrtNbqjjOuiM6JkT+DxXo5UK7t2q75KCJiimTtAuPcZ5wErZISLvZ34BodIHL2xK +b3Vww7K2FE1QaNsuQkGbUk++B9/+vV3H57vzskObdFWeWKSCpxIil4vZwIIH17zn +WU+O2WIY1F0aO9zp3E7qwfmYT4MJ38NF9R7FSlxRlgVc1uUHu/iyUU4N1O6F3VdX +P2Y+tgLFZLYV4kApfXk5l9h94dgKyfVcIpvS6yVpLfONPnlCNOxy +-----END CERTIFICATE----- diff --git a/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/chains/camerfirma/camerfirmachamberscommerceca-chain.pem b/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/chains/camerfirma/camerfirmachamberscommerceca-chain.pem new file mode 100644 index 0000000000000..b27d46c17c8cf --- /dev/null +++ b/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/chains/camerfirma/camerfirmachamberscommerceca-chain.pem @@ -0,0 +1,48 @@ +Owner: CN=AC Camerfirma Certificados Camerales, + O=AC Camerfirma SA, SERIALNUMBER=A82743287, + L=Madrid (see current address at www.camerfirma.com/address), + EMAILADDRESS=ac_camerfirma_cc@camerfirma.com, C=ES +Issuer: CN=Chambers of Commerce Root, OU=http://www.chambersign.org, + O=AC Camerfirma SA CIF A82743287, C=EU +Serial number: 5 +Valid from: Mon Feb 09 07:42:47 PST 2004 until: Thu Feb 09 07:42:47 PST 2034 +Certificate fingerprints: + SHA1: 9F:36:B4:BE:9D:AF:1C:91:01:B2:D7:61:58:FB:95:CB:53:82:01:10 + SHA256: C7:D8:43:81:E1:1F:7C:57:46:77:1A:F5:B0:50:DC:51:FC:6F:DA:D6:F6:F3:5B:B5:3A:3D:E9:13:82:2E:A0:9E +Signature algorithm name: SHA1withRSA (weak) +Subject Public Key Algorithm: 2048-bit RSA key +Version: 3 + +-----BEGIN CERTIFICATE----- +MIIFwDCCBKigAwIBAgIBBTANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJFVTEn +MCUGA1UEChMeQUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQL +ExpodHRwOi8vd3d3LmNoYW1iZXJzaWduLm9yZzEiMCAGA1UEAxMZQ2hhbWJlcnMg +b2YgQ29tbWVyY2UgUm9vdDAeFw0wNDAyMDkxNTQyNDdaFw0zNDAyMDkxNTQyNDda +MIHgMQswCQYDVQQGEwJFUzEuMCwGCSqGSIb3DQEJARYfYWNfY2FtZXJmaXJtYV9j +Y0BjYW1lcmZpcm1hLmNvbTFDMEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBh +ZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAGA1UEBRMJ +QTgyNzQzMjg3MRkwFwYDVQQKExBBQyBDYW1lcmZpcm1hIFNBMS0wKwYDVQQDEyRB +QyBDYW1lcmZpcm1hIENlcnRpZmljYWRvcyBDYW1lcmFsZXMwggEgMA0GCSqGSIb3 +DQEBAQUAA4IBDQAwggEIAoIBAQCjxnvvj01f36lgGhihRYVf1fAPEXsTJKrY4aLQ +cEUSh5szZE7VTtGiyMTMc2uCmnaXafjYHK8Lgmy6T9xxGEZ5OS4x6rgtuPyy13AP +tu3X3Y2kPVLu7ZMw5HoQC64wBj6YcnxTnBwmVW05DjzRXp6OyBIEKEaAB9vv2qEl +fh/Y234FG6Wd/ut1s0ScRZAo+6CSMNQxaY+ryXKD11uWkzWXJa9UZOasG7z4uPqc +Gr4/Hz2/CTLDTgp0xkMJYuzOztpUvOACrxlkS2utKUwVlAikJnboNwf/en94RbHN +zkKc5t0SAbzCf57ueawbzxSdPa+SAC25FNur64FKkfdq5PPjAgEDo4IB5TCCAeEw +EgYDVR0TAQH/BAgwBgEB/wIBCzA8BgNVHR8ENTAzMDGgL6AthitodHRwOi8vY3Js +LmNoYW1iZXJzaWduLm9yZy9jaGFtYmVyc3Jvb3QuY3JsMB0GA1UdDgQWBBS2H06d +HGiRLjdyYOFGj1qlKjExuTCBqwYDVR0jBIGjMIGggBTjlPWxTenboSlbV4tNdgZ2 +4dGiiqGBhKSBgTB/MQswCQYDVQQGEwJFVTEnMCUGA1UEChMeQUMgQ2FtZXJmaXJt +YSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1iZXJz +aWduLm9yZzEiMCAGA1UEAxMZQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdIIBADAO +BgNVHQ8BAf8EBAMCAYYwKgYDVR0RBCMwIYEfYWNfY2FtZXJmaXJtYV9jY0BjYW1l +cmZpcm1hLmNvbTAnBgNVHRIEIDAegRxjaGFtYmVyc3Jvb3RAY2hhbWJlcnNpZ24u +b3JnMFsGA1UdIARUMFIwUAYLKwYBBAGBhy4KCQEwQTA/BggrBgEFBQcCARYzaHR0 +cDovL2Nwcy5jYW1lcmZpcm1hLmNvbS9jcHMvYWNfY2FtZXJmaXJtYV9jYy5odG1s +MA0GCSqGSIb3DQEBBQUAA4IBAQBl8KoPBYL//EBonqQWS0N+hLfxImP1eQ6nac+v +R5QfF/0w+VCTkShfKwHaa6V/W1dPlVwXSECuvXHkX6DYrtxFGGFB6qxuP1rkIpRs +sTkAlpvOx3REiFjIkhsijKd/ijvqxjbMbuYU+EFACK/jQIRoj+LEEZ+haiqbALZB +Iqq/26HTqX0itDosBj6M94YWcIpbTDefQNWCGsSnZcw2+k+az/wAOZT6xAxlnEim +HpDDlgRsmaLrHpDPDoIRYOih0gbJTnn4mKex9Wgr0sZ+XFl03j+bvcXL1tiuQnwb +9dMRDe/OdXABT35W4ZzLbpost65ZW3Tx+oi/bLbmu6pbKCgs +-----END CERTIFICATE----- diff --git a/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/chains/camerfirma/camerfirmachambersignca-chain.pem b/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/chains/camerfirma/camerfirmachambersignca-chain.pem new file mode 100644 index 0000000000000..2ab3091439cb9 --- /dev/null +++ b/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/chains/camerfirma/camerfirmachambersignca-chain.pem @@ -0,0 +1,62 @@ +Owner: CN=AC Camerfirma - 2009, + L=Madrid (see current address at https://www.camerfirma.com/address), + SERIALNUMBER=A82743287, O=AC Camerfirma S.A., C=ES +Issuer: CN=Global Chambersign Root - 2008, + O=AC Camerfirma S.A., SERIALNUMBER=A82743287, + L=Madrid (see current address at www.camerfirma.com/address), C=EU +Serial number: 2 +Valid from: Mon Mar 16 10:16:25 PDT 2009 until: Sun Mar 11 10:16:25 PDT 2029 +Certificate fingerprints: + SHA1: BA:BA:69:CF:D5:CC:C9:4D:05:6B:5B:E7:80:5F:E2:03:CB:EB:5C:57 + SHA256: B6:8D:5D:9B:4E:A6:35:95:7C:0C:32:15:C2:0D:35:B2:21:7B:69:E3:49:C7:A3:04:C4:F9:7F:20:C4:08:1F:88 +Signature algorithm name: SHA1withRSA (weak) +Subject Public Key Algorithm: 4096-bit RSA key +Version: 3 + +-----BEGIN CERTIFICATE----- +MIIIPzCCBiegAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBrDELMAkGA1UEBhMCRVUx +QzBBBgNVBAcTOk1hZHJpZCAoc2VlIGN1cnJlbnQgYWRkcmVzcyBhdCB3d3cuY2Ft +ZXJmaXJtYS5jb20vYWRkcmVzcykxEjAQBgNVBAUTCUE4Mjc0MzI4NzEbMBkGA1UE +ChMSQUMgQ2FtZXJmaXJtYSBTLkEuMScwJQYDVQQDEx5HbG9iYWwgQ2hhbWJlcnNp +Z24gUm9vdCAtIDIwMDgwHhcNMDkwMzE2MTcxNjI1WhcNMjkwMzExMTcxNjI1WjCB +qjELMAkGA1UEBhMCRVMxGzAZBgNVBAoTEkFDIENhbWVyZmlybWEgUy5BLjESMBAG +A1UEBRMJQTgyNzQzMjg3MUswSQYDVQQHE0JNYWRyaWQgKHNlZSBjdXJyZW50IGFk +ZHJlc3MgYXQgaHR0cHM6Ly93d3cuY2FtZXJmaXJtYS5jb20vYWRkcmVzcykxHTAb +BgNVBAMTFEFDIENhbWVyZmlybWEgLSAyMDA5MIICIjANBgkqhkiG9w0BAQEFAAOC +Ag8AMIICCgKCAgEAmbHxFEYTJmMdPcYiPlWUGZu2+tQo4voohYi3dwCwoVuGdHSp +kyoqs1B3YGx4u5KT4n0A7+Bb8YQ/QzbNy7UQ4JXAK+rT8JpNeKIvfN4lHnQJaChE +4fdn0KpvHWymaNq2k+EbQClquZB6OsTLvsivwSuSnyLcUw5rbajj53wq77fwB12y +phMjwz2AnD1BvHZd3vLOaH1jRQP3zzNmyjT/Oj6+jdux7SBKlJWgQEaKflwcvYyc +DPFPhGM4KPwEGX61PCrS+l8Lw0Kdy6K4lE+GrfgJrXM5m1Ey1R0c9McYQQPAtYcm +cOnHHgkJdEAFVDa76T9C+lcMP6DNckbJIyc/ENrmM2v4rq/JnsJKEEx0VLyLizQx +cGU3gp4ckg0ImQ9hV3H/DLWEqfrPuD++zaV81gpstnc9+pLg0Jibvwg3qvIr7nS5 +acc//qqxH0iJGYoStHW5J5HoM9HcBvhACq5rjzjrNLPYSJqbPJwBHKcql/uUjQ6S +SVWe3/CeJp6/vGuY1aRXAk9c/8oO0ZDrLKE8LsUgZesTLnWGd1LQcyQf6UMG1nb9 +5C3eZRkCVpKma6Hl/SUQNukerlbLOU9InFGNPdeEVq1Jo62XeEi8KMbTPdXou6Yl +rpe99dFnOUjVOdY7gfBGSgIVJjORqf/V70jwsxcYz7j6PKl0XulJs06vpSECAwEA +AaOCAmowggJmMBIGA1UdEwEB/wQIMAYBAf8CAQIwHQYDVR0OBBYEFMgAD/zGUvyf +2ztkLjK5bi5x82V5MIHhBgNVHSMEgdkwgdaAFLkJypwe29NsOmuu7VTxW5MGNS5e +oYGypIGvMIGsMQswCQYDVQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUgY3Vy +cmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAG +A1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xJzAl +BgNVBAMTHkdsb2JhbCBDaGFtYmVyc2lnbiBSb290IC0gMjAwOIIJAMnN0+nVfSPO +MH0GCCsGAQUFBwEBBHEwbzBFBggrBgEFBQcwAoY5aHR0cDovL3d3dy5jYW1lcmZp +cm1hLmNvbS9jZXJ0cy9yb290X2NoYW1iZXJzaWduLTIwMDguY3J0MCYGCCsGAQUF +BzABhhpodHRwOi8vb2NzcC5jYW1lcmZpcm1hLmNvbTAOBgNVHQ8BAf8EBAMCAQYw +PgYDVR0gBDcwNTAzBgRVHSAAMCswKQYIKwYBBQUHAgEWHWh0dHBzOi8vcG9saWN5 +LmNhbWVyZmlybWEuY29tMH4GA1UdHwR3MHUwOKA2oDSGMmh0dHA6Ly9jcmwuY2Ft +ZXJmaXJtYS5jb20vY2hhbWJlcnNpZ25yb290LTIwMDguY3JsMDmgN6A1hjNodHRw +Oi8vY3JsMS5jYW1lcmZpcm1hLmNvbS9jaGFtYmVyc2lnbnJvb3QtMjAwOC5jcmww +DQYJKoZIhvcNAQEFBQADggIBABNYG4jBwoI7e8pCuUyDc6rwpE9H6AgrUdL7O1xK +TgTjDGBrMOBK+ZPS4Si8J3yZngvSrL694a1HmiiblJ+CmCdNGli2nBBM+OPK3tQB +4TW6hgkIe3vSNg/9o9y6+MAJcm8Kn0nPCBkSRME87NwvpehtekuF1G2ng1KDVwAn +F+eCXfNanEwY++vWbJAuPE69Z/0+rCgNyH1PzihiNu6vrUlSlLWKaG34O1DEttX+ +SsWTpEbpH9w5y9Vmw6WQ/B5nfhPM551HaMbiGgSxT9jHmf8APYQ3iT8EktcdTAdw +m1miiyxfKG+WjPT7P/x8Np1spJZw+sNIDTLdZ0T1XQ6obVkBTFUDSULKW8949HDu +VSwdl9Hu9lkDzzh9tyVYwwjEWVFZOiD/4TPVLfphf4ZEiyHt5YpNd9kZJIGGDxdc +CdtzPm2dQODFpv72LnPQHbuBQPJ71zkoAmyeM/1Qj0DlrFsPcYnbRasck1VmYgDc +Xc0+is0wcgCd7Gpx1zpEeVqwMD96am2xZPzd6nsbXvo+6TzsKLRMJo6nOERwrzuI +F+/eq3WXxYMt2UenJsHqwSgPJRMdl3SFz0+SZN0viHeLuwb7qaHN74qC6GP8yHGp +2xe6Z11mJDPLDSrQQ2dOceSJ1LurJgLP7amYmFlWwVnmM7LnfShhMWMV+MDrICnL +2ksL +-----END CERTIFICATE----- diff --git a/test/jdk/sun/security/tools/jarsigner/CertChainUnclosed.java b/test/jdk/sun/security/tools/jarsigner/CertChainUnclosed.java index 7ec4d88d73a0f..d658dd9504c55 100644 --- a/test/jdk/sun/security/tools/jarsigner/CertChainUnclosed.java +++ b/test/jdk/sun/security/tools/jarsigner/CertChainUnclosed.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, 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,15 +32,12 @@ import java.nio.file.Files; import java.nio.file.Paths; -import java.security.AccessController; -import java.security.PrivilegedAction; import java.util.Locale; public class CertChainUnclosed { public static void main(String[] args) throws Exception { - String os = AccessController.doPrivileged( - (PrivilegedAction)() -> System.getProperty("os.name")); + String os = System.getProperty("os.name"); if (!os.toUpperCase(Locale.US).contains("WINDOWS")) { System.out.println("Not Windows. Skip test."); return; diff --git a/test/jdk/sun/security/tools/jarsigner/CheckSignerCertChain.java b/test/jdk/sun/security/tools/jarsigner/CheckSignerCertChain.java index da409612efee7..eb3b9395b9167 100644 --- a/test/jdk/sun/security/tools/jarsigner/CheckSignerCertChain.java +++ b/test/jdk/sun/security/tools/jarsigner/CheckSignerCertChain.java @@ -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 @@ -81,10 +81,10 @@ public static void main(String[] args) throws Exception { "-sigalg SHA256withRSA " + "-verbose" + " a.jar e1") - .shouldContain("Signature algorithm: SHA1withRSA (disabled), 2048-bit key") + .shouldContain("Signature algorithm: SHA1withRSA (disabled), 2048-bit RSA key") // For trusted cert, warning should be generated for its weak 1024-bit // key, but not for its SHA1withRSA algorithm. - .shouldContain("Signature algorithm: SHA1withRSA, 1024-bit key (weak)") + .shouldContain("Signature algorithm: SHA1withRSA, 1024-bit RSA key (weak)") .shouldHaveExitValue(0); kt("-exportcert -alias ca -rfc -file cacert", "ks"); @@ -92,10 +92,10 @@ public static void main(String[] args) throws Exception { SecurityTools.jarsigner("-verify -certs signeda.jar " + "-keystore caks -storepass changeit -verbose -debug") - .shouldContain("Signature algorithm: SHA1withRSA (disabled), 2048-bit key") + .shouldContain("Signature algorithm: SHA1withRSA (disabled), 2048-bit RSA key") // For trusted cert, warning should be generated for its weak 1024-bit // key, but not for its SHA1withRSA algorithm. - .shouldContain("Signature algorithm: SHA1withRSA, 1024-bit key (weak)") + .shouldContain("Signature algorithm: SHA1withRSA, 1024-bit RSA key (weak)") .shouldHaveExitValue(0); /* @@ -118,8 +118,8 @@ public static void main(String[] args) throws Exception { "-J-Djava.security.properties=" + JAVA_SECURITY_FILE + " a.jar ee") - .shouldNotContain("Signature algorithm: MD5withRSA (disabled), 2048-bit key") - .shouldContain("Signature algorithm: SHA384withRSA, 2048-bit key") + .shouldNotContain("Signature algorithm: MD5withRSA (disabled), 2048-bit RSA key") + .shouldContain("Signature algorithm: SHA384withRSA, 2048-bit RSA key") .shouldNotContain("Invalid certificate chain: Algorithm constraints check failed on signature algorithm: MD5withRSA") .shouldHaveExitValue(0); @@ -134,8 +134,8 @@ public static void main(String[] args) throws Exception { "-J-Djava.security.properties=" + JAVA_SECURITY_FILE + " a.jar ee") - .shouldContain("Signature algorithm: MD5withRSA (disabled), 2048-bit key") - .shouldContain("Signature algorithm: SHA384withRSA, 2048-bit key") + .shouldContain("Signature algorithm: MD5withRSA (disabled), 2048-bit RSA key") + .shouldContain("Signature algorithm: SHA384withRSA, 2048-bit RSA key") .shouldContain("Invalid certificate chain: Algorithm constraints check failed on disabled algorithm: MD5 used with certificate: CN=EE") .shouldHaveExitValue(0); @@ -144,8 +144,8 @@ public static void main(String[] args) throws Exception { SecurityTools.jarsigner("-verify -certs signeda.jar " + "-keystore caks1 -storepass changeit -verbose -debug") - .shouldContain("Signature algorithm: MD5withRSA (disabled), 2048-bit key") - .shouldContain("Signature algorithm: SHA384withRSA, 2048-bit key") + .shouldContain("Signature algorithm: MD5withRSA (disabled), 2048-bit RSA key") + .shouldContain("Signature algorithm: SHA384withRSA, 2048-bit RSA key") .shouldContain("Invalid certificate chain: Algorithm constraints check failed on disabled algorithm: MD5 used with certificate: CN=EE") .shouldHaveExitValue(0); } diff --git a/test/jdk/sun/security/tools/jarsigner/ConciseJarsigner.java b/test/jdk/sun/security/tools/jarsigner/ConciseJarsigner.java index 69b45ea22930d..e81a25712a6b2 100644 --- a/test/jdk/sun/security/tools/jarsigner/ConciseJarsigner.java +++ b/test/jdk/sun/security/tools/jarsigner/ConciseJarsigner.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2021, 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 @@ -43,8 +43,15 @@ public class ConciseJarsigner { static OutputAnalyzer kt(String cmd) throws Exception { // Choose 2048-bit RSA to make sure it runs fine and fast. In // fact, every keyalg/keysize combination is OK for this test. - return SecurityTools.keytool("-storepass changeit -keypass changeit " - + "-keystore ks -keyalg rsa -keysize 2048 " + cmd); + // The start date is set to -1M to prevent the certificate not yet valid during fast enough execution. + // If -startdate is specified in cmd, cmd version will be used. + if (cmd.contains("-startdate")) { + return SecurityTools.keytool("-storepass changeit -keypass changeit " + + "-keystore ks -keyalg rsa -keysize 2048 " + cmd); + } else { + return SecurityTools.keytool("-storepass changeit -keypass changeit " + + "-keystore ks -keyalg rsa -keysize 2048 -startdate -1M " + cmd); + } } static void gencert(String owner, String cmd) throws Exception { diff --git a/test/jdk/sun/security/tools/jarsigner/DisableCurveTest.java b/test/jdk/sun/security/tools/jarsigner/DisableCurveTest.java index 353f82ad4b239..ee83c95333cc5 100644 --- a/test/jdk/sun/security/tools/jarsigner/DisableCurveTest.java +++ b/test/jdk/sun/security/tools/jarsigner/DisableCurveTest.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 @@ -60,7 +60,7 @@ public static void main(String[] args) throws Exception{ .shouldContain(">>> Signer") .shouldContain("Signature algorithm: SHA384withECDSA, 256-bit EC (secp256r1) key (disabled)") .shouldContain("Warning:") - .shouldContain("The EC (secp256r1) signing key has a keysize of 256 which is considered a security risk and is disabled") + .shouldContain("The 256-bit EC (secp256r1) signing key is considered a security risk and is disabled") .shouldHaveExitValue(0); SecurityTools.jarsigner("-verify signeda.jar " + @@ -84,7 +84,7 @@ public static void main(String[] args) throws Exception{ .shouldContain(">>> Signer") .shouldContain("Signature algorithm: SHA384withECDSA, 256-bit EC (secp256r1) key (weak)") .shouldContain("Warning:") - .shouldContain("The EC (secp256r1) signing key has a keysize of 256 which is considered a security risk. This key size will be disabled in a future update") + .shouldContain("The 256-bit EC (secp256r1) signing key is considered a security risk. It will be disabled in a future update") .shouldHaveExitValue(0); SecurityTools.jarsigner("-verify signeda.jar " + @@ -94,7 +94,7 @@ public static void main(String[] args) throws Exception{ .shouldContain("- Signed by") .shouldContain("Signature algorithm: SHA384withECDSA, 256-bit EC (secp256r1) key (weak)") .shouldContain("jar verified") - .shouldContain("The EC (secp256r1) signing key has a keysize of 256 which is considered a security risk. This key size will be disabled in a future update") + .shouldContain("The 256-bit EC (secp256r1) signing key is considered a security risk. It will be disabled in a future update") .shouldHaveExitValue(0); } } diff --git a/test/jdk/sun/security/tools/jarsigner/TimestampCheck.java b/test/jdk/sun/security/tools/jarsigner/TimestampCheck.java index c4cf1ef6a985d..bddc8c0e5fb5e 100644 --- a/test/jdk/sun/security/tools/jarsigner/TimestampCheck.java +++ b/test/jdk/sun/security/tools/jarsigner/TimestampCheck.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 @@ -448,8 +448,8 @@ public static void main(String[] args) throws Throwable { .shouldNotContain("The SHA-256 algorithm specified " + "for the -tsadigestalg option is considered a " + "security risk") - .shouldContain("The RSA signing key has a keysize " + - "of 1024 which is considered a security risk") + .shouldContain("The 1024-bit RSA signing key " + + "is considered a security risk") .shouldHaveExitValue(0); checkMultipleWeak("sign2.jar"); diff --git a/test/jdk/sun/security/tools/jarsigner/compatibility/Compatibility.java b/test/jdk/sun/security/tools/jarsigner/compatibility/Compatibility.java index 9b84f548c703d..3be1e74d97269 100644 --- a/test/jdk/sun/security/tools/jarsigner/compatibility/Compatibility.java +++ b/test/jdk/sun/security/tools/jarsigner/compatibility/Compatibility.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 @@ -718,7 +718,8 @@ private static void verifying(SignItem signItem, VerifyItem verifyItem) String match = "^ (" + " Signature algorithm: " + signItem.certInfo. expectedSigalg(signItem) + ", " + signItem.certInfo. - expectedKeySize() + "-bit key" + expectedKeySize() + "-bit " + signItem.certInfo. + expectedKeyAlgorithm() + " key" + ")|(" + " Digest algorithm: " + signItem.expectedDigestAlg() + (isWeakAlg(signItem.expectedDigestAlg()) ? " \\(weak\\)" : "") @@ -1224,6 +1225,12 @@ private String expectedSigalg(SignItem signer) { } } + private String expectedKeyAlgorithm() { + return keyAlgorithm.equals("EC") + ? ("EC .secp" + expectedKeySize() + "r1.") + : keyAlgorithm; + } + private int expectedKeySize() { if (keySize != 0) return keySize; diff --git a/test/jdk/sun/security/tools/jarsigner/warnings/Test.java b/test/jdk/sun/security/tools/jarsigner/warnings/Test.java index 71d4ee144b99b..0683c03c10ce7 100644 --- a/test/jdk/sun/security/tools/jarsigner/warnings/Test.java +++ b/test/jdk/sun/security/tools/jarsigner/warnings/Test.java @@ -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 @@ -149,7 +149,7 @@ public abstract class Test { + "This algorithm will be disabled in a future update."; static final String WEAK_KEY_WARNING - = "This key size will be disabled in a future update."; + = "It will be disabled in a future update."; static final String JAR_SIGNED = "jar signed."; diff --git a/test/jdk/sun/security/tools/keytool/GenKeyPairSigner.java b/test/jdk/sun/security/tools/keytool/GenKeyPairSigner.java index 84cfcd7cb17de..113ff2859d549 100644 --- a/test/jdk/sun/security/tools/keytool/GenKeyPairSigner.java +++ b/test/jdk/sun/security/tools/keytool/GenKeyPairSigner.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 @@ -77,14 +77,14 @@ static void testSignerPKCS12() throws Exception { SecurityTools.keytool("-keystore ks -storepass changeit " + "-genkeypair -keyalg EdDSA -alias ca -dname CN=CA -ext bc:c " + "-ext 2.5.29.14=04:14:00:01:02:03:04:05:06:07:08:09:10:11:12:13:14:15:16:17:18:19") - .shouldContain("Generating 255 bit Ed25519 key pair and self-signed certificate (Ed25519) with a validity of 90 days") + .shouldContain("Generating Ed25519 key pair and self-signed certificate (Ed25519) with a validity of 90 days") .shouldContain("for: CN=CA") .shouldHaveExitValue(0); System.out.println("Generating an XDH cert with -signer option"); SecurityTools.keytool("-keystore ks -storepass changeit " + "-genkeypair -keyalg XDH -alias e1 -dname CN=E1 -signer ca") - .shouldContain("Generating 255 bit X25519 key pair and a certificate (Ed25519) issued by with a validity of 90 days") + .shouldContain("Generating X25519 key pair and a certificate (Ed25519) issued by with a validity of 90 days") .shouldContain("for: CN=E1") .shouldHaveExitValue(0); @@ -118,7 +118,7 @@ static void testSignerPKCS12() throws Exception { .shouldContain("Alias name: e1") .shouldContain("Certificate chain length: 2") .shouldContain("Signature algorithm name: Ed25519") - .shouldContain("Subject Public Key Algorithm: 255-bit X25519 key") + .shouldContain("Subject Public Key Algorithm: X25519 key") .shouldHaveExitValue(0); // check to make sure that cert's AKID is created from the SKID of the signing cert @@ -150,7 +150,7 @@ static void testSignerPKCS12() throws Exception { System.out.println("Generating an X448 cert with -signer option"); SecurityTools.keytool("-keystore ks -storepass changeit " + "-genkeypair -keyalg X448 -alias e2 -dname CN=E2 -sigalg SHA384withRSA -signer ca2") - .shouldContain("Generating 448 bit X448 key pair and a certificate (SHA384withRSA) issued by with a validity of 90 days") + .shouldContain("Generating X448 key pair and a certificate (SHA384withRSA) issued by with a validity of 90 days") .shouldContain("for: CN=E2") .shouldHaveExitValue(0); @@ -177,7 +177,7 @@ static void testSignerPKCS12() throws Exception { "-list -v") .shouldContain("Alias name: e2") .shouldContain("Signature algorithm name: SHA384withRSA") - .shouldContain("Subject Public Key Algorithm: 448-bit X448 key") + .shouldContain("Subject Public Key Algorithm: X448 key") .shouldHaveExitValue(0); kt("-genkeypair -keyalg DSA -alias ca3 -dname CN=CA3 -ext bc:c ", @@ -186,7 +186,7 @@ static void testSignerPKCS12() throws Exception { System.out.println("Generating a DH cert with -signer option"); SecurityTools.keytool("-keystore ks -storepass changeit " + "-genkeypair -keyalg DH -alias e3 -dname CN=E3 -signer ca3") - .shouldContain("Generating 3,072 bit DH key pair and a certificate (SHA256withDSA) issued by with a validity of 90 days") + .shouldContain("Generating 3072-bit DH key pair and a certificate (SHA256withDSA) issued by with a validity of 90 days") .shouldContain("for: CN=E3") .shouldHaveExitValue(0); @@ -239,7 +239,7 @@ static void testSignerJKS() throws Exception { SecurityTools.keytool("-keystore ksjks -storepass changeit -storetype jks " + "-genkeypair -keyalg DSA -keysize 1024 -alias ca1 -dname CN=CA1 " + "-keypass ca1keypass -signer ca -signerkeypass cakeypass") - .shouldContain("Generating 1,024 bit DSA key pair and a certificate (SHA384withRSA) issued by with a validity of 90 days") + .shouldContain("Generating 1024-bit DSA key pair and a certificate (SHA384withRSA) issued by with a validity of 90 days") .shouldContain("for: CN=CA1") .shouldContain("The generated certificate #1 of 2 uses a 1024-bit DSA key which is considered a security risk") .shouldContain("The generated certificate #2 of 2 uses a 1024-bit RSA key which is considered a security risk") @@ -249,7 +249,7 @@ static void testSignerJKS() throws Exception { SecurityTools.keytool("-keystore ksjks -storepass changeit -storetype jks " + "-genkeypair -keyalg XDH -alias e1 -dname CN=E1 " + "-keypass e1keypass -signer ca1 -signerkeypass ca1keypass") - .shouldContain("Generating 255 bit X25519 key pair and a certificate (SHA256withDSA) issued by with a validity of 90 days") + .shouldContain("Generating X25519 key pair and a certificate (SHA256withDSA) issued by with a validity of 90 days") .shouldContain("for: CN=E1") .shouldContain("The generated certificate #2 of 3 uses a 1024-bit DSA key which is considered a security risk") .shouldContain("The generated certificate #3 of 3 uses a 1024-bit RSA key which is considered a security risk") @@ -285,7 +285,7 @@ static void testSignerJKS() throws Exception { .shouldContain("Alias name: e1") .shouldContain("Certificate chain length: 3") .shouldContain("Signature algorithm name: SHA256withDSA") - .shouldContain("Subject Public Key Algorithm: 255-bit X25519 key") + .shouldContain("Subject Public Key Algorithm: X25519 key") .shouldHaveExitValue(0); } diff --git a/test/jdk/sun/security/tools/keytool/KeyAlg.java b/test/jdk/sun/security/tools/keytool/KeyAlg.java index ed5061949bf64..2fcf2dfb70e1f 100644 --- a/test/jdk/sun/security/tools/keytool/KeyAlg.java +++ b/test/jdk/sun/security/tools/keytool/KeyAlg.java @@ -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 @@ -42,9 +42,9 @@ public static void main(String[] args) throws Exception { .shouldMatch("Signature algorithm name:.*SHA1withECDSA") .shouldMatch("Subject Public Key Algorithm:.*1024.*RSA"); keytool("-genkeypair -alias g -dname CN=g -keyalg EC -keysize 256") - .shouldContain("Generating 256 bit EC (secp256r1) key pair"); + .shouldContain("Generating 256-bit EC (secp256r1) key pair"); keytool("-genkeypair -alias f -dname CN=f -keyalg EC") - .shouldContain("Generating 384 bit EC (secp384r1) key pair"); + .shouldContain("Generating 384-bit EC (secp384r1) key pair"); } static OutputAnalyzer keytool(String s) throws Exception { diff --git a/test/jdk/sun/security/x509/AVA/AVAEqualsHashCode.java b/test/jdk/sun/security/x509/AVA/AVAEqualsHashCode.java index 20beb8db63922..60fe9775c82dd 100644 --- a/test/jdk/sun/security/x509/AVA/AVAEqualsHashCode.java +++ b/test/jdk/sun/security/x509/AVA/AVAEqualsHashCode.java @@ -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 @@ -49,9 +49,7 @@ public static void main(String[] args) throws Exception { byte[] ba = deros.toByteArray(); DerValue dv = new DerValue(ba); - GetAVAConstructor a = new GetAVAConstructor(); - java.security.AccessController.doPrivileged(a); - Constructor c = a.getCons(); + Constructor c = getAVAConstructor(); Object[] objs = new Object[2]; objs[0] = oid; @@ -72,16 +70,10 @@ public static void main(String[] args) throws Exception { else throw new Exception("FAILED equals()/hashCode() contract"); } -} - -class GetAVAConstructor implements java.security.PrivilegedExceptionAction { - private Class avaClass = null; - private Constructor avaCons = null; - - public Object run() throws Exception { + static Constructor getAVAConstructor() throws Exception { try { - avaClass = Class.forName("sun.security.x509.AVA"); + Class avaClass = Class.forName("sun.security.x509.AVA"); Constructor[] cons = avaClass.getDeclaredConstructors(); int i; @@ -90,22 +82,16 @@ public Object run() throws Exception { if (parms.length == 2) { if (parms[0].getName().equalsIgnoreCase("sun.security.util.ObjectIdentifier") && parms[1].getName().equalsIgnoreCase("sun.security.util.DerValue")) { - avaCons = cons[i]; + Constructor avaCons = cons[i]; avaCons.setAccessible(true); - break; + return avaCons; } } } - + return null; } catch (Exception e) { System.out.println("Caught unexpected exception " + e); throw e; } - return avaCons; } - - public Constructor getCons(){ - return avaCons; - } - } diff --git a/test/jdk/sun/security/x509/DNSName/LeadingPeriod.java b/test/jdk/sun/security/x509/DNSName/LeadingPeriod.java index a293e5360a9cf..2fa5eb6b8b525 100644 --- a/test/jdk/sun/security/x509/DNSName/LeadingPeriod.java +++ b/test/jdk/sun/security/x509/DNSName/LeadingPeriod.java @@ -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 @@ -26,8 +26,7 @@ * @bug 8311546 * @summary Adopt de-facto standards on x509 Name Constraints with leading dot. Certs * can be generated by running generate-certs.sh - * @library /test/lib - * @modules java.base/sun.security.x509 + * @run main LeadingPeriod */ import java.io.*; @@ -38,75 +37,33 @@ public class LeadingPeriod { - private static CertPath makeCertPath(String targetCertStr, - PKIXParameters params) throws CertificateException { - // generate certificate from cert strings - CertificateFactory cf = CertificateFactory.getInstance("X.509"); - - ByteArrayInputStream is; - - is = new ByteArrayInputStream(targetCertStr.getBytes()); - Certificate targetCert = cf.generateCertificate(is); - // set validity date so that validation won't fail when cert expires - params.setDate(((X509Certificate)targetCert).getNotBefore()); - - // generate certification path - List list = List.of(targetCert); - - return cf.generateCertPath(list); + public static void main(String[] args) throws Exception { + String certs = System.getProperty("test.src", "./") + "/certs/"; + validate(certs + "withoutLeadingPeriod"); + validate(certs + "withLeadingPeriod"); } - private static PKIXParameters genParams(String caStr) throws Exception { - // generate certificate from cert string - CertificateFactory cf = CertificateFactory.getInstance("X.509"); - - ByteArrayInputStream is = new ByteArrayInputStream(caStr.getBytes()); - Certificate selfSignedCert = cf.generateCertificate(is); + public static void validate(String certPath) throws Exception { + byte[] targetCertBytes = Files.readAllBytes(Paths.get(certPath + "/leaf.pem")); + byte[] caCertBytes = Files.readAllBytes(Paths.get(certPath + "/ca.pem")); - // generate a trust anchor - TrustAnchor anchor = new TrustAnchor((X509Certificate) selfSignedCert, null); + CertificateFactory cf = CertificateFactory.getInstance("X.509"); + Certificate caCert = cf.generateCertificate(new ByteArrayInputStream(caCertBytes)); + Certificate targetCert = cf.generateCertificate(new ByteArrayInputStream(targetCertBytes)); - Set anchors = Collections.singleton(anchor); + TrustAnchor anchor = new TrustAnchor((X509Certificate) caCert, null); - PKIXParameters params = new PKIXParameters(anchors); + PKIXParameters params = new PKIXParameters(Collections.singleton(anchor)); - // disable certificate revocation checking + // Disable certificate revocation checking params.setRevocationEnabled(false); - return params; - } + // Set validity date, so that validation won't fail when cert expires + params.setDate(((X509Certificate)targetCert).getNotBefore()); - public static void main(String[] args) throws Exception { + CertPath path = cf.generateCertPath(List.of(targetCert, caCert)); CertPathValidator validator = CertPathValidator.getInstance("PKIX"); - - // Load certs with a NameConstraint where DNS value does not begin with a period - Path targetFromCAWithoutPeriodPath = Paths.get(System.getProperty( - "test.src", "./") + "/certs/withoutLeadingPeriod/leaf.pem"); - String targetFromCAWithoutPeriod = Files.readString(targetFromCAWithoutPeriodPath); - - Path caWithoutLeadingPeriodPath = Paths.get(System.getProperty( - "test.src", "./") + "/certs/withoutLeadingPeriod/ca.pem"); - String caWithoutLeadingPeriod = Files.readString(caWithoutLeadingPeriodPath); - - PKIXParameters paramsForCAWithoutLeadingPeriod = genParams(caWithoutLeadingPeriod); - CertPath pathWithoutLeadingPeriod = makeCertPath( - targetFromCAWithoutPeriod, paramsForCAWithoutLeadingPeriod); - - validator.validate(pathWithoutLeadingPeriod, paramsForCAWithoutLeadingPeriod); - - // Load certificates with a NameConstraint where the DNS value does begin with a period - Path targetFromCAWithPeriodPath = Paths.get(System.getProperty( - "test.src", "./") + "/certs/withLeadingPeriod/leaf.pem"); - String targetFromCAWithPeriod = Files.readString(targetFromCAWithPeriodPath); - - Path caWithLeadingPeriodPath = Paths.get(System.getProperty( - "test.src", "./") + "/certs/withLeadingPeriod/ca.pem"); - String caWithLeadingPeriod = Files.readString(caWithLeadingPeriodPath); - - PKIXParameters paramsForCAWithLeadingPeriod = genParams(caWithLeadingPeriod); - CertPath pathWithLeadingPeriod = makeCertPath(targetFromCAWithPeriod, paramsForCAWithLeadingPeriod); - - validator.validate(pathWithLeadingPeriod, paramsForCAWithLeadingPeriod); + validator.validate(path, params); } } diff --git a/test/jdk/sun/security/x509/X509CertImpl/V3Certificate.java b/test/jdk/sun/security/x509/X509CertImpl/V3Certificate.java index 2d3dbfd659c91..29c651164d3fc 100644 --- a/test/jdk/sun/security/x509/X509CertImpl/V3Certificate.java +++ b/test/jdk/sun/security/x509/X509CertImpl/V3Certificate.java @@ -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 @@ -23,7 +23,7 @@ /* * @test - * @bug 8049237 8242151 + * @bug 8049237 8242151 8347841 * @modules java.base/sun.security.x509 * java.base/sun.security.util * jdk.crypto.ec @@ -114,7 +114,7 @@ public static boolean test(String algorithm, String sigAlg, int keyLength) // Validity interval Date firstDate = new Date(); - Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("PST")); + Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("America/Los_Angeles")); cal.set(2014, 03, 10, 12, 30, 30); Date lastDate = cal.getTime(); CertificateValidity interval = new CertificateValidity(firstDate, 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/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/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/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/RuntimeImageSymbolicLinksTest.java b/test/jdk/tools/jpackage/share/RuntimeImageSymbolicLinksTest.java index 867ea57121303..75ad34807fdc0 100644 --- a/test/jdk/tools/jpackage/share/RuntimeImageSymbolicLinksTest.java +++ b/test/jdk/tools/jpackage/share/RuntimeImageSymbolicLinksTest.java @@ -52,7 +52,6 @@ public class RuntimeImageSymbolicLinksTest { @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()); @@ -62,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/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/jdk/javadoc/doclet/testModuleSpecificStylesheet/TestModuleSpecificStylesheet.java b/test/langtools/jdk/javadoc/doclet/testModuleSpecificStylesheet/TestModuleSpecificStylesheet.java index 48b4750573b26..68deacb0e4756 100644 --- a/test/langtools/jdk/javadoc/doclet/testModuleSpecificStylesheet/TestModuleSpecificStylesheet.java +++ b/test/langtools/jdk/javadoc/doclet/testModuleSpecificStylesheet/TestModuleSpecificStylesheet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, 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 @@ -23,7 +23,7 @@ /* * @test - * @bug 8219313 + * @bug 8219313 8347058 * @summary Support module specific stylesheets * @library /tools/lib ../../lib * @modules jdk.compiler/com.sun.tools.javac.api @@ -82,22 +82,22 @@ public void test(Path base) throws Exception { checkOutput("ma/module-summary.html", true, """ - """); + """); checkOutput("ma/pa/package-summary.html", true, """ - """); + """); checkOutput("ma/pa/A.html", true, """ - """); + """); checkOutput("ma/pa/pb/B.html", true, """ - """); + """); checkOutput("ma/pa/pb/package-summary.html", true, """ - """); + """); } } diff --git a/test/langtools/jdk/javadoc/doclet/testOptions/TestOptions.java b/test/langtools/jdk/javadoc/doclet/testOptions/TestOptions.java index 898a498ddeeae..e04135382114b 100644 --- a/test/langtools/jdk/javadoc/doclet/testOptions/TestOptions.java +++ b/test/langtools/jdk/javadoc/doclet/testOptions/TestOptions.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 @@ -24,7 +24,7 @@ /* * @test * @bug 4749567 8071982 8175200 8186332 8185371 8182765 8217034 8261976 8261976 - * 8275786 + * 8275786 8347058 * @summary Test the output for -header, -footer, -nooverview, -nodeprecatedlist, * -nonavbar, -notree, -stylesheetfile, --main-stylesheet, --add-stylesheet, * --add-script options. @@ -118,7 +118,7 @@ public void testStylesheetFile() { checkOutput("resource-files/custom-stylesheet.css", true, "Custom javadoc style sheet"); checkOutput("pkg/Foo.html", true, """ - """); + """); } @Test @@ -131,7 +131,7 @@ public void testStylesheetFileAltOption() { checkOutput("resource-files/custom-stylesheet.css", true, "Custom javadoc style sheet"); checkOutput("pkg/Foo.html", true, """ - """); + """); } @Test @@ -149,9 +149,9 @@ public void testAdditionalStylesheetFile() { checkOutput("resource-files/additional-stylesheet-3.css", true, "Additional javadoc style sheet 3"); checkOutput("pkg/Foo.html", true, """ - - - """); + + + """); } @Test diff --git a/test/langtools/jdk/javadoc/doclet/testPackageSpecificStylesheet/TestPackageSpecificStylesheet.java b/test/langtools/jdk/javadoc/doclet/testPackageSpecificStylesheet/TestPackageSpecificStylesheet.java index 9c6ddc5616d4a..284b79577591e 100644 --- a/test/langtools/jdk/javadoc/doclet/testPackageSpecificStylesheet/TestPackageSpecificStylesheet.java +++ b/test/langtools/jdk/javadoc/doclet/testPackageSpecificStylesheet/TestPackageSpecificStylesheet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, 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 @@ -23,7 +23,7 @@ /* * @test - * @bug 8213354 + * @bug 8213354 8347058 * @summary Support package-specific stylesheets * @library /tools/lib ../../lib * @modules jdk.javadoc/jdk.javadoc.internal.tool @@ -82,15 +82,15 @@ public void test(Path base) throws Exception { checkOutput("pkg/A.html", true, """ - """); + """); checkOutput("pkg/package-summary.html", true, """ - """); + """); checkOutput("pkg2/B.html", false, """ - """); + """); } } diff --git a/test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.java b/test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.java index 292d82459829f..ba3f64cd8b29e 100644 --- a/test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.java +++ b/test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.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 @@ -26,7 +26,7 @@ * @bug 8141492 8071982 8141636 8147890 8166175 8168965 8176794 8175218 8147881 * 8181622 8182263 8074407 8187521 8198522 8182765 8199278 8196201 8196202 * 8184205 8214468 8222548 8223378 8234746 8241219 8254627 8247994 8263528 - * 8266808 8248863 8305710 8318082 + * 8266808 8248863 8305710 8318082 8347058 * @summary Test the search feature of javadoc. * @library ../../lib * @modules jdk.javadoc/jdk.javadoc.internal.tool @@ -418,7 +418,7 @@ void checkSearchOutput(String fileName, boolean expectedOutput) { // Test for search related markup checkOutput(fileName, expectedOutput, """ - + """, """ diff --git a/test/langtools/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java b/test/langtools/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java index 06663d2f4181d..a3dce5448f0f8 100644 --- a/test/langtools/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java +++ b/test/langtools/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java @@ -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 @@ -25,7 +25,7 @@ * @test * @bug 4494033 7028815 7052425 8007338 8023608 8008164 8016549 8072461 8154261 8162363 8160196 8151743 8177417 * 8175218 8176452 8181215 8182263 8183511 8169819 8183037 8185369 8182765 8196201 8184205 8223378 8241544 - * 8253117 8263528 8289334 8292594 + * 8253117 8263528 8289334 8292594 8347058 * @summary Run tests on doclet stylesheet. * @library /tools/lib ../../lib * @modules jdk.javadoc/jdk.javadoc.internal.tool @@ -186,7 +186,7 @@ public void test(Path base) { // Test whether a link to the stylesheet file is inserted properly // in the class documentation. """ - """, + """, """
Test comment for a class which has an anchor_with_name and an anchor_with_id.
"""); @@ -200,7 +200,7 @@ public void test(Path base) { checkOutput("index.html", true, """ - """); + """); checkOutput("resource-files/stylesheet.css", false, """ 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/annotations/typeAnnotations/TypeAnnotationsInConstantInit.java b/test/langtools/tools/javac/annotations/typeAnnotations/TypeAnnotationsInConstantInit.java new file mode 100644 index 0000000000000..b7b91119bc9da --- /dev/null +++ b/test/langtools/tools/javac/annotations/typeAnnotations/TypeAnnotationsInConstantInit.java @@ -0,0 +1,81 @@ +/* + * 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 8346751 + * @summary Verify type annotations inside constant expression field initializers + are handled correctly + * @library /tools/lib + * @modules + * jdk.compiler/com.sun.tools.javac.api + * jdk.compiler/com.sun.tools.javac.main + * jdk.compiler/com.sun.tools.javac.code + * jdk.compiler/com.sun.tools.javac.util + * @build toolbox.ToolBox toolbox.JavacTask + * @run main TypeAnnotationsInConstantInit + */ + +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import toolbox.JavacTask; +import toolbox.ToolBox; + +public class TypeAnnotationsInConstantInit { + + public static void main(String... args) throws Exception { + new TypeAnnotationsInConstantInit().run(); + } + + ToolBox tb = new ToolBox(); + + void run() throws Exception { + typeAnnotationInConstantExpressionFieldInit(Paths.get(".")); + } + + void typeAnnotationInConstantExpressionFieldInit(Path base) throws Exception { + Path src = base.resolve("src"); + Path classes = base.resolve("classes"); + tb.writeJavaFiles(src, + """ + import java.lang.annotation.*; + + @SuppressWarnings(Decl.VALUE) + public class Decl { + public static final @Nullable String VALUE = (@Nullable String) ""; + } + + @Retention(RetentionPolicy.RUNTIME) + @Target({ ElementType.TYPE_USE }) + @interface Nullable {} + """); + Files.createDirectories(classes); + new JavacTask(tb) + .options("-d", classes.toString()) + .files(tb.findJavaFiles(src)) + .run() + .writeAll(); + } + +} diff --git a/test/langtools/tools/javac/api/TestJavacTaskWithWarning.java b/test/langtools/tools/javac/api/TestJavacTaskWithWarning.java new file mode 100644 index 0000000000000..70d8332720eca --- /dev/null +++ b/test/langtools/tools/javac/api/TestJavacTaskWithWarning.java @@ -0,0 +1,88 @@ +/* + * 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 8348212 + * @summary Ensure the warn() phase executes when the compiler is invoked via the API + * @modules jdk.compiler/com.sun.tools.javac.api + */ + +import com.sun.tools.javac.api.JavacTaskImpl; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.PrintStream; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.List; + +import javax.tools.JavaCompiler; +import javax.tools.JavaFileObject; +import javax.tools.StandardJavaFileManager; +import javax.tools.ToolProvider; + +public class TestJavacTaskWithWarning { + + static final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); + static final StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null); + + public static void warningTest() throws Exception { + + // Create a source file that will generate a warning + String srcdir = System.getProperty("test.src"); + File file = new File(srcdir, "GeneratesWarning.java"); + try (PrintStream out = new PrintStream(new FileOutputStream(file))) { + out.print( + """ + public class GeneratesWarning { + public GeneratesWarning() { + hashCode(); // generates a "this-escape" warning + } + } + """); + } + + // Compile it using API + Iterable files = fm.getJavaFileObjectsFromFiles(List.of(file)); + StringWriter buf = new StringWriter(); + List options = List.of( + "-Xlint:this-escape", + "-XDrawDiagnostics" + ); + JavacTaskImpl task = (JavacTaskImpl)compiler.getTask(new PrintWriter(buf), fm, null, options, null, files); + task.analyze(); + + // Verify warning was generated + if (!buf.toString().contains("compiler.warn.possible.this.escape")) + throw new AssertionError("warning not found in:\n" + buf); + } + + public static void main(String[] args) throws Exception { + try { + warningTest(); + } finally { + fm.close(); + } + } +} 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/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/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/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/java/lang/StringBuilders.java b/test/micro/org/openjdk/bench/java/lang/StringBuilders.java index ed5c0d30db866..f857a77d80e66 100644 --- a/test/micro/org/openjdk/bench/java/lang/StringBuilders.java +++ b/test/micro/org/openjdk/bench/java/lang/StringBuilders.java @@ -54,6 +54,8 @@ public class StringBuilders { private StringBuilder sbLatin2; private StringBuilder sbUtf16; private StringBuilder sbUtf17; + private int[] intArray; + private long[] longArray; @Setup public void setup() { @@ -69,6 +71,13 @@ public void setup() { sbLatin2 = new StringBuilder("Latin1 string"); sbUtf16 = new StringBuilder("UTF-\uFF11\uFF16 string"); sbUtf17 = new StringBuilder("UTF-\uFF11\uFF16 string"); + int size = 16; + intArray = new int[size]; + longArray = new long[size]; + for (int i = 0; i < longArray.length; i++) { + intArray[i] = ((100 * i + i) << 24) + 4543 + i * 4; + longArray[i] = ((100L * i + i) << 32) + 4543 + i * 4L; + } } @Benchmark @@ -224,6 +233,45 @@ public String toStringCharWithInt8() { return result.toString(); } + @Benchmark + public int appendWithIntLatin1() { + StringBuilder buf = sbLatin1; + buf.setLength(0); + for (int i : intArray) { + buf.append(i); + } + return buf.length(); + } + + @Benchmark + public int appendWithIntUtf16() { + StringBuilder buf = sbUtf16; + buf.setLength(0); + for (int i : intArray) { + buf.append(i); + } + return buf.length(); + } + + @Benchmark + public int appendWithLongLatin1() { + StringBuilder buf = sbLatin1; + buf.setLength(0); + for (long l : longArray) { + buf.append(l); + } + return buf.length(); + } + + @Benchmark + public int appendWithLongUtf16() { + StringBuilder buf = sbUtf16; + buf.setLength(0); + for (long l : longArray) { + buf.append(l); + } + return buf.length(); + } @Benchmark public int appendWithBool8Latin1() { diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/CallOverheadByValue.java b/test/micro/org/openjdk/bench/java/lang/foreign/CallOverheadByValue.java new file mode 100644 index 0000000000000..8fae1905472ec --- /dev/null +++ b/test/micro/org/openjdk/bench/java/lang/foreign/CallOverheadByValue.java @@ -0,0 +1,96 @@ +/* + * 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.java.lang.foreign; + +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.State; +import org.openjdk.jmh.annotations.TearDown; +import org.openjdk.jmh.annotations.Warmup; + +import java.lang.foreign.Arena; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.Linker; +import java.lang.foreign.MemoryLayout; +import java.lang.foreign.MemorySegment; +import java.lang.foreign.SegmentAllocator; +import java.lang.foreign.SymbolLookup; +import java.lang.foreign.ValueLayout; +import java.lang.invoke.MethodHandle; +import java.util.concurrent.TimeUnit; + +import static org.openjdk.bench.java.lang.foreign.CLayouts.C_DOUBLE; + +@BenchmarkMode(Mode.AverageTime) +@Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS) +@Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) +@State(org.openjdk.jmh.annotations.Scope.Thread) +@OutputTimeUnit(TimeUnit.NANOSECONDS) +@Fork(value = 3, jvmArgs = { "--enable-native-access=ALL-UNNAMED", "-Djava.library.path=micro/native" }) +public class CallOverheadByValue { + + public static final MemoryLayout POINT_LAYOUT = MemoryLayout.structLayout( + C_DOUBLE, C_DOUBLE + ); + private static final MethodHandle MH_UNIT_BY_VALUE; + private static final MethodHandle MH_UNIT_BY_PTR; + + static { + Linker abi = Linker.nativeLinker(); + System.loadLibrary("CallOverheadByValue"); + SymbolLookup loaderLibs = SymbolLookup.loaderLookup(); + MH_UNIT_BY_VALUE = abi.downcallHandle( + loaderLibs.findOrThrow("unit"), + FunctionDescriptor.of(POINT_LAYOUT) + ); + MH_UNIT_BY_PTR = abi.downcallHandle( + loaderLibs.findOrThrow("unit_ptr"), + FunctionDescriptor.ofVoid(ValueLayout.ADDRESS) + ); + } + + Arena arena = Arena.ofConfined(); + MemorySegment point = arena.allocate(POINT_LAYOUT); + + @TearDown + public void tearDown() { + arena.close(); + } + + @Benchmark + public void byValue() throws Throwable { + // point = unit(); + MemorySegment unused = (MemorySegment) MH_UNIT_BY_VALUE.invokeExact( + (SegmentAllocator) (_, _) -> point); + } + + @Benchmark + public void byPtr() throws Throwable { + // unit_ptr(&point); + MH_UNIT_BY_PTR.invokeExact(point); + } +} diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/libCallOverheadByValue.c b/test/micro/org/openjdk/bench/java/lang/foreign/libCallOverheadByValue.c new file mode 100644 index 0000000000000..2eb80f537d8c8 --- /dev/null +++ b/test/micro/org/openjdk/bench/java/lang/foreign/libCallOverheadByValue.c @@ -0,0 +1,38 @@ +/* + * 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 "export.h" + +typedef struct { + double x; + double y; +} DoublePoint; + +EXPORT DoublePoint unit() { + DoublePoint result = { 1, 0 }; + return result; +} + +EXPORT void unit_ptr(DoublePoint* out) { + *out = unit(); +} 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(); + } +}