diff --git a/.github/actions/get-gtest/action.yml b/.github/actions/get-gtest/action.yml
index 5de2b10cd3209..d38d33eabd846 100644
--- a/.github/actions/get-gtest/action.yml
+++ b/.github/actions/get-gtest/action.yml
@@ -49,6 +49,6 @@ runs:
- name: 'Export path to where GTest is installed'
id: path-name
run: |
- # Export the path
- echo 'path=gtest' >> $GITHUB_OUTPUT
+ # Export the absolute path
+ echo "path=`pwd`/gtest" >> $GITHUB_OUTPUT
shell: bash
diff --git a/.github/actions/get-jtreg/action.yml b/.github/actions/get-jtreg/action.yml
index 78a3a4c9edddd..4bb671d25d1bc 100644
--- a/.github/actions/get-jtreg/action.yml
+++ b/.github/actions/get-jtreg/action.yml
@@ -49,6 +49,6 @@ runs:
- name: 'Export path to where JTReg is installed'
id: path-name
run: |
- # Export the path
- echo 'path=jtreg/installed' >> $GITHUB_OUTPUT
+ # Export the absolute path
+ echo "path=`pwd`/jtreg/installed" >> $GITHUB_OUTPUT
shell: bash
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 210d53be65819..3ea07501477f8 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -325,17 +325,6 @@ jobs:
bootjdk-platform: linux-x64
runs-on: ubuntu-22.04
- test-macos-x64:
- name: macos-x64
- needs:
- - build-macos-x64
- uses: ./.github/workflows/test.yml
- with:
- platform: macos-x64
- bootjdk-platform: macos-x64
- runs-on: macos-13
- xcode-toolset-version: '14.3.1'
-
test-macos-aarch64:
name: macos-aarch64
needs:
diff --git a/.jcheck/conf b/.jcheck/conf
index beb280d1a04ab..6ab5c2d64c215 100644
--- a/.jcheck/conf
+++ b/.jcheck/conf
@@ -36,6 +36,6 @@ pattern=^([124-8][0-9]{6}): (\S.*)$
dirs=test/jdk|test/langtools|test/lib-test|test/hotspot/jtreg|test/jaxp
[checks "copyright"]
-files=^(?!LICENSE|license\.txt|.*\.bin|.*\.gif|.*\.jpg|.*\.png|.*\.icon|.*\.tiff|.*\.dat|.*\.patch|.*\.wav|.*\.class|.*-header|.*\.jar|).*
+files=^(?!LICENSE|license\.txt|.*\.bin|.*\.gif|.*\.jpg|.*\.png|.*\.icon|.*\.tiff|.*\.dat|.*\.patch|.*\.wav|.*\.class|.*-header|.*\.jar).*
oracle_locator=.*Copyright \(c\)(.*)Oracle and/or its affiliates\. All rights reserved\.
oracle_validator=.*Copyright \(c\) (\d{4})(?:, (\d{4}))?, Oracle and/or its affiliates\. All rights reserved\.
diff --git a/Makefile b/Makefile
index ebe52d5d7f2fa..751574e962031 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2012, 2015, 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
@@ -24,8 +24,9 @@
#
###
-### This file is just a very small wrapper needed to run the real make/Init.gmk.
-### It also performs some sanity checks on make.
+### This file is just a very small wrapper which will include make/PreInit.gmk,
+### where the real work is done. This wrapper also performs some sanity checks
+### on make that must be done before we can include another file.
###
# The shell code below will be executed on /usr/bin/make on Solaris, but not in GNU Make.
@@ -58,7 +59,7 @@ ifeq ($(filter /%, $(lastword $(MAKEFILE_LIST))),)
else
makefile_path := $(lastword $(MAKEFILE_LIST))
endif
-topdir := $(strip $(patsubst %/, %, $(dir $(makefile_path))))
+TOPDIR := $(strip $(patsubst %/, %, $(dir $(makefile_path))))
-# ... and then we can include the real makefile
-include $(topdir)/make/Init.gmk
+# ... and then we can include the real makefile to bootstrap the build
+include $(TOPDIR)/make/PreInit.gmk
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/doc/hotspot-style.html b/doc/hotspot-style.html
index 0305bfeca03bd..9f26fc6636205 100644
--- a/doc/hotspot-style.html
+++ b/doc/hotspot-style.html
@@ -217,10 +217,10 @@
Source Files
should be put in the .hpp file, and not in the .inline.hpp file. This
rule exists to resolve problems with circular dependencies between
.inline.hpp files.
-All .cpp files include precompiled.hpp as the first include
-line.
-precompiled.hpp is just a build time optimization, so don't rely
-on it to resolve include problems.
+Some build configurations use precompiled headers to speed up the
+build times. The precompiled headers are included in the precompiled.hpp
+file. Note that precompiled.hpp is just a build time optimization, so
+don't rely on it to resolve include problems.
Keep the include lines alphabetically sorted.
Put conditional inclusions (#if ...
) at the end of
the include list.
diff --git a/doc/hotspot-style.md b/doc/hotspot-style.md
index f5e59648cb23c..0150662981736 100644
--- a/doc/hotspot-style.md
+++ b/doc/hotspot-style.md
@@ -150,10 +150,10 @@ the first include line. Declarations needed by other files should be put
in the .hpp file, and not in the .inline.hpp file. This rule exists to
resolve problems with circular dependencies between .inline.hpp files.
-* All .cpp files include precompiled.hpp as the first include line.
-
-* precompiled.hpp is just a build time optimization, so don't rely on
-it to resolve include problems.
+* Some build configurations use precompiled headers to speed up the
+build times. The precompiled headers are included in the precompiled.hpp
+file. Note that precompiled.hpp is just a build time optimization, so
+don't rely on it to resolve include problems.
* Keep the include lines alphabetically sorted.
diff --git a/doc/hotspot-unit-tests.html b/doc/hotspot-unit-tests.html
index 556cfecc42d7f..fcd4a93f8e485 100644
--- a/doc/hotspot-unit-tests.html
+++ b/doc/hotspot-unit-tests.html
@@ -245,7 +245,7 @@ Error messages
All GoogleTest asserts print compared expressions and their values,
so there is no need to have them in error messages. Asserts print only
compared values, they do not print any of interim variables, e.g.
-ASSERT_TRUE((val1 == val2 && isFail(foo(8)) || i == 18)
+ASSERT_TRUE((val1 == val2 && isFail(foo(8))) || i == 18)
prints only one value. If you use some complex predicates, please
consider EXPECT_PRED*
or EXPECT_FORMAT_PRED
assertions family, they check that a predicate returns true/success and
diff --git a/doc/hotspot-unit-tests.md b/doc/hotspot-unit-tests.md
index 62ace4ef6ee8b..e1222baa2e3a4 100644
--- a/doc/hotspot-unit-tests.md
+++ b/doc/hotspot-unit-tests.md
@@ -172,7 +172,7 @@ Provide informative, but not too verbose error messages.
All GoogleTest asserts print compared expressions and their values, so
there is no need to have them in error messages. Asserts print only
compared values, they do not print any of interim variables, e.g.
-`ASSERT_TRUE((val1 == val2 && isFail(foo(8)) || i == 18)` prints only
+`ASSERT_TRUE((val1 == val2 && isFail(foo(8))) || i == 18)` prints only
one value. If you use some complex predicates, please consider
`EXPECT_PRED*` or `EXPECT_FORMAT_PRED` assertions family, they check that
a predicate returns true/success and print out all parameters values.
diff --git a/make/Bundles.gmk b/make/Bundles.gmk
index 2ed04c1906421..58950b5fb1f71 100644
--- a/make/Bundles.gmk
+++ b/make/Bundles.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,10 +23,9 @@
# questions.
#
-default: all
+include MakeFileStart.gmk
-include $(SPEC)
-include MakeBase.gmk
+################################################################################
include CopyFiles.gmk
include MakeIO.gmk
@@ -43,8 +42,6 @@ ifeq ($(call isBuildOs, windows), true)
TAR_IGNORE_EXIT_VALUE := || test "$$$$?" = "1"
endif
-# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, Bundles-pre.gmk))
################################################################################
# BUNDLE : Name of bundle to create
# FILES : Files in BASE_DIRS to add to bundle
@@ -502,11 +499,6 @@ endif
################################################################################
-# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, Bundles.gmk))
-
-################################################################################
-
product-bundles: $(PRODUCT_TARGETS)
legacy-bundles: $(LEGACY_TARGETS)
test-bundles: $(TEST_TARGETS)
@@ -517,6 +509,10 @@ static-libs-bundles: $(STATIC_LIBS_TARGETS)
static-libs-graal-bundles: $(STATIC_LIBS_GRAAL_TARGETS)
jcov-bundles: $(JCOV_TARGETS)
-.PHONY: all default product-bundles test-bundles \
+.PHONY: product-bundles test-bundles \
docs-jdk-bundles docs-javase-bundles docs-reference-bundles \
static-libs-bundles static-libs-graal-bundles jcov-bundles
+
+################################################################################
+
+include MakeFileEnd.gmk
diff --git a/make/CompileCommands.gmk b/make/CompileCommands.gmk
index 180bc76d4b849..baf07cf2e94f4 100644
--- a/make/CompileCommands.gmk
+++ b/make/CompileCommands.gmk
@@ -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,9 @@
# questions.
#
-default: all
+include MakeFileStart.gmk
-include $(SPEC)
-include MakeBase.gmk
+################################################################################
# When FIXPATH is set, let it process the file to make sure all paths are usable
# by system native tools. The FIXPATH tool assumes arguments preceded by an @
@@ -50,6 +49,6 @@ $(OUTPUTDIR)/compile_commands.json: $(wildcard $(MAKESUPPORT_OUTPUTDIR)/compile-
TARGETS += $(OUTPUTDIR)/compile_commands.json
-all: $(TARGETS)
+################################################################################
-.PHONY: all
+include MakeFileEnd.gmk
diff --git a/make/CompileDemos.gmk b/make/CompileDemos.gmk
index 6c751552e5042..503edf18e0012 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
@@ -23,23 +23,17 @@
# questions.
#
+include MakeFileStart.gmk
+
################################################################################
# Build demos for the JDK into $(SUPPORT_OUTPUTDIR)/demos/image.
################################################################################
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
-
include CopyFiles.gmk
include JavaCompilation.gmk
include TextFileProcessing.gmk
include ZipArchive.gmk
-# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, CompileDemos-pre.gmk))
-
# Prepare the find cache.
DEMO_SRC_DIRS += $(TOPDIR)/src/demo
@@ -132,12 +126,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.
@@ -257,11 +258,8 @@ ifneq ($(filter images, $(MAKECMDGOALS)), )
IMAGES_TARGETS := $(COPY_TO_TEST_IMAGE)
endif
-################################################################################
-# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, CompileDemos-post.gmk))
-
-all: $(TARGETS)
images: $(IMAGES_TARGETS)
-.PHONY: all
+################################################################################
+
+include MakeFileEnd.gmk
diff --git a/make/CompileInterimLangtools.gmk b/make/CompileInterimLangtools.gmk
index dbb23de093c33..c869ea160c76d 100644
--- a/make/CompileInterimLangtools.gmk
+++ b/make/CompileInterimLangtools.gmk
@@ -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
@@ -23,11 +23,9 @@
# questions.
#
-# This must be the first rule
-default: all
+include MakeFileStart.gmk
-include $(SPEC)
-include MakeBase.gmk
+################################################################################
include CopyFiles.gmk
include JavaCompilation.gmk
@@ -148,5 +146,4 @@ TARGETS += $(BUILD_JAVAC_SERVER)
################################################################################
-
-all: $(TARGETS)
+include MakeFileEnd.gmk
diff --git a/make/CompileJavaModules.gmk b/make/CompileJavaModules.gmk
index 7c86b77dd31ca..b4a193dfadee6 100644
--- a/make/CompileJavaModules.gmk
+++ b/make/CompileJavaModules.gmk
@@ -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
@@ -23,13 +23,12 @@
# questions.
#
-# This must be the first rule
-default: all
+include MakeFileStart.gmk
+
+################################################################################
-include $(SPEC)
-include MakeBase.gmk
-include Modules.gmk
include JavaCompilation.gmk
+include Modules.gmk
################################################################################
# If this is an imported module that has prebuilt classes, only compile
@@ -86,7 +85,15 @@ CreateHkTargets = \
################################################################################
# Include module specific build settings
--include Java.gmk
+THIS_SNIPPET := modules/$(MODULE)/Java.gmk
+
+ifneq ($(wildcard $(THIS_SNIPPET)), )
+ include MakeSnippetStart.gmk
+
+ include $(THIS_SNIPPET)
+
+ include MakeSnippetEnd.gmk
+endif
################################################################################
# Setup the main compilation
@@ -148,6 +155,4 @@ endif
################################################################################
-all: $(TARGETS)
-
-.PHONY: all
+include MakeFileEnd.gmk
diff --git a/make/CompileModuleTools.gmk b/make/CompileModuleTools.gmk
index 888b8418eea87..1208855305529 100644
--- a/make/CompileModuleTools.gmk
+++ b/make/CompileModuleTools.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
@@ -23,14 +23,12 @@
# questions.
#
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
-include JavaCompilation.gmk
+include MakeFileStart.gmk
################################################################################
+include JavaCompilation.gmk
+
TOOLS_CLASSES_DIR := $(BUILDTOOLS_OUTPUTDIR)/tools_jigsaw_classes
# When using an external BUILDJDK, make it possible to shortcut building of
@@ -64,4 +62,4 @@ TARGETS += $(BUILD_JIGSAW_TOOLS)
################################################################################
-all: $(TARGETS)
+include MakeFileEnd.gmk
diff --git a/make/CompileToolsHotspot.gmk b/make/CompileToolsHotspot.gmk
index 3fd3e5e8b8816..1ce6578de0798 100644
--- a/make/CompileToolsHotspot.gmk
+++ b/make/CompileToolsHotspot.gmk
@@ -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
@@ -23,19 +23,12 @@
# questions.
#
-# This must be the first rule
-default: all
+include MakeFileStart.gmk
-include $(SPEC)
-include MakeBase.gmk
+################################################################################
include JavaCompilation.gmk
-TARGETS :=
-
-# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, hotspot/CompileTools.gmk))
-
################################################################################
# Build tools needed for the JFR source code generation
@@ -51,7 +44,6 @@ $(eval $(call SetupJavaCompilation, BUILD_TOOLS_HOTSPOT, \
TARGETS += $(BUILD_TOOLS_HOTSPOT)
+################################################################################
-all: $(TARGETS)
-
-.PHONY: all
+include MakeFileEnd.gmk
diff --git a/make/CompileToolsJdk.gmk b/make/CompileToolsJdk.gmk
index 41a19f90ace77..c291dbdba0a76 100644
--- a/make/CompileToolsJdk.gmk
+++ b/make/CompileToolsJdk.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
@@ -23,21 +23,14 @@
# questions.
#
-default: all
+include MakeFileStart.gmk
-include $(SPEC)
-include MakeBase.gmk
+################################################################################
include CopyFiles.gmk
include JavaCompilation.gmk
include TextFileProcessing.gmk
-################################################################################
-
-$(eval $(call IncludeCustomExtension, CompileTools.gmk))
-
-################################################################################
-
# Use += to be able to add to this from a custom extension
BUILD_TOOLS_SRC_DIRS += \
$(TOPDIR)/make/jdk/src/classes \
@@ -160,4 +153,6 @@ ifeq ($(ENABLE_PANDOC), true)
TARGETS += $(PANDOC_HTML_MANPAGE_FILTER_SETUP)
endif
-all: $(TARGETS)
+################################################################################
+
+include MakeFileEnd.gmk
diff --git a/make/CopyImportModules.gmk b/make/CopyImportModules.gmk
index 69a42f166baab..435468e48db86 100644
--- a/make/CopyImportModules.gmk
+++ b/make/CopyImportModules.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
@@ -23,13 +23,12 @@
# questions.
#
+include MakeFileStart.gmk
+
+################################################################################
# This makefile is called for every imported module to copy the non class
# contents into the exploded jdk image.
-
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
+################################################################################
include CopyFiles.gmk
@@ -103,4 +102,6 @@ ifneq ($(CONF_DIR), )
TARGETS += $(COPY_CONF)
endif
-all: $(TARGETS)
+################################################################################
+
+include MakeFileEnd.gmk
diff --git a/make/CopyInterimTZDB.gmk b/make/CopyInterimTZDB.gmk
index 1e54cd8af11e2..9305ca4c4edf3 100644
--- a/make/CopyInterimTZDB.gmk
+++ b/make/CopyInterimTZDB.gmk
@@ -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
@@ -23,15 +23,12 @@
# questions.
#
-default: all
+include MakeFileStart.gmk
-include $(SPEC)
-include MakeBase.gmk
+################################################################################
include CopyFiles.gmk
-################################################################################
-
### TZDB tool needs files from java.time.zone package
define tzdb_copyfiles
@@ -51,3 +48,7 @@ $(eval $(call SetupCopyFiles, COPY_INTERIM_TZDB, \
################################################################################
all: $(COPY_INTERIM_TZDB)
+
+################################################################################
+
+include MakeFileEnd.gmk
diff --git a/make/Coverage.gmk b/make/Coverage.gmk
index 503acbe03ab18..2fd4e4ec6d454 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
@@ -22,8 +22,7 @@
# or visit www.oracle.com if you need additional information or have any
# questions.
-include $(SPEC)
-include MakeBase.gmk
+include MakeFileStart.gmk
################################################################################
@@ -47,7 +46,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)
@@ -55,3 +53,7 @@ $(JCOV_IMAGE_DIR)/release: $(JCOV_INPUT_IMAGE_DIR)/release
$(RMDIR) $(JCOV_TEMP)
jcov-image: $(JCOV_IMAGE_DIR)/release
+
+################################################################################
+
+include MakeFileEnd.gmk
diff --git a/make/CreateJmods.gmk b/make/CreateJmods.gmk
index 86bc3b8335ee9..40bceda69a97f 100644
--- a/make/CreateJmods.gmk
+++ b/make/CreateJmods.gmk
@@ -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
@@ -23,10 +23,9 @@
# questions.
#
-default: all
+include MakeFileStart.gmk
-include $(SPEC)
-include MakeBase.gmk
+################################################################################
include CopyFiles.gmk
include Execute.gmk
@@ -36,8 +35,6 @@ ifeq ($(MODULE), )
$(error MODULE must be set when calling CreateJmods.gmk)
endif
-$(eval $(call IncludeCustomExtension, CreateJmods.gmk))
-
################################################################################
JMODS_DIR := $(IMAGES_OUTPUTDIR)/jmods
@@ -187,7 +184,15 @@ endif
################################################################################
# Include module specific build settings
--include Jmod.gmk
+THIS_SNIPPET := modules/$(MODULE)/Jmod.gmk
+
+ifneq ($(wildcard $(THIS_SNIPPET)), )
+ include MakeSnippetStart.gmk
+
+ include $(THIS_SNIPPET)
+
+ include MakeSnippetEnd.gmk
+endif
# Set main class
ifneq ($(JMOD_FLAGS_main_class), )
@@ -266,6 +271,4 @@ TARGETS += $(create_$(JMOD_FILE))
################################################################################
-all: $(TARGETS)
-
-################################################################################
+include MakeFileEnd.gmk
diff --git a/make/Docs.gmk b/make/Docs.gmk
index fb2726e6dadf4..be9efbdc37077 100644
--- a/make/Docs.gmk
+++ b/make/Docs.gmk
@@ -1,4 +1,4 @@
-# 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,26 +22,7 @@
# questions.
#
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
-
-include CopyFiles.gmk
-include Execute.gmk
-include Modules.gmk
-include ModuleTools.gmk
-include ProcessMarkdown.gmk
-include ToolsJdk.gmk
-include ZipArchive.gmk
-include TextFileProcessing.gmk
-
-# This is needed to properly setup DOCS_MODULES.
-$(eval $(call ReadImportMetaData))
-
-################################################################################
-# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, Docs.gmk))
+include MakeFileStart.gmk
################################################################################
# This file generates all documentation for OpenJDK.
@@ -54,7 +35,19 @@ $(eval $(call IncludeCustomExtension, Docs.gmk))
#
# We will also generate separate, free-standing specifications from either
# markdown or existing html files.
-#
+################################################################################
+
+include CopyFiles.gmk
+include Execute.gmk
+include Modules.gmk
+include ProcessMarkdown.gmk
+include TextFileProcessing.gmk
+include ZipArchive.gmk
+include $(TOPDIR)/make/ModuleTools.gmk
+include $(TOPDIR)/make/ToolsJdk.gmk
+
+# This is needed to properly setup DOCS_MODULES.
+$(eval $(call ReadImportMetaData))
################################################################################
# Javadoc settings
@@ -680,7 +673,7 @@ ifeq ($(ENABLE_PANDOC), true)
$(foreach m, $(ALL_MODULES), \
$(eval MAN_$m := $(call ApplySpecFilter, $(filter %.md, $(call FindFiles, \
- $(call FindModuleManDirs, $m))))) \
+ $(call FindModuleManDirsForDocs, $m))))) \
$(if $(MAN_$m), \
$(eval $(call SetupProcessMarkdown, MAN_TO_HTML_$m, \
FILES := $(MAN_$m), \
@@ -761,10 +754,6 @@ $(eval $(call SetupZipArchive, BUILD_JAVADOC_ZIP, \
ZIP_TARGETS += $(BUILD_JAVADOC_ZIP)
-################################################################################
-# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, Docs-post.gmk))
-
################################################################################
# Bundles all generated specs into a zip archive, skipping javadocs.
@@ -806,7 +795,11 @@ all: docs-jdk-api-javadoc docs-jdk-api-graphs docs-javase-api-javadoc \
docs-reference-api-graphs docs-jdk-specs docs-jdk-index docs-zip \
docs-specs-zip
-.PHONY: default all docs-jdk-api-javadoc docs-jdk-api-graphs \
+.PHONY: docs-jdk-api-javadoc docs-jdk-api-graphs \
docs-javase-api-javadoc docs-javase-api-graphs \
docs-reference-api-javadoc docs-reference-api-graphs docs-jdk-specs \
docs-jdk-index docs-zip docs-specs-zip
+
+################################################################################
+
+include MakeFileEnd.gmk
diff --git a/make/Doctor.gmk b/make/Doctor.gmk
index 39953cd28db3f..05de0730fa14f 100644
--- a/make/Doctor.gmk
+++ b/make/Doctor.gmk
@@ -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
@@ -23,18 +23,11 @@
# questions.
#
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
-
-# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, Doctor.gmk))
+include MakeFileStart.gmk
################################################################################
-#
# Help user diagnose possible errors and problems with the build environment.
-#
+################################################################################
prologue:
$(ECHO)
@@ -145,4 +138,8 @@ doctor: $(TARGETS)
all: doctor
-.PHONY: default all doctor $(TARGETS)
+.PHONY: doctor $(TARGETS)
+
+################################################################################
+
+include MakeFileEnd.gmk
diff --git a/make/ExplodedImageOptimize.gmk b/make/ExplodedImageOptimize.gmk
index a67b987d91dd5..928ff86f10f41 100644
--- a/make/ExplodedImageOptimize.gmk
+++ b/make/ExplodedImageOptimize.gmk
@@ -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
@@ -23,17 +23,15 @@
# questions.
#
-# Runs a tool on the exploded image to improve performance
+include MakeFileStart.gmk
-default: all
+################################################################################
+# Runs a tool on the exploded image to improve performance
+################################################################################
-include $(SPEC)
-include MakeBase.gmk
include Execute.gmk
include $(TOPDIR)/make/ModuleTools.gmk
-################################################################################
-
ALL_MODULEINFO_CLASSES := $(wildcard $(JDK_OUTPUTDIR)/modules/*/module-info.class)
$(eval $(call SetupExecute, optimize_image, \
@@ -47,6 +45,4 @@ TARGETS := $(optimize_image_TARGET)
################################################################################
-all: $(TARGETS)
-
-.PHONY: all default
+include MakeFileEnd.gmk
diff --git a/make/GenerateLinkOptData.gmk b/make/GenerateLinkOptData.gmk
index b6989042d6aed..5fc745ba223f4 100644
--- a/make/GenerateLinkOptData.gmk
+++ b/make/GenerateLinkOptData.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,15 +23,12 @@
# questions.
#
+include MakeFileStart.gmk
+
################################################################################
# Generate classlist
################################################################################
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
-
include CopyFiles.gmk
include JavaCompilation.gmk
@@ -148,4 +145,4 @@ TARGETS += $(COPY_JLI_TRACE)
################################################################################
-all: $(TARGETS)
+include MakeFileEnd.gmk
diff --git a/make/GenerateModuleSummary.gmk b/make/GenerateModuleSummary.gmk
index 854d938c9caa4..5c6ec055c45f3 100644
--- a/make/GenerateModuleSummary.gmk
+++ b/make/GenerateModuleSummary.gmk
@@ -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
@@ -23,12 +23,11 @@
# questions.
#
-# Default target declared first
-default: all
+include MakeFileStart.gmk
-include $(SPEC)
-include MakeBase.gmk
-include ModuleTools.gmk
+################################################################################
+
+include $(TOPDIR)/make/ModuleTools.gmk
GENGRAPHS_DIR := $(IMAGES_OUTPUTDIR)/gengraphs
SPEC_DOTFILES_DIR := $(GENGRAPHS_DIR)/spec-dotfiles
@@ -50,3 +49,7 @@ $(GENGRAPHS_DIR)/module-summary.html: $(BUILD_JIGSAW_TOOLS) $(GENGRAPHS_DIR)/tec
$(TOOL_MODULESUMMARY) -o $@ --module-path $(IMAGES_OUTPUTDIR)/jmods
all: $(GENGRAPHS_DIR)/jdk.dot $(GENGRAPHS_DIR)/module-summary.html $(SPEC_DOTFILES_DIR)/java.se.dot
+
+################################################################################
+
+include MakeFileEnd.gmk
diff --git a/make/Global.gmk b/make/Global.gmk
index 86487c1c2fc19..512c5b963aa99 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.))
@@ -120,12 +121,12 @@ print-configurations:
@true
test-prebuilt:
- @( cd $(topdir) && \
+ @( cd $(TOPDIR) && \
$(MAKE) --no-print-directory -r -R -I make/common/ -f make/RunTestsPrebuilt.gmk \
test-prebuilt CUSTOM_MAKE_DIR=$(CUSTOM_MAKE_DIR) TEST="$(TEST)" )
test-prebuilt-with-exit-code:
- @( cd $(topdir) && \
+ @( cd $(TOPDIR) && \
$(MAKE) --no-print-directory -r -R -I make/common/ -f make/RunTestsPrebuilt.gmk \
test-prebuilt-with-exit-code CUSTOM_MAKE_DIR=$(CUSTOM_MAKE_DIR) TEST="$(TEST)" )
diff --git a/make/GraalBuilderImage.gmk b/make/GraalBuilderImage.gmk
index 7fa90c6601966..d707e067a5505 100644
--- a/make/GraalBuilderImage.gmk
+++ b/make/GraalBuilderImage.gmk
@@ -23,19 +23,14 @@
# questions.
#
+include MakeFileStart.gmk
+
+################################################################################
# This makefile creates a jdk image overlaid with statically linked core
# libraries.
-
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
-
-include CopyFiles.gmk
-
################################################################################
-TARGETS :=
+include CopyFiles.gmk
$(eval $(call SetupCopyFiles, COPY_JDK_IMG, \
SRC := $(JDK_IMAGE_DIR)/, \
@@ -54,6 +49,4 @@ TARGETS += $(COPY_STATIC_LIBS)
################################################################################
-all: $(TARGETS)
-
-.PHONY: all
+include MakeFileEnd.gmk
diff --git a/make/Hsdis.gmk b/make/Hsdis.gmk
index 13d84f964bcdc..a0fc031be1b7a 100644
--- a/make/Hsdis.gmk
+++ b/make/Hsdis.gmk
@@ -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
@@ -23,17 +23,14 @@
# questions.
#
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
-include JdkNativeCompilation.gmk
+include MakeFileStart.gmk
################################################################################
# This makefile compiles and installs the hsdis library
-#
################################################################################
+include JdkNativeCompilation.gmk
+
HSDIS_OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/hsdis
REAL_HSDIS_NAME := hsdis-$(OPENJDK_TARGET_CPU_LEGACY_LIB)$(SHARED_LIBRARY_SUFFIX)
BUILT_HSDIS_LIB := $(HSDIS_OUTPUT_DIR)/$(REAL_HSDIS_NAME)
@@ -201,8 +198,8 @@ endif
TARGETS += install
-################################################################################
+.PHONY: build install
-all: $(TARGETS)
+################################################################################
-.PHONY: all default build install
+include MakeFileEnd.gmk
diff --git a/make/Images.gmk b/make/Images.gmk
index c5d0ef11b5d2e..6c859fce7a543 100644
--- a/make/Images.gmk
+++ b/make/Images.gmk
@@ -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
@@ -23,10 +23,9 @@
# questions.
#
-default: all
+include MakeFileStart.gmk
-include $(SPEC)
-include MakeBase.gmk
+################################################################################
include CopyFiles.gmk
include DebugInfoUtils.gmk
@@ -37,9 +36,6 @@ include Utils.gmk
JDK_TARGETS :=
JRE_TARGETS :=
-# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, Images-pre.gmk))
-
################################################################################
# All modules for the current target platform.
@@ -309,12 +305,6 @@ $(call SetupCopyDebuginfo,SYMBOLS)
################################################################################
-# Include custom post hook here to make it possible to augment the target lists
-# before actual target prerequisites are declared.
-$(eval $(call IncludeCustomExtension, Images-post.gmk))
-
-################################################################################
-
$(JRE_TARGETS): $(JLINK_JRE_TARGETS)
$(JDK_TARGETS): $(JLINK_JDK_TARGETS)
@@ -324,4 +314,8 @@ symbols: $(SYMBOLS_TARGETS)
all: jdk jre symbols
-.PHONY: default all jdk jre symbols
+.PHONY: jdk jre symbols
+
+################################################################################
+
+include MakeFileEnd.gmk
diff --git a/make/Init.gmk b/make/Init.gmk
index f2cfe3625a520..6da2fb985b62f 100644
--- a/make/Init.gmk
+++ b/make/Init.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
@@ -23,263 +23,84 @@
# questions.
#
+include MakeFileStart.gmk
+
################################################################################
-# This is the bootstrapping part of the build. This file is included from the
-# top level Makefile, and is responsible for launching the Main.gmk file with
-# the proper make and the proper make arguments.
+# Init.gmk sits between PreInit.gmk and Main.gmk when bootstrapping the build.
+# It is called from PreInit.gmk, and its main responsibility is to launch
+# Main.gmk with the proper make and the proper make arguments.
+# PreMain.gmk has provided us with a proper SPEC. This allows us to use the
+# value of $(MAKE) for all further make calls.
################################################################################
-# This must be the first rule
-default:
-.PHONY: default
+# Our helper functions.
+include $(TOPDIR)/make/InitSupport.gmk
+include LogUtils.gmk
+
+# Force early generation of module-deps.gmk and find-tests.gmk
+GENERATE_MODULE_DEPS_FILE := true
+include Modules.gmk
+GENERATE_FIND_TESTS_FILE := true
+include FindTests.gmk
# Inclusion of this pseudo-target will cause make to execute this file
# serially, regardless of -j.
.NOTPARALLEL:
-ifeq ($(HAS_SPEC), )
- ##############################################################################
- # This is the default mode. We have not been recursively called with a SPEC.
- ##############################################################################
-
- # Include our helper functions.
- include $(topdir)/make/InitSupport.gmk
-
- # Here are "global" targets, i.e. targets that can be executed without having
- # a configuration. This will define ALL_GLOBAL_TARGETS.
- include $(topdir)/make/Global.gmk
-
- # Targets provided by Init.gmk.
- ALL_INIT_TARGETS := print-modules print-targets print-configuration \
- print-tests reconfigure pre-compare-build post-compare-build
-
- # CALLED_TARGETS is the list of targets that the user provided,
- # or "default" if unspecified.
- CALLED_TARGETS := $(if $(MAKECMDGOALS), $(MAKECMDGOALS), default)
-
- # Extract non-global targets that require a spec file.
- CALLED_SPEC_TARGETS := $(filter-out $(ALL_GLOBAL_TARGETS), $(CALLED_TARGETS))
-
- # If we have only global targets, or if we are called with -qp (assuming an
- # external part, e.g. bash completion, is trying to understand our targets),
- # we will skip SPEC location and the sanity checks.
- ifeq ($(CALLED_SPEC_TARGETS), )
- ONLY_GLOBAL_TARGETS := true
- endif
- ifeq ($(findstring p, $(MAKEFLAGS))$(findstring q, $(MAKEFLAGS)), pq)
- ONLY_GLOBAL_TARGETS := true
- endif
-
- ifeq ($(ONLY_GLOBAL_TARGETS), true)
- ############################################################################
- # We have only global targets, or are called with -pq.
- ############################################################################
-
- ifeq ($(wildcard $(SPEC)), )
- # If we have no SPEC provided, we will just make a "best effort" target list.
- # First try to grab any available pre-existing main-targets.gmk.
- main_targets_file := $(firstword $(wildcard $(build_dir)/*/make-support/main-targets.gmk))
- ifneq ($(main_targets_file), )
- # Extract the SPEC that corresponds to this main-targets.gmk file.
- SPEC := $(patsubst %/make-support/main-targets.gmk, %/spec.gmk, $(main_targets_file))
- else
- # None found, pick an arbitrary SPEC for which to generate a file
- SPEC := $(firstword $(all_spec_files))
- endif
- endif
-
- ifneq ($(wildcard $(SPEC)), )
- $(eval $(call DefineMainTargets, LAZY, $(SPEC)))
- else
- # If we have no configurations we can not provide any main targets.
- ALL_MAIN_TARGETS :=
- endif
+# Parse COMPARE_BUILD (for makefile development)
+$(eval $(call ParseCompareBuild))
- ALL_TARGETS := $(sort $(ALL_GLOBAL_TARGETS) $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS))
+# Setup reproducible build environment
+$(eval $(call SetupReproducibleBuild))
- # Just list all our targets.
- $(ALL_TARGETS):
-
- .PHONY: $(ALL_TARGETS)
-
- else
- ############################################################################
- # This is the normal case, we have been called from the command line by the
- # user and we need to call ourself back with a proper SPEC.
- # We have at least one non-global target, so we need to find a spec file.
- ############################################################################
-
- # Basic checks on environment and command line.
- $(eval $(call CheckControlVariables))
- $(eval $(call CheckDeprecatedEnvironment))
- $(eval $(call CheckInvalidMakeFlags))
-
- # Check that CONF_CHECK is valid.
- $(eval $(call ParseConfCheckOption))
-
- # Check that the LOG given is valid, and set LOG_LEVEL, LOG_NOFILE, MAKE_LOG_VARS and MAKE_LOG_FLAGS.
+# If no LOG= was given on command line, but we have a non-standard default
+# value, use that instead and re-parse log level.
+ifeq ($(LOG), )
+ ifneq ($(DEFAULT_LOG), )
+ override LOG := $(DEFAULT_LOG)
$(eval $(call ParseLogLevel))
-
- # After this SPECS contain 1..N spec files (otherwise ParseConfAndSpec fails).
- $(eval $(call ParseConfAndSpec))
-
- # Extract main targets from Main.gmk using the spec(s) provided. In theory,
- # with multiple specs, we should find the intersection of targets provided
- # by all specs, but we approximate this by an arbitrary spec from the list.
- # This will setup ALL_MAIN_TARGETS.
- $(eval $(call DefineMainTargets, FORCE, $(firstword $(SPECS))))
-
- # Separate called targets depending on type.
- INIT_TARGETS := $(filter $(ALL_INIT_TARGETS), $(CALLED_SPEC_TARGETS))
- MAIN_TARGETS := $(filter $(ALL_MAIN_TARGETS), $(CALLED_SPEC_TARGETS))
- SEQUENTIAL_TARGETS := $(filter dist-clean clean%, $(MAIN_TARGETS))
- PARALLEL_TARGETS := $(filter-out $(SEQUENTIAL_TARGETS), $(MAIN_TARGETS))
-
- # The spec files depend on the autoconf source code. This check makes sure
- # the configuration is up to date after changes to configure.
- $(SPECS): $(wildcard $(topdir)/make/autoconf/*) \
- $(if $(CUSTOM_CONFIG_DIR), $(wildcard $(CUSTOM_CONFIG_DIR)/*)) \
- $(addprefix $(topdir)/make/conf/, version-numbers.conf branding.conf) \
- $(if $(CUSTOM_CONF_DIR), $(wildcard $(addprefix $(CUSTOM_CONF_DIR)/, \
- version-numbers.conf branding.conf)))
- ifeq ($(CONF_CHECK), fail)
- @echo Error: The configuration is not up to date for \
- "'$(lastword $(subst /, , $(dir $@)))'."
- $(call PrintConfCheckFailed)
- @exit 2
- else ifeq ($(CONF_CHECK), auto)
- @echo Note: The configuration is not up to date for \
- "'$(lastword $(subst /, , $(dir $@)))'."
- @( cd $(topdir) && \
- $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -f $(topdir)/make/Init.gmk \
- SPEC=$@ HAS_SPEC=true ACTUAL_TOPDIR=$(topdir) \
- reconfigure )
- else ifeq ($(CONF_CHECK), ignore)
- # Do nothing
- endif
-
- # Do not let make delete spec files even if aborted while doing a reconfigure
- .PRECIOUS: $(SPECS)
-
- # Unless reconfigure is explicitly called, let all main targets depend on
- # the spec files to be up to date.
- ifeq ($(findstring reconfigure, $(INIT_TARGETS)), )
- $(MAIN_TARGETS): $(SPECS)
- endif
-
- make-info:
- ifneq ($(findstring $(LOG_LEVEL), info debug trace), )
- $(info Running make as '$(strip $(MAKE) $(MFLAGS) \
- $(COMMAND_LINE_VARIABLES) $(MAKECMDGOALS))')
- endif
-
- MAKE_INIT_WITH_SPEC_ARGUMENTS := ACTUAL_TOPDIR=$(topdir) \
- USER_MAKE_VARS="$(USER_MAKE_VARS)" MAKE_LOG_FLAGS=$(MAKE_LOG_FLAGS) \
- $(MAKE_LOG_VARS) \
- INIT_TARGETS="$(INIT_TARGETS)" \
- SEQUENTIAL_TARGETS="$(SEQUENTIAL_TARGETS)" \
- PARALLEL_TARGETS="$(PARALLEL_TARGETS)"
-
- # Now the init and main targets will be called, once for each SPEC. The
- # recipe will be run once for every target specified, but we only want to
- # execute the recipe a single time, hence the TARGET_DONE with a dummy
- # command if true.
- # The COMPARE_BUILD part implements special support for makefile development.
- $(ALL_INIT_TARGETS) $(ALL_MAIN_TARGETS): make-info
- @$(if $(TARGET_DONE), \
- true \
- , \
- ( cd $(topdir) && \
- $(foreach spec, $(SPECS), \
- $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -j 1 -f $(topdir)/make/Init.gmk \
- SPEC=$(spec) HAS_SPEC=true $(MAKE_INIT_WITH_SPEC_ARGUMENTS) \
- main && \
- $(if $(and $(COMPARE_BUILD), $(PARALLEL_TARGETS)), \
- $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -f $(topdir)/make/Init.gmk \
- SPEC=$(spec) HAS_SPEC=true ACTUAL_TOPDIR=$(topdir) \
- COMPARE_BUILD="$(COMPARE_BUILD)" pre-compare-build && \
- $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -j 1 -f $(topdir)/make/Init.gmk \
- SPEC=$(spec) HAS_SPEC=true $(MAKE_INIT_WITH_SPEC_ARGUMENTS) \
- COMPARE_BUILD="$(COMPARE_BUILD):NODRYRUN=true" main && \
- $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -f $(topdir)/make/Init.gmk \
- SPEC=$(spec) HAS_SPEC=true ACTUAL_TOPDIR=$(topdir) \
- COMPARE_BUILD="$(COMPARE_BUILD):NODRYRUN=true" post-compare-build && \
- ) \
- ) true ) \
- $(eval TARGET_DONE=true) \
- )
-
- .PHONY: $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS)
-
- endif # $(ONLY_GLOBAL_TARGETS)!=true
-
-else # HAS_SPEC=true
-
- ##############################################################################
- # Now we have a spec. This part provides the "main" target that acts as a
- # trampoline to call the Main.gmk with the value of $(MAKE) found in the spec
- # file.
- ##############################################################################
-
- include $(SPEC)
-
- # Our helper functions.
- include $(TOPDIR)/make/InitSupport.gmk
-
- # Parse COMPARE_BUILD (for makefile development)
- $(eval $(call ParseCompareBuild))
-
- # Setup reproducible build environment
- $(eval $(call SetupReproducibleBuild))
-
- # If no LOG= was given on command line, but we have a non-standard default
- # value, use that instead and re-parse log level.
- ifeq ($(LOG), )
- ifneq ($(DEFAULT_LOG), )
- override LOG := $(DEFAULT_LOG)
- $(eval $(call ParseLogLevel))
- endif
endif
+endif
- ifeq ($(LOG_NOFILE), true)
- # Disable build log if LOG=[level,]nofile was given
- override BUILD_LOG_PIPE :=
- override BUILD_LOG_PIPE_SIMPLE :=
- endif
+ifeq ($(LOG_NOFILE), true)
+ # Disable build log if LOG=[level,]nofile was given
+ override BUILD_LOG_PIPE :=
+ override BUILD_LOG_PIPE_SIMPLE :=
+endif
- ifeq ($(filter dist-clean, $(SEQUENTIAL_TARGETS)), dist-clean)
- # We can't have a log file if we're about to remove it.
- override BUILD_LOG_PIPE :=
- override BUILD_LOG_PIPE_SIMPLE :=
- endif
+ifeq ($(filter dist-clean, $(SEQUENTIAL_TARGETS)), dist-clean)
+ # We can't have a log file if we're about to remove it.
+ override BUILD_LOG_PIPE :=
+ override BUILD_LOG_PIPE_SIMPLE :=
+endif
- ifeq ($(OUTPUT_SYNC_SUPPORTED), true)
- OUTPUT_SYNC_FLAG := -O$(OUTPUT_SYNC)
- endif
+ifeq ($(OUTPUT_SYNC_SUPPORTED), true)
+ OUTPUT_SYNC_FLAG := -O$(OUTPUT_SYNC)
+endif
- ##############################################################################
- # Init targets
- ##############################################################################
+##############################################################################
+# Init targets. These are handled fully, here and now.
+##############################################################################
- print-modules:
+print-modules:
( cd $(TOPDIR) && \
$(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
NO_RECIPES=true print-modules )
- print-targets:
+print-targets:
( cd $(TOPDIR) && \
$(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
NO_RECIPES=true print-targets )
- print-tests:
+print-tests:
( cd $(TOPDIR) && \
$(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
NO_RECIPES=true print-tests )
- print-configuration:
- $(ECHO) $(CONFIGURE_COMMAND_LINE)
+print-configuration:
+ $(ECHO) $(CONFIGURE_COMMAND_LINE)
- reconfigure:
+reconfigure:
ifneq ($(REAL_CONFIGURE_COMMAND_EXEC_FULL), )
$(ECHO) "Re-running configure using original command line '$(REAL_CONFIGURE_COMMAND_EXEC_SHORT) $(REAL_CONFIGURE_COMMAND_LINE)'"
$(eval RECONFIGURE_COMMAND := $(REAL_CONFIGURE_COMMAND_EXEC_FULL) $(REAL_CONFIGURE_COMMAND_LINE))
@@ -295,25 +116,27 @@ else # HAS_SPEC=true
CUSTOM_CONFIG_DIR="$(CUSTOM_CONFIG_DIR)" \
$(RECONFIGURE_COMMAND) )
- ##############################################################################
- # The main target, for delegating into Main.gmk
- ##############################################################################
+.PHONY: print-modules print-targets print-tests print-configuration reconfigure
- MAIN_TARGETS := $(SEQUENTIAL_TARGETS) $(PARALLEL_TARGETS) $(COMPARE_BUILD_MAKE)
- # If building the default target, add what they are to the description.
- DESCRIPTION_TARGETS := $(strip $(MAIN_TARGETS))
- ifeq ($(DESCRIPTION_TARGETS), default)
- DESCRIPTION_TARGETS += ($(DEFAULT_MAKE_TARGET))
- endif
- TARGET_DESCRIPTION := target$(if $(word 2, $(MAIN_TARGETS)),s) \
- '$(strip $(DESCRIPTION_TARGETS))' in configuration '$(CONF_NAME)'
+##############################################################################
+# The main target. This will delegate all other targets into Main.gmk.
+##############################################################################
- # MAKEOVERRIDES is automatically set and propagated by Make to sub-Make calls.
- # We need to clear it of the init-specific variables. The user-specified
- # variables are explicitly propagated using $(USER_MAKE_VARS).
- main: MAKEOVERRIDES :=
+MAIN_TARGETS := $(SEQUENTIAL_TARGETS) $(PARALLEL_TARGETS) $(COMPARE_BUILD_MAKE)
+# If building the default target, add what they are to the description.
+DESCRIPTION_TARGETS := $(strip $(MAIN_TARGETS))
+ifeq ($(DESCRIPTION_TARGETS), default)
+ DESCRIPTION_TARGETS += ($(DEFAULT_MAKE_TARGET))
+endif
+TARGET_DESCRIPTION := target$(if $(word 2, $(MAIN_TARGETS)),s) \
+ '$(strip $(DESCRIPTION_TARGETS))' in configuration '$(CONF_NAME)'
+
+# MAKEOVERRIDES is automatically set and propagated by Make to sub-Make calls.
+# We need to clear it of the init-specific variables. The user-specified
+# variables are explicitly propagated using $(USER_MAKE_VARS).
+main: MAKEOVERRIDES :=
- main: $(INIT_TARGETS)
+main: $(INIT_TARGETS)
ifneq ($(SEQUENTIAL_TARGETS)$(PARALLEL_TARGETS), )
$(call RotateLogFiles)
$(PRINTF) "Building $(TARGET_DESCRIPTION)\n" $(BUILD_LOG_PIPE_SIMPLE)
@@ -333,14 +156,14 @@ else # HAS_SPEC=true
# treat it as NOT using jobs at all.
( cd $(TOPDIR) && \
$(NICE) $(MAKE) $(MAKE_ARGS) $(OUTPUT_SYNC_FLAG) \
- $(if $(JOBS), -j $(JOBS)) \
+ $(if $(JOBS), -j $(JOBS)) \
-f make/Main.gmk $(USER_MAKE_VARS) \
$(PARALLEL_TARGETS) $(COMPARE_BUILD_MAKE) $(BUILD_LOG_PIPE) || \
( exitcode=$$? && \
$(PRINTF) "\nERROR: Build failed for $(TARGET_DESCRIPTION) (exit code $$exitcode) \n" \
$(BUILD_LOG_PIPE_SIMPLE) && \
cd $(TOPDIR) && $(MAKE) $(MAKE_ARGS) -j 1 -f make/Init.gmk \
- HAS_SPEC=true on-failure ; \
+ on-failure ; \
exit $$exitcode ) )
$(call CleanupJavacServer)
$(call StopGlobalTimer)
@@ -353,7 +176,7 @@ else # HAS_SPEC=true
$(call ReportProfileTimes)
endif
- on-failure:
+on-failure:
$(call CleanupJavacServer)
$(call StopGlobalTimer)
$(call ReportBuildTimes)
@@ -365,15 +188,18 @@ else # HAS_SPEC=true
$(call CleanupCompareBuild)
endif
- # Support targets for COMPARE_BUILD, used for makefile development
- pre-compare-build:
+# Support targets for COMPARE_BUILD, used for makefile development
+pre-compare-build:
$(call WaitForJavacServerFinish)
$(call PrepareCompareBuild)
- post-compare-build:
+post-compare-build:
$(call WaitForJavacServerFinish)
$(call CleanupCompareBuild)
$(call CompareBuildDoComparison)
- .PHONY: print-targets print-modules reconfigure main on-failure
-endif
+.PHONY: main on-failure pre-compare-build post-compare-build
+
+################################################################################
+
+include MakeFileEnd.gmk
diff --git a/make/InitSupport.gmk b/make/InitSupport.gmk
index eea593a80db95..a9af44e4225b1 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
@@ -23,396 +23,114 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
################################################################################
# This file contains helper functions for Init.gmk.
-# It is divided in two parts, depending on if a SPEC is present or not
-# (HAS_SPEC is true or not).
################################################################################
-ifndef _INITSUPPORT_GMK
-_INITSUPPORT_GMK := 1
-
-ifeq ($(HAS_SPEC), )
-
- # COMMA is defined in spec.gmk, but that is not included yet
- COMMA := ,
-
- # Include the corresponding closed file, if present.
- ifneq ($(CUSTOM_MAKE_DIR), )
- -include $(CUSTOM_MAKE_DIR)/InitSupport.gmk
- endif
-
- ##############################################################################
- # Helper functions for the initial part of Init.gmk, before the spec file is
- # loaded. Most of these functions provide parsing and setting up make options
- # 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
-
- # All known make control variables
- MAKE_CONTROL_VARIABLES := $(INIT_CONTROL_VARIABLES) TEST JDK_FILTER SPEC_FILTER
-
- # Define a simple reverse function.
- # Should maybe move to MakeBase.gmk, but we can't include that file now.
- reverse = \
- $(if $(strip $(1)), $(call reverse, $(wordlist 2, $(words $(1)), $(1)))) \
- $(firstword $(1))
-
- # The variable MAKEOVERRIDES contains variable assignments from the command
- # line, but in reverse order to what the user entered.
- # The '§' <=> '\ 'dance is needed to keep values with space in them connected.
- COMMAND_LINE_VARIABLES := $(subst §,\ , $(call reverse, $(subst \ ,§,$(MAKEOVERRIDES))))
-
- # A list like FOO="val1" BAR="val2" containing all user-supplied make
- # variables that we should propagate.
- # The '§' <=> '\ 'dance is needed to keep values with space in them connected.
- USER_MAKE_VARS := $(subst §,\ , $(filter-out $(addsuffix =%, $(INIT_CONTROL_VARIABLES)), \
- $(subst \ ,§,$(MAKEOVERRIDES))))
-
- # Setup information about available configurations, if any.
- ifneq ($(CUSTOM_ROOT), )
- build_dir = $(CUSTOM_ROOT)/build
- else
- build_dir = $(topdir)/build
+# Define basic logging setup
+BUILD_LOG := $(OUTPUTDIR)/build.log
+BUILD_PROFILE_LOG := $(OUTPUTDIR)/build-profile.log
+
+BUILD_LOG_PIPE := > >($(TEE) -a $(BUILD_LOG)) 2> >($(TEE) -a $(BUILD_LOG) >&2) && wait
+# Use this for simple echo/printf commands that are never expected to print
+# to stderr.
+BUILD_LOG_PIPE_SIMPLE := | $(TEE) -a $(BUILD_LOG)
+
+# Setup the build environment to match the requested specification on
+# level of reproducible builds
+define SetupReproducibleBuild
+ ifeq ($$(SOURCE_DATE), updated)
+ # For static values of SOURCE_DATE (not "updated"), these are set in spec.gmk
+ export SOURCE_DATE_EPOCH := $$(shell $$(DATE) +"%s")
+ export SOURCE_DATE_ISO_8601 := $$(call EpochToISO8601, $$(SOURCE_DATE_EPOCH))
endif
- all_spec_files = $(wildcard $(build_dir)/*/spec.gmk)
- # Extract the configuration names from the path
- all_confs = $(patsubst %/spec.gmk, %, $(patsubst $(build_dir)/%, %, $(all_spec_files)))
-
- # Check for unknown command-line variables
- define CheckControlVariables
- command_line_variables := $$(strip $$(foreach var, \
- $$(subst \ ,_,$$(MAKEOVERRIDES)), \
- $$(firstword $$(subst =, , $$(var)))))
- unknown_command_line_variables := $$(strip \
- $$(filter-out $$(MAKE_CONTROL_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))))
- $$(info Make sure it is not mistyped, and that you intend to override this variable.)
- $$(info 'make help' will list known control variables.)
- $$(info )
- endif
- endef
-
- # Check for deprecated ALT_ variables
- define CheckDeprecatedEnvironment
- defined_alt_variables := $$(filter ALT_%, $$(.VARIABLES))
- ifneq ($$(defined_alt_variables), )
- $$(info Warning: You have the following ALT_ variables set:)
- $$(foreach var, $$(defined_alt_variables), $$(info * $$(var)=$$($$(var))))
- $$(info ALT_ variables are deprecated, and may result in a failed build.)
- $$(info Please clean your environment.)
- $$(info )
- endif
- endef
-
- # Check for invalid make flags like -j
- define CheckInvalidMakeFlags
- # This is a trick to get this rule to execute before any other rules
- # MAKEFLAGS only indicate -j if read in a recipe (!)
- $$(topdir)/make/Init.gmk: .FORCE
- $$(if $$(findstring --jobserver, $$(MAKEFLAGS)), \
- $$(info Error: 'make -jN' is not supported, use 'make JOBS=N') \
- $$(error Cannot continue) \
- )
- .FORCE:
- .PHONY: .FORCE
- endef
-
- # Check that the CONF_CHECK option is valid and set up handling
- define ParseConfCheckOption
- ifeq ($$(CONF_CHECK), )
- # Default behavior is fail
- CONF_CHECK := fail
- else ifneq ($$(filter-out auto fail ignore, $$(CONF_CHECK)), )
- $$(info Error: CONF_CHECK must be one of: auto, fail or ignore.)
- $$(error Cannot continue)
- endif
- endef
-
- define ParseConfAndSpec
- ifneq ($$(origin SPEC), undefined)
- # We have been given a SPEC, check that it works out properly
- ifneq ($$(origin CONF), undefined)
- # We also have a CONF argument. We can't have both.
- $$(info Error: Cannot use CONF=$$(CONF) and SPEC=$$(SPEC) at the same time. Choose one.)
- $$(error Cannot continue)
- endif
- ifneq ($$(origin CONF_NAME), undefined)
- # We also have a CONF_NAME argument. We can't have both.
- $$(info Error: Cannot use CONF_NAME=$$(CONF_NAME) and SPEC=$$(SPEC) at the same time. Choose one.)
- $$(error Cannot continue)
- endif
- ifeq ($$(wildcard $$(SPEC)), )
- $$(info Error: Cannot locate spec.gmk, given by SPEC=$$(SPEC).)
- $$(error Cannot continue)
- endif
- ifeq ($$(filter /%, $$(SPEC)), )
- # If given with relative path, make it absolute
- SPECS := $$(CURDIR)/$$(strip $$(SPEC))
- else
- SPECS := $$(SPEC)
- endif
+endef
- # For now, unset this SPEC variable.
- override SPEC :=
+# Parse COMPARE_BUILD into COMPARE_BUILD_*
+# Syntax: COMPARE_BUILD=CONF=:PATCH=:
+# MAKE=:COMP_OPTS=:
+# COMP_DIR=|:
+# FAIL=
+# If neither CONF or PATCH is given, assume means CONF if it
+# begins with "--", otherwise assume it means PATCH.
+# MAKE and COMP_OPTS can only be used with CONF and/or PATCH specified.
+# If any value contains "+", it will be replaced by space.
+# FAIL can be set to false to have the return value of compare be ignored.
+define ParseCompareBuild
+ ifneq ($$(COMPARE_BUILD), )
+ COMPARE_BUILD_OUTPUTDIR := $(WORKSPACE_ROOT)/build/compare-build/$(CONF_NAME)
+ COMPARE_BUILD_FAIL := true
+
+ ifneq ($$(findstring :, $$(COMPARE_BUILD)), )
+ $$(foreach part, $$(subst :, , $$(COMPARE_BUILD)), \
+ $$(if $$(filter PATCH=%, $$(part)), \
+ $$(eval COMPARE_BUILD_PATCH = $$(strip $$(patsubst PATCH=%, %, $$(part)))) \
+ ) \
+ $$(if $$(filter CONF=%, $$(part)), \
+ $$(eval COMPARE_BUILD_CONF = $$(strip $$(subst +, , $$(patsubst CONF=%, %, $$(part))))) \
+ ) \
+ $$(if $$(filter MAKE=%, $$(part)), \
+ $$(eval COMPARE_BUILD_MAKE = $$(strip $$(subst +, , $$(patsubst MAKE=%, %, $$(part))))) \
+ ) \
+ $$(if $$(filter COMP_OPTS=%, $$(part)), \
+ $$(eval COMPARE_BUILD_COMP_OPTS = $$(strip $$(subst +, , $$(patsubst COMP_OPTS=%, %, $$(part))))) \
+ ) \
+ $$(if $$(filter COMP_DIR=%, $$(part)), \
+ $$(eval COMPARE_BUILD_COMP_DIR = $$(strip $$(subst +, , $$(patsubst COMP_DIR=%, %, $$(part))))) \
+ ) \
+ $$(if $$(filter FAIL=%, $$(part)), \
+ $$(eval COMPARE_BUILD_FAIL = $$(strip $$(subst +, , $$(patsubst FAIL=%, %, $$(part))))) \
+ ) \
+ $$(if $$(filter NODRYRUN=%, $$(part)), \
+ $$(eval COMPARE_BUILD_NODRYRUN = $$(strip $$(subst +, , $$(patsubst NODRYRUN=%, %, $$(part))))) \
+ ) \
+ )
else
- # Use spec.gmk files in the build output directory
- ifeq ($$(all_spec_files), )
- ifneq ($(CUSTOM_ROOT), )
- $$(info Error: No configurations found for $$(CUSTOM_ROOT).)
- else
- $$(info Error: No configurations found for $$(topdir).)
- endif
- $$(info Please run 'bash configure' to create a configuration.)
- $$(info )
- $$(error Cannot continue)
- endif
-
- ifneq ($$(origin CONF_NAME), undefined)
- ifneq ($$(origin CONF), undefined)
- # We also have a CONF argument. We can't have both.
- $$(info Error: Cannot use CONF=$$(CONF) and CONF_NAME=$$(CONF_NAME) at the same time. Choose one.)
- $$(error Cannot continue)
- endif
- matching_conf := $$(strip $$(filter $$(CONF_NAME), $$(all_confs)))
- ifeq ($$(matching_conf), )
- $$(info Error: No configurations found matching CONF_NAME=$$(CONF_NAME).)
- $$(info Available configurations in $$(build_dir):)
- $$(foreach var, $$(all_confs), $$(info * $$(var)))
- $$(error Cannot continue)
- else ifneq ($$(words $$(matching_conf)), 1)
- $$(info Error: Matching more than one configuration CONF_NAME=$$(CONF_NAME).)
- $$(info Available configurations in $$(build_dir):)
- $$(foreach var, $$(all_confs), $$(info * $$(var)))
- $$(error Cannot continue)
- else
- $$(info Building configuration '$$(matching_conf)' (matching CONF_NAME=$$(CONF_NAME)))
- endif
- # Create a SPEC definition. This will contain the path to exactly one spec file.
- SPECS := $$(build_dir)/$$(matching_conf)/spec.gmk
- else ifneq ($$(origin CONF), undefined)
- # User have given a CONF= argument.
- ifeq ($$(CONF), )
- # If given CONF=, match all configurations
- matching_confs := $$(strip $$(all_confs))
- else
- # Otherwise select those that contain the given CONF string
- ifeq ($$(patsubst !%,,$$(CONF)), )
- # A CONF starting with ! means we should negate the search term
- matching_confs := $$(strip $$(foreach var, $$(all_confs), \
- $$(if $$(findstring $$(subst !,,$$(CONF)), $$(var)), ,$$(var))))
- else
- matching_confs := $$(strip $$(foreach var, $$(all_confs), \
- $$(if $$(findstring $$(CONF), $$(var)), $$(var))))
- endif
- ifneq ($$(filter $$(CONF), $$(matching_confs)), )
- # 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), )
- $$(info Error: No configurations found matching CONF=$$(CONF).)
- $$(info Available configurations in $$(build_dir):)
- $$(foreach var, $$(all_confs), $$(info * $$(var)))
- $$(error Cannot continue)
- else
- # Don't repeat this output on make restarts caused by including
- # generated files.
- ifeq ($$(MAKE_RESTARTS), )
- ifeq ($$(words $$(matching_confs)), 1)
- ifneq ($$(findstring $$(LOG_LEVEL), info debug trace), )
- $$(info Building configuration '$$(matching_confs)' (matching CONF=$$(CONF)))
- endif
- else
- $$(info Building these configurations (matching CONF=$$(CONF)):)
- $$(foreach var, $$(matching_confs), $$(info * $$(var)))
- endif
- endif
- endif
-
- # Create a SPEC definition. This will contain the path to one or more spec.gmk files.
- SPECS := $$(addsuffix /spec.gmk, $$(addprefix $$(build_dir)/, $$(matching_confs)))
+ # Separate handling for single field case, to allow for spaces in values.
+ ifneq ($$(filter PATCH=%, $$(COMPARE_BUILD)), )
+ COMPARE_BUILD_PATCH = $$(strip $$(patsubst PATCH=%, %, $$(COMPARE_BUILD)))
+ else ifneq ($$(filter CONF=%, $$(COMPARE_BUILD)), )
+ COMPARE_BUILD_CONF = $$(strip $$(subst +, , $$(patsubst CONF=%, %, $$(COMPARE_BUILD))))
+ else ifneq ($$(filter --%, $$(COMPARE_BUILD)), )
+ # Assume CONF if value begins with --
+ COMPARE_BUILD_CONF = $$(strip $$(subst +, , $$(COMPARE_BUILD)))
else
- # No CONF or SPEC given, check the available configurations
- ifneq ($$(words $$(all_spec_files)), 1)
- $$(info Error: No CONF given, but more than one configuration found.)
- $$(info Available configurations in $$(build_dir):)
- $$(foreach var, $$(all_confs), $$(info * $$(var)))
- $$(info Please retry building with CONF= (or SPEC=).)
- $$(info )
- $$(error Cannot continue)
- endif
-
- # We found exactly one configuration, use it
- SPECS := $$(strip $$(all_spec_files))
+ # Otherwise assume patch file
+ COMPARE_BUILD_PATCH = $$(strip $$(COMPARE_BUILD))
endif
endif
- endef
-
- # Extract main targets from Main.gmk using the spec provided in $2.
- #
- # Param 1: FORCE = force generation of main-targets.gmk or LAZY = do not force.
- # Param 2: The SPEC file to use.
- define DefineMainTargets
-
- # We will start by making sure the main-targets.gmk file is removed, if
- # make has not been restarted. By the -include, we will trigger the
- # rule for generating the file (which is never there since we removed it),
- # thus generating it fresh, and make will restart, incrementing the restart
- # count.
- main_targets_file := $$(dir $(strip $2))make-support/main-targets.gmk
-
- ifeq ($$(MAKE_RESTARTS), )
- # Only do this if make has not been restarted, and if we do not force it.
- ifeq ($(strip $1), FORCE)
- $$(shell rm -f $$(main_targets_file))
+ ifneq ($$(COMPARE_BUILD_PATCH), )
+ ifneq ($$(wildcard $$(WORKSPACE_ROOT)/$$(COMPARE_BUILD_PATCH)), )
+ # Assume relative path, if file exists
+ COMPARE_BUILD_PATCH := $$(wildcard $$(WORKSPACE_ROOT)/$$(COMPARE_BUILD_PATCH))
+ else ifeq ($$(wildcard $$(COMPARE_BUILD_PATCH)), )
+ $$(error Patch file $$(COMPARE_BUILD_PATCH) does not exist)
endif
- endif
-
- $$(main_targets_file):
- @( cd $$(topdir) && \
- $$(MAKE) $$(MAKE_LOG_FLAGS) -r -R -f $$(topdir)/make/Main.gmk \
- -I $$(topdir)/make/common SPEC=$(strip $2) NO_RECIPES=true \
- $$(MAKE_LOG_VARS) \
- create-main-targets-include )
-
- # Now include main-targets.gmk. This will define ALL_MAIN_TARGETS.
- -include $$(main_targets_file)
- endef
-
- define PrintConfCheckFailed
- @echo ' '
- @echo "Please rerun configure! Easiest way to do this is by running"
- @echo "'make reconfigure'."
- @echo "This behavior may also be changed using CONF_CHECK=."
- @echo ' '
- endef
-
-else # $(HAS_SPEC)=true
- ##############################################################################
- # Helper functions for the 'main' target. These functions assume a single,
- # proper and existing SPEC is included.
- ##############################################################################
-
- include $(TOPDIR)/make/common/MakeBase.gmk
-
- # Define basic logging setup
- BUILD_LOG := $(OUTPUTDIR)/build.log
- BUILD_PROFILE_LOG := $(OUTPUTDIR)/build-profile.log
-
- BUILD_LOG_PIPE := > >($(TEE) -a $(BUILD_LOG)) 2> >($(TEE) -a $(BUILD_LOG) >&2) && wait
- # Use this for simple echo/printf commands that are never expected to print
- # to stderr.
- BUILD_LOG_PIPE_SIMPLE := | $(TEE) -a $(BUILD_LOG)
-
- ifneq ($(CUSTOM_ROOT), )
- topdir = $(CUSTOM_ROOT)
- else
- topdir = $(TOPDIR)
- endif
-
- # Setup the build environment to match the requested specification on
- # level of reproducible builds
- define SetupReproducibleBuild
- ifeq ($$(SOURCE_DATE), updated)
- # For static values of SOURCE_DATE (not "updated"), these are set in spec.gmk
- export SOURCE_DATE_EPOCH := $$(shell $$(DATE) +"%s")
- export SOURCE_DATE_ISO_8601 := $$(call EpochToISO8601, $$(SOURCE_DATE_EPOCH))
- endif
- endef
-
- # Parse COMPARE_BUILD into COMPARE_BUILD_*
- # Syntax: COMPARE_BUILD=CONF=:PATCH=:
- # MAKE=:COMP_OPTS=:
- # COMP_DIR=|:
- # FAIL=
- # If neither CONF or PATCH is given, assume means CONF if it
- # begins with "--", otherwise assume it means PATCH.
- # MAKE and COMP_OPTS can only be used with CONF and/or PATCH specified.
- # If any value contains "+", it will be replaced by space.
- # FAIL can be set to false to have the return value of compare be ignored.
- define ParseCompareBuild
- ifneq ($$(COMPARE_BUILD), )
- COMPARE_BUILD_OUTPUTDIR := $(topdir)/build/compare-build/$(CONF_NAME)
- COMPARE_BUILD_FAIL := true
-
- ifneq ($$(findstring :, $$(COMPARE_BUILD)), )
- $$(foreach part, $$(subst :, , $$(COMPARE_BUILD)), \
- $$(if $$(filter PATCH=%, $$(part)), \
- $$(eval COMPARE_BUILD_PATCH = $$(strip $$(patsubst PATCH=%, %, $$(part)))) \
- ) \
- $$(if $$(filter CONF=%, $$(part)), \
- $$(eval COMPARE_BUILD_CONF = $$(strip $$(subst +, , $$(patsubst CONF=%, %, $$(part))))) \
- ) \
- $$(if $$(filter MAKE=%, $$(part)), \
- $$(eval COMPARE_BUILD_MAKE = $$(strip $$(subst +, , $$(patsubst MAKE=%, %, $$(part))))) \
- ) \
- $$(if $$(filter COMP_OPTS=%, $$(part)), \
- $$(eval COMPARE_BUILD_COMP_OPTS = $$(strip $$(subst +, , $$(patsubst COMP_OPTS=%, %, $$(part))))) \
- ) \
- $$(if $$(filter COMP_DIR=%, $$(part)), \
- $$(eval COMPARE_BUILD_COMP_DIR = $$(strip $$(subst +, , $$(patsubst COMP_DIR=%, %, $$(part))))) \
- ) \
- $$(if $$(filter FAIL=%, $$(part)), \
- $$(eval COMPARE_BUILD_FAIL = $$(strip $$(subst +, , $$(patsubst FAIL=%, %, $$(part))))) \
- ) \
- $$(if $$(filter NODRYRUN=%, $$(part)), \
- $$(eval COMPARE_BUILD_NODRYRUN = $$(strip $$(subst +, , $$(patsubst NODRYRUN=%, %, $$(part))))) \
- ) \
- )
- else
- # Separate handling for single field case, to allow for spaces in values.
- ifneq ($$(filter PATCH=%, $$(COMPARE_BUILD)), )
- COMPARE_BUILD_PATCH = $$(strip $$(patsubst PATCH=%, %, $$(COMPARE_BUILD)))
- else ifneq ($$(filter CONF=%, $$(COMPARE_BUILD)), )
- COMPARE_BUILD_CONF = $$(strip $$(subst +, , $$(patsubst CONF=%, %, $$(COMPARE_BUILD))))
- else ifneq ($$(filter --%, $$(COMPARE_BUILD)), )
- # Assume CONF if value begins with --
- COMPARE_BUILD_CONF = $$(strip $$(subst +, , $$(COMPARE_BUILD)))
- else
- # Otherwise assume patch file
- COMPARE_BUILD_PATCH = $$(strip $$(COMPARE_BUILD))
+ ifneq ($$(COMPARE_BUILD_NODRYRUN), true)
+ PATCH_DRY_RUN := $$(shell cd $$(WORKSPACE_ROOT) && $$(PATCH) --dry-run -p1 < $$(COMPARE_BUILD_PATCH) > /dev/null 2>&1 || $$(ECHO) FAILED)
+ ifeq ($$(PATCH_DRY_RUN), FAILED)
+ $$(error Patch file $$(COMPARE_BUILD_PATCH) does not apply cleanly)
endif
endif
- ifneq ($$(COMPARE_BUILD_PATCH), )
- ifneq ($$(wildcard $$(topdir)/$$(COMPARE_BUILD_PATCH)), )
- # Assume relative path, if file exists
- COMPARE_BUILD_PATCH := $$(wildcard $$(topdir)/$$(COMPARE_BUILD_PATCH))
- else ifeq ($$(wildcard $$(COMPARE_BUILD_PATCH)), )
- $$(error Patch file $$(COMPARE_BUILD_PATCH) does not exist)
- endif
- ifneq ($$(COMPARE_BUILD_NODRYRUN), true)
- PATCH_DRY_RUN := $$(shell cd $$(topdir) && $$(PATCH) --dry-run -p1 < $$(COMPARE_BUILD_PATCH) > /dev/null 2>&1 || $$(ECHO) FAILED)
- ifeq ($$(PATCH_DRY_RUN), FAILED)
- $$(error Patch file $$(COMPARE_BUILD_PATCH) does not apply cleanly)
- endif
- endif
- endif
- ifneq ($$(COMPARE_BUILD_FAIL), true)
- COMPARE_BUILD_IGNORE_RESULT := || true
- endif
endif
- endef
+ ifneq ($$(COMPARE_BUILD_FAIL), true)
+ COMPARE_BUILD_IGNORE_RESULT := || true
+ endif
+ endif
+endef
- # Prepare for a comparison rebuild
- define PrepareCompareBuild
+# Prepare for a comparison rebuild
+define PrepareCompareBuild
$(ECHO) "Preparing for comparison rebuild"
# Apply patch, if any
- $(if $(COMPARE_BUILD_PATCH), cd $(topdir) && $(PATCH) -p1 < $(COMPARE_BUILD_PATCH))
+ $(if $(COMPARE_BUILD_PATCH), cd $(WORKSPACE_ROOT) && $(PATCH) -p1 < $(COMPARE_BUILD_PATCH))
# Move the first build away temporarily
- $(RM) -r $(topdir)/build/.compare-build-temp
- $(MKDIR) -p $(topdir)/build/.compare-build-temp
- $(MV) $(OUTPUTDIR) $(topdir)/build/.compare-build-temp
+ $(RM) -r $(WORKSPACE_ROOT)/build/.compare-build-temp
+ $(MKDIR) -p $(WORKSPACE_ROOT)/build/.compare-build-temp
+ $(MV) $(OUTPUTDIR) $(WORKSPACE_ROOT)/build/.compare-build-temp
# Restore an old compare-build, or create a new compare-build directory.
if test -d $(COMPARE_BUILD_OUTPUTDIR); then \
$(MV) $(COMPARE_BUILD_OUTPUTDIR) $(OUTPUTDIR); \
@@ -422,23 +140,23 @@ else # $(HAS_SPEC)=true
# Re-run configure with the same arguments (and possibly some additional),
# must be done after patching.
( cd $(CONFIGURE_START_DIR) && PATH="$(ORIGINAL_PATH)" \
- $(BASH) $(topdir)/configure $(CONFIGURE_COMMAND_LINE) $(COMPARE_BUILD_CONF))
- endef
+ $(BASH) $(WORKSPACE_ROOT)/configure $(CONFIGURE_COMMAND_LINE) $(COMPARE_BUILD_CONF))
+endef
- # Cleanup after a compare build
- define CleanupCompareBuild
+# Cleanup after a compare build
+define CleanupCompareBuild
# If running with a COMPARE_BUILD patch, reverse-apply it, but continue
# even if that fails (can happen with removed files).
- $(if $(COMPARE_BUILD_PATCH), cd $(topdir) && $(PATCH) -R -p1 < $(COMPARE_BUILD_PATCH) || true)
+ $(if $(COMPARE_BUILD_PATCH), cd $(WORKSPACE_ROOT) && $(PATCH) -R -p1 < $(COMPARE_BUILD_PATCH) || true)
# Move this build away and restore the original build
- $(MKDIR) -p $(topdir)/build/compare-build
+ $(MKDIR) -p $(WORKSPACE_ROOT)/build/compare-build
$(MV) $(OUTPUTDIR) $(COMPARE_BUILD_OUTPUTDIR)
- $(MV) $(topdir)/build/.compare-build-temp/$(CONF_NAME) $(OUTPUTDIR)
- $(RM) -r $(topdir)/build/.compare-build-temp
- endef
+ $(MV) $(WORKSPACE_ROOT)/build/.compare-build-temp/$(CONF_NAME) $(OUTPUTDIR)
+ $(RM) -r $(WORKSPACE_ROOT)/build/.compare-build-temp
+endef
- # Do the actual comparison of two builds
- define CompareBuildDoComparison
+# Do the actual comparison of two builds
+define CompareBuildDoComparison
# Compare first and second build. Ignore any error code from compare.sh.
$(ECHO) "Comparing between comparison rebuild (this/new) and baseline (other/old)"
$(if $(COMPARE_BUILD_COMP_DIR), \
@@ -448,9 +166,9 @@ else # $(HAS_SPEC)=true
+(cd $(COMPARE_BUILD_OUTPUTDIR) && ./compare.sh --diffs $(COMPARE_BUILD_COMP_OPTS) \
-o $(OUTPUTDIR) $(COMPARE_BUILD_IGNORE_RESULT)) \
)
- endef
+endef
- define PrintFailureReports
+define PrintFailureReports
$(if $(filter none, $(LOG_REPORT)), , \
$(RM) $(MAKESUPPORT_OUTPUTDIR)/failure-summary.log ; \
$(if $(wildcard $(MAKESUPPORT_OUTPUTDIR)/failure-logs/*.log), \
@@ -472,9 +190,9 @@ else # $(HAS_SPEC)=true
) >> $(MAKESUPPORT_OUTPUTDIR)/failure-summary.log \
) \
)
- endef
+endef
- define PrintBuildLogFailures
+define PrintBuildLogFailures
$(if $(filter none, $(LOG_REPORT)), , \
if $(GREP) -q "recipe for target .* failed" $(BUILD_LOG) 2> /dev/null; then \
$(PRINTF) "\n=== Make failed targets repeated here ===\n" ; \
@@ -487,96 +205,96 @@ else # $(HAS_SPEC)=true
fi >> $(MAKESUPPORT_OUTPUTDIR)/failure-summary.log ; \
$(CAT) $(MAKESUPPORT_OUTPUTDIR)/failure-summary.log \
)
- endef
+endef
- define RotateLogFiles
+define RotateLogFiles
$(RM) $(BUILD_LOG).old 2> /dev/null && \
$(MV) $(BUILD_LOG) $(BUILD_LOG).old 2> /dev/null || true
$(if $(findstring true, $(LOG_PROFILE_TIMES_FILE)), \
$(RM) $(BUILD_PROFILE_LOG).old 2> /dev/null && \
$(MV) $(BUILD_PROFILE_LOG) $(BUILD_PROFILE_LOG).old 2> /dev/null || true \
)
- endef
+endef
- # Failure logs are only supported for "parallel" main targets, not the
- # (trivial) sequential make targets (such as clean and reconfigure),
- # since the failure-logs directory creation will conflict with clean.
- # We also make sure the javatmp directory exists, which is needed if a java
- # process (like javac) is using java.io.tmpdir.
- define PrepareFailureLogs
+# Failure logs are only supported for "parallel" main targets, not the
+# (trivial) sequential make targets (such as clean and reconfigure),
+# since the failure-logs directory creation will conflict with clean.
+# We also make sure the javatmp directory exists, which is needed if a java
+# process (like javac) is using java.io.tmpdir.
+define PrepareFailureLogs
$(RM) -r $(MAKESUPPORT_OUTPUTDIR)/failure-logs 2> /dev/null && \
$(MKDIR) -p $(MAKESUPPORT_OUTPUTDIR)/failure-logs
$(MKDIR) -p $(JAVA_TMP_DIR)
$(RM) $(MAKESUPPORT_OUTPUTDIR)/exit-with-error 2> /dev/null
- endef
+endef
- # Remove any javac server logs and port files. This
- # prevents a new make run to reuse the previous servers.
- define PrepareJavacServer
+# Remove any javac server logs and port files. This
+# prevents a new make run to reuse the previous servers.
+define PrepareJavacServer
$(if $(JAVAC_SERVER_DIR), \
$(RM) -r $(JAVAC_SERVER_DIR) 2> /dev/null && \
$(MKDIR) -p $(JAVAC_SERVER_DIR) \
)
- endef
+endef
- define CleanupJavacServer
+define CleanupJavacServer
[ -f $(JAVAC_SERVER_DIR)/server.port ] && $(ECHO) Stopping javac server && \
$(TOUCH) $(JAVAC_SERVER_DIR)/server.port.stop; true
- endef
+endef
- ifeq ($(call isBuildOs, windows), true)
- # On windows we need to synchronize with the javac server to be able to
- # move or remove the build output directory. Since we have no proper
- # synchronization process, wait for a while and hope it helps. This is only
- # used by build comparisons.
+ifeq ($(call isBuildOs, windows), true)
+ # On windows we need to synchronize with the javac server to be able to
+ # move or remove the build output directory. Since we have no proper
+ # synchronization process, wait for a while and hope it helps. This is only
+ # used by build comparisons.
define WaitForJavacServerFinish
$(if $(JAVAC_SERVER_DIR), \
sleep 5 \
)
- endef
- else
- define WaitForJavacServerFinish
- endef
- endif
+ endef
+else
+ define WaitForJavacServerFinish
+ endef
+endif
- ##############################################################################
- # Functions for timers
- ##############################################################################
+##############################################################################
+# Functions for timers
+##############################################################################
- # Store the build times in this directory.
- BUILDTIMESDIR = $(OUTPUTDIR)/make-support/build-times
+# Store the build times in this directory.
+BUILDTIMESDIR := $(OUTPUTDIR)/make-support/build-times
- # Record starting time for build of a sub repository.
- define RecordStartTime
+# Record starting time for build of a sub repository.
+define RecordStartTime
$(DATE) '+%Y %m %d %H %M %S' | $(AWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_start_$(strip $1) && \
$(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_start_$(strip $1)_human_readable
- endef
+endef
- # Record ending time and calculate the difference and store it in a
- # easy to read format. Handles builds that cross midnight. Expects
- # that a build will never take 24 hours or more.
- define RecordEndTime
+# Record ending time and calculate the difference and store it in a
+# easy to read format. Handles builds that cross midnight. Expects
+# that a build will never take 24 hours or more.
+define RecordEndTime
$(DATE) '+%Y %m %d %H %M %S' | $(AWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_end_$(strip $1)
$(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_end_$(strip $1)_human_readable
$(ECHO) `$(CAT) $(BUILDTIMESDIR)/build_time_start_$(strip $1)` `$(CAT) $(BUILDTIMESDIR)/build_time_end_$(strip $1)` $1 | \
$(AWK) '{ F=$$7; T=$$14; if (F > T) { T+=3600*24 }; D=T-F; H=int(D/3600); \
M=int((D-H*3600)/60); S=D-H*3600-M*60; printf("%02d:%02d:%02d %s\n",H,M,S,$$15); }' \
> $(BUILDTIMESDIR)/build_time_diff_$(strip $1)
- endef
+endef
- define StartGlobalTimer
+define StartGlobalTimer
$(RM) -r $(BUILDTIMESDIR) 2> /dev/null && \
$(MKDIR) -p $(BUILDTIMESDIR) && \
$(call RecordStartTime,TOTAL)
- endef
+endef
- define StopGlobalTimer
+define StopGlobalTimer
$(call RecordEndTime,TOTAL)
- endef
+endef
- # Find all build_time_* files and print their contents in a list sorted
- # on the name of the sub repository.
- define ReportBuildTimes
+# Find all build_time_* files and print their contents in a list sorted
+# on the name of the sub repository.
+define ReportBuildTimes
$(PRINTF) $(LOG_INFO) -- \
"----- Build times -------\nStart %s\nEnd %s\n%s\n%s\n-------------------------\n" \
"`$(CAT) $(BUILDTIMESDIR)/build_time_start_TOTAL_human_readable`" \
@@ -585,119 +303,20 @@ else # $(HAS_SPEC)=true
$(XARGS) $(CAT) | $(SORT) -k 2`" \
"`$(CAT) $(BUILDTIMESDIR)/build_time_diff_TOTAL`" \
$(BUILD_LOG_PIPE_SIMPLE)
- endef
-
- define ReportProfileTimes
- $(if $(findstring true, $(LOG_PROFILE_TIMES_LOG)), \
- [ ! -f $(BUILD_PROFILE_LOG) ] || \
- { $(ECHO) Begin $(notdir $(BUILD_PROFILE_LOG)) && \
- $(CAT) $(BUILD_PROFILE_LOG) && \
- $(ECHO) End $(notdir $(BUILD_PROFILE_LOG)); \
- } \
- $(BUILD_LOG_PIPE_SIMPLE)
- )
- endef
-
-endif # HAS_SPEC
-
-# Look for a given option in the LOG variable, and if found, set a variable
-# and remove the option from the LOG variable
-# $1: The option to look for
-# $2: The variable to set to "true" if the option is found
-define ParseLogOption
- ifneq ($$(findstring $1, $$(LOG)), )
- override $2 := true
- # First try to remove "," if it exists, otherwise just remove " "
- LOG_STRIPPED := $$(subst $1,, $$(subst $$(COMMA)$$(strip $1),, $$(LOG)))
- # We might have ended up with a leading comma. Remove it. Need override
- # since LOG is set from the command line.
- override LOG := $$(strip $$(patsubst $$(COMMA)%, %, $$(LOG_STRIPPED)))
- endif
endef
-# Look for a given option with an assignment in the LOG variable, and if found,
-# set a variable to that value and remove the option from the LOG variable
-# $1: The option to look for
-# $2: The variable to set to the value of the option, if found
-define ParseLogValue
- ifneq ($$(findstring $1=, $$(LOG)), )
- # Make words of out comma-separated list and find the one with opt=val
- value := $$(strip $$(subst $$(strip $1)=,, $$(filter $$(strip $1)=%, $$(subst $$(COMMA), , $$(LOG)))))
- override $2 := $$(value)
- # First try to remove ", " if it exists, otherwise just remove " "
- LOG_STRIPPED := $$(subst $$(strip $1)=$$(value),, \
- $$(subst $$(COMMA)$$(strip $1)=$$(value),, $$(LOG)))
- # We might have ended up with a leading comma. Remove it. Need override
- # since LOG is set from the command line.
- override LOG := $$(strip $$(patsubst $$(COMMA)%, %, $$(LOG_STRIPPED)))
- endif
+define ReportProfileTimes
+ $(if $(findstring true, $(LOG_PROFILE_TIMES_LOG)), \
+ [ ! -f $(BUILD_PROFILE_LOG) ] || \
+ { $(ECHO) Begin $(notdir $(BUILD_PROFILE_LOG)) && \
+ $(CAT) $(BUILD_PROFILE_LOG) && \
+ $(ECHO) End $(notdir $(BUILD_PROFILE_LOG)); \
+ } \
+ $(BUILD_LOG_PIPE_SIMPLE)
+ )
endef
+################################################################################
-define ParseLogLevel
- # Catch old-style VERBOSE= command lines.
- ifneq ($$(origin VERBOSE), undefined)
- $$(info Error: VERBOSE is deprecated. Use LOG= instead.)
- $$(error Cannot continue)
- endif
-
- # Setup logging according to LOG
-
- # If "nofile" is present, do not log to a file
- $$(eval $$(call ParseLogOption, nofile, LOG_NOFILE))
-
- # If "cmdline" is present, print all executes "important" command lines.
- $$(eval $$(call ParseLogOption, cmdlines, LOG_CMDLINES))
-
- # If "report" is present, use non-standard reporting options at build failure.
- $$(eval $$(call ParseLogValue, report, LOG_REPORT))
- ifneq ($$(LOG_REPORT), )
- ifeq ($$(filter $$(LOG_REPORT), none all default), )
- $$(info Error: LOG=report has invalid value: $$(LOG_REPORT).)
- $$(info Valid values: LOG=report=||)
- $$(error Cannot continue)
- endif
- endif
-
- # If "profile-to-log" is present, write shell times in build log
- $$(eval $$(call ParseLogOption, profile-to-log, LOG_PROFILE_TIMES_LOG))
-
- # If "profile" is present, write shell times in separate log file
- # IMPORTANT: $(ParseLogOption profile-to-log) should go first. Otherwise
- # parsing of 'LOG=debug,profile-to-log,nofile' ends up in the following error:
- # Error: LOG contains unknown option or log level: debug-to-log.
- $$(eval $$(call ParseLogOption, profile, LOG_PROFILE_TIMES_FILE))
-
- # Treat LOG=profile-to-log as if it were LOG=profile,profile-to-log
- LOG_PROFILE_TIMES_FILE := $$(firstword $$(LOG_PROFILE_TIMES_FILE) $$(LOG_PROFILE_TIMES_LOG))
-
- override LOG_LEVEL := $$(LOG)
-
- ifeq ($$(LOG_LEVEL), )
- # Set LOG to "warn" as default if not set
- override LOG_LEVEL := warn
- endif
-
- ifeq ($$(LOG_LEVEL), warn)
- override MAKE_LOG_FLAGS := -s
- else ifeq ($$(LOG_LEVEL), info)
- override MAKE_LOG_FLAGS := -s
- else ifeq ($$(LOG_LEVEL), debug)
- override MAKE_LOG_FLAGS :=
- else ifeq ($$(LOG_LEVEL), trace)
- override MAKE_LOG_FLAGS :=
- else
- $$(info Error: LOG contains unknown option or log level: $$(LOG).)
- $$(info LOG can be [,[...]] where is nofile | cmdlines | profile | profile-to-log)
- $$(info and is warn | info | debug | trace)
- $$(error Cannot continue)
- endif
-endef
-
-MAKE_LOG_VARS = $(foreach v, \
- LOG_LEVEL LOG_NOFILE LOG_CMDLINES LOG_REPORT LOG_PROFILE_TIMES_LOG \
- LOG_PROFILE_TIMES_FILE, \
- $v=$($v) \
-)
-
-endif # _INITSUPPORT_GMK
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/InterimImage.gmk b/make/InterimImage.gmk
index e046f06051343..5fd685509aeeb 100644
--- a/make/InterimImage.gmk
+++ b/make/InterimImage.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,10 +23,9 @@
# questions.
#
-default: all
+include MakeFileStart.gmk
-include $(SPEC)
-include MakeBase.gmk
+################################################################################
include Execute.gmk
include Modules.gmk
@@ -58,6 +57,4 @@ TARGETS += $(jlink_interim_image)
################################################################################
-all: $(TARGETS)
-
-.PHONY: all
+include MakeFileEnd.gmk
diff --git a/make/JrtfsJar.gmk b/make/JrtfsJar.gmk
index e1b3965ba0429..54e2b094318fa 100644
--- a/make/JrtfsJar.gmk
+++ b/make/JrtfsJar.gmk
@@ -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
@@ -23,14 +23,13 @@
# questions.
#
-default: all
+include MakeFileStart.gmk
-include $(SPEC)
-include MakeBase.gmk
+################################################################################
include CopyFiles.gmk
-include JavaCompilation.gmk
include JarArchive.gmk
+include JavaCompilation.gmk
include TextFileProcessing.gmk
# This rule will be depended on due to the MANIFEST line
@@ -78,3 +77,7 @@ $(eval $(call SetupJarArchive, BUILD_JRTFS_JAR, \
))
all: $(BUILD_JRTFS_JAR)
+
+################################################################################
+
+include MakeFileEnd.gmk
diff --git a/make/MacBundles.gmk b/make/MacBundles.gmk
index 13b80b8e56e52..f80ca1e27351b 100644
--- a/make/MacBundles.gmk
+++ b/make/MacBundles.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
@@ -23,8 +23,9 @@
# questions.
#
-include $(SPEC)
-include MakeBase.gmk
+include MakeFileStart.gmk
+
+################################################################################
include CopyFiles.gmk
include TextFileProcessing.gmk
@@ -118,3 +119,7 @@ else # Not macosx
endif # macosx
.PHONY: jdk-bundle jre-bundle bundles
+
+################################################################################
+
+include MakeFileEnd.gmk
diff --git a/make/Main.gmk b/make/Main.gmk
index 7675fe6fcf718..f2f1bce0e1062 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
@@ -24,44 +24,35 @@
#
################################################################################
-# This is the main makefile containing most actual top level targets. It needs
-# to be called with a SPEC file defined.
+# This is the main makefile containing most actual top level targets.
################################################################################
-# Declare default target
-default:
+# Declare ALL_TARGETS as an immediate variable. This variable is a list of all
+# valid top level targets. It's used to declare them all as PHONY and to
+# generate the -only targets.
-ifeq ($(wildcard $(SPEC)), )
- $(error Main.gmk needs SPEC set to a proper spec.gmk)
-endif
+ALL_TARGETS :=
+
+DEFAULT_TARGET := default-target
-# Now load the spec
-include $(SPEC)
+include MakeFileStart.gmk
-# Load the vital tools for all the makefiles.
-include $(TOPDIR)/make/common/MakeBase.gmk
-include $(TOPDIR)/make/common/Modules.gmk
-include $(TOPDIR)/make/common/FindTests.gmk
+################################################################################
include $(TOPDIR)/make/MainSupport.gmk
+include FindTests.gmk
+include Modules.gmk
+
# Are we requested to ignore dependencies?
ifneq ($(findstring -only, $(MAKECMDGOALS)), )
DEPS := none
endif
-# Declare ALL_TARGETS as an immediate variable. This variable is a list of all
-# valid top level targets. It's used to declare them all as PHONY and to
-# generate the -only targets.
-ALL_TARGETS :=
-
-# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, Main.gmk))
# All modules for the current target platform.
ALL_MODULES := $(call FindAllModules)
-################################################################################
################################################################################
#
# Recipes for all targets. Only recipes, dependencies are declared later.
@@ -356,6 +347,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
@@ -754,6 +753,17 @@ $(eval $(call SetupTarget, test-image-lib, \
DEPS := build-test-lib, \
))
+$(eval $(call SetupTarget, build-test-setup-aot, \
+ MAKEFILE := test/BuildTestSetupAOT, \
+ DEPS := interim-langtools exploded-image, \
+))
+
+$(eval $(call SetupTarget, test-image-setup-aot, \
+ MAKEFILE := test/BuildTestSetupAOT, \
+ TARGET := images, \
+ DEPS := build-test-setup-aot, \
+))
+
ifeq ($(BUILD_FAILURE_HANDLER), true)
# Builds the failure handler jtreg extension
$(eval $(call SetupTarget, build-test-failure-handler, \
@@ -1282,7 +1292,8 @@ all-docs-bundles: docs-jdk-bundles docs-javase-bundles docs-reference-bundles
# This target builds the test image
test-image: prepare-test-image test-image-jdk-jtreg-native \
test-image-demos-jdk test-image-libtest-jtreg-native \
- test-image-lib test-image-lib-native
+ test-image-lib test-image-lib-native \
+ test-image-setup-aot
ifneq ($(JVM_TEST_IMAGE_TARGETS), )
# If JVM_TEST_IMAGE_TARGETS is externally defined, use it instead of the
@@ -1334,7 +1345,7 @@ ALL_TARGETS += buildtools hotspot hotspot-libs hotspot-static-libs \
# Traditional targets typically run by users.
# These can be considered aliases for the targets now named by a more
# "modern" naming scheme.
-default: $(DEFAULT_MAKE_TARGET)
+default-target: $(DEFAULT_MAKE_TARGET)
jdk: exploded-image
images: product-images
docs: docs-image
@@ -1369,7 +1380,6 @@ ALL_TARGETS += $(RUN_TEST_TARGETS) run-test exploded-run-test check \
test-hotspot-jtreg test-hotspot-jtreg-native test-hotspot-gtest \
test-jdk-jtreg-native test-docs
-################################################################################
################################################################################
#
# Clean targets
@@ -1475,13 +1485,12 @@ print-tests:
create-main-targets-include:
$(call LogInfo, Generating main target list)
+ $(call MakeDir, $(MAKESUPPORT_OUTPUTDIR))
@$(ECHO) ALL_MAIN_TARGETS := $(sort $(ALL_TARGETS)) > \
$(MAKESUPPORT_OUTPUTDIR)/main-targets.gmk
-################################################################################
-# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, Main-post.gmk))
-
.PHONY: $(ALL_TARGETS)
FRC: # Force target
+
+include MakeFileEnd.gmk
diff --git a/make/MainSupport.gmk b/make/MainSupport.gmk
index 5a5e40d025a59..f7ba4de2d53c5 100644
--- a/make/MainSupport.gmk
+++ b/make/MainSupport.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
@@ -23,13 +23,13 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
################################################################################
# This file contains helper functions for Main.gmk.
################################################################################
-ifndef _MAINSUPPORT_GMK
-_MAINSUPPORT_GMK := 1
-
# Setup make rules for creating a top-level target.
# Parameter 1 is the name of the rule. This name is used as variable prefix.
#
@@ -218,4 +218,5 @@ endef
################################################################################
-endif # _MAINSUPPORT_GMK
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/ModuleTools.gmk b/make/ModuleTools.gmk
index 020e12d6e4b61..3b26ce86c28e2 100644
--- a/make/ModuleTools.gmk
+++ b/make/ModuleTools.gmk
@@ -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
@@ -23,8 +23,10 @@
# questions.
#
-ifndef _MODULE_TOOLS_GMK
-_MODULE_TOOLS_GMK := 1
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
+################################################################################
include JavaCompilation.gmk
@@ -49,4 +51,7 @@ TOOL_ADD_PACKAGES_ATTRIBUTE := $(BUILD_JAVA) $(JAVA_FLAGS_SMALL_BUILDJDK) \
--add-exports java.base/jdk.internal.module=ALL-UNNAMED \
build.tools.jigsaw.AddPackagesAttribute
-endif # _MODULE_TOOLS_GMK
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/ModuleWrapper.gmk b/make/ModuleWrapper.gmk
index 51208432ea004..b3ddf940e008c 100644
--- a/make/ModuleWrapper.gmk
+++ b/make/ModuleWrapper.gmk
@@ -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
@@ -23,27 +23,29 @@
# questions.
#
+include MakeFileStart.gmk
+
################################################################################
# This makefile is called from Main.gmk, through a macro in MakeHelpers.gmk
# and wraps calls to makefiles for specific modules and build phases. Having
# this wrapper reduces the need for boilerplate code. It also provides
# opportunity for automatic copying of files to an interim exploded runnable
# image.
-
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
+################################################################################
include CopyFiles.gmk
MODULE_SRC := $(TOPDIR)/src/$(MODULE)
-# All makefiles should add the targets to be built to this variable.
-TARGETS :=
+# Define the snippet for MakeSnippetStart/End
+THIS_SNIPPET := modules/$(MODULE)/$(MAKEFILE_PREFIX).gmk
+
+include MakeSnippetStart.gmk
# Include the file being wrapped.
-include $(MAKEFILE_PREFIX).gmk
+include $(THIS_SNIPPET)
+
+include MakeSnippetEnd.gmk
ifeq ($(MAKEFILE_PREFIX), Lib)
# We need to keep track of what libraries are generated/needed by this
@@ -128,8 +130,12 @@ $(eval $(call SetupCopyFiles, COPY_CONF, \
))
ifeq ($(GENERATE_COMPILE_COMMANDS_ONLY), true)
- all: $(filter $(MAKESUPPORT_OUTPUTDIR)/compile-commands/%, $(TARGETS))
+ TARGETS := $(filter $(MAKESUPPORT_OUTPUTDIR)/compile-commands/%, $(TARGETS))
else
- all: $(TARGETS) $(COPY_LIBS_TO_BIN) $(COPY_LIBS_TO_LIB) \
+ TARGETS += $(COPY_LIBS_TO_BIN) $(COPY_LIBS_TO_LIB) \
$(COPY_INCLUDE) $(COPY_CMDS) $(COPY_MAN) $(COPY_CONF) $(LINK_LIBS_TO_LIB)
endif
+
+################################################################################
+
+include MakeFileEnd.gmk
diff --git a/make/PreInit.gmk b/make/PreInit.gmk
new file mode 100644
index 0000000000000..b4c0402da3dfb
--- /dev/null
+++ b/make/PreInit.gmk
@@ -0,0 +1,224 @@
+#
+# 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+################################################################################
+# This file is the earliest part of the build bootstrap process (not counting
+# Makefile that includes it). Its main responsibility is to figure out what
+# configuration to use and pick up the corresponding SPEC file. It will then
+# call Init.gmk with this SPEC for further bootstrapping.
+################################################################################
+
+# This must be the first rule
+default:
+.PHONY: default
+
+# Inclusion of this pseudo-target will cause make to execute this file
+# serially, regardless of -j.
+.NOTPARALLEL:
+
+IS_PREINIT_ENV := true
+
+# Include our helper functions.
+include $(TOPDIR)/make/PreInitSupport.gmk
+include $(TOPDIR)/make/common/LogUtils.gmk
+
+# Here are "global" targets, i.e. targets that can be executed without having
+# a configuration. This will define ALL_GLOBAL_TARGETS.
+include $(TOPDIR)/make/Global.gmk
+
+# CALLED_TARGETS is the list of targets that the user provided,
+# or "default" if unspecified.
+CALLED_TARGETS := $(if $(MAKECMDGOALS), $(MAKECMDGOALS), default)
+
+# Extract non-global targets that require a spec file.
+CALLED_SPEC_TARGETS := $(filter-out $(ALL_GLOBAL_TARGETS), $(CALLED_TARGETS))
+
+# If we have only global targets, or if we are called with -qp (assuming an
+# external part, e.g. bash completion, is trying to understand our targets),
+# we will skip SPEC location and the sanity checks.
+ifeq ($(CALLED_SPEC_TARGETS), )
+ SKIP_SPEC := true
+endif
+ifeq ($(findstring p, $(MAKEFLAGS))$(findstring q, $(MAKEFLAGS)), pq)
+ SKIP_SPEC := true
+endif
+
+ifneq ($(SKIP_SPEC), true)
+
+ ############################################################################
+ # This is the common case: we have been called from the command line by the
+ # user with a target that should be delegated to Main.gmk, so we need to
+ # figure out a proper SPEC and call Init.gmk with it.
+ ############################################################################
+
+ # Basic checks on environment and command line.
+ $(eval $(call CheckControlVariables))
+ $(eval $(call CheckDeprecatedEnvironment))
+ $(eval $(call CheckInvalidMakeFlags))
+
+ # Check that CONF_CHECK is valid.
+ $(eval $(call ParseConfCheckOption))
+
+ # Check that the LOG given is valid, and set LOG_LEVEL, LOG_NOFILE,
+ # MAKE_LOG_VARS and MAKE_LOG_FLAGS.
+ $(eval $(call ParseLogLevel))
+
+ # After this SPECS contain 1..N spec files (otherwise ParseConfAndSpec fails).
+ $(eval $(call ParseConfAndSpec))
+
+ # Extract main targets from Main.gmk using the spec(s) provided. In theory,
+ # with multiple specs, we should find the intersection of targets provided
+ # by all specs, but we approximate this by an arbitrary spec from the list.
+ # This will setup ALL_MAIN_TARGETS.
+ $(eval $(call DefineMainTargets, FORCE, $(firstword $(SPECS))))
+
+ # Targets provided by Init.gmk.
+ ALL_INIT_TARGETS := print-modules print-targets print-configuration \
+ print-tests reconfigure pre-compare-build post-compare-build
+
+ # Separate called targets depending on type.
+ INIT_TARGETS := $(filter $(ALL_INIT_TARGETS), $(CALLED_SPEC_TARGETS))
+ MAIN_TARGETS := $(filter $(ALL_MAIN_TARGETS), $(CALLED_SPEC_TARGETS))
+ SEQUENTIAL_TARGETS := $(filter dist-clean clean%, $(MAIN_TARGETS))
+ PARALLEL_TARGETS := $(filter-out $(SEQUENTIAL_TARGETS), $(MAIN_TARGETS))
+
+ MAKE_INIT_ARGS := $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -I $(TOPDIR)/make/common
+
+ # The spec files depend on the autoconf source code. This check makes sure
+ # the configuration is up to date after changes to configure.
+ $(SPECS): $(wildcard $(TOPDIR)/make/autoconf/*) \
+ $(if $(CUSTOM_CONFIG_DIR), $(wildcard $(CUSTOM_CONFIG_DIR)/*)) \
+ $(addprefix $(TOPDIR)/make/conf/, version-numbers.conf branding.conf) \
+ $(if $(CUSTOM_CONF_DIR), $(wildcard $(addprefix $(CUSTOM_CONF_DIR)/, \
+ version-numbers.conf branding.conf)))
+ ifeq ($(CONF_CHECK), fail)
+ @echo Error: The configuration is not up to date for \
+ "'$(lastword $(subst /, , $(dir $@)))'."
+ $(call PrintConfCheckFailed)
+ @exit 2
+ else ifeq ($(CONF_CHECK), auto)
+ @echo Note: The configuration is not up to date for \
+ "'$(lastword $(subst /, , $(dir $@)))'."
+ @( cd $(TOPDIR) && \
+ $(MAKE) $(MAKE_INIT_ARGS) -f $(TOPDIR)/make/Init.gmk SPEC=$@ \
+ reconfigure )
+ else ifeq ($(CONF_CHECK), ignore)
+ # Do nothing
+ endif
+
+ # Do not let make delete spec files even if aborted while doing a reconfigure
+ .PRECIOUS: $(SPECS)
+
+ # Unless reconfigure is explicitly called, let all main targets depend on
+ # the spec files to be up to date.
+ ifeq ($(findstring reconfigure, $(INIT_TARGETS)), )
+ $(MAIN_TARGETS): $(SPECS)
+ endif
+
+ make-info:
+ ifneq ($(findstring $(LOG_LEVEL), info debug trace), )
+ $(info Running make as '$(strip $(MAKE) $(MFLAGS) \
+ $(COMMAND_LINE_VARIABLES) $(MAKECMDGOALS))')
+ endif
+
+ MAKE_INIT_MAIN_TARGET_ARGS := \
+ USER_MAKE_VARS="$(USER_MAKE_VARS)" MAKE_LOG_FLAGS=$(MAKE_LOG_FLAGS) \
+ $(MAKE_LOG_VARS) \
+ INIT_TARGETS="$(INIT_TARGETS)" \
+ SEQUENTIAL_TARGETS="$(SEQUENTIAL_TARGETS)" \
+ PARALLEL_TARGETS="$(PARALLEL_TARGETS)"
+
+ # Now the init and main targets will be called, once for each SPEC. The
+ # recipe will be run once for every target specified, but we only want to
+ # execute the recipe a single time, hence the TARGET_DONE with a dummy
+ # command if true.
+ # The COMPARE_BUILD part implements special support for makefile development.
+ $(ALL_INIT_TARGETS) $(ALL_MAIN_TARGETS): make-info
+ @$(if $(TARGET_DONE), \
+ true \
+ , \
+ ( cd $(TOPDIR) && \
+ $(foreach spec, $(SPECS), \
+ $(MAKE) $(MAKE_INIT_ARGS) -j 1 -f $(TOPDIR)/make/Init.gmk \
+ SPEC=$(spec) $(MAKE_INIT_MAIN_TARGET_ARGS) \
+ main && \
+ $(if $(and $(COMPARE_BUILD), $(PARALLEL_TARGETS)), \
+ $(MAKE) $(MAKE_INIT_ARGS) -f $(TOPDIR)/make/Init.gmk \
+ SPEC=$(spec) \
+ COMPARE_BUILD="$(COMPARE_BUILD)" \
+ pre-compare-build && \
+ $(MAKE) $(MAKE_INIT_ARGS) -j 1 -f $(TOPDIR)/make/Init.gmk \
+ SPEC=$(spec) $(MAKE_INIT_MAIN_TARGET_ARGS) \
+ COMPARE_BUILD="$(COMPARE_BUILD):NODRYRUN=true" \
+ main && \
+ $(MAKE) $(MAKE_INIT_ARGS) -f $(TOPDIR)/make/Init.gmk \
+ SPEC=$(spec) \
+ COMPARE_BUILD="$(COMPARE_BUILD):NODRYRUN=true" \
+ post-compare-build && \
+ ) \
+ ) true ) \
+ $(eval TARGET_DONE=true) \
+ )
+
+ .PHONY: $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS)
+
+else # SKIP_SPEC=true
+
+ ############################################################################
+ # We have only global targets, or are called with -pq (from command
+ # completion). In this case we might not even have a configuration at all, but
+ # still need to handle the situation gracefully even if there is no SPEC file.
+ ############################################################################
+
+ ifeq ($(wildcard $(SPEC)), )
+ # If we have no SPEC provided, we will just make a "best effort" target list.
+ # First try to grab any available pre-existing main-targets.gmk.
+ main_targets_file := $(firstword $(wildcard $(build_dir)/*/make-support/main-targets.gmk))
+ ifneq ($(main_targets_file), )
+ # Extract the SPEC that corresponds to this main-targets.gmk file.
+ SPEC := $(patsubst %/make-support/main-targets.gmk, %/spec.gmk, $(main_targets_file))
+ else
+ # None found, pick an arbitrary SPEC for which to generate a file
+ SPEC := $(firstword $(all_spec_files))
+ endif
+ endif
+
+ ifneq ($(wildcard $(SPEC)), )
+ $(eval $(call DefineMainTargets, LAZY, $(SPEC)))
+ else
+ # If we have no configurations we can not provide any main targets.
+ ALL_MAIN_TARGETS :=
+ endif
+
+ ALL_TARGETS := $(sort $(ALL_GLOBAL_TARGETS) $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS))
+
+ # Just list all our targets.
+ $(ALL_TARGETS):
+
+ .PHONY: $(ALL_TARGETS)
+
+endif # $(SKIP_SPEC)!=true
+
+################################################################################
diff --git a/make/PreInitSupport.gmk b/make/PreInitSupport.gmk
new file mode 100644
index 0000000000000..c3741589330c9
--- /dev/null
+++ b/make/PreInitSupport.gmk
@@ -0,0 +1,299 @@
+#
+# 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+################################################################################
+# Helper functions for PreInit.gmk, the initial part of initialization before
+# the SPEC file is loaded. Most of these functions provide parsing and setting
+# up make options from the command-line.
+################################################################################
+
+# Include the corresponding closed file, if present.
+ifneq ($(CUSTOM_MAKE_DIR), )
+ -include $(CUSTOM_MAKE_DIR)/PreInitSupport-pre.gmk
+endif
+
+# COMMA is defined in spec.gmk, but that is not included yet
+COMMA := ,
+
+# Essential control variables that are handled by PreInit.gmk or Init.gmk
+INIT_CONTROL_VARIABLES := LOG CONF CONF_NAME SPEC JOBS CONF_CHECK ALLOW \
+ COMPARE_BUILD
+
+# 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.
+reverse = \
+ $(if $(strip $(1)), $(call reverse, $(wordlist 2, $(words $(1)), $(1)))) \
+ $(firstword $(1))
+
+# The variable MAKEOVERRIDES contains variable assignments from the command
+# line, but in reverse order to what the user entered.
+# The '§' <=> '\ 'dance is needed to keep values with space in them connected.
+COMMAND_LINE_VARIABLES := $(subst §,\ , $(call reverse, $(subst \ ,§,$(MAKEOVERRIDES))))
+
+# A list like FOO="val1" BAR="val2" containing all user-supplied make
+# variables that we should propagate.
+# The '§' <=> '\ 'dance is needed to keep values with space in them connected.
+# This explicit propagation is needed to avoid problems with characters that needs
+# escaping.
+USER_MAKE_VARS := $(subst §,\ , $(filter-out $(addsuffix =%, $(ALL_CONTROL_VARIABLES)), \
+ $(subst \ ,§,$(MAKEOVERRIDES))))
+
+# Setup information about available configurations, if any.
+ifneq ($(CUSTOM_ROOT), )
+ build_dir := $(CUSTOM_ROOT)/build
+else
+ build_dir := $(TOPDIR)/build
+endif
+all_spec_files := $(wildcard $(build_dir)/*/spec.gmk)
+# Extract the configuration names from the path
+all_confs := $(patsubst %/spec.gmk, %, $(patsubst $(build_dir)/%, %, $(all_spec_files)))
+
+# Check for unknown command-line variables
+define CheckControlVariables
+ 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 $$(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))))
+ $$(info Make sure it is not mistyped, and that you intend to override this variable.)
+ $$(info 'make help' will list known control variables.)
+ $$(info )
+ endif
+endef
+
+# Check for deprecated ALT_ variables
+define CheckDeprecatedEnvironment
+ defined_alt_variables := $$(filter ALT_%, $$(.VARIABLES))
+ ifneq ($$(defined_alt_variables), )
+ $$(info Warning: You have the following ALT_ variables set:)
+ $$(foreach var, $$(defined_alt_variables), $$(info * $$(var)=$$($$(var))))
+ $$(info ALT_ variables are deprecated, and may result in a failed build.)
+ $$(info Please clean your environment.)
+ $$(info )
+ endif
+endef
+
+# Check for invalid make flags like -j
+define CheckInvalidMakeFlags
+ # This is a trick to get this rule to execute before any other rules
+ # MAKEFLAGS only indicate -j if read in a recipe (!)
+ $$(TOPDIR)/make/PreInit.gmk: .FORCE
+ $$(if $$(findstring --jobserver, $$(MAKEFLAGS)), \
+ $$(info Error: 'make -jN' is not supported, use 'make JOBS=N') \
+ $$(error Cannot continue) \
+ )
+ .FORCE:
+ .PHONY: .FORCE
+endef
+
+# Check that the CONF_CHECK option is valid and set up handling
+define ParseConfCheckOption
+ ifeq ($$(CONF_CHECK), )
+ # Default behavior is fail
+ CONF_CHECK := fail
+ else ifneq ($$(filter-out auto fail ignore, $$(CONF_CHECK)), )
+ $$(info Error: CONF_CHECK must be one of: auto, fail or ignore.)
+ $$(error Cannot continue)
+ endif
+endef
+
+define ParseConfAndSpec
+ ifneq ($$(origin SPEC), undefined)
+ # We have been given a SPEC, check that it works out properly
+ ifneq ($$(origin CONF), undefined)
+ # We also have a CONF argument. We can't have both.
+ $$(info Error: Cannot use CONF=$$(CONF) and SPEC=$$(SPEC) at the same time. Choose one.)
+ $$(error Cannot continue)
+ endif
+ ifneq ($$(origin CONF_NAME), undefined)
+ # We also have a CONF_NAME argument. We can't have both.
+ $$(info Error: Cannot use CONF_NAME=$$(CONF_NAME) and SPEC=$$(SPEC) at the same time. Choose one.)
+ $$(error Cannot continue)
+ endif
+ ifeq ($$(wildcard $$(SPEC)), )
+ $$(info Error: Cannot locate spec.gmk, given by SPEC=$$(SPEC).)
+ $$(error Cannot continue)
+ endif
+ ifeq ($$(filter /%, $$(SPEC)), )
+ # If given with relative path, make it absolute
+ SPECS := $$(CURDIR)/$$(strip $$(SPEC))
+ else
+ SPECS := $$(SPEC)
+ endif
+
+ # For now, unset this SPEC variable.
+ override SPEC :=
+ else
+ # Use spec.gmk files in the build output directory
+ ifeq ($$(all_spec_files), )
+ ifneq ($(CUSTOM_ROOT), )
+ $$(info Error: No configurations found for $$(CUSTOM_ROOT).)
+ else
+ $$(info Error: No configurations found for $$(TOPDIR).)
+ endif
+ $$(info Please run 'bash configure' to create a configuration.)
+ $$(info )
+ $$(error Cannot continue)
+ endif
+
+ ifneq ($$(origin CONF_NAME), undefined)
+ ifneq ($$(origin CONF), undefined)
+ # We also have a CONF argument. We can't have both.
+ $$(info Error: Cannot use CONF=$$(CONF) and CONF_NAME=$$(CONF_NAME) at the same time. Choose one.)
+ $$(error Cannot continue)
+ endif
+ matching_conf := $$(strip $$(filter $$(CONF_NAME), $$(all_confs)))
+ ifeq ($$(matching_conf), )
+ $$(info Error: No configurations found matching CONF_NAME=$$(CONF_NAME).)
+ $$(info Available configurations in $$(build_dir):)
+ $$(foreach var, $$(all_confs), $$(info * $$(var)))
+ $$(error Cannot continue)
+ else ifneq ($$(words $$(matching_conf)), 1)
+ $$(info Error: Matching more than one configuration CONF_NAME=$$(CONF_NAME).)
+ $$(info Available configurations in $$(build_dir):)
+ $$(foreach var, $$(all_confs), $$(info * $$(var)))
+ $$(error Cannot continue)
+ else
+ $$(info Building configuration '$$(matching_conf)' (matching CONF_NAME=$$(CONF_NAME)))
+ endif
+ # Create a SPEC definition. This will contain the path to exactly one spec file.
+ SPECS := $$(build_dir)/$$(matching_conf)/spec.gmk
+ else ifneq ($$(origin CONF), undefined)
+ # User have given a CONF= argument.
+ ifeq ($$(CONF), )
+ # If given CONF=, match all configurations
+ matching_confs := $$(strip $$(all_confs))
+ else
+ # Otherwise select those that contain the given CONF string
+ ifeq ($$(patsubst !%,,$$(CONF)), )
+ # A CONF starting with ! means we should negate the search term
+ matching_confs := $$(strip $$(foreach var, $$(all_confs), \
+ $$(if $$(findstring $$(subst !,,$$(CONF)), $$(var)), ,$$(var))))
+ else
+ matching_confs := $$(strip $$(foreach var, $$(all_confs), \
+ $$(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)
+ endif
+ endif
+ ifeq ($$(matching_confs), )
+ $$(info Error: No configurations found matching CONF=$$(CONF).)
+ $$(info Available configurations in $$(build_dir):)
+ $$(foreach var, $$(all_confs), $$(info * $$(var)))
+ $$(error Cannot continue)
+ else
+ # Don't repeat this output on make restarts caused by including
+ # generated files.
+ ifeq ($$(MAKE_RESTARTS), )
+ ifeq ($$(words $$(matching_confs)), 1)
+ ifneq ($$(findstring $$(LOG_LEVEL), info debug trace), )
+ $$(info Building configuration '$$(matching_confs)' (matching CONF=$$(CONF)))
+ endif
+ else
+ $$(info Building these configurations (matching CONF=$$(CONF)):)
+ $$(foreach var, $$(matching_confs), $$(info * $$(var)))
+ endif
+ endif
+ endif
+
+ # Create a SPEC definition. This will contain the path to one or more spec.gmk files.
+ SPECS := $$(addsuffix /spec.gmk, $$(addprefix $$(build_dir)/, $$(matching_confs)))
+ else
+ # No CONF or SPEC given, check the available configurations
+ ifneq ($$(words $$(all_spec_files)), 1)
+ $$(info Error: No CONF given, but more than one configuration found.)
+ $$(info Available configurations in $$(build_dir):)
+ $$(foreach var, $$(all_confs), $$(info * $$(var)))
+ $$(info Please retry building with CONF= (or SPEC=).)
+ $$(info )
+ $$(error Cannot continue)
+ endif
+
+ # We found exactly one configuration, use it
+ SPECS := $$(strip $$(all_spec_files))
+ endif
+ endif
+endef
+
+# Extract main targets from Main.gmk using the spec provided in $2.
+#
+# Param 1: FORCE = force generation of main-targets.gmk or LAZY = do not force.
+# Param 2: The SPEC file to use.
+define DefineMainTargets
+
+ # We will start by making sure the main-targets.gmk file is removed, if
+ # make has not been restarted. By the -include, we will trigger the
+ # rule for generating the file (which is never there since we removed it),
+ # thus generating it fresh, and make will restart, incrementing the restart
+ # count.
+ main_targets_file := $$(dir $(strip $2))make-support/main-targets.gmk
+
+ ifeq ($$(MAKE_RESTARTS), )
+ # Only do this if make has not been restarted, and if we do not force it.
+ ifeq ($(strip $1), FORCE)
+ $$(shell rm -f $$(main_targets_file))
+ endif
+ endif
+
+ $$(main_targets_file):
+ @( cd $$(TOPDIR) && \
+ $$(MAKE) $$(MAKE_LOG_FLAGS) -r -R -f $$(TOPDIR)/make/Main.gmk \
+ -I $$(TOPDIR)/make/common SPEC=$(strip $2) NO_RECIPES=true \
+ $$(MAKE_LOG_VARS) \
+ create-main-targets-include )
+
+ # Now include main-targets.gmk. This will define ALL_MAIN_TARGETS.
+ -include $$(main_targets_file)
+endef
+
+define PrintConfCheckFailed
+ @echo ' '
+ @echo "Please rerun configure! Easiest way to do this is by running"
+ @echo "'make reconfigure'."
+ @echo "This behavior may also be changed using CONF_CHECK=."
+ @echo ' '
+endef
+
+################################################################################
diff --git a/make/ReleaseFile.gmk b/make/ReleaseFile.gmk
index dc6f66a69a2af..4204dfc76d56a 100644
--- a/make/ReleaseFile.gmk
+++ b/make/ReleaseFile.gmk
@@ -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
@@ -23,16 +23,12 @@
# questions.
#
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
+include MakeFileStart.gmk
################################################################################
# This makefile generates the "release" file into the exploded image. Jlink is
# then responsible for using this as the base for release files in each linked
# image.
-#
################################################################################
BASE_RELEASE_FILE := $(JDK_OUTPUTDIR)/release
@@ -85,10 +81,4 @@ TARGETS += $(BASE_RELEASE_FILE)
################################################################################
-$(eval $(call IncludeCustomExtension, ReleaseFile.gmk))
-
-################################################################################
-
-all: $(TARGETS)
-
-.PHONY: all default
+include MakeFileEnd.gmk
diff --git a/make/RunTests.gmk b/make/RunTests.gmk
index 636d1ed18b23b..616341a89019e 100644
--- a/make/RunTests.gmk
+++ b/make/RunTests.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,10 +23,10 @@
# questions.
#
-default: all
+include MakeFileStart.gmk
+
+################################################################################
-include $(SPEC)
-include MakeBase.gmk
include FindTests.gmk
# We will always run multiple tests serially
@@ -71,13 +71,13 @@ ifeq ($(call isTargetOs, windows), true)
endif
endif
-################################################################################
-# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, RunTests.gmk))
################################################################################
# This is the JDK that we will test
JDK_UNDER_TEST := $(JDK_IMAGE_DIR)
+# The JDK used to compile jtreg test code. By default it is the same as
+# JDK_UNDER_TEST.
+JDK_FOR_COMPILE := $(JDK_IMAGE_DIR)
TEST_RESULTS_DIR := $(OUTPUTDIR)/test-results
TEST_SUPPORT_DIR := $(OUTPUTDIR)/test-support
@@ -108,8 +108,8 @@ ifneq ($(wildcard $(JTREG_FAILURE_HANDLER)), )
#
endif
-GTEST_LAUNCHER_DIRS := $(patsubst %/gtestLauncher, %, \
- $(wildcard $(TEST_IMAGE_DIR)/hotspot/gtest/*/gtestLauncher))
+GTEST_LAUNCHER_DIRS := $(patsubst %/gtestLauncher$(EXECUTABLE_SUFFIX), %, \
+ $(wildcard $(TEST_IMAGE_DIR)/hotspot/gtest/*/gtestLauncher$(EXECUTABLE_SUFFIX)))
GTEST_VARIANTS := $(strip $(patsubst $(TEST_IMAGE_DIR)/hotspot/gtest/%, %, \
$(GTEST_LAUNCHER_DIRS)))
@@ -703,6 +703,9 @@ define SetJtregValue
endif
endef
+################################################################################
+# Helper function for creating a customized AOT cache for running tests
+################################################################################
# Parameter 1 is the name of the rule.
#
@@ -713,48 +716,47 @@ endef
# $1_AOT_TARGETS List of all targets that the test rule will need to depend on
# $1_AOT_JDK_CACHE The AOT cache file to be used to run the test with
#
-SetupAot = $(NamedParamsMacroTemplate)
-define SetupAotBody
- $1_AOT_JDK_CONF := $$($1_TEST_SUPPORT_DIR)/aot/jdk.aotconf
+SetupAOT = $(NamedParamsMacroTemplate)
+define SetupAOTBody
+ $1_AOT_JDK_CONF := $$($1_TEST_SUPPORT_DIR)/aot/jdk.aotconf
$1_AOT_JDK_CACHE := $$($1_TEST_SUPPORT_DIR)/aot/jdk.aotcache
-
- $1_JAVA_TOOL_OPTS := $$(addprefix -J, $$($1_VM_OPTIONS))
+ $1_AOT_JDK_LOG := $$($1_TEST_SUPPORT_DIR)/aot/TestSetupAOT.log
+
+ # We execute the training run with $(TEST_IMAGE_DIR)/setup_aot/TestSetupAOT.class
+ # to touch a fair number of classes inside the JDK. Note that we can't specify a classpath,
+ # or else the AOT cache cannot be used with jtreg test cases that use a different value
+ # for their classpaths. Instead, we run in the $(TEST_IMAGE_DIR)/setup_aot/ directory.
+ # The "java" launcher will have an implicit classpath of ".", so it can pick up the TestSetupAOT
+ # class from the JVM's current directory.
+ #
+ # The TestSetupAOT class (or any other classes that are loaded from ".") will be excluded
+ # from the the AOT cache as "." is an unsupported location. As a result, the AOT cache will contain
+ # only classes from the JDK.
$$($1_AOT_JDK_CACHE): $$(JDK_IMAGE_DIR)/release
$$(call MakeDir, $$($1_TEST_SUPPORT_DIR)/aot)
- $(foreach jtool, javac javap jlink jar, \
- $(info AOT: Create cache configuration for $(jtool)) \
- $$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/aot.$(jtool), ( \
- $$(FIXPATH) $(JDK_UNDER_TEST)/bin/$(jtool) $$($1_JAVA_TOOL_OPTS) \
- -J-XX:AOTMode=record -J-XX:AOTConfiguration=$$($1_AOT_JDK_CONF).$(jtool) --help \
- ))
- )
-
- $$(info AOT: Copy $(JDK_UNDER_TEST)/lib/classlist to $$($1_AOT_JDK_CONF).jdk )
+ $$(call LogWarn, AOT: Create cache configuration) \
$$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/aot, ( \
- $$(FIXPATH) $(CP) $(JDK_UNDER_TEST)/lib/classlist $$($1_AOT_JDK_CONF).jdk \
+ $(CD) $(TEST_IMAGE_DIR)/setup_aot; \
+ $$(FIXPATH) $(JDK_UNDER_TEST)/bin/java $$($1_VM_OPTIONS) \
+ -Xlog:cds,cds+class=debug:file=$$($1_AOT_JDK_CONF).log -Xlog:cds*=error \
+ -XX:AOTMode=record -XX:AOTConfiguration=$$($1_AOT_JDK_CONF) \
+ TestSetupAOT > $$($1_AOT_JDK_LOG) \
))
- $$(FIXPATH) $$(CAT) $$($1_AOT_JDK_CONF).* > $$($1_AOT_JDK_CONF).temp
- $$(FIXPATH) $$(CAT) $$($1_AOT_JDK_CONF).temp | $(GREP) -v '#' | $(GREP) -v '@' | $(SORT) | \
- $(SED) -e 's/id:.*//g' | uniq \
- > $$($1_AOT_JDK_CONF)
- $$(FIXPATH) $$(CAT) $$($1_AOT_JDK_CONF).temp | $(GREP) '@cp' | $(SORT) \
- >> $$($1_AOT_JDK_CONF)
-
- $$(info AOT: Generate AOT cache $$($1_AOT_JDK_CACHE) with flags: $$($1_VM_OPTIONS))
+ $$(call LogWarn, AOT: Generate AOT cache $$($1_AOT_JDK_CACHE) with flags: $$($1_VM_OPTIONS))
$$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/aot, ( \
- $$(FIXPATH) $(JDK_UNDER_TEST)/bin/java \
- $$($1_VM_OPTIONS) -Xlog:cds,cds+class=debug:file=$$($1_AOT_JDK_CACHE).log \
- -XX:AOTMode=create -XX:AOTConfiguration=$$($1_AOT_JDK_CONF) -XX:AOTCache=$$($1_AOT_JDK_CACHE) \
+ $$(FIXPATH) $(JDK_UNDER_TEST)/bin/java \
+ $$($1_VM_OPTIONS) -Xlog:cds,cds+class=debug:file=$$($1_AOT_JDK_CACHE).log -Xlog:cds*=error \
+ -XX:ExtraSharedClassListFile=$(JDK_UNDER_TEST)/lib/classlist \
+ -XX:AOTMode=create -XX:AOTConfiguration=$$($1_AOT_JDK_CONF) -XX:AOTCache=$$($1_AOT_JDK_CACHE) \
))
$1_AOT_TARGETS += $$($1_AOT_JDK_CACHE)
endef
-
SetupRunJtregTest = $(NamedParamsMacroTemplate)
define SetupRunJtregTestBody
$1_TEST_RESULTS_DIR := $$(TEST_RESULTS_DIR)/$1
@@ -946,11 +948,10 @@ define SetupRunJtregTestBody
endif
ifeq ($$(JTREG_AOT_JDK), true)
- $$(info Add AOT target for $1)
- $$(eval $$(call SetupAot, $1, VM_OPTIONS := $$(JTREG_ALL_OPTIONS) ))
+ $$(call LogWarn, Add AOT target for $1)
+ $$(eval $$(call SetupAOT, $1, VM_OPTIONS := $$(JTREG_ALL_OPTIONS) ))
- $$(info AOT_TARGETS=$$($1_AOT_TARGETS))
- $$(info AOT_JDK_CACHE=$$($1_AOT_JDK_CACHE))
+ $$(call LogWarn, AOT_JDK_CACHE=$$($1_AOT_JDK_CACHE))
$1_JTREG_BASIC_OPTIONS += -vmoption:-XX:AOTCache="$$($1_AOT_JDK_CACHE)"
endif
@@ -979,6 +980,7 @@ define SetupRunJtregTestBody
$$(JTREG_JAVA) $$($1_JTREG_LAUNCHER_OPTIONS) \
-Dprogram=jtreg -jar $$(JT_HOME)/lib/jtreg.jar \
$$($1_JTREG_BASIC_OPTIONS) \
+ -compilejdk:$$(JDK_FOR_COMPILE) \
-testjdk:$$(JDK_UNDER_TEST) \
-dir:$$(JTREG_TOPDIR) \
-reportDir:$$($1_TEST_RESULTS_DIR) \
@@ -1353,4 +1355,8 @@ endif
all: run-test
-.PHONY: default all $(TARGETS)
+.PHONY: $(TARGETS)
+
+################################################################################
+
+include MakeFileEnd.gmk
diff --git a/make/RunTestsPrebuilt.gmk b/make/RunTestsPrebuilt.gmk
index 95ad239e846ed..1ca22276c7526 100644
--- a/make/RunTestsPrebuilt.gmk
+++ b/make/RunTestsPrebuilt.gmk
@@ -24,9 +24,11 @@
#
################################################################################
-# Initial bootstrapping, copied and stripped down from Makefile and Init.gmk
+# Initial bootstrapping, copied and stripped down from Makefile and PreInit.gmk.
################################################################################
+IS_PREINIT_ENV := true
+
# In Cygwin, the MAKE variable gets prepended with the current directory if the
# make executable is called using a Windows mixed path (c:/cygwin/bin/make.exe).
ifneq ($(findstring :, $(MAKE)), )
@@ -57,7 +59,7 @@ TOPDIR := $(strip $(patsubst %/make/, %, $(dir $(makefile_path))))
define SetupVariable
ifeq ($$($1), )
ifeq ($2, )
- $$(info Error: Prebuilt variable $1 is missing, needed for run-tests-prebuilt)
+ $$(info Error: Prebuilt variable $1 is missing, needed for test-prebuilt)
$$(error Cannot continue.)
else ifeq ($2, OPTIONAL)
ifneq ($$(findstring $$(LOG), info debug trace), )
@@ -135,8 +137,8 @@ $(eval $(call SetupVariable,JIB_JAR,OPTIONAL))
# can include the prebuilt spec file ourselves, without an ephemeral spec
# wrapper. This is required so we can include MakeBase which is needed for
# CreateNewSpec.
-HAS_SPEC :=
-include $(TOPDIR)/make/InitSupport.gmk
+include $(TOPDIR)/make/PreInitSupport.gmk
+include $(TOPDIR)/make/common/LogUtils.gmk
$(eval $(call CheckDeprecatedEnvironment))
$(eval $(call CheckInvalidMakeFlags))
@@ -245,7 +247,7 @@ endif
# Now we can include additional custom support.
# This might define CUSTOM_NEW_SPEC_LINE
ifneq ($(CUSTOM_MAKE_DIR), )
- include $(CUSTOM_MAKE_DIR)/RunTestsPrebuilt.gmk
+ include $(CUSTOM_MAKE_DIR)/RunTestsPrebuilt-pre.gmk
endif
NEW_SPEC := $(OUTPUTDIR)/run-test-spec.gmk
@@ -295,13 +297,10 @@ test-prebuilt:
# is unfortunately not available at this point.
$(call MakeDir, $(MAKESUPPORT_OUTPUTDIR)/failure-logs)
@$(RM) -f $(MAKESUPPORT_OUTPUTDIR)/exit-with-error
- # The lazy initialization of the cache file in FindTests.gmk does not
- # always work with RunTests.gmk. To guarantee that the jtreg test groups
- # are always found and parsed, call FindTests.gmk stand alone once
- # before calling RunTests.gmk.
- @cd $(TOPDIR) && $(MAKE) $(MAKE_ARGS) -f make/common/FindTests.gmk \
- SPEC=$(SPEC) FINDTESTS_STAND_ALONE=true
- @cd $(TOPDIR) && $(MAKE) $(MAKE_ARGS) -f make/RunTests.gmk run-test \
+ # We need to fill the FindTest cache before entering RunTests.gmk.
+ @cd $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) SPEC=$(SPEC) \
+ -f RunTestsPrebuiltFindTests.gmk
+ @cd $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk run-test \
TEST="$(TEST)"
test-prebuilt-with-exit-code: test-prebuilt
diff --git a/make/RunTestsPrebuiltFindTests.gmk b/make/RunTestsPrebuiltFindTests.gmk
new file mode 100644
index 0000000000000..d8faa5cd0cd4e
--- /dev/null
+++ b/make/RunTestsPrebuiltFindTests.gmk
@@ -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. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+include MakeFileStart.gmk
+
+################################################################################
+# This makefile is a thin wrapper around FindTests.gmk, just to make FindTest
+# fill the cache.
+################################################################################
+
+GENERATE_FIND_TESTS_FILE := true
+include FindTests.gmk
+
+################################################################################
+
+include MakeFileEnd.gmk
diff --git a/make/SourceRevision.gmk b/make/SourceRevision.gmk
index 79c438987f7c9..285aaae17b591 100644
--- a/make/SourceRevision.gmk
+++ b/make/SourceRevision.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,10 +23,7 @@
# questions.
#
-include $(SPEC)
-include MakeBase.gmk
-
-$(eval $(call IncludeCustomExtension, SourceRevision-pre.gmk))
+include MakeFileStart.gmk
################################################################################
# Keep track of what source revision is used to create the build, by creating
@@ -38,6 +35,7 @@ $(eval $(call IncludeCustomExtension, SourceRevision-pre.gmk))
# bundle. As a part of creating this source bundle, the current SCM revisions of
# all repos will be stored in a file in the top dir, which is then used when
# creating the tracker file.
+################################################################################
STORED_SOURCE_REVISION := $(TOPDIR)/.src-rev
@@ -156,10 +154,6 @@ endif
################################################################################
-$(eval $(call IncludeCustomExtension, SourceRevision-post.gmk))
-
-################################################################################
-
store-source-revision: $(STORE_SOURCE_REVISION_TARGET)
create-source-revision-tracker: $(CREATE_SOURCE_REVISION_TRACKER_TARGET)
@@ -167,3 +161,7 @@ create-source-revision-tracker: $(CREATE_SOURCE_REVISION_TRACKER_TARGET)
FRC: # Force target
.PHONY: store-source-revision create-source-revision-tracker
+
+################################################################################
+
+include MakeFileEnd.gmk
diff --git a/make/StaticLibs.gmk b/make/StaticLibs.gmk
index d54c67b50b3ea..3fcbd0565c3c2 100644
--- a/make/StaticLibs.gmk
+++ b/make/StaticLibs.gmk
@@ -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,10 +23,9 @@
# questions.
#
-default: all
+include MakeFileStart.gmk
-include $(SPEC)
-include MakeBase.gmk
+################################################################################
include CopyFiles.gmk
include DebugInfoUtils.gmk
@@ -67,10 +66,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 +104,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, \
@@ -186,6 +184,8 @@ static-jdk-image: $(copy-from-jdk-image) $(copy-static-launcher) $(copy-static-l
TARGETS += static-jdk-image
-all: $(TARGETS)
+.PHONY: static-launcher static-jdk-image
+
+################################################################################
-.PHONY: all static-launcher static-jdk-image
+include MakeFileEnd.gmk
diff --git a/make/StaticLibsImage.gmk b/make/StaticLibsImage.gmk
index 6a181ff262f41..1f50c5b7f1b85 100644
--- a/make/StaticLibsImage.gmk
+++ b/make/StaticLibsImage.gmk
@@ -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
@@ -23,13 +23,12 @@
# questions.
#
+include MakeFileStart.gmk
+
+################################################################################
# This makefile creates an image of the optional static versions of certain JDK
# libraries.
-
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
+################################################################################
include CopyFiles.gmk
include Modules.gmk
@@ -38,8 +37,6 @@ ALL_MODULES = $(call FindAllModules)
################################################################################
-TARGETS :=
-
ifneq ($(filter static-libs-image, $(MAKECMDGOALS)), )
IMAGE_DEST_DIR = $(STATIC_LIBS_IMAGE_DIR)/lib
else ifneq ($(filter static-libs-graal-image, $(MAKECMDGOALS)), )
@@ -72,11 +69,9 @@ ifneq ($(filter static-libs-image, $(MAKECMDGOALS)), )
)
endif
-################################################################################
-
static-libs-image: $(HOTSPOT_VARIANT_STATIC_LIBS_TARGETS) $(STATIC_LIBS_TARGETS)
static-libs-graal-image: $(STATIC_LIBS_TARGETS)
-all: $(TARGETS)
+################################################################################
-.PHONY: all
+include MakeFileEnd.gmk
diff --git a/make/TestImage.gmk b/make/TestImage.gmk
index 5c788a8d0a60a..869cce1d55818 100644
--- a/make/TestImage.gmk
+++ b/make/TestImage.gmk
@@ -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
@@ -23,13 +23,7 @@
# questions.
#
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
-
-# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, TestImage-pre.gmk))
+include MakeFileStart.gmk
################################################################################
@@ -54,4 +48,8 @@ TARGETS += $(BUILD_INFO_PROPERTIES) $(README)
prepare-test-image: $(TARGETS)
all: prepare-test-image
-.PHONY: default all prepare-test-image
+.PHONY: prepare-test-image
+
+################################################################################
+
+include MakeFileEnd.gmk
diff --git a/make/ToolsHotspot.gmk b/make/ToolsHotspot.gmk
index f53d851c0b75f..60ef0f2e35e1b 100644
--- a/make/ToolsHotspot.gmk
+++ b/make/ToolsHotspot.gmk
@@ -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
@@ -23,8 +23,10 @@
# questions.
#
-ifndef _TOOLS_HOTSPOT_GMK
-_TOOLS_HOTSPOT_GMK := 1
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
+################################################################################
include JavaCompilation.gmk
@@ -44,4 +46,5 @@ TOOL_JFR_GEN := $(JAVA_SMALL) -cp $(HOTSPOT_TOOLS_OUTPUTDIR) \
################################################################################
-endif # _TOOLS_HOTSPOT_GMK
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/ToolsJdk.gmk b/make/ToolsJdk.gmk
index 98287473f3ea0..f301ddb53d103 100644
--- a/make/ToolsJdk.gmk
+++ b/make/ToolsJdk.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
@@ -23,13 +23,12 @@
# questions.
#
-ifndef _TOOLS_GMK
-_TOOLS_GMK := 1
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
-include JavaCompilation.gmk
+################################################################################
-# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, Tools.gmk))
+include JavaCompilation.gmk
################################################################################
# To avoid reevaluating the compilation setup for the tools each time this file
@@ -137,7 +136,5 @@ PANDOC_HTML_MANPAGE_FILTER := $(BUILDTOOLS_OUTPUTDIR)/manpages/pandoc-html-manpa
################################################################################
-# Hook to include the corresponding custom post file, if present.
-$(eval $(call IncludeCustomExtension, ToolsJdk-post.gmk))
-
-endif # _TOOLS_GMK
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/ToolsLangtools.gmk b/make/ToolsLangtools.gmk
index 86fb364a7cdb8..4146652bf8b07 100644
--- a/make/ToolsLangtools.gmk
+++ b/make/ToolsLangtools.gmk
@@ -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
@@ -23,11 +23,10 @@
# questions.
#
-# This must be the first rule
-default: all
+include MakeFileStart.gmk
+
+################################################################################
-include $(SPEC)
-include MakeBase.gmk
include JavaCompilation.gmk
################################################################################
@@ -43,3 +42,7 @@ $(eval $(call SetupJavaCompilation, BUILD_TOOLS_LANGTOOLS, \
))
all: $(BUILD_TOOLS_LANGTOOLS)
+
+################################################################################
+
+include MakeFileEnd.gmk
diff --git a/make/UpdateBuildDocs.gmk b/make/UpdateBuildDocs.gmk
index 7fed72e731109..b507789489f7f 100644
--- a/make/UpdateBuildDocs.gmk
+++ b/make/UpdateBuildDocs.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2017, 2019, 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
@@ -23,17 +23,14 @@
# questions.
#
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
-include ProcessMarkdown.gmk
+include MakeFileStart.gmk
################################################################################
# This makefile updates the generated build html documentation.
-#
################################################################################
+include ProcessMarkdown.gmk
+
ifeq ($(ENABLE_PANDOC), false)
$(info No pandoc executable was detected by configure)
$(error Cannot continue)
@@ -55,10 +52,4 @@ TARGETS += $(md_docs)
################################################################################
-$(eval $(call IncludeCustomExtension, UpdateBuildDocs.gmk))
-
-################################################################################
-
-all: $(TARGETS)
-
-.PHONY: all default
+include MakeFileEnd.gmk
diff --git a/make/UpdateSleefSource.gmk b/make/UpdateSleefSource.gmk
index 37a28abcb85c2..c7fdfdb41d918 100644
--- a/make/UpdateSleefSource.gmk
+++ b/make/UpdateSleefSource.gmk
@@ -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,15 +23,7 @@
# questions.
#
-################################################################################
-
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
-
-include CopyFiles.gmk
-include Execute.gmk
+include MakeFileStart.gmk
################################################################################
# This file is responsible for updating the generated sleef source code files
@@ -40,6 +32,9 @@ include Execute.gmk
# updated from upstream.
################################################################################
+include CopyFiles.gmk
+include Execute.gmk
+
ifneq ($(COMPILE_TYPE), cross)
$(error Only cross-compilation of libsleef is currently supported)
endif
@@ -148,6 +143,4 @@ TARGETS := $(copy_generated_sleef_source)
################################################################################
-all: $(TARGETS)
-
-.PHONY: all default
+include MakeFileEnd.gmk
diff --git a/make/UpdateX11Wrappers.gmk b/make/UpdateX11Wrappers.gmk
index f6f43ac2b5362..3ff2fc148fbde 100644
--- a/make/UpdateX11Wrappers.gmk
+++ b/make/UpdateX11Wrappers.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
@@ -23,15 +23,7 @@
# questions.
#
-################################################################################
-
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
-include Execute.gmk
-include JdkNativeCompilation.gmk
-include ToolsJdk.gmk
+include MakeFileStart.gmk
################################################################################
# This file is responsible for extracting the x11 native struct offsets to
@@ -43,6 +35,10 @@ include ToolsJdk.gmk
# GensrcX11Wrappers.gmk to generate the Java code during the build.
################################################################################
+include Execute.gmk
+include JdkNativeCompilation.gmk
+include $(TOPDIR)/make/ToolsJdk.gmk
+
ifeq ($(COMPILE_TYPE), cross)
$(error It is not possible to update the x11wrappers when cross-compiling)
endif
@@ -108,6 +104,4 @@ TARGETS += $(run_wrappergen) wrapper-information
################################################################################
-all: $(TARGETS)
-
-.PHONY: all default
+include MakeFileEnd.gmk
diff --git a/make/ZipSecurity.gmk b/make/ZipSecurity.gmk
index 08f9caadd9aec..fa5e4125290f6 100644
--- a/make/ZipSecurity.gmk
+++ b/make/ZipSecurity.gmk
@@ -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
@@ -23,10 +23,10 @@
# questions.
#
-default: all
+include MakeFileStart.gmk
+
+################################################################################
-include $(SPEC)
-include MakeBase.gmk
include ZipArchive.gmk
################################################################################
@@ -100,6 +100,4 @@ endif
################################################################################
-all: $(TARGETS)
-
-.PHONY: default all
+include MakeFileEnd.gmk
diff --git a/make/ZipSource.gmk b/make/ZipSource.gmk
index c1df6af758327..519339f207886 100644
--- a/make/ZipSource.gmk
+++ b/make/ZipSource.gmk
@@ -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
@@ -23,19 +23,16 @@
# questions.
#
-default: all
+include MakeFileStart.gmk
+
+################################################################################
-include $(SPEC)
-include MakeBase.gmk
include Modules.gmk
include ZipArchive.gmk
SRC_ZIP_WORK_DIR := $(SUPPORT_OUTPUTDIR)/src
$(if $(filter $(TOPDIR)/%, $(SUPPORT_OUTPUTDIR)), $(eval SRC_ZIP_BASE := $(TOPDIR)), $(eval SRC_ZIP_BASE := $(SUPPORT_OUTPUTDIR)))
-# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, ZipSource.gmk))
-
################################################################################
# Create the directory structure for src.zip using symlinks.
# //.java
@@ -95,8 +92,8 @@ zip: $(SRC_ZIP_SRCS)
TARGETS += zip
-################################################################################
+.PHONY: zip
-all: $(TARGETS)
+################################################################################
-.PHONY: default all zip
+include MakeFileEnd.gmk
diff --git a/make/autoconf/basic.m4 b/make/autoconf/basic.m4
index f574174a12e8a..d897cbafba79f 100644
--- a/make/autoconf/basic.m4
+++ b/make/autoconf/basic.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
@@ -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
@@ -618,4 +624,10 @@ AC_DEFUN_ONCE([BASIC_POST_CONFIG_OUTPUT],
# Make the compare script executable
$CHMOD +x $OUTPUTDIR/compare.sh
+
+ # Copy the linker wrapper script for clang on AIX and make it executable
+ if test "x$TOOLCHAIN_TYPE" = xclang && test "x$OPENJDK_TARGET_OS" = xaix; then
+ $CP -f "$TOPDIR/make/scripts/aix/ld.sh" "$OUTPUTDIR/ld.sh"
+ $CHMOD +x "$OUTPUTDIR/ld.sh"
+ fi
])
diff --git a/make/autoconf/flags-cflags.m4 b/make/autoconf/flags-cflags.m4
index d33f1885922d5..857e2b65e5753 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"
@@ -277,7 +278,7 @@ AC_DEFUN([FLAGS_SETUP_WARNINGS],
AC_DEFUN([FLAGS_SETUP_QUALITY_CHECKS],
[
# bounds, memory and behavior checking options
- if test "x$TOOLCHAIN_TYPE" = xgcc; then
+ if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
case $DEBUG_LEVEL in
release )
# no adjustment
@@ -346,7 +347,7 @@ AC_DEFUN([FLAGS_SETUP_OPTIMIZATION],
C_O_FLAG_DEBUG="-Od"
C_O_FLAG_DEBUG_JVM=""
C_O_FLAG_NONE="-Od"
- C_O_FLAG_SIZE="-Os"
+ C_O_FLAG_SIZE="-O1"
fi
# Now copy to C++ flags
@@ -516,12 +517,6 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
-fvisibility=hidden -fno-strict-aliasing -fno-omit-frame-pointer"
fi
- if test "x$TOOLCHAIN_TYPE" = xclang && test "x$OPENJDK_TARGET_OS" = xaix; then
- # clang compiler on aix needs -ffunction-sections
- TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -ffunction-sections -ftls-model -fno-math-errno -fstack-protector"
- TOOLCHAIN_CFLAGS_JDK="-ffunction-sections -fsigned-char -fstack-protector"
- fi
-
if test "x$TOOLCHAIN_TYPE" = xgcc; then
TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -fstack-protector"
TOOLCHAIN_CFLAGS_JDK="-fvisibility=hidden -pipe -fstack-protector"
@@ -541,7 +536,7 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
# Restrict the debug information created by Clang to avoid
# too big object files and speed the build up a little bit
# (see http://llvm.org/bugs/show_bug.cgi?id=7554)
- TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -flimit-debug-info"
+ TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -flimit-debug-info -fstack-protector"
# In principle the stack alignment below is cpu- and ABI-dependent and
# should agree with values of StackAlignmentInBytes in various
@@ -559,13 +554,19 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
TOOLCHAIN_CFLAGS_JDK="-pipe"
TOOLCHAIN_CFLAGS_JDK_CONLY="-fno-strict-aliasing" # technically NOT for CXX
fi
- TOOLCHAIN_CFLAGS_JDK="$TOOLCHAIN_CFLAGS_JDK -fvisibility=hidden"
+
+ if test "x$OPENJDK_TARGET_OS" = xaix; then
+ TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -ffunction-sections -ftls-model -fno-math-errno"
+ TOOLCHAIN_CFLAGS_JDK="-ffunction-sections -fsigned-char"
+ fi
+
+ TOOLCHAIN_CFLAGS_JDK="$TOOLCHAIN_CFLAGS_JDK -fvisibility=hidden -fstack-protector"
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++)
@@ -714,11 +715,13 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
if test "x$FLAGS_CPU" = xppc64; then
# -mminimal-toc fixes `relocation truncated to fit' error for gcc 4.1.
# Use ppc64 instructions, but schedule for power5
- $1_CFLAGS_CPU_JVM="${$1_CFLAGS_CPU_JVM} -mminimal-toc -mcpu=powerpc64 -mtune=power5"
+ $1_CFLAGS_CPU="-mcpu=powerpc64 -mtune=power5"
+ $1_CFLAGS_CPU_JVM="${$1_CFLAGS_CPU_JVM} -mminimal-toc"
elif 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"
+ $1_CFLAGS_CPU="-mcpu=power8 -mtune=power10"
+ $1_CFLAGS_CPU_JVM="${$1_CFLAGS_CPU_JVM} -DABI_ELFv2"
fi
elif test "x$FLAGS_CPU" = xs390x; then
$1_CFLAGS_CPU="-mbackchain -march=z10"
@@ -736,6 +739,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=power10"
+ fi
fi
if test "x$OPENJDK_TARGET_OS" = xaix; then
$1_CFLAGS_CPU="-mcpu=pwr8"
@@ -830,6 +838,22 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
FLAGS_SETUP_BRANCH_PROTECTION
+ if test "x$FLAGS_CPU" = xriscv64; then
+ AC_MSG_CHECKING([if RVV/vector sigcontext supported])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ],
+ [
+ return (int)sizeof(struct __riscv_v_ext_state);
+ ])],
+ [
+ AC_MSG_RESULT([yes])
+ ],
+ [
+ $1_DEFINES_CPU_JVM="${$1_DEFINES_CPU_JVM} -DNO_RVV_SIGCONTEXT"
+ AC_MSG_RESULT([no])
+ ]
+ )
+ fi
+
# EXPORT to API
CFLAGS_JVM_COMMON="$ALWAYS_CFLAGS_JVM $ALWAYS_DEFINES_JVM \
$TOOLCHAIN_CFLAGS_JVM ${$1_TOOLCHAIN_CFLAGS_JVM} \
diff --git a/make/autoconf/flags-ldflags.m4 b/make/autoconf/flags-ldflags.m4
index ffb1f0d6e1979..90947494ec8af 100644
--- a/make/autoconf/flags-ldflags.m4
+++ b/make/autoconf/flags-ldflags.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
@@ -79,7 +79,7 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER],
fi
if test "x$OPENJDK_TARGET_OS" = xaix; then
BASIC_LDFLAGS="-Wl,-b64 -Wl,-brtl -Wl,-bnorwexec -Wl,-bnolibpath -Wl,-bnoexpall \
- -Wl,-bernotok -Wl,-bdatapsize:64k -Wl,-btextpsize:64k -Wl,-bstackpsize:64k"
+ -Wl,-bernotok -Wl,-bdatapsize:64k -Wl,-btextpsize:64k -Wl,-bstackpsize:64k -fuse-ld=$OUTPUTDIR/ld.sh"
BASIC_LDFLAGS_JVM_ONLY="$BASIC_LDFLAGS_JVM_ONLY -Wl,-lC_r -Wl,-bbigtoc"
fi
@@ -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..991f57505dc50 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.
@@ -515,10 +516,11 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_UNDEFINED_BEHAVIOR_SANITIZER],
OPTIONAL: true)
# GCC reports lots of likely false positives for stringop-truncation and format-overflow.
+ # GCC 13 also for array-bounds and stringop-overflow
# Silence them for now.
UBSAN_CHECKS="-fsanitize=undefined -fsanitize=float-divide-by-zero -fno-sanitize=shift-base -fno-sanitize=alignment \
$ADDITIONAL_UBSAN_CHECKS"
- UBSAN_CFLAGS="$UBSAN_CHECKS -Wno-stringop-truncation -Wno-format-overflow -fno-omit-frame-pointer -DUNDEFINED_BEHAVIOR_SANITIZER"
+ UBSAN_CFLAGS="$UBSAN_CHECKS -Wno-stringop-truncation -Wno-format-overflow -Wno-array-bounds -Wno-stringop-overflow -fno-omit-frame-pointer -DUNDEFINED_BEHAVIOR_SANITIZER"
UBSAN_LDFLAGS="$UBSAN_CHECKS"
UTIL_ARG_ENABLE(NAME: ubsan, DEFAULT: false, RESULT: UBSAN_ENABLED,
DESC: [enable UndefinedBehaviorSanitizer],
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/lib-tests.m4 b/make/autoconf/lib-tests.m4
index afb9403080871..d2a4fcbb191c5 100644
--- a/make/autoconf/lib-tests.m4
+++ b/make/autoconf/lib-tests.m4
@@ -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
@@ -28,7 +28,7 @@
################################################################################
# Minimum supported versions
-JTREG_MINIMUM_VERSION=7.4
+JTREG_MINIMUM_VERSION=7.5.1
GTEST_MINIMUM_VERSION=1.14.0
################################################################################
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/CopyFiles.gmk b/make/common/CopyFiles.gmk
index 8ba216772459f..f56947f01f51a 100644
--- a/make/common/CopyFiles.gmk
+++ b/make/common/CopyFiles.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
@@ -23,14 +23,11 @@
# questions.
#
-ifeq ($(_MAKEBASE_GMK), )
- $(error You must include MakeBase.gmk prior to including CopyFiles.gmk)
-endif
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
################################################################################
-#
# Code for handling the SetupCopyFiles macro.
-#
################################################################################
define AddFileToCopy
@@ -110,3 +107,8 @@ define SetupCopyFilesBody
)
endef
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/common/DebugInfoUtils.gmk b/make/common/DebugInfoUtils.gmk
index 69d6c24b5e037..721dd06e587b4 100644
--- a/make/common/DebugInfoUtils.gmk
+++ b/make/common/DebugInfoUtils.gmk
@@ -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,14 +23,11 @@
# questions.
#
-ifeq ($(_MAKEBASE_GMK), )
- $(error You must include MakeBase.gmk prior to including DebugInfoUtils.gmk)
-endif
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
################################################################################
-#
# Common debuginfo utility functions
-#
################################################################################
################################################################################
@@ -56,3 +53,6 @@ else
$(if $(wildcard $1), $(call containing, .dSYM/, $(call FindFiles, $1)))
endif
endif
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/common/Execute.gmk b/make/common/Execute.gmk
index aa3c2e58813f9..bf108c30c0552 100644
--- a/make/common/Execute.gmk
+++ b/make/common/Execute.gmk
@@ -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
@@ -23,17 +23,13 @@
# questions.
#
-ifeq ($(_MAKEBASE_GMK), )
- $(error You must include MakeBase.gmk prior to including Execute.gmk)
-endif
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
################################################################################
-#
# Code for handling the SetupExecute macro.
-#
################################################################################
-
################################################################################
# Setup make rules for executing an arbitrary command.
#
@@ -196,3 +192,8 @@ define SetupExecuteBody
$1_TARGET := $$($1_FINAL_RESULT)
endef
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/common/FileUtils.gmk b/make/common/FileUtils.gmk
index d3cc4872ebb8f..fa934797fc732 100644
--- a/make/common/FileUtils.gmk
+++ b/make/common/FileUtils.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
@@ -23,14 +23,11 @@
# questions.
#
-ifeq ($(_MAKEBASE_GMK), )
- $(error You must include MakeBase.gmk prior to including FileUtils.gmk)
-endif
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
################################################################################
-#
# Common file utility functions
-#
################################################################################
################################################################################
@@ -307,3 +304,8 @@ ifeq ($(DISABLE_CACHE_FIND), true)
else
FindFiles = $(CacheFindFiles)
endif
+
+################################################################################
+
+include MakeIncludeEnd.gmk
+endif # include guard
diff --git a/make/common/FindTests.gmk b/make/common/FindTests.gmk
index db9cfe774defe..1f3a70b30356a 100644
--- a/make/common/FindTests.gmk
+++ b/make/common/FindTests.gmk
@@ -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
@@ -23,21 +23,10 @@
# questions.
#
-ifndef _FIND_TESTS_GMK
-_FIND_TESTS_GMK := 1
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
-# This makefile can be called directly to just trigger generation of the cache
-# makefile. If so, SPEC and MakeBase.gmk need to be included.
-ifeq ($(FINDTESTS_STAND_ALONE), true)
- include $(SPEC)
- include MakeBase.gmk
-endif
-
-# Make sure this variable is not lazy evaled.
-ALL_NAMED_TESTS :=
-
-# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, common/FindTests.gmk))
+################################################################################
# TEST_BASEDIRS might have been set by a custom extension
TEST_BASEDIRS += $(TOPDIR)/test $(TOPDIR)
@@ -62,10 +51,11 @@ $(foreach root, $(JTREG_TESTROOTS), \
# Cache the expensive to calculate test names in a generated makefile.
FIND_TESTS_CACHE_FILE := $(MAKESUPPORT_OUTPUTDIR)/find-tests.gmk
-# If this file is deemed outdated, it will automatically get regenerated
-# by this rule before being included below.
-$(FIND_TESTS_CACHE_FILE): $(JTREG_ROOT_FILES) $(JTREG_GROUP_FILES) \
- $(TOPDIR)/test/make/TestMake.gmk
+ifeq ($(GENERATE_FIND_TESTS_FILE), true)
+ # If this file is deemed outdated, it will automatically get regenerated
+ # by this rule before being included below.
+ $(FIND_TESTS_CACHE_FILE): $(JTREG_ROOT_FILES) $(JTREG_GROUP_FILES) \
+ $(TOPDIR)/test/make/TestMake.gmk
$(call MakeTargetDir)
( $(foreach root, $(JTREG_TESTROOTS), \
$(PRINTF) "\n$(root)_JTREG_TEST_GROUPS := " ; \
@@ -78,6 +68,7 @@ $(FIND_TESTS_CACHE_FILE): $(JTREG_ROOT_FILES) $(JTREG_GROUP_FILES) \
$(MAKE) -s --no-print-directory $(MAKE_ARGS) \
SPEC=$(SPEC) -f $(TOPDIR)/test/make/TestMake.gmk print-targets \
TARGETS_FILE=$@
+endif
-include $(FIND_TESTS_CACHE_FILE)
@@ -103,4 +94,5 @@ ALL_NAMED_TESTS += failure-handler make
################################################################################
-endif # _FIND_TESTS_GMK
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/common/JarArchive.gmk b/make/common/JarArchive.gmk
index 68e9eaca32c5b..1f8ed1bc002ef 100644
--- a/make/common/JarArchive.gmk
+++ b/make/common/JarArchive.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
@@ -23,12 +23,10 @@
# questions.
#
-ifndef _JAR_ARCHIVE_GMK
-_JAR_ARCHIVE_GMK := 1
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
-ifeq ($(_MAKEBASE_GMK), )
- $(error You must include MakeBase.gmk prior to including JarArchive.gmk)
-endif
+################################################################################
include MakeIO.gmk
@@ -283,4 +281,7 @@ define SetupJarArchiveBody
$1 += $$($1_JAR)
endef
-endif # _JAR_ARCHIVE_GMK
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/common/JavaCompilation.gmk b/make/common/JavaCompilation.gmk
index 59ea23d359b6a..f48aefcd51700 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
@@ -23,19 +23,15 @@
# questions.
#
-ifndef _JAVA_COMPILATION_GMK
-_JAVA_COMPILATION_GMK := 1
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
-ifeq ($(_MAKEBASE_GMK), )
- $(error You must include MakeBase.gmk prior to including JavaCompilation.gmk)
-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 +152,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 +524,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
@@ -556,4 +538,7 @@ SetupJavaCompilationCompileTarget = \
SetupJavaCompilationApiTarget = \
$(strip $2)/_the.$(strip $1)_pubapi
-endif # _JAVA_COMPILATION_GMK
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/common/JdkNativeCompilation.gmk b/make/common/JdkNativeCompilation.gmk
index ca0f1429c6165..372ad39305c59 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
@@ -23,18 +23,13 @@
# questions.
#
-ifndef _JDK_NATIVE_COMPILATION_GMK
-_JDK_NATIVE_COMPILATION_GMK := 1
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
-ifeq ($(_MAKEBASE_GMK), )
- $(error You must include MakeBase.gmk prior to including JdkNativeCompilation.gmk)
-endif
+################################################################################
include NativeCompilation.gmk
-# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, common/JdkNativeCompilation.gmk))
-
FindSrcDirsForComponent += \
$(call uniq, $(wildcard \
$(TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS)/native/$(strip $2) \
@@ -266,6 +261,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 +383,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))
@@ -494,4 +494,7 @@ define SetupJdkExecutableBody
$$(eval $$(call SetupJdkNativeCompilation, $1))
endef
-endif # _JDK_NATIVE_COMPILATION_GMK
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/common/LogUtils.gmk b/make/common/LogUtils.gmk
new file mode 100644
index 0000000000000..b32f6179ac732
--- /dev/null
+++ b/make/common/LogUtils.gmk
@@ -0,0 +1,138 @@
+#
+# 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+include $(TOPDIR)/make/common/MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
+################################################################################
+# This file contains helper functions for logging.
+################################################################################
+
+# Look for a given option in the LOG variable, and if found, set a variable
+# and remove the option from the LOG variable
+# $1: The option to look for
+# $2: The variable to set to "true" if the option is found
+define ParseLogOption
+ ifneq ($$(findstring $1, $$(LOG)), )
+ override $2 := true
+ # First try to remove "," if it exists, otherwise just remove " "
+ LOG_STRIPPED := $$(subst $1,, $$(subst $$(COMMA)$$(strip $1),, $$(LOG)))
+ # We might have ended up with a leading comma. Remove it. Need override
+ # since LOG is set from the command line.
+ override LOG := $$(strip $$(patsubst $$(COMMA)%, %, $$(LOG_STRIPPED)))
+ endif
+endef
+
+# Look for a given option with an assignment in the LOG variable, and if found,
+# set a variable to that value and remove the option from the LOG variable
+# $1: The option to look for
+# $2: The variable to set to the value of the option, if found
+define ParseLogValue
+ ifneq ($$(findstring $1=, $$(LOG)), )
+ # Make words of out comma-separated list and find the one with opt=val
+ value := $$(strip $$(subst $$(strip $1)=,, $$(filter $$(strip $1)=%, $$(subst $$(COMMA), , $$(LOG)))))
+ override $2 := $$(value)
+ # First try to remove ", " if it exists, otherwise just remove " "
+ LOG_STRIPPED := $$(subst $$(strip $1)=$$(value),, \
+ $$(subst $$(COMMA)$$(strip $1)=$$(value),, $$(LOG)))
+ # We might have ended up with a leading comma. Remove it. Need override
+ # since LOG is set from the command line.
+ override LOG := $$(strip $$(patsubst $$(COMMA)%, %, $$(LOG_STRIPPED)))
+ endif
+endef
+
+define ParseLogLevel
+ # Catch old-style VERBOSE= command lines.
+ ifneq ($$(origin VERBOSE), undefined)
+ $$(info Error: VERBOSE is deprecated. Use LOG= instead.)
+ $$(error Cannot continue)
+ endif
+
+ # Setup logging according to LOG
+
+ # If "nofile" is present, do not log to a file
+ $$(eval $$(call ParseLogOption, nofile, LOG_NOFILE))
+
+ # If "cmdline" is present, print all executes "important" command lines.
+ $$(eval $$(call ParseLogOption, cmdlines, LOG_CMDLINES))
+
+ # If "report" is present, use non-standard reporting options at build failure.
+ $$(eval $$(call ParseLogValue, report, LOG_REPORT))
+ ifneq ($$(LOG_REPORT), )
+ ifeq ($$(filter $$(LOG_REPORT), none all default), )
+ $$(info Error: LOG=report has invalid value: $$(LOG_REPORT).)
+ $$(info Valid values: LOG=report=||)
+ $$(error Cannot continue)
+ endif
+ endif
+
+ # If "profile-to-log" is present, write shell times in build log
+ $$(eval $$(call ParseLogOption, profile-to-log, LOG_PROFILE_TIMES_LOG))
+
+ # If "profile" is present, write shell times in separate log file
+ # IMPORTANT: $(ParseLogOption profile-to-log) should go first. Otherwise
+ # parsing of 'LOG=debug,profile-to-log,nofile' ends up in the following error:
+ # Error: LOG contains unknown option or log level: debug-to-log.
+ $$(eval $$(call ParseLogOption, profile, LOG_PROFILE_TIMES_FILE))
+
+ # If "flow" is present, log makefile execution flow
+ $$(eval $$(call ParseLogOption, flow, LOG_FLOW))
+
+ # Treat LOG=profile-to-log as if it were LOG=profile,profile-to-log
+ LOG_PROFILE_TIMES_FILE := $$(firstword $$(LOG_PROFILE_TIMES_FILE) $$(LOG_PROFILE_TIMES_LOG))
+
+ override LOG_LEVEL := $$(LOG)
+
+ ifeq ($$(LOG_LEVEL), )
+ # Set LOG to "warn" as default if not set
+ override LOG_LEVEL := warn
+ endif
+
+ ifeq ($$(LOG_LEVEL), warn)
+ override MAKE_LOG_FLAGS := -s
+ else ifeq ($$(LOG_LEVEL), info)
+ override MAKE_LOG_FLAGS := -s
+ else ifeq ($$(LOG_LEVEL), debug)
+ override MAKE_LOG_FLAGS :=
+ else ifeq ($$(LOG_LEVEL), trace)
+ override MAKE_LOG_FLAGS :=
+ else
+ $$(info Error: LOG contains unknown option or log level: $$(LOG).)
+ $$(info LOG can be [,[...]] where is nofile | cmdlines | profile | profile-to-log)
+ $$(info and is warn | info | debug | trace)
+ $$(error Cannot continue)
+ endif
+endef
+
+MAKE_LOG_VARS = $(foreach v, \
+ LOG_LEVEL LOG_NOFILE LOG_CMDLINES LOG_REPORT LOG_PROFILE_TIMES_LOG \
+ LOG_PROFILE_TIMES_FILE LOG_FLOW, \
+ $v=$($v) \
+)
+
+################################################################################
+
+endif # include guard
+include $(TOPDIR)/make/common/MakeIncludeEnd.gmk
diff --git a/make/common/MakeBase.gmk b/make/common/MakeBase.gmk
index aec7396cd659a..d1bb039694354 100644
--- a/make/common/MakeBase.gmk
+++ b/make/common/MakeBase.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
@@ -23,6 +23,11 @@
# questions.
#
+MAKEBASE_INCLUDED := true
+
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
################################################################################
# MakeBase provides the core functionality needed and used by all makefiles. It
# should be included by all makefiles. MakeBase provides essential
@@ -30,13 +35,6 @@
# execution, logging and fixpath functionality.
################################################################################
-ifndef _MAKEBASE_GMK
-_MAKEBASE_GMK := 1
-
-ifeq ($(wildcard $(SPEC)), )
- $(error MakeBase.gmk needs SPEC set to a proper spec.gmk)
-endif
-
# By defining this pseudo target, make will automatically remove targets
# if their recipe fails so that a rebuild is automatically triggered on the
# next make invocation.
@@ -312,7 +310,5 @@ ExecuteWithLog = \
################################################################################
-# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, common/MakeBase.gmk))
-
-endif # _MAKEBASE_GMK
+include MakeIncludeEnd.gmk
+endif # include guard
diff --git a/make/common/MakeFileEnd.gmk b/make/common/MakeFileEnd.gmk
new file mode 100644
index 0000000000000..0c02ae79373d6
--- /dev/null
+++ b/make/common/MakeFileEnd.gmk
@@ -0,0 +1,42 @@
+#
+# 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. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+################################################################################
+# MakeFileEnd.gmk should be included last of all in all top-level makefiles
+################################################################################
+
+# Hook to include the corresponding custom file, if present.
+ifneq ($(NO_CUSTOM_EXTENSIONS), true)
+ CUSTOM_POST_NAME := $(subst .gmk,-post.gmk, $(THIS_MAKEFILE))
+ $(eval $(call IncludeCustomExtension, $(CUSTOM_POST_NAME)))
+endif
+
+all: $(TARGETS)
+
+ifeq ($(LOG_FLOW), true)
+ $(info :Leave $(THIS_MAKEFILE) [now executing rules])
+endif
+
+.PHONY: default all
diff --git a/make/common/MakeFileStart.gmk b/make/common/MakeFileStart.gmk
new file mode 100644
index 0000000000000..f1dd0abb792c3
--- /dev/null
+++ b/make/common/MakeFileStart.gmk
@@ -0,0 +1,66 @@
+#
+# 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. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+################################################################################
+# MakeFileStart.gmk should be included first of all in all top-level makefiles
+################################################################################
+
+# This must be the first rule
+default: $(if $(DEFAULT_TARGET), $(DEFAULT_TARGET), all)
+
+THIS_MAKEFILE_PATH := $(firstword $(MAKEFILE_LIST))
+
+ifeq ($(SPEC), )
+ $(error $(THIS_MAKEFILE_PATH): SPEC is not set)
+endif
+
+ifeq ($(wildcard $(SPEC)), )
+ $(error $(THIS_MAKEFILE_PATH): spec.gmk file $(SPEC) is missing)
+endif
+
+ifneq ($(words $(MAKEFILE_LIST)), 2)
+ $(error $(THIS_MAKEFILE_PATH): This file is not supposed to be included)
+endif
+
+# We need spec.gmk to get $(TOPDIR)
+include $(SPEC)
+
+THIS_MAKEFILE := $(patsubst make/%,%,$(patsubst $(TOPDIR)/%,%,$(THIS_MAKEFILE_PATH)))
+
+ifeq ($(LOG_FLOW), true)
+ $(info :Enter $(THIS_MAKEFILE))
+endif
+
+include $(TOPDIR)/make/common/MakeBase.gmk
+
+TARGETS :=
+
+all:
+
+# Hook to include the corresponding custom file, if present.
+ifneq ($(NO_CUSTOM_EXTENSIONS), true)
+ CUSTOM_PRE_NAME := $(subst .gmk,-pre.gmk, $(THIS_MAKEFILE))
+ $(eval $(call IncludeCustomExtension, $(CUSTOM_PRE_NAME)))
+endif
diff --git a/make/common/MakeIO.gmk b/make/common/MakeIO.gmk
index e1806e9259aba..b32f427226a09 100644
--- a/make/common/MakeIO.gmk
+++ b/make/common/MakeIO.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
@@ -23,18 +23,14 @@
# questions.
#
-ifeq ($(_MAKEBASE_GMK), )
- $(error You must include MakeBase.gmk prior to including MakeIO.gmk)
-endif
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
################################################################################
-#
# Functions for dealing with reading and writing from makefiles. Prior to GNU
# Make 4.0, this was tricky business.
-#
################################################################################
-
################################################################################
# ListPathsSafely can be used to print command parameters to a file. This is
# typically done if the command line length risk being too long for the
@@ -241,3 +237,8 @@ else # HAS_FILE_FUNCTION = false
$$(call ListPathsSafely_IfPrintf,$1,$2,29751,30000)
endef
endif # HAS_FILE_FUNCTION
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/common/MakeIncludeEnd.gmk b/make/common/MakeIncludeEnd.gmk
new file mode 100644
index 0000000000000..7023a861fa149
--- /dev/null
+++ b/make/common/MakeIncludeEnd.gmk
@@ -0,0 +1,45 @@
+#
+# 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. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+################################################################################
+# MakeIncludeEnd.gmk should be included last of all in all include files
+################################################################################
+
+# Hook to include the corresponding custom file, if present.
+ifneq ($(NO_CUSTOM_EXTENSIONS), true)
+ CUSTOM_POST_NAME := $(subst .gmk,-post.gmk, $(THIS_INCLUDE))
+ $(eval $(call IncludeCustomExtension, $(CUSTOM_POST_NAME)))
+endif
+
+# Pop our helper name off the stack
+INCLUDE_STACK := $(wordlist 2, $(words $(INCLUDE_STACK)), $(INCLUDE_STACK))
+
+# Print an indented message, also counting the top-level makefile as a level
+ifeq ($(LOG_FLOW), true)
+ $(info :$(foreach s, top $(INCLUDE_STACK) $(SNIPPET_STACK), )Leave $(THIS_INCLUDE))
+endif
+
+# Restore the previous helper name
+THIS_INCLUDE := $(firstword $(INCLUDE_STACK))
diff --git a/make/common/MakeIncludeStart.gmk b/make/common/MakeIncludeStart.gmk
new file mode 100644
index 0000000000000..d09f027c1d38d
--- /dev/null
+++ b/make/common/MakeIncludeStart.gmk
@@ -0,0 +1,83 @@
+#
+# 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. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+################################################################################
+# MakeIncludeStart.gmk should be included first of all in all include files
+################################################################################
+
+# Get the next to last word (by prepending a padding element)
+THIS_INCLUDE_PATH := $(word $(words ${MAKEFILE_LIST}),padding ${MAKEFILE_LIST})
+THIS_INCLUDE := $(patsubst $(TOPDIR)/make/%,%,$(THIS_INCLUDE_PATH))
+
+# Print an indented message, also counting the top-level makefile as a level
+ifneq ($(INCLUDE_GUARD_$(THIS_INCLUDE)), true)
+ THIS_INCLUDE_MSG := include
+else
+ THIS_INCLUDE_MSG := included already
+endif
+
+ifeq ($(LOG_FLOW), true)
+ $(info :$(foreach s, top $(INCLUDE_STACK) $(SNIPPET_STACK), )Enter $(THIS_INCLUDE) [$(THIS_INCLUDE_MSG)])
+endif
+
+ifneq ($(filter $(THIS_INCLUDE), $(INCLUDE_STACK)), )
+ $(error Internal makefile error: Include loop detected: $(THIS_INCLUDE) $(INCLUDE_STACK))
+endif
+
+ifeq ($(words $(MAKEFILE_LIST)), 2)
+ $(error $(THIS_INCLUDE_PATH): This file is supposed to be included)
+endif
+
+# In a preinit environment, we do not have any SPEC
+ifneq ($(IS_PREINIT_ENV), true)
+ ifeq ($(SPEC), )
+ $(error $(THIS_INCLUDE_PATH): SPEC is not set)
+ endif
+
+ ifeq ($(wildcard $(SPEC)), )
+ $(error $(THIS_INCLUDE_PATH): spec.gmk file $(SPEC) is missing)
+ endif
+
+ ifneq ($(MAKEBASE_INCLUDED), true)
+ $(error $(THIS_INCLUDE_PATH): MakeBase.gmk is not included)
+ endif
+endif
+
+# Push our helper name onto the stack
+INCLUDE_STACK := $(THIS_INCLUDE) $(INCLUDE_STACK)
+
+# Setup an automatic include guard
+ifneq ($(INCLUDE_GUARD_$(THIS_INCLUDE)), true)
+ INCLUDE_GUARD_$(THIS_INCLUDE) := true
+ INCLUDE := true
+
+ # Hook to include the corresponding custom file, if present.
+ ifneq ($(NO_CUSTOM_EXTENSIONS), true)
+ CUSTOM_PRE_NAME := $(subst .gmk,-pre.gmk, $(THIS_INCLUDE))
+ $(eval $(call IncludeCustomExtension, $(CUSTOM_PRE_NAME)))
+ endif
+else
+ INCLUDE := false
+endif
diff --git a/make/common/MakeSnippetEnd.gmk b/make/common/MakeSnippetEnd.gmk
new file mode 100644
index 0000000000000..7b46310330ac6
--- /dev/null
+++ b/make/common/MakeSnippetEnd.gmk
@@ -0,0 +1,45 @@
+#
+# 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. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+################################################################################
+# MakeSnippetEnd.gmk should be included after including a makefile snippet
+################################################################################
+
+# Hook to include the corresponding custom file, if present.
+ifneq ($(NO_CUSTOM_EXTENSIONS), true)
+ CUSTOM_POST_NAME := $(subst .gmk,-post.gmk, $(THIS_SNIPPET))
+ $(eval $(call IncludeCustomExtension, $(CUSTOM_POST_NAME)))
+endif
+
+# Pop our helper name off the stack
+SNIPPET_STACK := $(wordlist 2, $(words $(SNIPPET_STACK)), $(SNIPPET_STACK))
+
+# Print an indented message, also counting the top-level makefile as a level
+ifeq ($(LOG_FLOW), true)
+ $(info :$(foreach s, top $(INCLUDE_STACK) $(SNIPPET_STACK), )Leave $(THIS_SNIPPET))
+endif
+
+# Restore the previous helper name
+THIS_SNIPPET := $(firstword $(SNIPPET_STACK))
diff --git a/make/common/MakeSnippetStart.gmk b/make/common/MakeSnippetStart.gmk
new file mode 100644
index 0000000000000..1df5a1e20cb8d
--- /dev/null
+++ b/make/common/MakeSnippetStart.gmk
@@ -0,0 +1,46 @@
+#
+# 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. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+################################################################################
+# MakeSnippetStart.gmk should be included before including a makefile snippet
+################################################################################
+
+ifeq ($(THIS_SNIPPET), )
+ $(error Internal makefile error: THIS_SNIPPET is not defined)
+endif
+
+# Print an indented message, also counting the top-level makefile as a level
+ifeq ($(LOG_FLOW), true)
+ $(info :$(foreach s, top $(INCLUDE_STACK) $(SNIPPET_STACK), )Enter $(THIS_SNIPPET) [snippet])
+endif
+
+# Push our helper name onto the stack
+SNIPPET_STACK := $(THIS_SNIPPET) $(SNIPPET_STACK)
+
+# Hook to include the corresponding custom file, if present.
+ifneq ($(NO_CUSTOM_EXTENSIONS), true)
+ CUSTOM_PRE_NAME := $(subst .gmk,-pre.gmk, $(THIS_SNIPPET))
+ $(eval $(call IncludeCustomExtension, $(CUSTOM_PRE_NAME)))
+endif
diff --git a/make/common/Modules.gmk b/make/common/Modules.gmk
index 8ae33b3641eae..f4f815c740db6 100644
--- a/make/common/Modules.gmk
+++ b/make/common/Modules.gmk
@@ -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
@@ -23,8 +23,8 @@
# questions.
#
-ifndef _MODULES_GMK
-_MODULES_GMK := 1
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
################################################################################
# Setup module sets for classloaders
@@ -45,11 +45,6 @@ include $(TOPDIR)/make/conf/docs-modules.conf
include $(TOPDIR)/make/conf/build-module-sets.conf
-################################################################################
-# Hook to include the corresponding custom file, if present.
-# Allowing MODULE list extensions setup above.
-$(eval $(call IncludeCustomExtension, common/Modules.gmk))
-
################################################################################
# Depending on the configuration, we might need to filter out some modules that
# normally should have been included
@@ -92,7 +87,10 @@ SRC_SUBDIRS += share/classes
SPEC_SUBDIRS += share/specs
-MAN_SUBDIRS += share/man
+MAN_SUBDIRS += share/man $(TARGET_OS)/man
+
+# The docs should include the sum of all man pages for all platforms
+MAN_DOCS_SUBDIRS += share/man windows/man
# Find all module-info.java files for the current build target platform and
# configuration.
@@ -158,6 +156,10 @@ FindModuleManDirs = \
$(strip $(wildcard \
$(foreach sub, $(MAN_SUBDIRS), $(addsuffix /$(strip $1)/$(sub), $(TOP_SRC_DIRS)))))
+FindModuleManDirsForDocs = \
+ $(strip $(wildcard \
+ $(foreach sub, $(MAN_DOCS_SUBDIRS), $(addsuffix /$(strip $1)/$(sub), $(TOP_SRC_DIRS)))))
+
# Construct the complete module source path
GetModuleSrcPath = \
$(call PathList, \
@@ -172,8 +174,9 @@ MODULE_DEPS_MAKEFILE := $(MAKESUPPORT_OUTPUTDIR)/module-deps.gmk
MODULE_INFOS := $(call FindAllModuleInfos, *)
-$(MODULE_DEPS_MAKEFILE): $(MODULE_INFOS) \
- $(call DependOnVariable, MODULE_INFOS, $(MAKESUPPORT_OUTPUTDIR)/MODULE_INFOS.vardeps)
+ifeq ($(GENERATE_MODULE_DEPS_FILE), true)
+ $(MODULE_DEPS_MAKEFILE): $(MODULE_INFOS) \
+ $(call DependOnVariable, MODULE_INFOS, $(MAKESUPPORT_OUTPUTDIR)/MODULE_INFOS.vardeps)
$(call MakeTargetDir)
$(RM) $@
$(foreach m, $(MODULE_INFOS), \
@@ -206,6 +209,7 @@ $(MODULE_DEPS_MAKEFILE): $(MODULE_INFOS) \
printf(" %s", $$0) } \
END { printf("\n") }' $m \
) >> $@ $(NEWLINE))
+endif
-include $(MODULE_DEPS_MAKEFILE)
@@ -314,4 +318,5 @@ endef
################################################################################
-endif # _MODULES_GMK
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/common/NativeCompilation.gmk b/make/common/NativeCompilation.gmk
index 66d07df3b786a..9721f1c0aca49 100644
--- a/make/common/NativeCompilation.gmk
+++ b/make/common/NativeCompilation.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
@@ -23,19 +23,15 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
################################################################################
# This is the top-level entry point for our native compilation and linking.
# It contains the SetupNativeCompilation macro, but is supported by helper
# macros in the make/common/native directory.
################################################################################
-ifndef _NATIVE_COMPILATION_GMK
-_NATIVE_COMPILATION_GMK := 1
-
-ifeq ($(_MAKEBASE_GMK), )
- $(error You must include MakeBase.gmk prior to including NativeCompilation.gmk)
-endif
-
include MakeIO.gmk
include native/CompileFile.gmk
include native/DebugSymbols.gmk
@@ -223,6 +219,7 @@ define SetupNativeCompilationBody
ifeq ($(GENERATE_COMPILE_COMMANDS_ONLY), true)
# Override all targets (this is a hack)
$1 := $$($1_ALL_OBJS_JSON) $$($1_LDFLAGS_FILE)
+ TARGETS := $(filter $(MAKESUPPORT_OUTPUTDIR)/compile-commands/%, $(TARGETS))
endif
endef
@@ -409,4 +406,7 @@ define ImportDependencyFile
endif
endef
-endif # _NATIVE_COMPILATION_GMK
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/common/ProcessMarkdown.gmk b/make/common/ProcessMarkdown.gmk
index d14c3ce4f765e..1b4a5b76ea1e5 100644
--- a/make/common/ProcessMarkdown.gmk
+++ b/make/common/ProcessMarkdown.gmk
@@ -1,4 +1,4 @@
-# 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,9 +22,10 @@
# questions.
#
-ifeq ($(_MAKEBASE_GMK), )
- $(error You must include MakeBase.gmk prior to including ProcessMarkdown.gmk)
-endif
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
+################################################################################
include TextFileProcessing.gmk
@@ -181,3 +182,8 @@ define SetupProcessMarkdownBody
)
endif
endef
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/common/TestFilesCompilation.gmk b/make/common/TestFilesCompilation.gmk
index e09e144fa06ce..9e076590cf31c 100644
--- a/make/common/TestFilesCompilation.gmk
+++ b/make/common/TestFilesCompilation.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
@@ -23,13 +23,10 @@
# questions.
#
-ifndef _TEST_FILES_COMPILATION_GMK
-_TEST_FILES_COMPILATION_GMK := 1
-
-ifeq ($(_MAKEBASE_GMK), )
- $(error You must include MakeBase.gmk prior to including TestFilesCompilation.gmk)
-endif
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+################################################################################
include JdkNativeCompilation.gmk
@@ -142,4 +139,7 @@ define SetupTestFilesCompilationBody
endef
-endif # _TEST_FILES_COMPILATION_GMK
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/common/TextFileProcessing.gmk b/make/common/TextFileProcessing.gmk
index 94aa259bebc53..462d8756650b0 100644
--- a/make/common/TextFileProcessing.gmk
+++ b/make/common/TextFileProcessing.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
@@ -23,9 +23,10 @@
# questions.
#
-ifeq ($(_MAKEBASE_GMK), )
- $(error You must include MakeBase.gmk prior to including TextFileProcessing.gmk)
-endif
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
+################################################################################
# Helper function for SetupTextFileProcessing; adds a rule for a single file
# to be processed.
@@ -222,3 +223,8 @@ define SetupTextFileProcessingBody
endif
endif
endef
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/common/Utils.gmk b/make/common/Utils.gmk
index 26d05ed91bef4..03009ec3ca4be 100644
--- a/make/common/Utils.gmk
+++ b/make/common/Utils.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
@@ -23,14 +23,11 @@
# questions.
#
-ifeq ($(_MAKEBASE_GMK), )
- $(error You must include MakeBase.gmk prior to including Utils.gmk)
-endif
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
################################################################################
-#
# Basic utility functions available to MakeBase.gmk itself
-#
################################################################################
# String equals
@@ -398,3 +395,8 @@ FilterExcludedTranslations = \
), \
$1 \
))
+
+################################################################################
+
+include MakeIncludeEnd.gmk
+endif # include guard
diff --git a/make/common/ZipArchive.gmk b/make/common/ZipArchive.gmk
index 22fd6722fa235..e6bc99eb4c1a1 100644
--- a/make/common/ZipArchive.gmk
+++ b/make/common/ZipArchive.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
@@ -23,15 +23,13 @@
# questions.
#
-ifndef _ZIP_ARCHIVE_GMK
-_ZIP_ARCHIVE_GMK := 1
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
-# Depends on build tools for MakeZipReproducible
-include ../ToolsJdk.gmk
+################################################################################
-ifeq ($(_MAKEBASE_GMK), )
- $(error You must include MakeBase.gmk prior to including ZipArchive.gmk)
-endif
+# Depends on build tools for MakeZipReproducible
+include $(TOPDIR)/make/ToolsJdk.gmk
# Setup make rules for creating a zip archive.
#
@@ -192,4 +190,7 @@ define SetupZipArchiveBody
$1 += $$($1_ZIP)
endef
-endif # _ZIP_ARCHIVE_GMK
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/common/modules/CopyCommon.gmk b/make/common/modules/CopyCommon.gmk
index f4df1ce3a3082..9dc03f08e59ca 100644
--- a/make/common/modules/CopyCommon.gmk
+++ b/make/common/modules/CopyCommon.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
@@ -23,6 +23,11 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
+################################################################################
+
include CopyFiles.gmk
LIB_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)
@@ -88,3 +93,8 @@ define SetupCopyLegalFilesBody
) \
)
endef
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/common/modules/GendataCommon.gmk b/make/common/modules/GendataCommon.gmk
index 0d5d39ea973d0..ad1d1c7f7a5ef 100644
--- a/make/common/modules/GendataCommon.gmk
+++ b/make/common/modules/GendataCommon.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2020, 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,6 +23,15 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
+################################################################################
+
include JavaCompilation.gmk
-include ToolsJdk.gmk
+include $(TOPDIR)/make/ToolsJdk.gmk
+
+################################################################################
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/common/modules/GensrcCommon.gmk b/make/common/modules/GensrcCommon.gmk
index b14e96293bad3..64d1f71d82e65 100644
--- a/make/common/modules/GensrcCommon.gmk
+++ b/make/common/modules/GensrcCommon.gmk
@@ -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
@@ -23,9 +23,14 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
+################################################################################
+
include Execute.gmk
include TextFileProcessing.gmk
-include ToolsJdk.gmk
+include $(TOPDIR)/make/ToolsJdk.gmk
################################################################################
# Sets up a rule that creates a version.properties file in the gensrc output
@@ -41,3 +46,8 @@ define SetupVersionProperties
$$(strip $1) += $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/$$(strip $2)
endef
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/common/modules/GensrcModuleInfo.gmk b/make/common/modules/GensrcModuleInfo.gmk
index 56b5fb54eb8d6..f2097c3476665 100644
--- a/make/common/modules/GensrcModuleInfo.gmk
+++ b/make/common/modules/GensrcModuleInfo.gmk
@@ -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
@@ -23,6 +23,8 @@
# questions.
#
+include MakeFileStart.gmk
+
################################################################################
# This file makes modifications to module-info.java files based on the build
# configuration.
@@ -41,13 +43,8 @@
#
# The modified module-info.java files are put in the gensrc directory where
# they will automatically override the static versions in the src tree.
-#
################################################################################
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
include Modules.gmk
################################################################################
@@ -101,4 +98,4 @@ endif
################################################################################
-all: $(TARGETS)
+include MakeFileEnd.gmk
diff --git a/make/common/modules/GensrcProperties.gmk b/make/common/modules/GensrcProperties.gmk
index 5db10af27b105..4d4fc0460f062 100644
--- a/make/common/modules/GensrcProperties.gmk
+++ b/make/common/modules/GensrcProperties.gmk
@@ -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
@@ -23,8 +23,13 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
+################################################################################
# This file defines macros that sets up rules for generating java classes
# from resource bundle properties files.
+################################################################################
include JavaCompilation.gmk
@@ -142,3 +147,8 @@ define SetupCompilePropertiesBody
$1 += $$($1_JAVAS) $$($1_TARGET) $$($1_HK)
endef
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/common/modules/LauncherCommon.gmk b/make/common/modules/LauncherCommon.gmk
index 38485283dcb98..700c0de74d564 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
@@ -23,11 +23,16 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
+################################################################################
+
include CopyFiles.gmk
include JdkNativeCompilation.gmk
include Modules.gmk
include ProcessMarkdown.gmk
-include ToolsJdk.gmk
+include $(TOPDIR)/make/ToolsJdk.gmk
LAUNCHER_SRC := $(TOPDIR)/src/java.base/share/native/launcher
LAUNCHER_CFLAGS += -I$(TOPDIR)/src/java.base/share/native/launcher \
@@ -48,21 +53,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 +72,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 +151,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 +162,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), \
@@ -237,3 +239,8 @@ ifeq ($(call isTargetOsType, unix)+$(MAKEFILE_PREFIX), true+Launcher)
endif
endif
endif
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/common/modules/LibCommon.gmk b/make/common/modules/LibCommon.gmk
index 4e3570d9cd7dd..0320450c93447 100644
--- a/make/common/modules/LibCommon.gmk
+++ b/make/common/modules/LibCommon.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
@@ -23,4 +23,14 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
+################################################################################
+
include JdkNativeCompilation.gmk
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/common/native/CompileFile.gmk b/make/common/native/CompileFile.gmk
index 0c67a337acf82..9c3d39d6edf31 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
@@ -23,11 +23,15 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
################################################################################
# This file contains functionality related to compiling a single native source
# file (C, C++ or Objective-C) into an object file. It also harbours related
# functionality for generating PCH (precompiled headers) and Windows resource
# files.
+################################################################################
################################################################################
# Creates a recipe that creates a compile_commands.json fragment. Remove any
@@ -253,11 +257,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 +277,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)
@@ -349,3 +356,8 @@ define CreateWindowsResourceFile
> $$($1_RES_DEPS_TARGETS_FILE)
endif
endef
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/common/native/DebugSymbols.gmk b/make/common/native/DebugSymbols.gmk
index f7a5a4021e26e..7f21fd8cbf337 100644
--- a/make/common/native/DebugSymbols.gmk
+++ b/make/common/native/DebugSymbols.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
@@ -23,8 +23,12 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
################################################################################
# This file contains functionality related to native debug symbol handling.
+################################################################################
################################################################################
define CreateDebugSymbols
@@ -98,3 +102,8 @@ define CreateDebugSymbols
endif # $1_DEBUG_SYMBOLS != false
endif # COPY_DEBUG_SYMBOLS
endef
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/common/native/Flags.gmk b/make/common/native/Flags.gmk
index daa9a83d62b2d..747e090b81600 100644
--- a/make/common/native/Flags.gmk
+++ b/make/common/native/Flags.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
@@ -23,10 +23,14 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
################################################################################
# This file contains functionality related to setting up compiler and linker
# flags, based on various more abstract sources of compilation description,
# like optimization level.
+################################################################################
################################################################################
# $1 is the prefix of the file to be compiled
@@ -223,3 +227,8 @@ define SetupLinkerFlags
$1_EXTRA_LIBS += $$($1_LIBS_$(OPENJDK_TARGET_OS_TYPE)) $$($1_LIBS_$(OPENJDK_TARGET_OS)) \
$$($1_LIBS_$(TOOLCHAIN_TYPE)) $$($1_LIBS_$(TOOLCHAIN_TYPE)_$(OPENJDK_TARGET_OS))
endef
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/common/native/Link.gmk b/make/common/native/Link.gmk
index 1461f7302dc43..7cf6c97b27c30 100644
--- a/make/common/native/Link.gmk
+++ b/make/common/native/Link.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
@@ -23,9 +23,13 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
################################################################################
# This file contains functionality related to linking a native binary;
# creating either a dynamic library, a static library or an executable.
+################################################################################
################################################################################
# GetEntitlementsFile
@@ -212,3 +216,8 @@ define CreateDynamicLibraryOrExecutable
$$(ECHO) $$($1_ALL_LD_ARGS) > $$@
endef
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/common/native/LinkMicrosoft.gmk b/make/common/native/LinkMicrosoft.gmk
index 7c895a9507d18..55f8e5684e74d 100644
--- a/make/common/native/LinkMicrosoft.gmk
+++ b/make/common/native/LinkMicrosoft.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
@@ -23,9 +23,13 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
################################################################################
# This file contains functionality related to linking a native binary;
# creating either a dynamic library, a static library or an executable.
+################################################################################
################################################################################
define CreateLinkedResultMicrosoft
@@ -114,3 +118,8 @@ define CreateDynamicLibraryOrExecutableMicrosoft
-outputresource:$$@;#1
endif
endef
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/common/native/Paths.gmk b/make/common/native/Paths.gmk
index e021a390289bd..ee097b2e134ff 100644
--- a/make/common/native/Paths.gmk
+++ b/make/common/native/Paths.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
@@ -23,6 +23,9 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
################################################################################
# This file contains functionality related to handling paths for source files
# and object files. This is complicated by the fact that we usually, but not
@@ -31,6 +34,7 @@
# "@-files", which we normally use to avoid hitting command line length limits.
# Finally this file contains functionality for locating all source code files
# that should be included in the compilation.
+################################################################################
################################################################################
# When absolute paths are not allowed in the output, and the compiler does not
@@ -240,3 +244,8 @@ define SetupObjectFileList
endif
endif
endef
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/conf/github-actions.conf b/make/conf/github-actions.conf
index a6b383daa8fd4..c34c90ef76ed2 100644
--- a/make/conf/github-actions.conf
+++ b/make/conf/github-actions.conf
@@ -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
@@ -26,7 +26,7 @@
# Versions and download locations for dependencies used by GitHub Actions (GHA)
GTEST_VERSION=1.14.0
-JTREG_VERSION=7.4+1
+JTREG_VERSION=7.5.1+1
LINUX_X64_BOOT_JDK_EXT=tar.gz
LINUX_X64_BOOT_JDK_URL=https://download.java.net/java/GA/jdk23/3c5b90190c68498b986a97f276efd28a/37/GPL/openjdk-23_linux-x64_bin.tar.gz
diff --git a/make/conf/jib-profiles.js b/make/conf/jib-profiles.js
index e6204d2995edb..397e75968e4c4 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"
@@ -1186,9 +1186,9 @@ var getJibProfilesDependencies = function (input, common) {
jtreg: {
server: "jpg",
product: "jtreg",
- version: "7.4",
+ version: "7.5.1",
build_number: "1",
- file: "bundles/jtreg-7.4+1.zip",
+ file: "bundles/jtreg-7.5.1+1.zip",
environment_name: "JT_HOME",
environment_path: input.get("jtreg", "home_path") + "/bin",
configure_args: "--with-jtreg=" + input.get("jtreg", "home_path"),
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/CopyToExplodedJdk.gmk b/make/hotspot/CopyToExplodedJdk.gmk
index 21d68c7b06f5e..2848ed24b9345 100644
--- a/make/hotspot/CopyToExplodedJdk.gmk
+++ b/make/hotspot/CopyToExplodedJdk.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,6 +23,11 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
+################################################################################
+
include CopyFiles.gmk
# Copy all built libraries into exploded jdk
@@ -57,3 +62,8 @@ else
TARGETS += $(COPY_LIBS) $(LINK_LIBS)
endif
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/hotspot/HotspotCommon.gmk b/make/hotspot/HotspotCommon.gmk
index 3aacdf30c4cc6..661af26221ced 100644
--- a/make/hotspot/HotspotCommon.gmk
+++ b/make/hotspot/HotspotCommon.gmk
@@ -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
@@ -23,6 +23,11 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
+################################################################################
+
ifeq ($(JVM_VARIANT), )
$(error This makefile must be called with JVM_VARIANT set)
endif
@@ -46,3 +51,8 @@ check-jvm-feature = \
$(if $(filter-out $(VALID_JVM_FEATURES), $1), \
$(error Internal error: Invalid feature tested: $1)) \
$(if $(filter $1, $(JVM_FEATURES_$(JVM_VARIANT))), true, false))
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/hotspot/gensrc/GenerateSources.gmk b/make/hotspot/gensrc/GenerateSources.gmk
index 48fe7e25507c0..48715c8e71a8f 100644
--- a/make/hotspot/gensrc/GenerateSources.gmk
+++ b/make/hotspot/gensrc/GenerateSources.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
@@ -23,17 +23,16 @@
# questions.
#
-default: all
+include MakeFileStart.gmk
+
+################################################################################
-include $(SPEC)
-include MakeBase.gmk
include Execute.gmk
+include HotspotCommon.gmk
include JavaCompilation.gmk
include JdkNativeCompilation.gmk
include TextFileProcessing.gmk
-include HotspotCommon.gmk
-
# The real work is done in these files
include gensrc/GensrcJfr.gmk
@@ -41,8 +40,6 @@ include gensrc/GensrcAdlc.gmk
include gensrc/GensrcDtrace.gmk
include gensrc/GensrcJvmti.gmk
-$(eval $(call IncludeCustomExtension, hotspot/gensrc/GenerateSources.gmk))
-
# While technically the rules below are "gendata" which can be done in parallel
# with native compilation, let's keep it here for simplicity.
@@ -63,6 +60,6 @@ $(CHMOD_HOTSPOT_LAUNCHER): $(CREATE_HOTSPOT_LAUNCHER)
TARGETS += $(CREATE_HOTSPOT_LAUNCHER) $(CHMOD_HOTSPOT_LAUNCHER)
-all: $(TARGETS)
+################################################################################
-.PHONY: all
+include MakeFileEnd.gmk
diff --git a/make/hotspot/gensrc/GensrcAdlc.gmk b/make/hotspot/gensrc/GensrcAdlc.gmk
index d43a8b8d3aba5..4cecc3070e7b1 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
@@ -23,7 +23,10 @@
# questions.
#
-$(eval $(call IncludeCustomExtension, hotspot/gensrc/GensrcAdlc.gmk))
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
+################################################################################
ifeq ($(call check-jvm-feature, compiler2), true)
@@ -37,13 +40,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
@@ -265,3 +263,8 @@ ifeq ($(call check-jvm-feature, compiler2), true)
TARGETS += $(ADLC_GENERATED_FILES)
endif
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/hotspot/gensrc/GensrcDtrace.gmk b/make/hotspot/gensrc/GensrcDtrace.gmk
index 0cc0ff110938e..fd243ea82692d 100644
--- a/make/hotspot/gensrc/GensrcDtrace.gmk
+++ b/make/hotspot/gensrc/GensrcDtrace.gmk
@@ -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
@@ -23,8 +23,12 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
################################################################################
# Gensrc support for dtrace. The files generated here are included by dtrace.hpp
+################################################################################
ifeq ($(call check-jvm-feature, dtrace), true)
@@ -52,3 +56,8 @@ ifeq ($(call check-jvm-feature, dtrace), true)
$(DTRACE_GENSRC_DIR)/%.h, $(wildcard $(DTRACE_SOURCE_DIR)/*.d))
endif
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/hotspot/gensrc/GensrcJfr.gmk b/make/hotspot/gensrc/GensrcJfr.gmk
index 545c6876ad688..d1d9eb5ec778f 100644
--- a/make/hotspot/gensrc/GensrcJfr.gmk
+++ b/make/hotspot/gensrc/GensrcJfr.gmk
@@ -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
@@ -23,9 +23,12 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
################################################################################
# Setup make rules for JFR gensrc file generation.
-#
+################################################################################
include $(TOPDIR)/make/ToolsHotspot.gmk
@@ -44,3 +47,8 @@ $(eval $(call SetupExecute, jfr_gen_headers, \
))
TARGETS += $(jfr_gen_headers)
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/hotspot/gensrc/GensrcJvmti.gmk b/make/hotspot/gensrc/GensrcJvmti.gmk
index b9c2e38b820e9..19eb4540947c5 100644
--- a/make/hotspot/gensrc/GensrcJvmti.gmk
+++ b/make/hotspot/gensrc/GensrcJvmti.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
@@ -23,12 +23,14 @@
# questions.
#
-include CopyFiles.gmk
-
-$(eval $(call IncludeCustomExtension, hotspot/gensrc/GensrcJvmti.gmk))
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
################################################################################
# Build tools needed for the JVMTI source code generation
+################################################################################
+
+include CopyFiles.gmk
# FIXME: jvmtiGen.java should move to make/src, jvmtiEnvFill.java should be removed.
JVMTI_TOOLS_SRCDIR := $(TOPDIR)/src/hotspot/share/prims
@@ -120,3 +122,8 @@ ifeq ($(JVM_VARIANT), $(firstword $(JVM_VARIANTS)))
TARGETS += $(COPY_JVMTI_H)
endif
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/hotspot/lib/CompileGtest.gmk b/make/hotspot/lib/CompileGtest.gmk
index 8e55c9b669bb7..5c576cbbf0d66 100644
--- a/make/hotspot/lib/CompileGtest.gmk
+++ b/make/hotspot/lib/CompileGtest.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
@@ -22,8 +22,10 @@
# or visit www.oracle.com if you need additional information or have any
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
-$(eval $(call IncludeCustomExtension, hotspot/lib/CompileGtest.gmk))
+################################################################################
GTEST_TEST_SRC += $(TOPDIR)/test/hotspot/gtest
@@ -159,3 +161,6 @@ $(eval $(call SetupJdkExecutable, BUILD_GTEST_LAUNCHER, \
TARGETS += $(BUILD_GTEST_LAUNCHER)
################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/hotspot/lib/CompileJvm.gmk b/make/hotspot/lib/CompileJvm.gmk
index ff4c7fd3af3bd..b2c59505f9a43 100644
--- a/make/hotspot/lib/CompileJvm.gmk
+++ b/make/hotspot/lib/CompileJvm.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
@@ -23,6 +23,11 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
+################################################################################
+
include CopyFiles.gmk
# Include support files that will setup compiler flags due to the selected
@@ -125,9 +130,7 @@ else ifeq ($(call And, $(call isTargetOs, linux) $(call isTargetCpu, aarch64)),
endif
endif
-ifeq ($(call isTargetOs, linux macosx windows), true)
- JVM_PRECOMPILED_HEADER := $(TOPDIR)/src/hotspot/share/precompiled/precompiled.hpp
-endif
+JVM_PRECOMPILED_HEADER := $(TOPDIR)/src/hotspot/share/precompiled/precompiled.hpp
ifeq ($(call isTargetCpu, x86), true)
JVM_EXCLUDE_PATTERNS += x86_64
@@ -361,3 +364,8 @@ ifneq ($(GENERATE_COMPILE_COMMANDS_ONLY), true)
$(foreach o, $(BUILD_LIBJVM_ALL_OBJS), $(eval $(call SetupOperatorNewDeleteCheck,$o)))
endif
endif
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/hotspot/lib/CompileLibraries.gmk b/make/hotspot/lib/CompileLibraries.gmk
index 03ba95cac3c60..9563c36eec675 100644
--- a/make/hotspot/lib/CompileLibraries.gmk
+++ b/make/hotspot/lib/CompileLibraries.gmk
@@ -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,14 +23,12 @@
# questions.
#
-default: all
+include MakeFileStart.gmk
-include $(SPEC)
-include MakeBase.gmk
-include JdkNativeCompilation.gmk
+################################################################################
include HotspotCommon.gmk
-
+include JdkNativeCompilation.gmk
include lib/CompileJvm.gmk
ifneq ($(GTEST_FRAMEWORK_SRC), )
@@ -41,6 +39,6 @@ endif
include CopyToExplodedJdk.gmk
-all: $(TARGETS)
+################################################################################
-.PHONY: all
+include MakeFileEnd.gmk
diff --git a/make/hotspot/lib/JvmFeatures.gmk b/make/hotspot/lib/JvmFeatures.gmk
index 09a48508effa8..0efb8671da846 100644
--- a/make/hotspot/lib/JvmFeatures.gmk
+++ b/make/hotspot/lib/JvmFeatures.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
@@ -23,11 +23,15 @@
# questions.
#
-$(eval $(call IncludeCustomExtension, hotspot/lib/JvmFeatures.gmk))
+################################################################################
+
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
################################################################################
# Setup CFLAGS and EXCLUDES for the libjvm compilation, depending on which
# jvm features are selected for this jvm variant.
+################################################################################
ifeq ($(call check-jvm-feature, compiler1), true)
JVM_CFLAGS_FEATURES += -DCOMPILER1
@@ -280,3 +284,8 @@ ifeq ($(call check-jvm-feature, opt-size), true)
BUILD_LIBJVM_systemDictionary.cpp_CXXFLAGS := -fno-optimize-sibling-calls
endif
endif
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/hotspot/lib/JvmFlags.gmk b/make/hotspot/lib/JvmFlags.gmk
index e5929ab994ba0..97538da74c730 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
@@ -23,10 +23,12 @@
# questions.
#
-$(eval $(call IncludeCustomExtension, hotspot/lib/JvmFlags.gmk))
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
################################################################################
# Setup JVM_CFLAGS. These are shared between GensrcDtrace.gmk and CompileJvm.gmk.
+################################################################################
# This variable may be added to by a custom extension
JVM_SRC_ROOTS += $(TOPDIR)/src/hotspot
@@ -43,7 +45,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 +94,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
@@ -105,3 +101,8 @@ endif
ifeq ($(ENABLE_COMPATIBLE_CDS_ALIGNMENT), true)
JVM_CFLAGS += -DCOMPATIBLE_CDS_ALIGNMENT
endif
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/hotspot/lib/JvmOverrideFiles.gmk b/make/hotspot/lib/JvmOverrideFiles.gmk
index 6a513e10c61d4..3eedb64a597a3 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
@@ -23,11 +23,13 @@
# questions.
#
-$(eval $(call IncludeCustomExtension, hotspot/lib/JvmOverrideFiles.gmk))
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
################################################################################
# This file contains explicit overrides of CFLAGS and/or precompiled header
# status for individual files on specific platforms.
+################################################################################
ifeq ($(TOOLCHAIN_TYPE), gcc)
BUILD_LIBJVM_vmStructs.cpp_CXXFLAGS := -fno-var-tracking-assignments
@@ -52,16 +54,14 @@ 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 \
- $(OPT_SPEED_SRC) \
- #
- endif
+ JVM_PRECOMPILED_HEADER_EXCLUDE := \
+ sharedRuntimeTrig.cpp \
+ sharedRuntimeTrans.cpp \
+ $(OPT_SPEED_SRC) \
+ #
ifeq ($(call isTargetCpu, x86), true)
# Performance measurements show that by compiling GC related code, we could
@@ -110,11 +110,7 @@ else ifeq ($(call isTargetOs, macosx), true)
endif
else ifeq ($(call isTargetOs, aix), true)
- ifeq ($(TOOLCHAIN_TYPE), clang)
- BUILD_LIBJVM_synchronizer.cpp_CXXFLAGS := -fno-inline
- else
- BUILD_LIBJVM_synchronizer.cpp_CXXFLAGS := -qnoinline
- endif
+ BUILD_LIBJVM_synchronizer.cpp_CXXFLAGS := -fno-inline
BUILD_LIBJVM_sharedRuntimeTrans.cpp_CXXFLAGS := $(CXX_O_FLAG_NONE)
# Disable aggressive optimizations for functions in sharedRuntimeTrig.cpp
# and sharedRuntimeTrans.cpp on ppc64.
@@ -128,28 +124,32 @@ else ifeq ($(call isTargetOs, aix), true)
# mode, so don't optimize sharedRuntimeTrig.cpp at all.
BUILD_LIBJVM_sharedRuntimeTrig.cpp_CXXFLAGS := $(CXX_O_FLAG_NONE)
- ifneq ($(DEBUG_LEVEL), slowdebug)
- # Compiling jvmtiEnterTrace.cpp with full optimization needs more than 30min
- # (mostly because of '-qhot=level=1' and the more than 1300 'log_trace' calls
- # which cause a lot of template expansion).
- BUILD_LIBJVM_jvmtiEnterTrace.cpp_OPTIMIZATION := LOW
- endif
-
# Disable ELF decoder on AIX (AIX uses XCOFF).
JVM_EXCLUDE_PATTERNS += elf
+ JVM_PRECOMPILED_HEADER_EXCLUDE := \
+ sharedRuntimeTrig.cpp \
+ sharedRuntimeTrans.cpp \
+ synchronizer.cpp \
+ $(OPT_SPEED_SRC) \
+ #
+
else ifeq ($(call isTargetOs, windows), true)
JVM_PRECOMPILED_HEADER_EXCLUDE := \
- bytecodeInterpreter.cpp \
- bytecodeInterpreterWithChecks.cpp \
opcodes.cpp \
os_windows.cpp \
os_windows_x86.cpp \
osThread_windows.cpp \
jvmciCompilerToVMInit.cpp \
+ $(OPT_SPEED_SRC) \
#
# Workaround for jvmciCompilerToVM.cpp long compilation time
BUILD_LIBJVM_jvmciCompilerToVMInit.cpp_OPTIMIZATION := NONE
endif
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/hotspot/test/GtestImage.gmk b/make/hotspot/test/GtestImage.gmk
index 3d6290837eea5..524c0b36be8e9 100644
--- a/make/hotspot/test/GtestImage.gmk
+++ b/make/hotspot/test/GtestImage.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,10 +23,9 @@
# questions.
#
-default: all
+include MakeFileStart.gmk
-include $(SPEC)
-include MakeBase.gmk
+################################################################################
include CopyFiles.gmk
@@ -70,4 +69,6 @@ ifeq ($(call isTargetOs, windows), true)
)
endif
-all: $(TARGETS)
+################################################################################
+
+include MakeFileEnd.gmk
diff --git a/make/ide/eclipse/CreateWorkspace.gmk b/make/ide/eclipse/CreateWorkspace.gmk
index 50d04ad87afb5..052693dbb2d94 100644
--- a/make/ide/eclipse/CreateWorkspace.gmk
+++ b/make/ide/eclipse/CreateWorkspace.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,13 +23,13 @@
# questions.
#
-default: all
+include MakeFileStart.gmk
-include $(SPEC)
-include MakeBase.gmk
+################################################################################
+
+include Modules.gmk
include TextFileProcessing.gmk
include Utils.gmk
-include Modules.gmk
JVM_VARIANT := $(JVM_VARIANT_MAIN)
include hotspot/HotspotCommon.gmk
@@ -356,4 +356,6 @@ else
))
endif
-all: $(TARGETS)
+################################################################################
+
+include MakeFileEnd.gmk
diff --git a/make/ide/idea/jdk/idea.gmk b/make/ide/idea/jdk/IdeaGenConfig.gmk
similarity index 61%
rename from make/ide/idea/jdk/idea.gmk
rename to make/ide/idea/jdk/IdeaGenConfig.gmk
index b27de609c49be..5f8afc4711740 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,38 @@
# questions.
#
-include Makefile
-include make/MainSupport.gmk
+include MakeFileStart.gmk
-.PHONY: idea
+################################################################################
+
+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
-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:
+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: idea
+
+################################################################################
+
+include MakeFileEnd.gmk
diff --git a/make/ide/visualstudio/hotspot/CreateVSProject.gmk b/make/ide/visualstudio/hotspot/CreateVSProject.gmk
index db48cdea9f77a..b2afbe2b9bc89 100644
--- a/make/ide/visualstudio/hotspot/CreateVSProject.gmk
+++ b/make/ide/visualstudio/hotspot/CreateVSProject.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,13 +23,12 @@
# questions.
#
-# This must be the first rule
-default: all
+include MakeFileStart.gmk
+
+################################################################################
-include $(SPEC)
-include MakeBase.gmk
-include JavaCompilation.gmk
include Execute.gmk
+include JavaCompilation.gmk
ifeq ($(call isTargetOs, windows), true)
# The next part is a bit hacky. We include the CompileJvm.gmk to be
@@ -144,11 +143,11 @@ ifeq ($(call isTargetOs, windows), true)
TARGETS += $(vcproj_file_TARGET)
- all: $(TARGETS)
-
else
all:
$(info Hotspot Visual Studio generation only supported on Windows)
endif
-.PHONY: all
+################################################################################
+
+include MakeFileEnd.gmk
diff --git a/make/ide/vscode/hotspot/CreateVSCodeProject.gmk b/make/ide/vscode/hotspot/CreateVSCodeProject.gmk
index 54c98a3eeb667..11f25c152f62c 100644
--- a/make/ide/vscode/hotspot/CreateVSCodeProject.gmk
+++ b/make/ide/vscode/hotspot/CreateVSCodeProject.gmk
@@ -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
@@ -23,11 +23,7 @@
# questions.
#
-# This must be the first rule
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
+include MakeFileStart.gmk
################################################################################
# SedEscape
@@ -115,6 +111,8 @@ $(OUTPUTDIR)/.vscode/launch.json:
TARGETS := $(OUTPUTDIR)/jdk.code-workspace $(OUTPUTDIR)/.vscode/tasks.json \
$(OUTPUTDIR)/.vscode/launch.json
-all: $(TARGETS)
+.PHONY: $(TARGETS)
+
+################################################################################
-.PHONY: all $(TARGETS)
+include MakeFileEnd.gmk
diff --git a/make/ide/xcode/hotspot/CreateXcodeProject.gmk b/make/ide/xcode/hotspot/CreateXcodeProject.gmk
index 1f92ba0716f1e..3476078b243f0 100644
--- a/make/ide/xcode/hotspot/CreateXcodeProject.gmk
+++ b/make/ide/xcode/hotspot/CreateXcodeProject.gmk
@@ -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,11 +23,10 @@
# questions.
#
-# This must be the first rule
-default: all
+include MakeFileStart.gmk
+
+################################################################################
-include $(SPEC)
-include MakeBase.gmk
include CopyFiles.gmk
include Execute.gmk
include JavaCompilation.gmk
@@ -100,8 +99,6 @@ ifeq ($(call isTargetOs, macosx), true)
build: $(build_xcode_project) $(copy_xcode_project)
open: $(open_xcode_project)
-
- all: $(TARGETS)
else
build:
open:
@@ -109,4 +106,8 @@ else
$(info Xcode projects are only supported on macOS)
endif
-.PHONY: default all build open
+.PHONY: build open
+
+################################################################################
+
+include MakeFileEnd.gmk
diff --git a/make/modules/java.base/Copy.gmk b/make/modules/java.base/Copy.gmk
index 7e3a0e9c3ab5e..e33676529cdf3 100644
--- a/make/modules/java.base/Copy.gmk
+++ b/make/modules/java.base/Copy.gmk
@@ -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
@@ -23,15 +23,12 @@
# questions.
#
+################################################################################
+
include CopyCommon.gmk
include Modules.gmk
include TextFileProcessing.gmk
-# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, modules/java.base/Copy.gmk))
-
-################################################################################
-
ifeq ($(call isTargetOs, aix), true)
TZMAPPINGS_SRC := $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/conf
diff --git a/make/modules/java.base/Gendata.gmk b/make/modules/java.base/Gendata.gmk
index 9e5cfe2d0fc40..edb8e050bbffb 100644
--- a/make/modules/java.base/Gendata.gmk
+++ b/make/modules/java.base/Gendata.gmk
@@ -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
@@ -23,17 +23,14 @@
# questions.
#
-include GendataCommon.gmk
-
-include gendata/GendataBreakIterator.gmk
-
-include gendata/GendataTZDB.gmk
+################################################################################
+include GendataCommon.gmk
include gendata/GendataBlockedCerts.gmk
-
+include gendata/GendataBreakIterator.gmk
include gendata/GendataCryptoPolicy.gmk
-
include gendata/GendataPublicSuffixList.gmk
+include gendata/GendataTZDB.gmk
################################################################################
diff --git a/make/modules/java.base/Gensrc.gmk b/make/modules/java.base/Gensrc.gmk
index 6eae7edd07837..c974db7b6c682 100644
--- a/make/modules/java.base/Gensrc.gmk
+++ b/make/modules/java.base/Gensrc.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
@@ -23,18 +23,20 @@
# questions.
#
+################################################################################
+
include GensrcCommon.gmk
+include gensrc/GensrcBuffer.gmk
include gensrc/GensrcCharacterData.gmk
-include gensrc/GensrcMisc.gmk
-include gensrc/GensrcCharsetMapping.gmk
include gensrc/GensrcCharsetCoder.gmk
-include gensrc/GensrcBuffer.gmk
+include gensrc/GensrcCharsetMapping.gmk
include gensrc/GensrcExceptions.gmk
-include gensrc/GensrcVarHandles.gmk
+include gensrc/GensrcMisc.gmk
include gensrc/GensrcModuleLoaderMap.gmk
-include gensrc/GensrcScopedMemoryAccess.gmk
include gensrc/GensrcRegex.gmk
+include gensrc/GensrcScopedMemoryAccess.gmk
+include gensrc/GensrcVarHandles.gmk
################################################################################
@@ -113,3 +115,5 @@ $(INTPOLY_GEN_DONE): $(INTPLOY_HEADER) $(BUILD_TOOLS_JDK)
$(TOUCH) $@
TARGETS += $(INTPOLY_GEN_DONE)
+
+################################################################################
diff --git a/make/modules/java.base/Java.gmk b/make/modules/java.base/Java.gmk
index 5820c280fe9d1..84344f93409a8 100644
--- a/make/modules/java.base/Java.gmk
+++ b/make/modules/java.base/Java.gmk
@@ -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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
# The base module should be built with all warnings enabled. When a
# new warning is added to javac, it can be temporarily added to the
# disabled warnings list.
@@ -57,3 +59,5 @@ ifeq ($(call isTargetOs, windows), true)
sun/nio/ch/SimpleAsynchronousFileChannelImpl.java \
#
endif
+
+################################################################################
diff --git a/make/modules/java.base/Launcher.gmk b/make/modules/java.base/Launcher.gmk
index 024c1c4731b0c..c249656f188ca 100644
--- a/make/modules/java.base/Launcher.gmk
+++ b/make/modules/java.base/Launcher.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
@@ -23,10 +23,9 @@
# questions.
#
-include LauncherCommon.gmk
+################################################################################
-# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, modules/java.base/Launcher.gmk))
+include LauncherCommon.gmk
JAVA_VERSION_INFO_RESOURCE := \
$(TOPDIR)/src/java.base/windows/native/launcher/java.rc
@@ -38,7 +37,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 +50,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), \
))
@@ -100,3 +102,5 @@ ifeq ($(call isTargetOsType, unix), true)
TARGETS += $(BUILD_JSPAWNHELPER)
endif
+
+################################################################################
diff --git a/make/modules/java.base/Lib.gmk b/make/modules/java.base/Lib.gmk
index 2c3df4622b1b7..771b94525aaef 100644
--- a/make/modules/java.base/Lib.gmk
+++ b/make/modules/java.base/Lib.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
@@ -23,12 +23,11 @@
# questions.
#
+################################################################################
+
include CopyFiles.gmk
include LibCommon.gmk
-# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, modules/java.base/Lib.gmk))
-
# Prepare the find cache.
$(call FillFindCache, $(wildcard $(TOPDIR)/src/java.base/*/native))
@@ -200,3 +199,5 @@ ifeq ($(call isTargetOs, linux)+$(call isTargetCpu, x86_64)+$(INCLUDE_COMPILER2)
TARGETS += $(BUILD_LIBSIMD_SORT)
endif
+
+################################################################################
diff --git a/make/modules/java.base/gendata/GendataBlockedCerts.gmk b/make/modules/java.base/gendata/GendataBlockedCerts.gmk
index b6149b457cd50..c26b4cdeed79d 100644
--- a/make/modules/java.base/gendata/GendataBlockedCerts.gmk
+++ b/make/modules/java.base/gendata/GendataBlockedCerts.gmk
@@ -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
@@ -23,6 +23,11 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
+################################################################################
+
GENDATA_BLOCKED_CERTS_SRC += $(MODULE_SRC)/share/data/blockedcertsconverter/blocked.certs.pem
GENDATA_BLOCKED_CERTS := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/security/blocked.certs
@@ -32,3 +37,8 @@ $(GENDATA_BLOCKED_CERTS): $(BUILD_TOOLS_JDK) $(GENDATA_BLOCKED_CERTS_SRC)
($(CAT) $(GENDATA_BLOCKED_CERTS_SRC) | $(TOOL_BLOCKED_CERTS) > $@) || exit 1
TARGETS += $(GENDATA_BLOCKED_CERTS)
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/modules/java.base/gendata/GendataBreakIterator.gmk b/make/modules/java.base/gendata/GendataBreakIterator.gmk
index 857ce2b7c34fc..7aa26d5490b19 100644
--- a/make/modules/java.base/gendata/GendataBreakIterator.gmk
+++ b/make/modules/java.base/gendata/GendataBreakIterator.gmk
@@ -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
@@ -23,9 +23,12 @@
# questions.
#
-#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
+################################################################################
# Make file for generating BreakIterator data files.
-#
+################################################################################
# input
#
@@ -111,3 +114,8 @@ $(LD_DATA_PKG_DIR)/_the.bifiles_th: $(BUILD_TOOLS_JDK) $(UNICODEDATA) \
$(TOUCH) $@
TARGETS += $(BIFILES) $(BIFILES_TH)
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/modules/java.base/gendata/GendataCryptoPolicy.gmk b/make/modules/java.base/gendata/GendataCryptoPolicy.gmk
index c63b36fe058ad..f4774cb1f28f6 100644
--- a/make/modules/java.base/gendata/GendataCryptoPolicy.gmk
+++ b/make/modules/java.base/gendata/GendataCryptoPolicy.gmk
@@ -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,6 +23,11 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
+################################################################################
+
#
# In pre-JDK9 releases, Oracle JDK has had a separately downloadable set
# of policy files which has been a nightmare for deployment.
@@ -37,12 +42,6 @@
# determines the default directory/policy.
#
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
-
-
################################################################################
POLICY_DIR := $(SUPPORT_OUTPUTDIR)/modules_conf/java.base/security/policy
LIMITED_POLICY_DIR := $(POLICY_DIR)/limited
@@ -70,3 +69,6 @@ TARGETS += \
$(UNLIMITED_POLICY_DIR)/default_local.policy \
################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/modules/java.base/gendata/GendataPublicSuffixList.gmk b/make/modules/java.base/gendata/GendataPublicSuffixList.gmk
index 189fccf0c0da5..563b728c38df0 100644
--- a/make/modules/java.base/gendata/GendataPublicSuffixList.gmk
+++ b/make/modules/java.base/gendata/GendataPublicSuffixList.gmk
@@ -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
@@ -23,7 +23,10 @@
# questions.
#
-include $(SPEC)
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
+################################################################################
GENDATA_PUBLICSUFFIXLIST_SRC += $(MODULE_SRC)/share/data/publicsuffixlist/public_suffix_list.dat
GENDATA_PUBLICSUFFIXLIST := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/security/public_suffix_list.dat
@@ -36,3 +39,8 @@ $(GENDATA_PUBLICSUFFIXLIST): $(GENDATA_PUBLICSUFFIXLIST_SRC) $(BUILD_TOOLS_JDK)
$(CHMOD) 444 $@
TARGETS += $(GENDATA_PUBLICSUFFIXLIST)
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/modules/java.base/gendata/GendataTZDB.gmk b/make/modules/java.base/gendata/GendataTZDB.gmk
index fbdd9ff3749a2..4674c687a2406 100644
--- a/make/modules/java.base/gendata/GendataTZDB.gmk
+++ b/make/modules/java.base/gendata/GendataTZDB.gmk
@@ -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
@@ -23,6 +23,11 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
+################################################################################
+
GENDATA_TZDB :=
#
@@ -40,3 +45,8 @@ $(GENDATA_TZDB_DAT): $(TZDATA_TZFILES)
$(TOOL_TZDB) -srcdir $(TZDATA_DIR) -dstfile $(GENDATA_TZDB_DAT) $(TZDATA_TZFILE)
TARGETS += $(GENDATA_TZDB_DAT)
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/modules/java.base/gensrc/GensrcBuffer.gmk b/make/modules/java.base/gensrc/GensrcBuffer.gmk
index fe417e9c423ed..f769a8e61e052 100644
--- a/make/modules/java.base/gensrc/GensrcBuffer.gmk
+++ b/make/modules/java.base/gensrc/GensrcBuffer.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
@@ -23,6 +23,11 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
+################################################################################
+
GENSRC_BUFFER :=
GENSRC_BUFFER_DST := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/nio
@@ -380,3 +385,8 @@ $(eval $(call SetupGenBuffer,ByteBufferAsDoubleBufferRL,$(BYTE_X_BUF), type := d
$(GENSRC_BUFFER): $(BUILD_TOOLS_JDK)
TARGETS += $(GENSRC_BUFFER)
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/modules/java.base/gensrc/GensrcCharacterData.gmk b/make/modules/java.base/gensrc/GensrcCharacterData.gmk
index beee18000f149..c05b126299b9e 100644
--- a/make/modules/java.base/gensrc/GensrcCharacterData.gmk
+++ b/make/modules/java.base/gensrc/GensrcCharacterData.gmk
@@ -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
@@ -23,9 +23,12 @@
# questions.
#
-#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
+################################################################################
# Rules to create $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/lang/CharacterData*.java
-#
+################################################################################
GENSRC_CHARACTERDATA :=
@@ -66,3 +69,8 @@ $(eval $(call SetupCharacterData,CharacterData0E, -string -plane 14, 11 4 1))
$(GENSRC_CHARACTERDATA): $(BUILD_TOOLS_JDK)
TARGETS += $(GENSRC_CHARACTERDATA)
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/modules/java.base/gensrc/GensrcCharsetCoder.gmk b/make/modules/java.base/gensrc/GensrcCharsetCoder.gmk
index 2940ba4231931..3e654d0b7a836 100644
--- a/make/modules/java.base/gensrc/GensrcCharsetCoder.gmk
+++ b/make/modules/java.base/gensrc/GensrcCharsetCoder.gmk
@@ -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
@@ -23,6 +23,11 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
+################################################################################
+
GENSRC_CHARSETCODER :=
GENSRC_CHARSETCODER_DST := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/nio/charset
@@ -108,3 +113,8 @@ GENSRC_CHARSETCODER += $(GENSRC_CHARSETCODER_DST)/CharsetEncoder.java
$(GENSRC_CHARSETCODER): $(BUILD_TOOLS_JDK)
TARGETS += $(GENSRC_CHARSETCODER)
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/modules/java.base/gensrc/GensrcCharsetMapping.gmk b/make/modules/java.base/gensrc/GensrcCharsetMapping.gmk
index b9a8f269a7d7d..8a9b9dfee5c3a 100644
--- a/make/modules/java.base/gensrc/GensrcCharsetMapping.gmk
+++ b/make/modules/java.base/gensrc/GensrcCharsetMapping.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2020, 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,11 +23,14 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
################################################################################
-#
# Generate StandardCharsets.java and individul sun.nio.cs charset class using
# the charsetmapping tool
-#
+################################################################################
+
CHARSET_DATA_DIR := $(TOPDIR)/make/data/charsetmapping
CHARSET_EXTSRC_DIR := $(TOPDIR)/src/jdk.charsets/share/classes/sun/nio/cs/ext
CHARSET_GENSRC_JAVA_DIR_BASE := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/cs
@@ -54,3 +57,8 @@ $(CHARSET_DONE_BASE)-stdcs: $(CHARSET_DATA_DIR)/charsets \
$(TOUCH) '$@'
TARGETS += $(CHARSET_DONE_BASE)-stdcs
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/modules/java.base/gensrc/GensrcExceptions.gmk b/make/modules/java.base/gensrc/GensrcExceptions.gmk
index 9fa5d48009bfd..baa61596d6b10 100644
--- a/make/modules/java.base/gensrc/GensrcExceptions.gmk
+++ b/make/modules/java.base/gensrc/GensrcExceptions.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
@@ -23,6 +23,11 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
+################################################################################
+
GENSRC_EXCEPTIONS :=
GENSRC_EXCEPTIONS_DST := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/nio
@@ -45,3 +50,8 @@ GENSRC_EXCEPTIONS += $(foreach D, $(GENSRC_EXCEPTIONS_SRC_DIRS), $(GENSRC_EXCEPT
$(GENSRC_EXCEPTIONS): $(BUILD_TOOLS_JDK)
TARGETS += $(GENSRC_EXCEPTIONS)
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/modules/java.base/gensrc/GensrcMisc.gmk b/make/modules/java.base/gensrc/GensrcMisc.gmk
index a5bbd37321c24..edb5e8bc58efa 100644
--- a/make/modules/java.base/gensrc/GensrcMisc.gmk
+++ b/make/modules/java.base/gensrc/GensrcMisc.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
@@ -23,6 +23,11 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
+################################################################################
+
################################################################################
# Install the launcher name, release version string, full version
# string and the runtime name into the VersionProps.java file.
@@ -154,3 +159,8 @@ ifneq ($(wildcard $(TOPDIR)/src/java.base/share/classes/javax/crypto/JceSecurity
TARGETS += $(BUILD_JCESECURITY_JAVA)
endif
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/modules/java.base/gensrc/GensrcModuleLoaderMap.gmk b/make/modules/java.base/gensrc/GensrcModuleLoaderMap.gmk
index ce91cdc861c2d..13b985df3ef45 100644
--- a/make/modules/java.base/gensrc/GensrcModuleLoaderMap.gmk
+++ b/make/modules/java.base/gensrc/GensrcModuleLoaderMap.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
@@ -23,6 +23,11 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
+################################################################################
+
include Modules.gmk
$(eval $(call ReadImportMetaData))
@@ -58,3 +63,6 @@ $(SUPPORT_OUTPUTDIR)/gensrc/java.base/jdk/internal/module/ModuleLoaderMap.java:
TARGETS += $(SUPPORT_OUTPUTDIR)/gensrc/java.base/jdk/internal/module/ModuleLoaderMap.java
################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/modules/java.base/gensrc/GensrcRegex.gmk b/make/modules/java.base/gensrc/GensrcRegex.gmk
index 6384d36de59ef..c46a029e2c255 100644
--- a/make/modules/java.base/gensrc/GensrcRegex.gmk
+++ b/make/modules/java.base/gensrc/GensrcRegex.gmk
@@ -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,10 +23,13 @@
# questions.
#
-#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
+################################################################################
# Rules to create java files under
# $(SUPPORT_OUTPUTDIR)/gensrc/java.base/jdk/internal/util/regex/
-#
+################################################################################
GENSRC_INDICCONJUNCTBREAK := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/jdk/internal/util/regex/IndicConjunctBreak.java
@@ -44,3 +47,8 @@ $(GENSRC_INDICCONJUNCTBREAK): $(BUILD_TOOLS_JDK) $(INDICCONJUNCTBREAKTEMP) $(IND
$(INDICCONJUNCTBREAKPARAMS)
TARGETS += $(GENSRC_INDICCONJUNCTBREAK)
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/modules/java.base/gensrc/GensrcScopedMemoryAccess.gmk b/make/modules/java.base/gensrc/GensrcScopedMemoryAccess.gmk
index 54fea77571e90..1ed3fb3db795f 100644
--- a/make/modules/java.base/gensrc/GensrcScopedMemoryAccess.gmk
+++ b/make/modules/java.base/gensrc/GensrcScopedMemoryAccess.gmk
@@ -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
@@ -23,6 +23,11 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
+################################################################################
+
SCOPED_MEMORY_ACCESS_GENSRC_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/jdk/internal/misc
SCOPED_MEMORY_ACCESS_SRC_DIR := $(MODULE_SRC)/share/classes/jdk/internal/misc
SCOPED_MEMORY_ACCESS_TEMPLATE := $(SCOPED_MEMORY_ACCESS_SRC_DIR)/X-ScopedMemoryAccess.java.template
@@ -149,3 +154,8 @@ $(SCOPED_MEMORY_ACCESS_DEST): $(BUILD_TOOLS_JDK) $(SCOPED_MEMORY_ACCESS_TEMPLATE
$(PRINTF) "}\n" >> $(SCOPED_MEMORY_ACCESS_DEST)
TARGETS += $(SCOPED_MEMORY_ACCESS_DEST)
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/modules/java.base/gensrc/GensrcVarHandles.gmk b/make/modules/java.base/gensrc/GensrcVarHandles.gmk
index fe4c4e9764834..e2f5664dec63f 100644
--- a/make/modules/java.base/gensrc/GensrcVarHandles.gmk
+++ b/make/modules/java.base/gensrc/GensrcVarHandles.gmk
@@ -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,6 +23,11 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
+################################################################################
+
GENSRC_VARHANDLES :=
VARHANDLES_GENSRC_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/invoke
@@ -277,3 +282,8 @@ $(foreach t, $(VARHANDLES_MEMORY_SEGMENT_TYPES), \
$(eval $(call GenerateVarHandleMemorySegment,VAR_HANDLE_MEMORY_SEGMENT_$t,$t)))
TARGETS += $(GENSRC_VARHANDLES)
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/modules/java.base/lib/CoreLibraries.gmk b/make/modules/java.base/lib/CoreLibraries.gmk
index 61ac495968a3d..b76394d081f25 100644
--- a/make/modules/java.base/lib/CoreLibraries.gmk
+++ b/make/modules/java.base/lib/CoreLibraries.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
@@ -23,6 +23,11 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
+################################################################################
+
################################################################################
## Build libverify
################################################################################
@@ -192,3 +197,8 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJLI, \
))
TARGETS += $(BUILD_LIBJLI)
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/modules/java.compiler/Java.gmk b/make/modules/java.compiler/Java.gmk
index 04f31a9bc66ee..cb720672639f5 100644
--- a/make/modules/java.compiler/Java.gmk
+++ b/make/modules/java.compiler/Java.gmk
@@ -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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
# To the extent technically possible, this module should be built with
# -Werror and all lint warnings enabled. In particular,
# DISABLED_WARNINGS_java should not be augmented.
@@ -31,3 +33,5 @@ DOCLINT += -Xdoclint:all/protected \
'-Xdoclint/package:java.*,javax.*'
EXCLUDES += javax/tools/snippet-files
+
+################################################################################
diff --git a/make/modules/java.datatransfer/Java.gmk b/make/modules/java.datatransfer/Java.gmk
index 6c5332f645737..47eb6e265770d 100644
--- a/make/modules/java.datatransfer/Java.gmk
+++ b/make/modules/java.datatransfer/Java.gmk
@@ -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
@@ -23,8 +23,12 @@
# questions.
#
+################################################################################
+
DISABLED_WARNINGS_java += this-escape
DOCLINT += -Xdoclint:all/protected \
'-Xdoclint/package:java.*,javax.*'
COPY += flavormap.properties
+
+################################################################################
diff --git a/make/modules/java.desktop/Copy.gmk b/make/modules/java.desktop/Copy.gmk
index 4232e62552c86..9acca9f688cef 100644
--- a/make/modules/java.desktop/Copy.gmk
+++ b/make/modules/java.desktop/Copy.gmk
@@ -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
@@ -23,11 +23,11 @@
# questions.
#
+################################################################################
+
include CopyCommon.gmk
include Modules.gmk
-################################################################################
-
$(CONF_DST_DIR)/sound.properties: $(TOPDIR)/src/java.desktop/share/conf/sound.properties
$(call install-file)
diff --git a/make/modules/java.desktop/Gendata.gmk b/make/modules/java.desktop/Gendata.gmk
index a3f0c926ca6b1..3df4610bd1df4 100644
--- a/make/modules/java.desktop/Gendata.gmk
+++ b/make/modules/java.desktop/Gendata.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2020, 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,8 +23,10 @@
# questions.
#
-include GendataCommon.gmk
+################################################################################
+include GendataCommon.gmk
include gendata/GendataFontConfig.gmk
-
include gendata/GendataHtml32dtd.gmk
+
+################################################################################
diff --git a/make/modules/java.desktop/Gensrc.gmk b/make/modules/java.desktop/Gensrc.gmk
index f76091079739c..ceeade7a96d86 100644
--- a/make/modules/java.desktop/Gensrc.gmk
+++ b/make/modules/java.desktop/Gensrc.gmk
@@ -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
@@ -23,10 +23,9 @@
# questions.
#
-include GensrcCommon.gmk
+################################################################################
-# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, modules/java.desktop/Gensrc.gmk))
+include GensrcCommon.gmk
ifeq ($(call isTargetOs, windows), false)
include gensrc/GensrcIcons.gmk
@@ -77,3 +76,5 @@ $(eval $(call SetupCompileProperties, COMPILE_PROPERTIES, \
))
TARGETS += $(COMPILE_PROPERTIES)
+
+################################################################################
diff --git a/make/modules/java.desktop/Java.gmk b/make/modules/java.desktop/Java.gmk
index a13b4b1ba3560..61c7fa44e0e83 100644
--- a/make/modules/java.desktop/Java.gmk
+++ b/make/modules/java.desktop/Java.gmk
@@ -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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
DISABLED_WARNINGS_java += dangling-doc-comments lossy-conversions this-escape
DOCLINT += -Xdoclint:all/protected \
'-Xdoclint/package:java.*,javax.*'
@@ -139,3 +141,5 @@ EXCLUDE_FILES += \
javax/swing/plaf/nimbus/SplitPanePainter.java \
javax/swing/plaf/nimbus/TabbedPanePainter.java \
#
+
+################################################################################
diff --git a/make/modules/java.desktop/Lib.gmk b/make/modules/java.desktop/Lib.gmk
index 18f386ae6b41f..830e0553c39d9 100644
--- a/make/modules/java.desktop/Lib.gmk
+++ b/make/modules/java.desktop/Lib.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
@@ -23,12 +23,11 @@
# questions.
#
+################################################################################
+
include LibCommon.gmk
include Execute.gmk
-# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, modules/java.desktop/Lib.gmk))
-
# Prepare the find cache.
$(call FillFindCache, $(wildcard $(TOPDIR)/src/java.desktop/*/native))
@@ -131,3 +130,5 @@ ifeq ($(call isTargetOs, macosx), true)
TARGETS += $(BUILD_LIBOSX)
endif
+
+################################################################################
diff --git a/make/modules/java.desktop/gendata/GendataFontConfig.gmk b/make/modules/java.desktop/gendata/GendataFontConfig.gmk
index 92a64b986e189..572adb4376ec7 100644
--- a/make/modules/java.desktop/gendata/GendataFontConfig.gmk
+++ b/make/modules/java.desktop/gendata/GendataFontConfig.gmk
@@ -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
@@ -23,6 +23,11 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
+################################################################################
+
FONTCONFIG_DATA_DIR := $(MODULE_SRC)/$(OPENJDK_TARGET_OS)/data/fontconfig
FONTCONFIG_SRC_FILE := $(FONTCONFIG_DATA_DIR)/fontconfig.properties
@@ -55,3 +60,8 @@ ifneq ($(wildcard $(FONTCONFIG_SRC_FILE)), )
TARGETS += $(FONTCONFIG_OUT_BIN_FILE)
endif
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/modules/java.desktop/gendata/GendataHtml32dtd.gmk b/make/modules/java.desktop/gendata/GendataHtml32dtd.gmk
index bf3e0a1b4ed63..2c5899c91c2b9 100644
--- a/make/modules/java.desktop/gendata/GendataHtml32dtd.gmk
+++ b/make/modules/java.desktop/gendata/GendataHtml32dtd.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2018, 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,6 +23,11 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
+################################################################################
+
GENDATA_HTML32DTD :=
HTML32DTD = $(JDK_OUTPUTDIR)/modules/java.desktop/javax/swing/text/html/parser/html32.bdtd
@@ -33,3 +38,8 @@ $(HTML32DTD): $(BUILD_TOOLS_JDK)
($(TOOL_DTDBUILDER) html32 > $@) || exit 1
TARGETS += $(HTML32DTD)
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/modules/java.desktop/gensrc/GensrcIcons.gmk b/make/modules/java.desktop/gensrc/GensrcIcons.gmk
index 4e572211334a2..bc7f580fe766e 100644
--- a/make/modules/java.desktop/gensrc/GensrcIcons.gmk
+++ b/make/modules/java.desktop/gensrc/GensrcIcons.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
@@ -23,6 +23,11 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
+################################################################################
+
GENSRC_AWT_ICONS :=
GENSRC_AWT_ICONS_SRC :=
GENSRC_AWT_ICONS_TMP := $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop
@@ -108,3 +113,8 @@ ifeq ($(call isTargetOs, macosx), true)
TARGETS += $(GENSRC_OSX_ICONS)
endif
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/modules/java.desktop/gensrc/GensrcSwing.gmk b/make/modules/java.desktop/gensrc/GensrcSwing.gmk
index abd428f364198..a59499e9b1a57 100644
--- a/make/modules/java.desktop/gensrc/GensrcSwing.gmk
+++ b/make/modules/java.desktop/gensrc/GensrcSwing.gmk
@@ -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
@@ -23,9 +23,13 @@
# questions.
#
-#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
+################################################################################
# Generate java files for javax.swing.plaf package
-#
+################################################################################
+
NIMBUS_PACKAGE = javax.swing.plaf
NIMBUS_GENSRC_DIR = $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/javax/swing/plaf/nimbus
NIMBUS_SKIN_FILE = $(MODULE_SRC)/share/classes/javax/swing/plaf/nimbus/skin.laf
@@ -41,3 +45,8 @@ $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_the.generated_nimbus: $(NIMBUS_SKIN_FI
GENSRC_SWING_NIMBUS := $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_the.generated_nimbus
TARGETS += $(GENSRC_SWING_NIMBUS)
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/modules/java.desktop/gensrc/GensrcX11Wrappers.gmk b/make/modules/java.desktop/gensrc/GensrcX11Wrappers.gmk
index 25402ad035a5b..fa271fc55ffea 100644
--- a/make/modules/java.desktop/gensrc/GensrcX11Wrappers.gmk
+++ b/make/modules/java.desktop/gensrc/GensrcX11Wrappers.gmk
@@ -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
@@ -23,8 +23,13 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
+################################################################################
# Generate java sources using the X11 offsets that are precalculated in files
# src/java.desktop/unix/data/x11wrappergen/sizes-.txt.
+################################################################################
# Put the generated Java classes used to interface X11 from awt here.
GENSRC_X11WRAPPERS_OUTPUTDIR := $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/sun/awt/X11
@@ -45,3 +50,8 @@ $(eval $(call SetupExecute, gen_x11wrappers, \
))
TARGETS += $(gen_x11wrappers_TARGET)
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/modules/java.desktop/lib/AwtLibraries.gmk b/make/modules/java.desktop/lib/AwtLibraries.gmk
index 5ba7c819008b5..4d18038f2aac3 100644
--- a/make/modules/java.desktop/lib/AwtLibraries.gmk
+++ b/make/modules/java.desktop/lib/AwtLibraries.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
@@ -23,12 +23,16 @@
# questions.
#
-include CopyFiles.gmk
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
################################################################################
# This file will build all AWT/2D native libraries with "awt" in the name.
# Note that this does not imply that the code they bring in belong to AWT.
# This split is purely made to keep the size of the Makefiles reasonable.
+################################################################################
+
+include CopyFiles.gmk
LIBAWT_DEFAULT_HEADER_DIRS := \
common/awt/utility \
@@ -437,3 +441,8 @@ ifeq ($(call isTargetOs, windows), true)
TARGETS += $(COPY_JAWT_LIB)
endif
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/modules/java.desktop/lib/ClientLibraries.gmk b/make/modules/java.desktop/lib/ClientLibraries.gmk
index 41f3040222cc0..6599f655c1066 100644
--- a/make/modules/java.desktop/lib/ClientLibraries.gmk
+++ b/make/modules/java.desktop/lib/ClientLibraries.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
@@ -23,11 +23,15 @@
# questions.
#
+include MakeIncludeStart.gmk
+ifeq ($(INCLUDE), true)
+
################################################################################
# This file will build all AWT/2D native libraries that does not have "awt" in
# the name. Note that this does not imply anything about the logical ownership
# of the code they compile.
# This split is purely made to keep the size of the Makefiles reasonable.
+################################################################################
################################################################################
## Build libmlib_image
@@ -222,7 +226,7 @@ ifeq ($(ENABLE_HEADLESS_ONLY), false)
EXCLUDE_SRC_PATTERNS := $(LIBSPLASHSCREEN_EXCLUDE_SRC_PATTERNS), \
EXCLUDE_FILES := imageioJPEG.c jpegdecoder.c pngtest.c, \
EXCLUDES := $(LIBSPLASHSCREEN_EXCLUDES), \
- OPTIMIZATION := LOW, \
+ OPTIMIZATION := SIZE, \
CFLAGS := $(LIBSPLASHSCREEN_CFLAGS) \
$(GIFLIB_CFLAGS) $(LIBJPEG_CFLAGS) $(PNG_CFLAGS) $(LIBZ_CFLAGS), \
CXXFLAGS := $(LIBSPLASHSCREEN_CFLAGS) \
@@ -360,8 +364,6 @@ else
LIBFONTMANAGER_JDK_LIBS += libfreetype
endif
-LIBFONTMANAGER_OPTIMIZATION := HIGHEST
-
ifneq ($(filter $(TOOLCHAIN_TYPE), gcc clang), )
# gcc (and to an extent clang) is particularly bad at optimizing these files,
# causing a massive spike in compile time. We don't care about these
@@ -372,7 +374,6 @@ endif
ifeq ($(call isTargetOs, windows), true)
LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c X11TextRenderer.c
- LIBFONTMANAGER_OPTIMIZATION := HIGHEST
else ifeq ($(call isTargetOs, macosx), true)
LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c X11TextRenderer.c \
fontpath.c lcdglyph.c
@@ -393,7 +394,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBFONTMANAGER, \
AccelGlyphCache.c, \
CFLAGS := $(LIBFONTMANAGER_CFLAGS), \
CXXFLAGS := $(LIBFONTMANAGER_CFLAGS), \
- OPTIMIZATION := $(LIBFONTMANAGER_OPTIMIZATION), \
+ OPTIMIZATION := HIGHEST, \
CFLAGS_windows = -DCC_NOEX, \
EXTRA_HEADER_DIRS := $(LIBFONTMANAGER_EXTRA_HEADER_DIRS), \
EXTRA_SRC := $(LIBFONTMANAGER_EXTRA_SRC), \
@@ -406,6 +407,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBFONTMANAGER, \
LDFLAGS_aix := -Wl$(COMMA)-berok, \
JDK_LIBS := libawt java.base:libjava $(LIBFONTMANAGER_JDK_LIBS), \
JDK_LIBS_macosx := libawt_lwawt, \
+ JDK_LIBS_unix := java.base:libjvm, \
LIBS := $(LIBFONTMANAGER_LIBS), \
LIBS_unix := $(LIBM), \
LIBS_macosx := \
@@ -470,3 +472,8 @@ ifeq ($(call isTargetOs, macosx), true)
$(BUILD_LIBOSXUI): $(SHADERS_LIB)
endif
+
+################################################################################
+
+endif # include guard
+include MakeIncludeEnd.gmk
diff --git a/make/modules/java.instrument/Java.gmk b/make/modules/java.instrument/Java.gmk
index f49e425718e7f..6e5ea0e2c733b 100644
--- a/make/modules/java.instrument/Java.gmk
+++ b/make/modules/java.instrument/Java.gmk
@@ -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
@@ -23,5 +23,9 @@
# questions.
#
+################################################################################
+
DOCLINT += -Xdoclint:all/protected \
'-Xdoclint/package:java.*,javax.*'
+
+################################################################################
diff --git a/make/modules/java.instrument/Lib.gmk b/make/modules/java.instrument/Lib.gmk
index 675c1d8ccd3d7..0d1a3d81b50dd 100644
--- a/make/modules/java.instrument/Lib.gmk
+++ b/make/modules/java.instrument/Lib.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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include LibCommon.gmk
################################################################################
@@ -48,3 +50,5 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBINSTRUMENT, \
))
TARGETS += $(BUILD_LIBINSTRUMENT)
+
+################################################################################
diff --git a/make/modules/java.logging/Copy.gmk b/make/modules/java.logging/Copy.gmk
index 8c9e677b861db..36d70ed555530 100644
--- a/make/modules/java.logging/Copy.gmk
+++ b/make/modules/java.logging/Copy.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
@@ -23,10 +23,10 @@
# questions.
#
-include CopyCommon.gmk
-
################################################################################
+include CopyCommon.gmk
+
LOGGING_LIB_SRC := $(TOPDIR)/src/java.logging/share/conf
$(CONF_DST_DIR)/logging.properties: $(LOGGING_LIB_SRC)/logging.properties
diff --git a/make/modules/java.logging/Gensrc.gmk b/make/modules/java.logging/Gensrc.gmk
index c28edd822b65f..3b166e0f0a612 100644
--- a/make/modules/java.logging/Gensrc.gmk
+++ b/make/modules/java.logging/Gensrc.gmk
@@ -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
@@ -23,10 +23,9 @@
# questions.
#
-include GensrcCommon.gmk
-
################################################################################
+include GensrcCommon.gmk
include GensrcProperties.gmk
$(eval $(call SetupCompileProperties, COMPILE_PROPERTIES, \
@@ -35,3 +34,5 @@ $(eval $(call SetupCompileProperties, COMPILE_PROPERTIES, \
))
TARGETS += $(COMPILE_PROPERTIES)
+
+################################################################################
diff --git a/make/modules/java.logging/Java.gmk b/make/modules/java.logging/Java.gmk
index 781370b2e1879..ab4e1b6144e1a 100644
--- a/make/modules/java.logging/Java.gmk
+++ b/make/modules/java.logging/Java.gmk
@@ -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
@@ -23,7 +23,11 @@
# questions.
#
+################################################################################
+
DISABLED_WARNINGS_java += this-escape
DOCLINT += -Xdoclint:all/protected \
'-Xdoclint/package:java.*,javax.*'
+
+################################################################################
diff --git a/make/modules/java.management.rmi/Java.gmk b/make/modules/java.management.rmi/Java.gmk
index 4579fea684343..11f99c26bd3cb 100644
--- a/make/modules/java.management.rmi/Java.gmk
+++ b/make/modules/java.management.rmi/Java.gmk
@@ -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
@@ -23,5 +23,9 @@
# questions.
#
+################################################################################
+
DOCLINT += -Xdoclint:all/protected \
'-Xdoclint/package:javax.*'
+
+################################################################################
diff --git a/make/modules/java.management/Java.gmk b/make/modules/java.management/Java.gmk
index 7a337946cd7df..44e3f328c7fc9 100644
--- a/make/modules/java.management/Java.gmk
+++ b/make/modules/java.management/Java.gmk
@@ -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
@@ -23,7 +23,11 @@
# questions.
#
+################################################################################
+
DISABLED_WARNINGS_java += dangling-doc-comments this-escape
DOCLINT += -Xdoclint:all/protected \
'-Xdoclint/package:java.*,javax.*'
+
+################################################################################
diff --git a/make/modules/java.management/Lib.gmk b/make/modules/java.management/Lib.gmk
index b9f79da451635..cfa96b012c95b 100644
--- a/make/modules/java.management/Lib.gmk
+++ b/make/modules/java.management/Lib.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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include LibCommon.gmk
################################################################################
@@ -45,3 +47,5 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBMANAGEMENT, \
))
TARGETS += $(BUILD_LIBMANAGEMENT)
+
+################################################################################
diff --git a/make/modules/java.naming/Java.gmk b/make/modules/java.naming/Java.gmk
index 207329f594418..1c7a2a1668a71 100644
--- a/make/modules/java.naming/Java.gmk
+++ b/make/modules/java.naming/Java.gmk
@@ -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
@@ -23,8 +23,12 @@
# questions.
#
+################################################################################
+
DISABLED_WARNINGS_java += dangling-doc-comments this-escape
DOCLINT += -Xdoclint:all/protected \
'-Xdoclint/package:java.*,javax.*'
CLEAN += jndiprovider.properties
+
+################################################################################
diff --git a/make/modules/java.prefs/Java.gmk b/make/modules/java.prefs/Java.gmk
index e124e8844d3b3..6e5ea0e2c733b 100644
--- a/make/modules/java.prefs/Java.gmk
+++ b/make/modules/java.prefs/Java.gmk
@@ -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
@@ -23,5 +23,9 @@
# questions.
#
+################################################################################
+
DOCLINT += -Xdoclint:all/protected \
'-Xdoclint/package:java.*,javax.*'
+
+################################################################################
diff --git a/make/modules/java.prefs/Lib.gmk b/make/modules/java.prefs/Lib.gmk
index 033768ffa1dce..7590a5431b121 100644
--- a/make/modules/java.prefs/Lib.gmk
+++ b/make/modules/java.prefs/Lib.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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include LibCommon.gmk
################################################################################
@@ -46,3 +48,5 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBPREFS, \
))
TARGETS += $(BUILD_LIBPREFS)
+
+################################################################################
diff --git a/make/modules/java.rmi/Java.gmk b/make/modules/java.rmi/Java.gmk
index 6c607bd0572f2..4f24edb6f677b 100644
--- a/make/modules/java.rmi/Java.gmk
+++ b/make/modules/java.rmi/Java.gmk
@@ -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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
DISABLED_WARNINGS_java += this-escape
DOCLINT += -Xdoclint:all/protected \
@@ -32,3 +34,5 @@ CLEAN_FILES += $(wildcard \
$(TOPDIR)/src/java.rmi/share/classes/sun/rmi/server/resources/*.properties)
TARGETS += $(call CreateHkTargets, $(CLEAN_FILES))
+
+################################################################################
diff --git a/make/modules/java.rmi/Launcher.gmk b/make/modules/java.rmi/Launcher.gmk
index 8c335711da026..a72c107981c73 100644
--- a/make/modules/java.rmi/Launcher.gmk
+++ b/make/modules/java.rmi/Launcher.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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include LauncherCommon.gmk
################################################################################
@@ -32,3 +34,5 @@ include LauncherCommon.gmk
$(eval $(call SetupBuildLauncher, rmiregistry, \
MAIN_CLASS := sun.rmi.registry.RegistryImpl, \
))
+
+################################################################################
diff --git a/make/modules/java.rmi/Lib.gmk b/make/modules/java.rmi/Lib.gmk
index 3f4a5bed893bc..0520af6b702ab 100644
--- a/make/modules/java.rmi/Lib.gmk
+++ b/make/modules/java.rmi/Lib.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,6 +23,8 @@
# questions.
#
+################################################################################
+
include LibCommon.gmk
################################################################################
@@ -37,3 +39,5 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBRMI, \
))
TARGETS += $(BUILD_LIBRMI)
+
+################################################################################
diff --git a/make/modules/java.scripting/Java.gmk b/make/modules/java.scripting/Java.gmk
index c9060b5fa46b6..1909ec1a2dffd 100644
--- a/make/modules/java.scripting/Java.gmk
+++ b/make/modules/java.scripting/Java.gmk
@@ -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
@@ -23,7 +23,11 @@
# questions.
#
+################################################################################
+
DOCLINT += -Xdoclint:all/protected \
'-Xdoclint/package:java.*,javax.*'
COPY += .js
CLEAN += .properties
+
+################################################################################
diff --git a/make/modules/java.scripting/Launcher.gmk b/make/modules/java.scripting/Launcher.gmk
index a969b567d1e4f..ee6b93fbf2cc6 100644
--- a/make/modules/java.scripting/Launcher.gmk
+++ b/make/modules/java.scripting/Launcher.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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include LauncherCommon.gmk
################################################################################
@@ -33,3 +35,5 @@ $(eval $(call SetupBuildLauncher, jrunscript, \
MAIN_CLASS := com.sun.tools.script.shell.Main, \
JAVA_ARGS := --add-modules ALL-DEFAULT, \
))
+
+################################################################################
diff --git a/make/modules/java.security.jgss/Java.gmk b/make/modules/java.security.jgss/Java.gmk
index 7a337946cd7df..44e3f328c7fc9 100644
--- a/make/modules/java.security.jgss/Java.gmk
+++ b/make/modules/java.security.jgss/Java.gmk
@@ -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
@@ -23,7 +23,11 @@
# questions.
#
+################################################################################
+
DISABLED_WARNINGS_java += dangling-doc-comments this-escape
DOCLINT += -Xdoclint:all/protected \
'-Xdoclint/package:java.*,javax.*'
+
+################################################################################
diff --git a/make/modules/java.security.jgss/Launcher.gmk b/make/modules/java.security.jgss/Launcher.gmk
index b0e2fdcffd1d5..40a9385937824 100644
--- a/make/modules/java.security.jgss/Launcher.gmk
+++ b/make/modules/java.security.jgss/Launcher.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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include LauncherCommon.gmk
ifeq ($(call isTargetOs, windows), true)
@@ -50,3 +52,5 @@ ifeq ($(call isTargetOs, windows), true)
MAIN_CLASS := sun.security.krb5.internal.tools.Ktab, \
))
endif
+
+################################################################################
diff --git a/make/modules/java.security.jgss/Lib.gmk b/make/modules/java.security.jgss/Lib.gmk
index 2c827b84109f7..4b05100e6a603 100644
--- a/make/modules/java.security.jgss/Lib.gmk
+++ b/make/modules/java.security.jgss/Lib.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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include LibCommon.gmk
################################################################################
@@ -94,3 +96,5 @@ ifneq ($(BUILD_CRYPTO), false)
TARGETS += $(BUILD_LIBOSXKRB5)
endif
endif
+
+################################################################################
diff --git a/make/modules/java.security.sasl/Java.gmk b/make/modules/java.security.sasl/Java.gmk
index 136b311a827a9..12d13b4910fac 100644
--- a/make/modules/java.security.sasl/Java.gmk
+++ b/make/modules/java.security.sasl/Java.gmk
@@ -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,4 +23,8 @@
# questions.
#
+################################################################################
+
DISABLED_WARNINGS_java += dangling-doc-comments this-escape
+
+################################################################################
diff --git a/make/modules/java.smartcardio/Java.gmk b/make/modules/java.smartcardio/Java.gmk
index f49e425718e7f..6e5ea0e2c733b 100644
--- a/make/modules/java.smartcardio/Java.gmk
+++ b/make/modules/java.smartcardio/Java.gmk
@@ -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
@@ -23,5 +23,9 @@
# questions.
#
+################################################################################
+
DOCLINT += -Xdoclint:all/protected \
'-Xdoclint/package:java.*,javax.*'
+
+################################################################################
diff --git a/make/modules/java.smartcardio/Lib.gmk b/make/modules/java.smartcardio/Lib.gmk
index 1e647fd7e2403..8d8a2aef086bf 100644
--- a/make/modules/java.smartcardio/Lib.gmk
+++ b/make/modules/java.smartcardio/Lib.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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include LibCommon.gmk
################################################################################
@@ -41,3 +43,5 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJ2PCSC, \
))
TARGETS += $(BUILD_LIBJ2PCSC)
+
+################################################################################
diff --git a/make/modules/java.sql.rowset/Java.gmk b/make/modules/java.sql.rowset/Java.gmk
index 6bc30e3693d00..ecfe3e6e6412d 100644
--- a/make/modules/java.sql.rowset/Java.gmk
+++ b/make/modules/java.sql.rowset/Java.gmk
@@ -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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
DISABLED_WARNINGS_java += dangling-doc-comments
DOCLINT += -Xdoclint:all/protected \
@@ -32,3 +34,5 @@ CLEAN_FILES += $(wildcard \
$(TOPDIR)/src/java.sql.rowset/share/classes/javax/sql/rowset/*.properties)
TARGETS += $(call CreateHkTargets, $(CLEAN_FILES))
+
+################################################################################
diff --git a/make/modules/java.sql/Java.gmk b/make/modules/java.sql/Java.gmk
index 7a337946cd7df..44e3f328c7fc9 100644
--- a/make/modules/java.sql/Java.gmk
+++ b/make/modules/java.sql/Java.gmk
@@ -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
@@ -23,7 +23,11 @@
# questions.
#
+################################################################################
+
DISABLED_WARNINGS_java += dangling-doc-comments this-escape
DOCLINT += -Xdoclint:all/protected \
'-Xdoclint/package:java.*,javax.*'
+
+################################################################################
diff --git a/make/modules/java.transaction.xa/Java.gmk b/make/modules/java.transaction.xa/Java.gmk
index 4579fea684343..11f99c26bd3cb 100644
--- a/make/modules/java.transaction.xa/Java.gmk
+++ b/make/modules/java.transaction.xa/Java.gmk
@@ -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
@@ -23,5 +23,9 @@
# questions.
#
+################################################################################
+
DOCLINT += -Xdoclint:all/protected \
'-Xdoclint/package:javax.*'
+
+################################################################################
diff --git a/make/modules/java.xml.crypto/Java.gmk b/make/modules/java.xml.crypto/Java.gmk
index 9ee19c8c30297..68db8ed817a23 100644
--- a/make/modules/java.xml.crypto/Java.gmk
+++ b/make/modules/java.xml.crypto/Java.gmk
@@ -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
@@ -23,9 +23,13 @@
# questions.
#
+################################################################################
+
DISABLED_WARNINGS_java += dangling-doc-comments this-escape
DOCLINT += -Xdoclint:all/protected \
'-Xdoclint/package:java.*,javax.*'
COPY += .dtd .xml
CLEAN += .properties
+
+################################################################################
diff --git a/make/modules/java.xml/Copy.gmk b/make/modules/java.xml/Copy.gmk
index f242cb2ac7611..f8c1896e526f2 100644
--- a/make/modules/java.xml/Copy.gmk
+++ b/make/modules/java.xml/Copy.gmk
@@ -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,11 +23,12 @@
# questions.
#
+################################################################################
+
include CopyCommon.gmk
include Modules.gmk
################################################################################
-#
# Copy property and template files from share/conf to CONF_DST_DIR
#
$(eval $(call SetupCopyFiles, COPY_XML_MODULE_CONF, \
@@ -37,4 +38,5 @@ $(eval $(call SetupCopyFiles, COPY_XML_MODULE_CONF, \
))
TARGETS += $(COPY_XML_MODULE_CONF)
+
################################################################################
diff --git a/make/modules/java.xml/Java.gmk b/make/modules/java.xml/Java.gmk
index 0c174f2113e84..35f66238a7a96 100644
--- a/make/modules/java.xml/Java.gmk
+++ b/make/modules/java.xml/Java.gmk
@@ -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
@@ -23,9 +23,13 @@
# questions.
#
+################################################################################
+
DISABLED_WARNINGS_java += dangling-doc-comments lossy-conversions this-escape
DOCLINT += -Xdoclint:all/protected \
'-Xdoclint/package:$(call CommaList, javax.xml.catalog javax.xml.datatype \
javax.xml.transform javax.xml.validation javax.xml.xpath)'
COPY += .dtd .xsd .xml .ent .mod
CLEAN += .properties
+
+################################################################################
diff --git a/make/modules/jdk.accessibility/Copy.gmk b/make/modules/jdk.accessibility/Copy.gmk
index cd8aeba5a11d0..798b97902c6e9 100644
--- a/make/modules/jdk.accessibility/Copy.gmk
+++ b/make/modules/jdk.accessibility/Copy.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2014, 2017, 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,6 +24,8 @@
#
################################################################################
-# Include CopyCommon.gmk to get exported header files to be properly copied.
+# Include CopyCommon.gmk to get exported header files to be properly copied.
include CopyCommon.gmk
+
+################################################################################
diff --git a/make/modules/jdk.accessibility/Java.gmk b/make/modules/jdk.accessibility/Java.gmk
index fc8b2f832d713..7f1718a23ed76 100644
--- a/make/modules/jdk.accessibility/Java.gmk
+++ b/make/modules/jdk.accessibility/Java.gmk
@@ -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,4 +23,8 @@
# questions.
#
+################################################################################
+
DISABLED_WARNINGS_java += dangling-doc-comments
+
+################################################################################
diff --git a/make/modules/jdk.accessibility/Launcher.gmk b/make/modules/jdk.accessibility/Launcher.gmk
index 86ad96b3a1ec4..04694b10e9e58 100644
--- a/make/modules/jdk.accessibility/Launcher.gmk
+++ b/make/modules/jdk.accessibility/Launcher.gmk
@@ -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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include LauncherCommon.gmk
ifeq ($(call isTargetOs, windows), true)
@@ -89,3 +91,5 @@ ifeq ($(call isTargetOs, windows), true)
TARGETS += $(BUILD_JACCESSWALKER)
endif
+
+################################################################################
diff --git a/make/modules/jdk.accessibility/Lib.gmk b/make/modules/jdk.accessibility/Lib.gmk
index 6323049c98577..6a3631bff675a 100644
--- a/make/modules/jdk.accessibility/Lib.gmk
+++ b/make/modules/jdk.accessibility/Lib.gmk
@@ -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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include LibCommon.gmk
################################################################################
@@ -80,3 +82,5 @@ ifeq ($(call isTargetOs, windows), true)
TARGETS += $(BUILD_LIBWINDOWSACCESSBRIDGE)
endif
+
+################################################################################
diff --git a/make/modules/jdk.attach/Lib.gmk b/make/modules/jdk.attach/Lib.gmk
index 8eefe7a4ec057..78437d761d2e6 100644
--- a/make/modules/jdk.attach/Lib.gmk
+++ b/make/modules/jdk.attach/Lib.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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include LibCommon.gmk
################################################################################
@@ -46,3 +48,5 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBATTACH, \
))
TARGETS += $(BUILD_LIBATTACH)
+
+################################################################################
diff --git a/make/modules/jdk.charsets/Gensrc.gmk b/make/modules/jdk.charsets/Gensrc.gmk
index e93ea19219d8f..82dc091cbfda1 100644
--- a/make/modules/jdk.charsets/Gensrc.gmk
+++ b/make/modules/jdk.charsets/Gensrc.gmk
@@ -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
@@ -23,12 +23,12 @@
# questions.
#
-include GensrcCommon.gmk
-
################################################################################
-#
# Generate files using the charsetmapping tool
-#
+################################################################################
+
+include GensrcCommon.gmk
+
CHARSET_DATA_DIR := $(TOPDIR)/make/data/charsetmapping
CHARSET_GENSRC_JAVA_DIR_CS := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.charsets/sun/nio/cs/ext
@@ -82,3 +82,5 @@ TARGETS += \
$(CHARSET_DONE_CS)-euctw \
$(CHARSET_GENSRC_JAVA_DIR_CS)/sjis0213.dat \
#
+
+################################################################################
diff --git a/make/modules/jdk.charsets/Java.gmk b/make/modules/jdk.charsets/Java.gmk
index 2eb5bd454568d..c5dbb1e2a603c 100644
--- a/make/modules/jdk.charsets/Java.gmk
+++ b/make/modules/jdk.charsets/Java.gmk
@@ -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
@@ -23,4 +23,8 @@
# questions.
#
+################################################################################
+
COPY += .dat
+
+################################################################################
diff --git a/make/modules/jdk.compiler/Gendata.gmk b/make/modules/jdk.compiler/Gendata.gmk
index 57487c7c842f5..739625a5732a1 100644
--- a/make/modules/jdk.compiler/Gendata.gmk
+++ b/make/modules/jdk.compiler/Gendata.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
@@ -23,16 +23,13 @@
# questions.
#
+################################################################################
+
include CopyFiles.gmk
include JarArchive.gmk
include JavaCompilation.gmk
include Modules.gmk
-################################################################################
-
-# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, modules/jdk.compiler/Gendata.gmk))
-
# This is needed to properly setup DOCS_MODULES.
$(eval $(call ReadImportMetaData))
diff --git a/make/modules/jdk.compiler/Gensrc.gmk b/make/modules/jdk.compiler/Gensrc.gmk
index 14cc4f55a2b1e..c6c5879745cf4 100644
--- a/make/modules/jdk.compiler/Gensrc.gmk
+++ b/make/modules/jdk.compiler/Gensrc.gmk
@@ -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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include GensrcCommon.gmk
include GensrcProperties.gmk
include Execute.gmk
@@ -72,3 +74,5 @@ $(eval $(call SetupExecute, PARSEPROPERTIES, \
))
TARGETS += $(PARSEPROPERTIES)
+
+################################################################################
diff --git a/make/modules/jdk.compiler/Java.gmk b/make/modules/jdk.compiler/Java.gmk
index a2dd4f60fa681..3d6d22b278290 100644
--- a/make/modules/jdk.compiler/Java.gmk
+++ b/make/modules/jdk.compiler/Java.gmk
@@ -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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
# To the extent technically possible, this module should be built with
# -Werror and all lint warnings enabled. In particular,
# DISABLED_WARNINGS_java should not be augmented.
@@ -33,3 +35,5 @@ JAVAC_FLAGS += -XDstringConcat=inline
CLEAN_FILES += $(wildcard \
$(patsubst %, $(TOPDIR)/src/jdk.compiler/share/classes/%/*.properties, \
sun/tools/serialver/resources))
+
+################################################################################
diff --git a/make/modules/jdk.compiler/Launcher.gmk b/make/modules/jdk.compiler/Launcher.gmk
index e80c31bcb18f3..74bd6896409c8 100644
--- a/make/modules/jdk.compiler/Launcher.gmk
+++ b/make/modules/jdk.compiler/Launcher.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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include LauncherCommon.gmk
################################################################################
@@ -32,7 +34,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 +43,7 @@ $(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.crypto.cryptoki/Java.gmk b/make/modules/jdk.crypto.cryptoki/Java.gmk
index fc8b2f832d713..7f1718a23ed76 100644
--- a/make/modules/jdk.crypto.cryptoki/Java.gmk
+++ b/make/modules/jdk.crypto.cryptoki/Java.gmk
@@ -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,4 +23,8 @@
# questions.
#
+################################################################################
+
DISABLED_WARNINGS_java += dangling-doc-comments
+
+################################################################################
diff --git a/make/modules/jdk.crypto.cryptoki/Lib.gmk b/make/modules/jdk.crypto.cryptoki/Lib.gmk
index ec80aaf46b42b..29d1422cd787c 100644
--- a/make/modules/jdk.crypto.cryptoki/Lib.gmk
+++ b/make/modules/jdk.crypto.cryptoki/Lib.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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include LibCommon.gmk
################################################################################
@@ -40,3 +42,5 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJ2PKCS11, \
))
TARGETS += $(BUILD_LIBJ2PKCS11)
+
+################################################################################
diff --git a/make/modules/jdk.crypto.mscapi/Java.gmk b/make/modules/jdk.crypto.mscapi/Java.gmk
index 269a1195b6a10..aca47fc97f704 100644
--- a/make/modules/jdk.crypto.mscapi/Java.gmk
+++ b/make/modules/jdk.crypto.mscapi/Java.gmk
@@ -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,4 +23,8 @@
# questions.
#
+################################################################################
+
DISABLED_WARNINGS_java += this-escape
+
+################################################################################
diff --git a/make/modules/jdk.crypto.mscapi/Lib.gmk b/make/modules/jdk.crypto.mscapi/Lib.gmk
index 39b83a21ae94a..9c78621ec0cb7 100644
--- a/make/modules/jdk.crypto.mscapi/Lib.gmk
+++ b/make/modules/jdk.crypto.mscapi/Lib.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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include LibCommon.gmk
ifeq ($(call isTargetOs, windows), true)
@@ -40,3 +42,5 @@ ifeq ($(call isTargetOs, windows), true)
TARGETS += $(BUILD_LIBSUNMSCAPI)
endif
+
+################################################################################
diff --git a/make/modules/jdk.dev/Java.gmk b/make/modules/jdk.dev/Java.gmk
index c26b4f9c8f691..5740117531408 100644
--- a/make/modules/jdk.dev/Java.gmk
+++ b/make/modules/jdk.dev/Java.gmk
@@ -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
@@ -23,8 +23,12 @@
# questions.
#
+################################################################################
+
CLEAN_FILES += $(wildcard \
$(patsubst %, $(TOPDIR)/src/jdk.dev/share/classes/%/*.properties, \
com/sun/tools/script/shell))
COPY += .js oqlhelp.html .txt
+
+################################################################################
diff --git a/make/modules/jdk.dynalink/Java.gmk b/make/modules/jdk.dynalink/Java.gmk
index 852e68c0d3141..f95e59bf36e26 100644
--- a/make/modules/jdk.dynalink/Java.gmk
+++ b/make/modules/jdk.dynalink/Java.gmk
@@ -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
@@ -23,4 +23,8 @@
# questions.
#
+################################################################################
+
CLEAN += .properties
+
+################################################################################
diff --git a/make/modules/jdk.editpad/Java.gmk b/make/modules/jdk.editpad/Java.gmk
index ef2d3bcfa7c52..640335dae43f4 100644
--- a/make/modules/jdk.editpad/Java.gmk
+++ b/make/modules/jdk.editpad/Java.gmk
@@ -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
@@ -23,4 +23,8 @@
# questions.
#
+################################################################################
+
COPY += .properties
+
+################################################################################
diff --git a/make/modules/jdk.hotspot.agent/Gensrc.gmk b/make/modules/jdk.hotspot.agent/Gensrc.gmk
index b2bd016a512d7..b5cfa6d15fc7b 100644
--- a/make/modules/jdk.hotspot.agent/Gensrc.gmk
+++ b/make/modules/jdk.hotspot.agent/Gensrc.gmk
@@ -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
@@ -54,3 +54,5 @@ ifeq ($(call isTargetOs, macosx), true)
TARGETS += $(MACH_EXC_SERVER)
endif
+
+################################################################################
diff --git a/make/modules/jdk.hotspot.agent/Java.gmk b/make/modules/jdk.hotspot.agent/Java.gmk
index 333d28a5aa0cf..eef2ccb4bb030 100644
--- a/make/modules/jdk.hotspot.agent/Java.gmk
+++ b/make/modules/jdk.hotspot.agent/Java.gmk
@@ -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
@@ -23,6 +23,10 @@
# questions.
#
+################################################################################
+
DISABLED_WARNINGS_java += rawtypes serial cast static overrides \
dangling-doc-comments fallthrough this-escape
COPY += .gif .png .properties
+
+################################################################################
diff --git a/make/modules/jdk.hotspot.agent/Launcher.gmk b/make/modules/jdk.hotspot.agent/Launcher.gmk
index 94ad08bda0cec..83e640486c2da 100644
--- a/make/modules/jdk.hotspot.agent/Launcher.gmk
+++ b/make/modules/jdk.hotspot.agent/Launcher.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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include LauncherCommon.gmk
################################################################################
@@ -33,3 +35,5 @@ $(eval $(call SetupBuildLauncher, jhsdb, \
MAIN_CLASS := sun.jvm.hotspot.SALauncher, \
MACOSX_PRIVILEGED := true, \
))
+
+################################################################################
diff --git a/make/modules/jdk.hotspot.agent/Lib.gmk b/make/modules/jdk.hotspot.agent/Lib.gmk
index 12f1c1f2a9077..ed8de631dc351 100644
--- a/make/modules/jdk.hotspot.agent/Lib.gmk
+++ b/make/modules/jdk.hotspot.agent/Lib.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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include LibCommon.gmk
################################################################################
@@ -79,3 +81,5 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBSAPROC, \
))
TARGETS += $(BUILD_LIBSAPROC)
+
+################################################################################
diff --git a/make/modules/jdk.httpserver/Gensrc.gmk b/make/modules/jdk.httpserver/Gensrc.gmk
index 37b51bb1d451f..baeb620781af8 100644
--- a/make/modules/jdk.httpserver/Gensrc.gmk
+++ b/make/modules/jdk.httpserver/Gensrc.gmk
@@ -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
@@ -23,12 +23,12 @@
# questions.
#
+################################################################################
+
include GensrcCommon.gmk
include GensrcProperties.gmk
include Modules.gmk
-################################################################################
-
# Use wildcard so as to avoid getting non-existing directories back
SIMPLESERVER_RESOURCES_DIRS := $(wildcard $(addsuffix /sun/net/httpserver/simpleserver/resources, \
$(call FindModuleSrcDirs, jdk.httpserver)))
@@ -39,3 +39,5 @@ $(eval $(call SetupCompileProperties, SIMPLESERVER_PROPERTIES, \
))
TARGETS += $(SIMPLESERVER_PROPERTIES)
+
+################################################################################
diff --git a/make/modules/jdk.httpserver/Java.gmk b/make/modules/jdk.httpserver/Java.gmk
index 95c0f1eb6ab6b..f36d09919bc19 100644
--- a/make/modules/jdk.httpserver/Java.gmk
+++ b/make/modules/jdk.httpserver/Java.gmk
@@ -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
@@ -23,6 +23,10 @@
# questions.
#
+################################################################################
+
DISABLED_WARNINGS_java += this-escape
COPY += .ico
+
+################################################################################
diff --git a/make/modules/jdk.httpserver/Jmod.gmk b/make/modules/jdk.httpserver/Jmod.gmk
index 9a216ef095878..72c87e19c29b2 100644
--- a/make/modules/jdk.httpserver/Jmod.gmk
+++ b/make/modules/jdk.httpserver/Jmod.gmk
@@ -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,4 +23,8 @@
# questions.
#
+################################################################################
+
JMOD_FLAGS_main_class := --main-class sun.net.httpserver.simpleserver.Main
+
+################################################################################
diff --git a/make/modules/jdk.httpserver/Launcher.gmk b/make/modules/jdk.httpserver/Launcher.gmk
index 0f0c060e6e3ac..d537ec1b50a36 100644
--- a/make/modules/jdk.httpserver/Launcher.gmk
+++ b/make/modules/jdk.httpserver/Launcher.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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include LauncherCommon.gmk
################################################################################
@@ -32,3 +34,5 @@ include LauncherCommon.gmk
$(eval $(call SetupBuildLauncher, jwebserver, \
MAIN_CLASS := sun.net.httpserver.simpleserver.JWebServer, \
))
+
+################################################################################
diff --git a/make/modules/jdk.incubator.vector/Java.gmk b/make/modules/jdk.incubator.vector/Java.gmk
index 6cd5301428f7e..e51ffe57ceaa4 100644
--- a/make/modules/jdk.incubator.vector/Java.gmk
+++ b/make/modules/jdk.incubator.vector/Java.gmk
@@ -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
@@ -23,6 +23,10 @@
# questions.
#
+################################################################################
+
DISABLED_WARNINGS_java += dangling-doc-comments
DOCLINT += -Xdoclint:all/protected
+
+################################################################################
diff --git a/make/modules/jdk.incubator.vector/Lib.gmk b/make/modules/jdk.incubator.vector/Lib.gmk
index 69da7ed059a6c..6d1259cfe6097 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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include LibCommon.gmk
################################################################################
@@ -64,8 +66,10 @@ 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)
endif
+
+################################################################################
diff --git a/make/modules/jdk.internal.jvmstat/Java.gmk b/make/modules/jdk.internal.jvmstat/Java.gmk
index 4376b7e348494..108730a0fc593 100644
--- a/make/modules/jdk.internal.jvmstat/Java.gmk
+++ b/make/modules/jdk.internal.jvmstat/Java.gmk
@@ -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
@@ -23,6 +23,10 @@
# questions.
#
+################################################################################
+
DISABLED_WARNINGS_java += this-escape
COPY += aliasmap
+
+################################################################################
diff --git a/make/modules/jdk.internal.le/Java.gmk b/make/modules/jdk.internal.le/Java.gmk
index 4c952b6357449..27c6eaf5f7f96 100644
--- a/make/modules/jdk.internal.le/Java.gmk
+++ b/make/modules/jdk.internal.le/Java.gmk
@@ -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
@@ -23,6 +23,10 @@
# questions.
#
+################################################################################
+
DISABLED_WARNINGS_java += dangling-doc-comments this-escape
COPY += .properties .caps .txt
+
+################################################################################
diff --git a/make/modules/jdk.internal.md/Java.gmk b/make/modules/jdk.internal.md/Java.gmk
index 2a850f5563743..638c12413c4cb 100644
--- a/make/modules/jdk.internal.md/Java.gmk
+++ b/make/modules/jdk.internal.md/Java.gmk
@@ -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,4 +23,8 @@
# questions.
#
+################################################################################
+
COPY += .txt
+
+################################################################################
diff --git a/make/modules/jdk.internal.opt/Java.gmk b/make/modules/jdk.internal.opt/Java.gmk
index 0c65d9ad94ee8..08bb3a5334a73 100644
--- a/make/modules/jdk.internal.opt/Java.gmk
+++ b/make/modules/jdk.internal.opt/Java.gmk
@@ -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
@@ -23,6 +23,10 @@
# questions.
#
+################################################################################
+
DISABLED_WARNINGS_java += this-escape
COPY += .properties
+
+################################################################################
diff --git a/make/modules/jdk.internal.vm.ci/Java.gmk b/make/modules/jdk.internal.vm.ci/Java.gmk
index 6bf8ad5e74c7f..cb569bb88170c 100644
--- a/make/modules/jdk.internal.vm.ci/Java.gmk
+++ b/make/modules/jdk.internal.vm.ci/Java.gmk
@@ -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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
DISABLED_WARNINGS_java += dangling-doc-comments this-escape
# -parameters provides method's parameters information in class file,
@@ -30,3 +32,5 @@ DISABLED_WARNINGS_java += dangling-doc-comments this-escape
# Don't use Indy strings concatenation to have good JVMCI startup performance.
JAVAC_FLAGS += -parameters -XDstringConcat=inline
+
+################################################################################
diff --git a/make/modules/jdk.jartool/Gensrc.gmk b/make/modules/jdk.jartool/Gensrc.gmk
index 06fbedfa40c9f..dc53aa0b6520e 100644
--- a/make/modules/jdk.jartool/Gensrc.gmk
+++ b/make/modules/jdk.jartool/Gensrc.gmk
@@ -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,10 +23,9 @@
# questions.
#
-include GensrcCommon.gmk
-
################################################################################
+include GensrcCommon.gmk
include GensrcProperties.gmk
$(eval $(call SetupCompileProperties, COMPILE_PROPERTIES, \
@@ -35,3 +34,5 @@ $(eval $(call SetupCompileProperties, COMPILE_PROPERTIES, \
))
TARGETS += $(COMPILE_PROPERTIES)
+
+################################################################################
diff --git a/make/modules/jdk.jartool/Java.gmk b/make/modules/jdk.jartool/Java.gmk
index 5e06f172070fb..806975d1e1832 100644
--- a/make/modules/jdk.jartool/Java.gmk
+++ b/make/modules/jdk.jartool/Java.gmk
@@ -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
@@ -23,4 +23,8 @@
# questions.
#
+################################################################################
+
JAVAC_FLAGS += -XDstringConcat=inline
+
+################################################################################
diff --git a/make/modules/jdk.jartool/Jmod.gmk b/make/modules/jdk.jartool/Jmod.gmk
index 8b42113ec84c9..42fd1f0532528 100644
--- a/make/modules/jdk.jartool/Jmod.gmk
+++ b/make/modules/jdk.jartool/Jmod.gmk
@@ -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,4 +23,8 @@
# questions.
#
+################################################################################
+
JMOD_FLAGS_main_class := --main-class sun.tools.jar.Main
+
+################################################################################
diff --git a/make/modules/jdk.jartool/Launcher.gmk b/make/modules/jdk.jartool/Launcher.gmk
index 3139fac45d5ff..f75f30d409886 100644
--- a/make/modules/jdk.jartool/Launcher.gmk
+++ b/make/modules/jdk.jartool/Launcher.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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include LauncherCommon.gmk
################################################################################
@@ -40,3 +42,5 @@ $(eval $(call SetupBuildLauncher, jar, \
$(eval $(call SetupBuildLauncher, jarsigner, \
MAIN_CLASS := sun.security.tools.jarsigner.Main, \
))
+
+################################################################################
diff --git a/make/modules/jdk.javadoc/Copy.gmk b/make/modules/jdk.javadoc/Copy.gmk
index 031b4a91d33c5..1566911209c4c 100644
--- a/make/modules/jdk.javadoc/Copy.gmk
+++ b/make/modules/jdk.javadoc/Copy.gmk
@@ -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,6 +23,8 @@
# questions.
#
+################################################################################
+
include CopyCommon.gmk
JDK_JAVADOC_DIR := $(JDK_OUTPUTDIR)/modules/jdk.javadoc
diff --git a/make/modules/jdk.javadoc/Gendata.gmk b/make/modules/jdk.javadoc/Gendata.gmk
index d733af65f1ea6..2cd812de779ef 100644
--- a/make/modules/jdk.javadoc/Gendata.gmk
+++ b/make/modules/jdk.javadoc/Gendata.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
@@ -23,13 +23,10 @@
# questions.
#
-include JavaCompilation.gmk
-include Modules.gmk
-
################################################################################
-# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, modules/jdk.javadoc/Gendata.gmk))
+include JavaCompilation.gmk
+include Modules.gmk
# This is needed to properly setup DOCS_MODULES.
$(eval $(call ReadImportMetaData))
@@ -115,3 +112,5 @@ $(INTERIM_JDK_JAVADOC_DIR)/_element_lists.marker: $(JDK_JAVADOC_DIR)/_element_li
TARGETS += $(JDK_JAVADOC_DIR)/_element_lists.marker \
$(INTERIM_JDK_JAVADOC_DIR)/_element_lists.marker
+
+################################################################################
diff --git a/make/modules/jdk.javadoc/Gensrc.gmk b/make/modules/jdk.javadoc/Gensrc.gmk
index 0346e3832df53..e62988f883cfc 100644
--- a/make/modules/jdk.javadoc/Gensrc.gmk
+++ b/make/modules/jdk.javadoc/Gensrc.gmk
@@ -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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include GensrcCommon.gmk
include GensrcProperties.gmk
@@ -37,3 +39,5 @@ $(eval $(call SetupCompileProperties, COMPILE_PROPERTIES, \
))
TARGETS += $(COMPILE_PROPERTIES)
+
+################################################################################
diff --git a/make/modules/jdk.javadoc/Java.gmk b/make/modules/jdk.javadoc/Java.gmk
index 1194797b13425..f5315019f008f 100644
--- a/make/modules/jdk.javadoc/Java.gmk
+++ b/make/modules/jdk.javadoc/Java.gmk
@@ -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
@@ -23,8 +23,12 @@
# questions.
#
+################################################################################
+
# To the extent technically possible, this module should be built with
# -Werror and all lint warnings enabled. In particular,
# DISABLED_WARNINGS_java should not be augmented.
COPY += .xml .css .svg .js .js.template .png .txt .woff .woff2
+
+################################################################################
diff --git a/make/modules/jdk.javadoc/Launcher.gmk b/make/modules/jdk.javadoc/Launcher.gmk
index 30d714be30d6a..9ed3b494117b2 100644
--- a/make/modules/jdk.javadoc/Launcher.gmk
+++ b/make/modules/jdk.javadoc/Launcher.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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include LauncherCommon.gmk
################################################################################
@@ -32,5 +34,7 @@ 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.jcmd/Java.gmk b/make/modules/jdk.jcmd/Java.gmk
index d19d9beb4d88d..5748e62f7bc14 100644
--- a/make/modules/jdk.jcmd/Java.gmk
+++ b/make/modules/jdk.jcmd/Java.gmk
@@ -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
@@ -23,4 +23,8 @@
# questions.
#
+################################################################################
+
COPY += _options
+
+################################################################################
diff --git a/make/modules/jdk.jcmd/Launcher.gmk b/make/modules/jdk.jcmd/Launcher.gmk
index acff5a212c5d2..5d0da09d22bf3 100644
--- a/make/modules/jdk.jcmd/Launcher.gmk
+++ b/make/modules/jdk.jcmd/Launcher.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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include LauncherCommon.gmk
################################################################################
@@ -84,3 +86,5 @@ $(eval $(call SetupBuildLauncher, jstat, \
$(eval $(call SetupBuildLauncher, jcmd, \
MAIN_CLASS := sun.tools.jcmd.JCmd, \
))
+
+################################################################################
diff --git a/make/modules/jdk.jconsole/Java.gmk b/make/modules/jdk.jconsole/Java.gmk
index 2de9321392d44..d6cf8689df341 100644
--- a/make/modules/jdk.jconsole/Java.gmk
+++ b/make/modules/jdk.jconsole/Java.gmk
@@ -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
@@ -23,7 +23,11 @@
# questions.
#
+################################################################################
+
COPY += .gif .png
CLEAN_FILES += $(wildcard \
$(TOPDIR)/src/jdk.jconsole/share/classes/sun/tools/jconsole/resources/*.properties)
+
+################################################################################
diff --git a/make/modules/jdk.jconsole/Launcher.gmk b/make/modules/jdk.jconsole/Launcher.gmk
index 3e65c3cccc37a..7cb40a1b13a1f 100644
--- a/make/modules/jdk.jconsole/Launcher.gmk
+++ b/make/modules/jdk.jconsole/Launcher.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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include LauncherCommon.gmk
################################################################################
@@ -36,5 +38,7 @@ $(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/Gensrc.gmk b/make/modules/jdk.jdeps/Gensrc.gmk
index b5f1e702a7520..6ae92ee830a92 100644
--- a/make/modules/jdk.jdeps/Gensrc.gmk
+++ b/make/modules/jdk.jdeps/Gensrc.gmk
@@ -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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include GensrcCommon.gmk
include GensrcProperties.gmk
@@ -40,3 +42,5 @@ $(eval $(call SetupCompileProperties, COMPILE_PROPERTIES, \
))
TARGETS += $(COMPILE_PROPERTIES)
+
+################################################################################
diff --git a/make/modules/jdk.jdeps/Java.gmk b/make/modules/jdk.jdeps/Java.gmk
index 69c7ae0433fc7..f2da87aeadec9 100644
--- a/make/modules/jdk.jdeps/Java.gmk
+++ b/make/modules/jdk.jdeps/Java.gmk
@@ -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
@@ -23,8 +23,12 @@
# questions.
#
+################################################################################
+
COPY += .txt
CLEAN_FILES += $(wildcard \
$(TOPDIR)/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/*.properties \
$(TOPDIR)/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/*.properties)
+
+################################################################################
diff --git a/make/modules/jdk.jdeps/Launcher.gmk b/make/modules/jdk.jdeps/Launcher.gmk
index 1aa54e16f4564..debf36b62ae44 100644
--- a/make/modules/jdk.jdeps/Launcher.gmk
+++ b/make/modules/jdk.jdeps/Launcher.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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include LauncherCommon.gmk
################################################################################
@@ -31,7 +33,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 +42,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 +51,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 +60,7 @@ $(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.jdi/Gensrc.gmk b/make/modules/jdk.jdi/Gensrc.gmk
index 47f975064ad5f..57b8faee8a8ed 100644
--- a/make/modules/jdk.jdi/Gensrc.gmk
+++ b/make/modules/jdk.jdi/Gensrc.gmk
@@ -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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include GensrcCommon.gmk
################################################################################
@@ -68,3 +70,5 @@ $(eval $(call SetupCompileProperties, COMPILE_PROPERTIES, \
))
TARGETS += $(COMPILE_PROPERTIES)
+
+################################################################################
diff --git a/make/modules/jdk.jdi/Java.gmk b/make/modules/jdk.jdi/Java.gmk
index 6577db98b0a12..d31008c318fdc 100644
--- a/make/modules/jdk.jdi/Java.gmk
+++ b/make/modules/jdk.jdi/Java.gmk
@@ -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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
DISABLED_WARNINGS_java += dangling-doc-comments
EXCLUDES += \
@@ -33,3 +35,5 @@ EXCLUDES += \
#
EXCLUDE_FILES += jdi-overview.html
+
+################################################################################
diff --git a/make/modules/jdk.jdi/Launcher.gmk b/make/modules/jdk.jdi/Launcher.gmk
index 79be72e6ef340..a568e504b5a4d 100644
--- a/make/modules/jdk.jdi/Launcher.gmk
+++ b/make/modules/jdk.jdi/Launcher.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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include LauncherCommon.gmk
################################################################################
@@ -32,3 +34,5 @@ include LauncherCommon.gmk
$(eval $(call SetupBuildLauncher, jdb, \
MAIN_CLASS := com.sun.tools.example.debug.tty.TTY, \
))
+
+################################################################################
diff --git a/make/modules/jdk.jdi/Lib.gmk b/make/modules/jdk.jdi/Lib.gmk
index 80a5664289bf9..b59a3ab8ea43c 100644
--- a/make/modules/jdk.jdi/Lib.gmk
+++ b/make/modules/jdk.jdi/Lib.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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include LibCommon.gmk
ifeq ($(call isTargetOs, windows), true)
@@ -40,3 +42,5 @@ ifeq ($(call isTargetOs, windows), true)
TARGETS += $(BUILD_LIBDT_SHMEM)
endif
+
+################################################################################
diff --git a/make/modules/jdk.jdwp.agent/Copy.gmk b/make/modules/jdk.jdwp.agent/Copy.gmk
index cd8aeba5a11d0..798b97902c6e9 100644
--- a/make/modules/jdk.jdwp.agent/Copy.gmk
+++ b/make/modules/jdk.jdwp.agent/Copy.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2014, 2017, 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,6 +24,8 @@
#
################################################################################
-# Include CopyCommon.gmk to get exported header files to be properly copied.
+# Include CopyCommon.gmk to get exported header files to be properly copied.
include CopyCommon.gmk
+
+################################################################################
diff --git a/make/modules/jdk.jdwp.agent/Lib.gmk b/make/modules/jdk.jdwp.agent/Lib.gmk
index 53b48cc7c453b..a1f9a0fca52fa 100644
--- a/make/modules/jdk.jdwp.agent/Lib.gmk
+++ b/make/modules/jdk.jdwp.agent/Lib.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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include LibCommon.gmk
################################################################################
@@ -77,3 +79,5 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJDWP, \
))
TARGETS += $(BUILD_LIBJDWP)
+
+################################################################################
diff --git a/make/modules/jdk.jfr/Copy.gmk b/make/modules/jdk.jfr/Copy.gmk
index f4fa3d97551ab..81dc58c13248e 100644
--- a/make/modules/jdk.jfr/Copy.gmk
+++ b/make/modules/jdk.jfr/Copy.gmk
@@ -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
@@ -23,10 +23,10 @@
# questions.
#
-include CopyCommon.gmk
-
################################################################################
+include CopyCommon.gmk
+
JFR_CONF_DIR := $(TOPDIR)/src/jdk.jfr/share/conf/jfr
$(eval $(call SetupCopyFiles, COPY_JFR_CONF, \
DEST := $(LIB_DST_DIR)/jfr, \
diff --git a/make/modules/jdk.jfr/Gendata.gmk b/make/modules/jdk.jfr/Gendata.gmk
index 522eea70f32a6..0a5dd874c8193 100644
--- a/make/modules/jdk.jfr/Gendata.gmk
+++ b/make/modules/jdk.jfr/Gendata.gmk
@@ -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
@@ -25,8 +25,8 @@
################################################################################
-include ToolsHotspot.gmk
include Execute.gmk
+include $(TOPDIR)/make/ToolsHotspot.gmk
JFR_SRCDIR := $(TOPDIR)/src/hotspot/share/jfr/metadata
JFR_DATA_OUTPUTDIR := $(OUTPUTDIR)/jdk/modules/jdk.jfr/jdk/jfr/internal/types
@@ -46,3 +46,5 @@ $(eval $(call SetupExecute, jfr_gen_metadata, \
))
TARGETS += $(jfr_gen_metadata)
+
+################################################################################
diff --git a/make/modules/jdk.jfr/Java.gmk b/make/modules/jdk.jfr/Java.gmk
index d07f9117c2dfc..5fabda8a4b777 100644
--- a/make/modules/jdk.jfr/Java.gmk
+++ b/make/modules/jdk.jfr/Java.gmk
@@ -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
@@ -23,6 +23,10 @@
# questions.
#
+################################################################################
+
DISABLED_WARNINGS_java += dangling-doc-comments exports
COPY := .xsd .xml .dtd .ini
JAVAC_FLAGS := -XDstringConcat=inline
+
+################################################################################
diff --git a/make/modules/jdk.jfr/Jmod.gmk b/make/modules/jdk.jfr/Jmod.gmk
index 79a6a81c730b2..499ea142d3aa9 100644
--- a/make/modules/jdk.jfr/Jmod.gmk
+++ b/make/modules/jdk.jfr/Jmod.gmk
@@ -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,4 +23,8 @@
# questions.
#
+################################################################################
+
JMOD_FLAGS_main_class := --main-class jdk.jfr.internal.tool.Main
+
+################################################################################
diff --git a/make/modules/jdk.jfr/Launcher.gmk b/make/modules/jdk.jfr/Launcher.gmk
index 2dd3586a92072..80417cd67d362 100644
--- a/make/modules/jdk.jfr/Launcher.gmk
+++ b/make/modules/jdk.jfr/Launcher.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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include LauncherCommon.gmk
################################################################################
@@ -31,5 +33,7 @@ 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/Gensrc.gmk b/make/modules/jdk.jlink/Gensrc.gmk
index c450ceea073f1..87703c7c8bb7d 100644
--- a/make/modules/jdk.jlink/Gensrc.gmk
+++ b/make/modules/jdk.jlink/Gensrc.gmk
@@ -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
@@ -23,12 +23,12 @@
# questions.
#
+################################################################################
+
include GensrcCommon.gmk
include GensrcProperties.gmk
include Modules.gmk
-################################################################################
-
# Use wildcard so as to avoid getting non-existing directories back
JLINK_RESOURCES_DIRS := $(wildcard $(addsuffix /jdk/tools/jlink/resources, \
$(call FindModuleSrcDirs, jdk.jlink)))
@@ -50,3 +50,5 @@ $(eval $(call SetupCompileProperties, JIMAGE_PROPERTIES, \
TARGETS += $(JLINK_PROPERTIES) $(JMOD_PROPERTIES) $(JIMAGE_PROPERTIES)
+
+################################################################################
diff --git a/make/modules/jdk.jlink/Launcher.gmk b/make/modules/jdk.jlink/Launcher.gmk
index d427906519357..312c40e47ab25 100644
--- a/make/modules/jdk.jlink/Launcher.gmk
+++ b/make/modules/jdk.jlink/Launcher.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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include LauncherCommon.gmk
################################################################################
@@ -31,7 +33,7 @@ include LauncherCommon.gmk
$(eval $(call SetupBuildLauncher, jimage, \
MAIN_CLASS := jdk.tools.jimage.Main, \
- CFLAGS := -DENABLE_ARG_FILES, \
+ ENABLE_ARG_FILES := true, \
))
################################################################################
@@ -41,7 +43,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 +53,8 @@ $(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.jpackage/Gensrc.gmk b/make/modules/jdk.jpackage/Gensrc.gmk
index 434b42dc0bfe7..98311d89b879c 100644
--- a/make/modules/jdk.jpackage/Gensrc.gmk
+++ b/make/modules/jdk.jpackage/Gensrc.gmk
@@ -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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include GensrcCommon.gmk
################################################################################
@@ -36,5 +38,7 @@ ifeq ($(call isTargetOs, macosx), true)
$(ENTITLEMENTS_TARGET_FILE): $(ENTITLEMENTS_SRC_FILE)
$(call install-file)
- TARGETS := $(ENTITLEMENTS_TARGET_FILE)
+ TARGETS += $(ENTITLEMENTS_TARGET_FILE)
endif
+
+################################################################################
diff --git a/make/modules/jdk.jpackage/Java.gmk b/make/modules/jdk.jpackage/Java.gmk
index d60e9ac281488..da66fc1400901 100644
--- a/make/modules/jdk.jpackage/Java.gmk
+++ b/make/modules/jdk.jpackage/Java.gmk
@@ -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
@@ -23,10 +23,14 @@
# questions.
#
+################################################################################
+
DISABLED_WARNINGS_java += dangling-doc-comments
COPY += .gif .png .txt .spec .script .prerm .preinst \
.postrm .postinst .list .sh .desktop .copyright .control .plist .template \
- .icns .scpt .wxs .wxl .wxi .ico .bmp .tiff .service .xsl
+ .icns .scpt .wxs .wxl .wxi .wxf .ico .bmp .tiff .service .xsl
CLEAN += .properties
+
+################################################################################
diff --git a/make/modules/jdk.jpackage/Jmod.gmk b/make/modules/jdk.jpackage/Jmod.gmk
index 8e0982202a7f7..27b03e1081eeb 100644
--- a/make/modules/jdk.jpackage/Jmod.gmk
+++ b/make/modules/jdk.jpackage/Jmod.gmk
@@ -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,4 +23,8 @@
# questions.
#
+################################################################################
+
JMOD_FLAGS_main_class := --main-class jdk.jpackage.main.Main
+
+################################################################################
diff --git a/make/modules/jdk.jpackage/Launcher.gmk b/make/modules/jdk.jpackage/Launcher.gmk
index f80c4ed83d376..80f644eea3f9a 100644
--- a/make/modules/jdk.jpackage/Launcher.gmk
+++ b/make/modules/jdk.jpackage/Launcher.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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include LauncherCommon.gmk
################################################################################
@@ -32,3 +34,5 @@ include LauncherCommon.gmk
$(eval $(call SetupBuildLauncher, jpackage, \
MAIN_CLASS := jdk.jpackage.main.Main, \
))
+
+################################################################################
diff --git a/make/modules/jdk.jpackage/Lib.gmk b/make/modules/jdk.jpackage/Lib.gmk
index 33d10336e6e47..a301447d73eed 100644
--- a/make/modules/jdk.jpackage/Lib.gmk
+++ b/make/modules/jdk.jpackage/Lib.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
@@ -23,8 +23,10 @@
# questions.
#
-include LibCommon.gmk
+################################################################################
+
include LauncherCommon.gmk
+include LibCommon.gmk
JPACKAGE_OUTPUT_DIR := \
$(JDK_OUTPUTDIR)/modules/$(MODULE)/jdk/jpackage/internal/resources
@@ -186,3 +188,5 @@ ifeq ($(call isTargetOs, windows), true)
TARGETS += $(BUILD_JPACKAGEAPPLAUNCHERW)
endif
+
+################################################################################
diff --git a/make/modules/jdk.jshell/Gensrc.gmk b/make/modules/jdk.jshell/Gensrc.gmk
index 71d1ad4281703..deab53719a5df 100644
--- a/make/modules/jdk.jshell/Gensrc.gmk
+++ b/make/modules/jdk.jshell/Gensrc.gmk
@@ -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,6 +23,8 @@
# questions.
#
+################################################################################
+
include GensrcCommon.gmk
include GensrcProperties.gmk
@@ -37,3 +39,5 @@ $(eval $(call SetupCompileProperties, COMPILE_PROPERTIES, \
))
TARGETS += $(COMPILE_PROPERTIES)
+
+################################################################################
diff --git a/make/modules/jdk.jshell/Java.gmk b/make/modules/jdk.jshell/Java.gmk
index 744c85d960a94..f4194b23af7e3 100644
--- a/make/modules/jdk.jshell/Java.gmk
+++ b/make/modules/jdk.jshell/Java.gmk
@@ -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
@@ -23,4 +23,8 @@
# questions.
#
+################################################################################
+
COPY += .jsh .properties
+
+################################################################################
diff --git a/make/modules/jdk.jshell/Jmod.gmk b/make/modules/jdk.jshell/Jmod.gmk
index 12f22e9d9afda..ec599e44fcce1 100644
--- a/make/modules/jdk.jshell/Jmod.gmk
+++ b/make/modules/jdk.jshell/Jmod.gmk
@@ -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,4 +23,8 @@
# questions.
#
+################################################################################
+
JMOD_FLAGS_main_class := --main-class jdk.internal.jshell.tool.JShellToolProvider
+
+################################################################################
diff --git a/make/modules/jdk.jshell/Launcher.gmk b/make/modules/jdk.jshell/Launcher.gmk
index bf555d7f64c13..bdfcbf1911df1 100644
--- a/make/modules/jdk.jshell/Launcher.gmk
+++ b/make/modules/jdk.jshell/Launcher.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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include LauncherCommon.gmk
################################################################################
@@ -31,5 +33,7 @@ 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/modules/jdk.jstatd/Jmod.gmk b/make/modules/jdk.jstatd/Jmod.gmk
index 2c95e094cfe00..1c2aa35a2c21a 100644
--- a/make/modules/jdk.jstatd/Jmod.gmk
+++ b/make/modules/jdk.jstatd/Jmod.gmk
@@ -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,4 +23,8 @@
# questions.
#
+################################################################################
+
JMOD_FLAGS_main_class := --main-class sun.tools.jstatd.Jstatd
+
+################################################################################
diff --git a/make/modules/jdk.jstatd/Launcher.gmk b/make/modules/jdk.jstatd/Launcher.gmk
index 209b810353f2d..d101cd3f4ed45 100644
--- a/make/modules/jdk.jstatd/Launcher.gmk
+++ b/make/modules/jdk.jstatd/Launcher.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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include LauncherCommon.gmk
################################################################################
@@ -32,3 +34,5 @@ include LauncherCommon.gmk
$(eval $(call SetupBuildLauncher, jstatd, \
MAIN_CLASS := sun.tools.jstatd.Jstatd, \
))
+
+################################################################################
diff --git a/make/modules/jdk.localedata/Gensrc.gmk b/make/modules/jdk.localedata/Gensrc.gmk
index 4d9f15a20c9c0..a3c5cdf82e8cb 100644
--- a/make/modules/jdk.localedata/Gensrc.gmk
+++ b/make/modules/jdk.localedata/Gensrc.gmk
@@ -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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include GensrcCommon.gmk
################################################################################
@@ -47,3 +49,5 @@ $(CLDR_GEN_DONE): $(wildcard $(CLDR_DATA_DIR)/dtd/*.dtd) \
$(TOUCH) $@
TARGETS += $(CLDR_GEN_DONE)
+
+################################################################################
diff --git a/make/modules/jdk.localedata/Java.gmk b/make/modules/jdk.localedata/Java.gmk
index 41696a641a7d4..c359f0ee03cfb 100644
--- a/make/modules/jdk.localedata/Java.gmk
+++ b/make/modules/jdk.localedata/Java.gmk
@@ -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
@@ -23,8 +23,12 @@
# questions.
#
+################################################################################
+
COPY += _dict _th
# Exclude BreakIterator classes that are just used in compile process to generate
# data files and shouldn't go in the product
EXCLUDE_FILES += sun/text/resources/ext/BreakIteratorRules_th.java
KEEP_ALL_TRANSLATIONS := true
+
+################################################################################
diff --git a/make/modules/jdk.management.agent/Copy.gmk b/make/modules/jdk.management.agent/Copy.gmk
index 5600989b4d38a..ada75231ec71c 100644
--- a/make/modules/jdk.management.agent/Copy.gmk
+++ b/make/modules/jdk.management.agent/Copy.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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include CopyCommon.gmk
################################################################################
diff --git a/make/modules/jdk.management.agent/Gensrc.gmk b/make/modules/jdk.management.agent/Gensrc.gmk
index c13f4da75fe81..4bafdd9503e6c 100644
--- a/make/modules/jdk.management.agent/Gensrc.gmk
+++ b/make/modules/jdk.management.agent/Gensrc.gmk
@@ -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
@@ -23,10 +23,9 @@
# questions.
#
-include GensrcCommon.gmk
-
################################################################################
+include GensrcCommon.gmk
include GensrcProperties.gmk
$(eval $(call SetupCompileProperties, COMPILE_PROPERTIES, \
@@ -35,3 +34,5 @@ $(eval $(call SetupCompileProperties, COMPILE_PROPERTIES, \
))
TARGETS += $(COMPILE_PROPERTIES)
+
+################################################################################
diff --git a/make/modules/jdk.management.agent/Lib.gmk b/make/modules/jdk.management.agent/Lib.gmk
index 89de59d7fecbb..17dd163f63cf1 100644
--- a/make/modules/jdk.management.agent/Lib.gmk
+++ b/make/modules/jdk.management.agent/Lib.gmk
@@ -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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include LibCommon.gmk
################################################################################
@@ -37,3 +39,5 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBMANAGEMENT_AGENT, \
))
TARGETS += $(BUILD_LIBMANAGEMENT_AGENT)
+
+################################################################################
diff --git a/make/modules/jdk.management/Java.gmk b/make/modules/jdk.management/Java.gmk
index 269a1195b6a10..aca47fc97f704 100644
--- a/make/modules/jdk.management/Java.gmk
+++ b/make/modules/jdk.management/Java.gmk
@@ -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,4 +23,8 @@
# questions.
#
+################################################################################
+
DISABLED_WARNINGS_java += this-escape
+
+################################################################################
diff --git a/make/modules/jdk.management/Lib.gmk b/make/modules/jdk.management/Lib.gmk
index cb65b37bda80d..fd9345e8b8a60 100644
--- a/make/modules/jdk.management/Lib.gmk
+++ b/make/modules/jdk.management/Lib.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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include LibCommon.gmk
################################################################################
@@ -54,3 +56,5 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBMANAGEMENT_EXT, \
))
TARGETS += $(BUILD_LIBMANAGEMENT_EXT)
+
+################################################################################
diff --git a/make/modules/jdk.net/Lib.gmk b/make/modules/jdk.net/Lib.gmk
index e43d8427f5a1c..00d243a7f534a 100644
--- a/make/modules/jdk.net/Lib.gmk
+++ b/make/modules/jdk.net/Lib.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,6 +23,8 @@
# questions.
#
+################################################################################
+
include LibCommon.gmk
################################################################################
@@ -38,3 +40,5 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBEXTNET, \
))
TARGETS += $(BUILD_LIBEXTNET)
+
+################################################################################
diff --git a/make/modules/jdk.sctp/Java.gmk b/make/modules/jdk.sctp/Java.gmk
index cac0f770816fc..5c7c4eb41760f 100644
--- a/make/modules/jdk.sctp/Java.gmk
+++ b/make/modules/jdk.sctp/Java.gmk
@@ -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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
# No SCTP implementation on Mac OS X or AIX. These classes should be excluded.
SCTP_IMPL_CLASSES = \
$(TOPDIR)/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/AssociationChange.java \
@@ -51,3 +53,5 @@ ifeq ($(call isTargetOsType, unix), true)
EXCLUDE_FILES += $(TOPDIR)/src/jdk.sctp/share/classes/sun/nio/ch/sctp/UnsupportedUtil.java
endif
endif
+
+################################################################################
diff --git a/make/modules/jdk.sctp/Lib.gmk b/make/modules/jdk.sctp/Lib.gmk
index a6d95a25154bd..2017805f52d53 100644
--- a/make/modules/jdk.sctp/Lib.gmk
+++ b/make/modules/jdk.sctp/Lib.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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include LibCommon.gmk
ifeq ($(call isTargetOs, linux), true)
@@ -44,3 +46,5 @@ ifeq ($(call isTargetOs, linux), true)
TARGETS += $(BUILD_LIBSCTP)
endif
+
+################################################################################
diff --git a/make/modules/jdk.security.auth/Java.gmk b/make/modules/jdk.security.auth/Java.gmk
index fc8b2f832d713..7f1718a23ed76 100644
--- a/make/modules/jdk.security.auth/Java.gmk
+++ b/make/modules/jdk.security.auth/Java.gmk
@@ -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,4 +23,8 @@
# questions.
#
+################################################################################
+
DISABLED_WARNINGS_java += dangling-doc-comments
+
+################################################################################
diff --git a/make/modules/jdk.security.auth/Lib.gmk b/make/modules/jdk.security.auth/Lib.gmk
index a0d410044891a..9ead32dbe121f 100644
--- a/make/modules/jdk.security.auth/Lib.gmk
+++ b/make/modules/jdk.security.auth/Lib.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
@@ -23,6 +23,8 @@
# questions.
#
+################################################################################
+
include LibCommon.gmk
################################################################################
@@ -37,3 +39,5 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJAAS, \
))
TARGETS += $(BUILD_LIBJAAS)
+
+################################################################################
diff --git a/make/modules/sun.charsets/Java.gmk b/make/modules/sun.charsets/Java.gmk
index 2745327c8e46e..c5dbb1e2a603c 100644
--- a/make/modules/sun.charsets/Java.gmk
+++ b/make/modules/sun.charsets/Java.gmk
@@ -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
@@ -23,4 +23,8 @@
# questions.
#
+################################################################################
+
COPY += .dat
+
+################################################################################
diff --git a/test/jdk/sun/security/util/Pem/encoding.sh b/make/scripts/aix/ld.sh
similarity index 63%
rename from test/jdk/sun/security/util/Pem/encoding.sh
rename to make/scripts/aix/ld.sh
index ef670b3aee5ba..faa77ce4ba5a8 100644
--- a/test/jdk/sun/security/util/Pem/encoding.sh
+++ b/make/scripts/aix/ld.sh
@@ -1,10 +1,13 @@
+#!/bin/bash
#
-# Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 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
# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
@@ -20,16 +23,5 @@
# or visit www.oracle.com if you need additional information or have any
# questions.
#
-
-# @test
-# @bug 8158633
-# @summary BASE64 encoded cert not correctly parsed with UTF-16
-# @build PemEncoding
-# @run shell encoding.sh
-
-# jtreg does not like -Dfile.encoding=UTF-16 inside a @run main line,
-# therefore a shell test is written.
-
-$TESTJAVA/bin/java $TESTVMOPTS $TESTJAVAOPTS -cp $TESTCLASSES \
- -Dfile.encoding=UTF-16 \
- PemEncoding $TESTSRC/../HostnameChecker/cert5.crt
+unset LIBPATH
+exec /usr/bin/ld "$@"
diff --git a/make/test/BuildFailureHandler.gmk b/make/test/BuildFailureHandler.gmk
index e8f49e76b3268..b4f3d690b0d75 100644
--- a/make/test/BuildFailureHandler.gmk
+++ b/make/test/BuildFailureHandler.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,18 +23,13 @@
# questions.
#
-default: build
+include MakeFileStart.gmk
-include $(SPEC)
-include MakeBase.gmk
+################################################################################
include CopyFiles.gmk
include JavaCompilation.gmk
-TARGETS :=
-
-################################################################################
-
FH_BASEDIR := $(TOPDIR)/test/failure_handler
FH_SUPPORT := $(SUPPORT_OUTPUTDIR)/test/failure_handler
FH_JAR := $(FH_SUPPORT)/jtregFailureHandler.jar
@@ -110,4 +105,8 @@ test:
build: $(TARGETS)
images: $(IMAGES_TARGETS)
-.PHONY: all images test
+.PHONY: images test
+
+################################################################################
+
+include MakeFileEnd.gmk
diff --git a/make/test/BuildJtregTestThreadFactory.gmk b/make/test/BuildJtregTestThreadFactory.gmk
index 4f0ead24ece9e..94338626769dd 100644
--- a/make/test/BuildJtregTestThreadFactory.gmk
+++ b/make/test/BuildJtregTestThreadFactory.gmk
@@ -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
@@ -23,18 +23,13 @@
# questions.
#
-default: build
+include MakeFileStart.gmk
-include $(SPEC)
-include MakeBase.gmk
+################################################################################
include CopyFiles.gmk
include JavaCompilation.gmk
-TARGETS :=
-
-################################################################################
-
TTF_BASEDIR := $(TOPDIR)/test/jtreg_test_thread_factory
TTF_SUPPORT := $(SUPPORT_OUTPUTDIR)/test/jtreg_test_thread_factory
TTF_JAR := $(TTF_SUPPORT)/jtregTestThreadFactory.jar
@@ -64,4 +59,8 @@ IMAGES_TARGETS += $(COPY_TTF)
build: $(TARGETS)
images: $(IMAGES_TARGETS)
-.PHONY: all images
+.PHONY: images
+
+################################################################################
+
+include MakeFileEnd.gmk
diff --git a/make/test/BuildMicrobenchmark.gmk b/make/test/BuildMicrobenchmark.gmk
index 1052e422f7b06..92f40472c3cb9 100644
--- a/make/test/BuildMicrobenchmark.gmk
+++ b/make/test/BuildMicrobenchmark.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -23,11 +23,9 @@
# questions.
#
-# This must be the first rule
-default: all
+include MakeFileStart.gmk
-include $(SPEC)
-include MakeBase.gmk
+################################################################################
include CopyFiles.gmk
include JarArchive.gmk
@@ -96,8 +94,6 @@ $(eval $(call SetupJavaCompilation, BUILD_JDK_MICROBENCHMARK, \
--add-exports java.base/jdk.internal.foreign=ALL-UNNAMED \
--add-exports java.base/jdk.internal.misc=ALL-UNNAMED \
--add-exports java.base/jdk.internal.util=ALL-UNNAMED \
- --add-exports java.base/jdk.internal.org.objectweb.asm.tree=ALL-UNNAMED \
- --add-exports java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED \
--add-exports java.base/jdk.internal.vm=ALL-UNNAMED \
--add-exports java.base/sun.invoke.util=ALL-UNNAMED \
--add-exports java.base/sun.security.util=ALL-UNNAMED \
@@ -126,9 +122,20 @@ $(JMH_UNPACKED_JARS_DONE): $(JMH_RUNTIME_JARS)
$(RM) $(JMH_UNPACKED_DIR)/*.xml
$(TOUCH) $@
+# Copy dependency files for inclusion in the benchmark JARs
+$(eval $(call SetupCopyFiles, COPY_JAXP_TEST_XML, \
+ SRC := $(TOPDIR)/test/jaxp/javax/xml/jaxp/unittest, \
+ DEST := $(MICROBENCHMARK_CLASSES)/org/openjdk/bench/javax/xml, \
+ FILES := \
+ stream/XMLStreamWriterTest/message_12.xml \
+ validation/tck/reZ003vExc23082309.xml \
+ transform/msgAttach.xml, \
+ FLATTEN := true, \
+))
+
# Create benchmarks JAR file with benchmarks for both the old and new JDK
$(eval $(call SetupJarArchive, BUILD_JDK_JAR, \
- DEPENDENCIES := $(BUILD_JDK_MICROBENCHMARK) $(JMH_UNPACKED_JARS_DONE), \
+ DEPENDENCIES := $(BUILD_JDK_MICROBENCHMARK) $(JMH_UNPACKED_JARS_DONE) $(COPY_JAXP_TEST_XML), \
SRCS := $(MICROBENCHMARK_CLASSES) $(JMH_UNPACKED_DIR), \
BIN := $(MICROBENCHMARK_JAR_BIN), \
SUFFIXES := .*, \
@@ -157,4 +164,6 @@ $(eval $(call SetupCopyFiles, COPY_MICROBENCHMARK_NATIVE, \
all: $(MICROBENCHMARK_JAR) $(BUILD_MICROBENCHMARK_LIBRARIES) $(COPY_MICROBENCHMARK_NATIVE)
-.PHONY: all
+################################################################################
+
+include MakeFileEnd.gmk
diff --git a/make/test/BuildTestLib.gmk b/make/test/BuildTestLib.gmk
index 5659423826136..dc5e0a9bd64bc 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
@@ -23,17 +23,14 @@
# questions.
#
+include MakeFileStart.gmk
+
################################################################################
# This file builds the Java components of testlib.
# It also covers the test-image part, where the built files are copied to the
# test image.
################################################################################
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
-
include CopyFiles.gmk
include JavaCompilation.gmk
@@ -41,8 +38,6 @@ include JavaCompilation.gmk
# Targets for building the test lib jars
################################################################################
-TARGETS :=
-
TEST_LIB_SOURCE_DIR := $(TOPDIR)/test/lib
TEST_LIB_SUPPORT := $(SUPPORT_OUTPUTDIR)/test/lib
@@ -57,19 +52,27 @@ $(eval $(call SetupJavaCompilation, BUILD_WB_JAR, \
TARGETS += $(BUILD_WB_JAR)
+ifeq ($(call isTargetOs, linux), false)
+ BUILD_TEST_LIB_JAR_EXCLUDES := jdk/test/lib/containers
+endif
+
$(eval $(call SetupJavaCompilation, BUILD_TEST_LIB_JAR, \
TARGET_RELEASE := $(TARGET_RELEASE_NEWJDK_UPGRADED), \
SRC := $(TEST_LIB_SOURCE_DIR), \
- EXCLUDES := jdk/test/lib/containers jdk/test/lib/security, \
+ EXCLUDES := $(BUILD_TEST_LIB_JAR_EXCLUDES), \
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 \
--add-exports java.base/jdk.internal.classfile.constantpool=ALL-UNNAMED \
--add-exports java.base/jdk.internal.module=ALL-UNNAMED \
+ --add-exports java.base/jdk.internal.platform=ALL-UNNAMED \
+ --add-exports java.base/sun.security.pkcs=ALL-UNNAMED \
+ --add-exports java.base/sun.security.provider.certpath=ALL-UNNAMED \
+ --add-exports java.base/sun.security.tools.keytool=ALL-UNNAMED \
+ --add-exports java.base/sun.security.x509=ALL-UNNAMED \
--enable-preview, \
))
@@ -86,10 +89,13 @@ $(eval $(call SetupCopyFiles, COPY_LIBTEST_JARS, \
DEST := $(TEST_IMAGE_DIR)/lib-test, \
FILES := $(BUILD_WB_JAR_JAR) $(BUILD_TEST_LIB_JAR_JAR), \
))
-#
test-image-lib: $(COPY_LIBTEST_JARS)
all: build-test-lib
-.PHONY: default all build-test-lib test-image-lib
+.PHONY: build-test-lib test-image-lib
+
+################################################################################
+
+include MakeFileEnd.gmk
diff --git a/make/test/BuildTestLibNative.gmk b/make/test/BuildTestLibNative.gmk
index 63dcbbf008b65..f2a3aafeea956 100644
--- a/make/test/BuildTestLibNative.gmk
+++ b/make/test/BuildTestLibNative.gmk
@@ -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
@@ -23,17 +23,14 @@
# questions.
#
+include MakeFileStart.gmk
+
################################################################################
# This file builds the native component of testlib.
# It also covers the test-image part, where the built files are copied to the
# test image.
################################################################################
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
-
include CopyFiles.gmk
include TestFilesCompilation.gmk
@@ -86,4 +83,8 @@ test-image-lib-native: $(COPY_LIBTEST_NATIVE_TO_HOTSPOT) $(COPY_LIBTEST_NATIVE_T
all: build-test-lib-native
-.PHONY: default all build-test-lib-native test-image-lib-native
+.PHONY: build-test-lib-native test-image-lib-native
+
+################################################################################
+
+include MakeFileEnd.gmk
diff --git a/make/test/BuildTestSetupAOT.gmk b/make/test/BuildTestSetupAOT.gmk
new file mode 100644
index 0000000000000..46b18005366dc
--- /dev/null
+++ b/make/test/BuildTestSetupAOT.gmk
@@ -0,0 +1,69 @@
+#
+# 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. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+include MakeFileStart.gmk
+
+################################################################################
+# This file builds the TestSetupAOT.class, which is used by SetupAOT
+# in ../RunTests.gmk
+################################################################################
+
+include CopyFiles.gmk
+include JavaCompilation.gmk
+
+################################################################################
+
+SETUP_AOT_BASEDIR := $(TOPDIR)/test/setup_aot
+SETUP_AOT_SUPPORT := $(SUPPORT_OUTPUTDIR)/test/setup_aot
+SETUP_AOT_CLASS := $(SETUP_AOT_SUPPORT)/classes/TestSetupAOT.class
+
+$(eval $(call SetupJavaCompilation, BUILD_SETUP_AOT, \
+ TARGET_RELEASE := $(TARGET_RELEASE_NEWJDK_UPGRADED), \
+ SRC := $(SETUP_AOT_BASEDIR), \
+ BIN := $(SETUP_AOT_SUPPORT)/classes, \
+))
+
+TARGETS += $(BUILD_SETUP_AOT)
+
+################################################################################
+# Targets for building test-image.
+################################################################################
+
+# Copy to hotspot jtreg test image
+$(eval $(call SetupCopyFiles, COPY_SETUP_AOT, \
+ SRC := $(SETUP_AOT_SUPPORT)/classes, \
+ DEST := $(TEST_IMAGE_DIR)/setup_aot, \
+ FILES := TestSetupAOT.class, \
+))
+
+IMAGES_TARGETS += $(COPY_SETUP_AOT)
+
+images: $(IMAGES_TARGETS)
+
+.PHONY: images
+
+################################################################################
+
+include MakeFileEnd.gmk
diff --git a/make/test/JtregNativeHotspot.gmk b/make/test/JtregNativeHotspot.gmk
index 97f2f12cb7639..2ee26b422e0c2 100644
--- a/make/test/JtregNativeHotspot.gmk
+++ b/make/test/JtregNativeHotspot.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
@@ -23,22 +23,17 @@
# questions.
#
+include MakeFileStart.gmk
+
################################################################################
# This file builds the native component of the JTReg tests for Hotspot.
# It also covers the test-image part, where the built files are copied to the
# test image.
################################################################################
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
-
include CopyFiles.gmk
include TestFilesCompilation.gmk
-$(eval $(call IncludeCustomExtension, test/JtregNativeHotspot.gmk))
-
################################################################################
# Targets for building the native tests themselves.
################################################################################
@@ -867,6 +862,7 @@ ifeq ($(call isTargetOs, linux), true)
BUILD_HOTSPOT_JTREG_EXECUTABLES_LIBS_exestack-gap := -lpthread
BUILD_TEST_exeinvoke_exeinvoke.c_OPTIMIZATION := NONE
BUILD_HOTSPOT_JTREG_EXECUTABLES_LIBS_exeFPRegs := -ldl
+ BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libatExit += -ldl
BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libAsyncGetCallTraceTest := -ldl
BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libfast-math := -ffast-math
else
@@ -880,7 +876,6 @@ endif
BUILD_HOTSPOT_JTREG_EXECUTABLES_JDK_LIBS_exesigtest := java.base:libjvm
-BUILD_HOTSPOT_JTREG_LIBRARIES_JDK_LIBS_libatExit := java.base:libjvm
BUILD_HOTSPOT_JTREG_EXECUTABLES_JDK_LIBS_exedaemonDestroy := java.base:libjvm
ifeq ($(call isTargetOs, windows), true)
@@ -1588,4 +1583,8 @@ test-image-hotspot-jtreg-native: $(COPY_HOTSPOT_JTREG_NATIVE)
all: build-test-hotspot-jtreg-native
test-image: test-image-hotspot-jtreg-native
-.PHONY: default all build-test-hotspot-jtreg-native test-image-hotspot-jtreg-native test-image
+.PHONY: build-test-hotspot-jtreg-native test-image-hotspot-jtreg-native test-image
+
+################################################################################
+
+include MakeFileEnd.gmk
diff --git a/make/test/JtregNativeJdk.gmk b/make/test/JtregNativeJdk.gmk
index 90055cb5c0114..60a88ca1c9a5c 100644
--- a/make/test/JtregNativeJdk.gmk
+++ b/make/test/JtregNativeJdk.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
@@ -23,22 +23,17 @@
# questions.
#
+include MakeFileStart.gmk
+
################################################################################
# This file builds the native component of the JTReg tests for JDK.
# It also covers the test-image part, where the built files are copied to the
# test image.
################################################################################
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
-
include CopyFiles.gmk
include TestFilesCompilation.gmk
-$(eval $(call IncludeCustomExtension, test/JtregNativeJdk.gmk))
-
################################################################################
# Targets for building the native tests themselves.
################################################################################
@@ -61,8 +56,6 @@ BUILD_JDK_JTREG_EXECUTABLES_JDK_LIBS_exeCallerAccessTest := java.base:libjvm
BUILD_JDK_JTREG_EXECUTABLES_JDK_LIBS_exeNullCallerTest := java.base:libjvm
BUILD_JDK_JTREG_LIBRARIES_JDK_LIBS_libstringPlatformChars := java.base:libjava
-BUILD_JDK_JTREG_LIBRARIES_JDK_LIBS_libTracePinnedThreads := java.base:libjvm
-BUILD_JDK_JTREG_LIBRARIES_JDK_LIBS_libNewDirectByteBuffer := java.base:libjava
BUILD_JDK_JTREG_LIBRARIES_JDK_LIBS_libGetXSpace := java.base:libjava
# Platform specific setup
@@ -75,7 +68,6 @@ ifeq ($(call isTargetOs, windows), true)
BUILD_JDK_JTREG_EXECUTABLES_LIBS_exerevokeall := advapi32.lib
BUILD_JDK_JTREG_EXECUTABLES_CFLAGS_exeNullCallerTest := /EHsc
else
- BUILD_JDK_JTREG_LIBRARIES_JDK_LIBS_libDirectIO := java.base:libjava
BUILD_JDK_JTREG_LIBRARIES_LDFLAGS_libNativeThread := -pthread
# java.lang.foreign tests
@@ -85,12 +77,10 @@ else
BUILD_JDK_JTREG_LIBRARIES_LDFLAGS_libLinkerInvokerModule := -pthread
BUILD_JDK_JTREG_LIBRARIES_LDFLAGS_libLoaderLookupInvoker := -pthread
- BUILD_JDK_JTREG_LIBRARIES_JDK_LIBS_libExplicitAttach := java.base:libjvm
BUILD_JDK_JTREG_LIBRARIES_LDFLAGS_libExplicitAttach := -pthread
BUILD_JDK_JTREG_LIBRARIES_LDFLAGS_libImplicitAttach := -pthread
BUILD_JDK_JTREG_EXCLUDE += exerevokeall.c
ifeq ($(call isTargetOs, linux), true)
- BUILD_JDK_JTREG_LIBRARIES_JDK_LIBS_libInheritedChannel := java.base:libjava
BUILD_JDK_JTREG_EXECUTABLES_LIBS_exelauncher := -ldl
endif
BUILD_JDK_JTREG_EXECUTABLES_LIBS_exeNullCallerTest := $(LIBCXX)
@@ -169,4 +159,8 @@ test-image-jdk-jtreg-native: $(COPY_JDK_JTREG_NATIVE)
all: build-test-jdk-jtreg-native
test-image: test-image-jdk-jtreg-native
-.PHONY: default all build-test-jdk-jtreg-native test-image-jdk-jtreg-native test-image
+.PHONY: build-test-jdk-jtreg-native test-image-jdk-jtreg-native test-image
+
+################################################################################
+
+include MakeFileEnd.gmk
diff --git a/make/test/JtregNativeLibTest.gmk b/make/test/JtregNativeLibTest.gmk
index 1a0177e63b039..6a1441495d154 100644
--- a/make/test/JtregNativeLibTest.gmk
+++ b/make/test/JtregNativeLibTest.gmk
@@ -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
@@ -23,22 +23,17 @@
# questions.
#
+include MakeFileStart.gmk
+
################################################################################
# This file builds the native component of the JTReg tests for testlibrary.
# It also covers the test-image part, where the built files are copied to the
# test image.
################################################################################
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
-
include CopyFiles.gmk
include TestFilesCompilation.gmk
-$(eval $(call IncludeCustomExtension, test/JtregNativeLibTest.gmk))
-
################################################################################
# Targets for building the native tests themselves.
################################################################################
@@ -89,4 +84,8 @@ test-image-libtest-jtreg-native: $(COPY_LIBTEST_JTREG_NATIVE)
all: build-test-libtest-jtreg-native
test-image: test-image-libtest-jtreg-native
-.PHONY: default all build-test-libtest-jtreg-native test-image-libtest-jtreg-native test-image
+.PHONY: build-test-libtest-jtreg-native test-image-libtest-jtreg-native test-image
+
+################################################################################
+
+include MakeFileEnd.gmk
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_Defs_aarch64.hpp b/src/hotspot/cpu/aarch64/c1_Defs_aarch64.hpp
index 9470caae9fe5a..5f65ef5f04328 100644
--- a/src/hotspot/cpu/aarch64/c1_Defs_aarch64.hpp
+++ b/src/hotspot/cpu/aarch64/c1_Defs_aarch64.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.
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -41,16 +41,17 @@ enum {
// registers
enum {
+ pd_nof_available_regs = 32,
pd_nof_cpu_regs_frame_map = Register::number_of_registers, // number of GP registers used during code emission
pd_nof_fpu_regs_frame_map = FloatRegister::number_of_registers, // number of FP registers used during code emission
- pd_nof_caller_save_cpu_regs_frame_map = 19 - 2 /* rscratch1 and rscratch2 */ R18_RESERVED_ONLY(- 1), // number of registers killed by calls
+ pd_nof_caller_save_cpu_regs_frame_map = pd_nof_available_regs, // number of registers killed by calls
pd_nof_caller_save_fpu_regs_frame_map = 32, // number of registers killed by calls
- pd_first_callee_saved_reg = 19 - 2 /* rscratch1 and rscratch2 */ R18_RESERVED_ONLY(- 1),
- pd_last_callee_saved_reg = 26 - 2 /* rscratch1 and rscratch2 */ R18_RESERVED_ONLY(- 1),
+ pd_first_callee_saved_reg = pd_nof_available_regs - 1,
+ pd_last_callee_saved_reg = pd_first_callee_saved_reg - 1, // in fact, no callee saved regs
- pd_last_allocatable_cpu_reg = 16 R18_RESERVED_ONLY(- 1),
+ pd_last_allocatable_cpu_reg = pd_nof_available_regs - 1,
pd_nof_cpu_regs_reg_alloc
= pd_last_allocatable_cpu_reg + 1, // number of registers that are visible to register allocator
@@ -60,9 +61,9 @@ enum {
pd_nof_fpu_regs_linearscan = pd_nof_fpu_regs_frame_map, // number of registers visible to linear scan
pd_nof_xmm_regs_linearscan = 0, // don't have vector registers
pd_first_cpu_reg = 0,
- pd_last_cpu_reg = 16 R18_RESERVED_ONLY(- 1),
+ pd_last_cpu_reg = pd_nof_available_regs - 1,
pd_first_byte_reg = 0,
- pd_last_byte_reg = 16 R18_RESERVED_ONLY(- 1),
+ pd_last_byte_reg = pd_last_cpu_reg,
pd_first_fpu_reg = pd_nof_cpu_regs_frame_map,
pd_last_fpu_reg = pd_first_fpu_reg + 31,
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..9d30092b45aac 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"
@@ -194,9 +193,26 @@ void FrameMap::initialize() {
map_register(i, r25); r25_opr = LIR_OprFact::single_cpu(i); i++;
map_register(i, r26); r26_opr = LIR_OprFact::single_cpu(i); i++;
- map_register(i, r27); r27_opr = LIR_OprFact::single_cpu(i); i++; // rheapbase
+ // r27 is allocated conditionally. With compressed oops it holds
+ // the heapbase value and is not visible to the allocator.
+ bool preserve_rheapbase = i >= nof_caller_save_cpu_regs();
+ if (!preserve_rheapbase) {
+ map_register(i, r27); r27_opr = LIR_OprFact::single_cpu(i); i++; // rheapbase
+ }
+
+ if(!PreserveFramePointer) {
+ map_register(i, r29); r29_opr = LIR_OprFact::single_cpu(i); i++;
+ }
+
+ // The unallocatable registers are at the end
+
+ if (preserve_rheapbase) {
+ map_register(i, r27); r27_opr = LIR_OprFact::single_cpu(i); i++; // rheapbase
+ }
map_register(i, r28); r28_opr = LIR_OprFact::single_cpu(i); i++; // rthread
- map_register(i, r29); r29_opr = LIR_OprFact::single_cpu(i); i++; // rfp
+ if(PreserveFramePointer) {
+ map_register(i, r29); r29_opr = LIR_OprFact::single_cpu(i); i++; // rfp
+ }
map_register(i, r30); r30_opr = LIR_OprFact::single_cpu(i); i++; // lr
map_register(i, r31_sp); sp_opr = LIR_OprFact::single_cpu(i); i++; // sp
map_register(i, r8); r8_opr = LIR_OprFact::single_cpu(i); i++; // rscratch1
@@ -240,6 +256,19 @@ void FrameMap::initialize() {
_caller_save_cpu_regs[16] = r18_opr;
#endif
+ _caller_save_cpu_regs[17 R18_RESERVED_ONLY(-1)] = r19_opr;
+ _caller_save_cpu_regs[18 R18_RESERVED_ONLY(-1)] = r20_opr;
+ _caller_save_cpu_regs[19 R18_RESERVED_ONLY(-1)] = r21_opr;
+ _caller_save_cpu_regs[20 R18_RESERVED_ONLY(-1)] = r22_opr;
+ _caller_save_cpu_regs[21 R18_RESERVED_ONLY(-1)] = r23_opr;
+ _caller_save_cpu_regs[22 R18_RESERVED_ONLY(-1)] = r24_opr;
+ _caller_save_cpu_regs[23 R18_RESERVED_ONLY(-1)] = r25_opr;
+ _caller_save_cpu_regs[24 R18_RESERVED_ONLY(-1)] = r26_opr;
+
+ if (nof_caller_save_cpu_regs() > 25 R18_RESERVED_ONLY(-1)) {
+ _caller_save_cpu_regs[25 R18_RESERVED_ONLY(-1)] = r27_opr;
+ }
+
for (int i = 0; i < 8; i++) {
_caller_save_fpu_regs[i] = LIR_OprFact::single_fpu(i);
}
diff --git a/src/hotspot/cpu/aarch64/c1_FrameMap_aarch64.hpp b/src/hotspot/cpu/aarch64/c1_FrameMap_aarch64.hpp
index 3ec3ce1f67936..4d783418429cb 100644
--- a/src/hotspot/cpu/aarch64/c1_FrameMap_aarch64.hpp
+++ b/src/hotspot/cpu/aarch64/c1_FrameMap_aarch64.hpp
@@ -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.
*
@@ -140,8 +140,27 @@
static bool is_caller_save_register (LIR_Opr opr) { return true; }
static bool is_caller_save_register (Register r) { return true; }
- static int nof_caller_save_cpu_regs() { return pd_nof_caller_save_cpu_regs_frame_map; }
- static int last_cpu_reg() { return pd_last_cpu_reg; }
- static int last_byte_reg() { return pd_last_byte_reg; }
+ static int adjust_reg_range(int range, bool exclude_fp = true) {
+ // r27 is not allocatable when compressed oops is on and heapbase is not
+ // zero, compressed klass pointers doesn't use r27 after JDK-8234794
+ if (UseCompressedOops && (CompressedOops::base() != nullptr)) {
+ range -= 1;
+ }
+
+ // r29 is not allocatable when PreserveFramePointer is on,
+ // but fp saving is handled in MacroAssembler::build_frame()/remove_frame()
+ if (exclude_fp) {
+ range -= 1;
+ }
+
+ // rscratch registers r8, r9
+ // r28=rthread, r30=lr, r31=sp
+ // r18 on masOS/Windows
+ return range - 5 R18_RESERVED_ONLY(-1);
+ }
+
+ static int nof_caller_save_cpu_regs() { return adjust_reg_range(pd_nof_caller_save_cpu_regs_frame_map); }
+ static int last_cpu_reg() { return adjust_reg_range(pd_last_cpu_reg, PreserveFramePointer); }
+ static int last_byte_reg() { return adjust_reg_range(pd_last_byte_reg, PreserveFramePointer); }
#endif // CPU_AARCH64_C1_FRAMEMAP_AARCH64_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..e85daed732429 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;
}
@@ -1319,6 +1316,11 @@ void LIRGenerator::do_InstanceOf(InstanceOf* x) {
x->direct_compare(), patching_info, x->profiled_method(), x->profiled_bci());
}
+// Intrinsic for Class::isInstance
+address LIRGenerator::isInstance_entry() {
+ return Runtime1::entry_for(C1StubId::is_instance_of_id);
+}
+
void LIRGenerator::do_If(If* x) {
assert(x->number_of_sux() == 2, "inconsistency");
ValueTag tag = x->x()->type()->tag();
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_LinearScan_aarch64.hpp b/src/hotspot/cpu/aarch64/c1_LinearScan_aarch64.hpp
index 01a4d27532a5b..4062adf4154b6 100644
--- a/src/hotspot/cpu/aarch64/c1_LinearScan_aarch64.hpp
+++ b/src/hotspot/cpu/aarch64/c1_LinearScan_aarch64.hpp
@@ -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) 2014, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -41,9 +41,9 @@ inline bool LinearScan::requires_adjacent_regs(BasicType type) {
inline bool LinearScan::is_caller_save(int assigned_reg) {
assert(assigned_reg >= 0 && assigned_reg < nof_regs, "should call this only for registers");
- if (assigned_reg < pd_first_callee_saved_reg)
+ if (assigned_reg < FrameMap::nof_caller_save_cpu_regs())
return true;
- if (assigned_reg > pd_last_callee_saved_reg && assigned_reg < pd_first_callee_saved_fpu_reg)
+ if (assigned_reg >= pd_first_fpu_reg && assigned_reg < pd_first_callee_saved_fpu_reg)
return true;
if (assigned_reg > pd_last_callee_saved_fpu_reg && assigned_reg < pd_last_fpu_reg)
return true;
@@ -66,7 +66,7 @@ inline bool LinearScanWalker::pd_init_regs_for_alloc(Interval* cur) {
return true;
} else if (cur->type() == T_INT || cur->type() == T_LONG || cur->type() == T_OBJECT || cur->type() == T_ADDRESS || cur->type() == T_METADATA) {
_first_reg = pd_first_cpu_reg;
- _last_reg = pd_last_allocatable_cpu_reg;
+ _last_reg = FrameMap::last_cpu_reg();
return true;
}
return false;
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..063918ee20b7b 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"
@@ -258,15 +257,18 @@ static OopMap* generate_oop_map(StubAssembler* sasm, bool save_fpu_registers) {
int frame_size_in_slots = frame_size_in_bytes / sizeof(jint);
OopMap* oop_map = new OopMap(frame_size_in_slots, 0);
- for (int i = 0; i < FrameMap::nof_cpu_regs; i++) {
- Register r = as_Register(i);
- if (r == rthread || (i <= 18 && i != rscratch1->encoding() && i != rscratch2->encoding())) {
- int sp_offset = cpu_reg_save_offsets[i];
- oop_map->set_callee_saved(VMRegImpl::stack2reg(sp_offset),
- r->as_VMReg());
- }
+ for (int i = 0; i < FrameMap::nof_caller_save_cpu_regs(); i++) {
+ LIR_Opr opr = FrameMap::caller_save_cpu_reg_at(i);
+ Register r = opr->as_register();
+ int reg_num = r->encoding();
+ int sp_offset = cpu_reg_save_offsets[reg_num];
+ oop_map->set_callee_saved(VMRegImpl::stack2reg(cpu_reg_save_offsets[reg_num]), r->as_VMReg());
}
+ Register r = rthread;
+ int reg_num = r->encoding();
+ oop_map->set_callee_saved(VMRegImpl::stack2reg(cpu_reg_save_offsets[reg_num]), r->as_VMReg());
+
if (save_fpu_registers) {
for (int i = 0; i < FrameMap::nof_fpu_regs; i++) {
FloatRegister r = as_FloatRegister(i);
@@ -901,6 +903,55 @@ OopMapSet* Runtime1::generate_code_for(C1StubId id, StubAssembler* sasm) {
}
break;
+ case C1StubId::is_instance_of_id:
+ {
+ // Mirror: c_rarg0
+ // Object: c_rarg1
+ // Temps: r3, r4, r5, r6
+ // Result: r0
+
+ // Get the Klass* into c_rarg6
+ Register klass = c_rarg6, obj = c_rarg1, result = r0;
+ __ ldr(klass, Address(c_rarg0, java_lang_Class::klass_offset()));
+
+ Label fail, is_secondary, success;
+
+ __ cbz(klass, fail); // Klass is null
+ __ cbz(obj, fail); // obj is null
+
+ __ ldrw(r3, Address(klass, in_bytes(Klass::super_check_offset_offset())));
+ __ cmpw(r3, in_bytes(Klass::secondary_super_cache_offset()));
+ __ br(Assembler::EQ, is_secondary); // Klass is a secondary superclass
+
+ // Klass is a concrete class
+ __ load_klass(r5, obj);
+ __ ldr(rscratch1, Address(r5, r3));
+ __ cmp(klass, rscratch1);
+ __ cset(result, Assembler::EQ);
+ __ ret(lr);
+
+ __ bind(is_secondary);
+
+ __ load_klass(obj, obj);
+
+ // This is necessary because I am never in my own secondary_super list.
+ __ cmp(obj, klass);
+ __ br(Assembler::EQ, success);
+
+ __ lookup_secondary_supers_table_var(obj, klass,
+ /*temps*/r3, r4, r5, v0,
+ result,
+ &success);
+ __ bind(fail);
+ __ mov(result, 0);
+ __ ret(lr);
+
+ __ bind(success);
+ __ mov(result, 1);
+ __ ret(lr);
+ }
+ break;
+
case C1StubId::monitorexit_nofpu_id:
save_fpu_registers = false;
// fall through
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..b07fa2fa9df64 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();
@@ -503,11 +507,11 @@ frame frame::sender_for_interpreter_frame(RegisterMap* map) const {
intptr_t* unextended_sp = interpreter_frame_sender_sp();
intptr_t* sender_fp = link();
-#if COMPILER2_OR_JVMCI
+#if defined(COMPILER1) || COMPILER2_OR_JVMCI
if (map->update_map()) {
update_map_with_saved_link(map, (intptr_t**) addr_at(link_offset));
}
-#endif // COMPILER2_OR_JVMCI
+#endif // defined(COMPILER1) || COMPILER1_OR_COMPILER2
// For ROP protection, Interpreter will have signed the sender_pc,
// but there is no requirement to authenticate it here.
diff --git a/src/hotspot/cpu/aarch64/gc/g1/g1BarrierSetAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/gc/g1/g1BarrierSetAssembler_aarch64.cpp
index df521f94d1f84..42f3c4a015ac4 100644
--- a/src/hotspot/cpu/aarch64/gc/g1/g1BarrierSetAssembler_aarch64.cpp
+++ b/src/hotspot/cpu/aarch64/gc/g1/g1BarrierSetAssembler_aarch64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "gc/g1/g1BarrierSet.hpp"
#include "gc/g1/g1BarrierSetAssembler.hpp"
diff --git a/src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.cpp
index 0161843036bc5..828033975a065 100644
--- a/src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.cpp
+++ b/src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "classfile/classLoaderData.hpp"
#include "gc/shared/barrierSet.hpp"
#include "gc/shared/barrierSetAssembler.hpp"
diff --git a/src/hotspot/cpu/aarch64/gc/shared/barrierSetNMethod_aarch64.cpp b/src/hotspot/cpu/aarch64/gc/shared/barrierSetNMethod_aarch64.cpp
index 5169a510154ab..c45611c882b5a 100644
--- a/src/hotspot/cpu/aarch64/gc/shared/barrierSetNMethod_aarch64.cpp
+++ b/src/hotspot/cpu/aarch64/gc/shared/barrierSetNMethod_aarch64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "code/codeCache.hpp"
#include "code/nativeInst.hpp"
#include "gc/shared/barrierSet.hpp"
diff --git a/src/hotspot/cpu/aarch64/gc/shared/cardTableBarrierSetAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/gc/shared/cardTableBarrierSetAssembler_aarch64.cpp
index 6afdb285914fb..ea36183c9de95 100644
--- a/src/hotspot/cpu/aarch64/gc/shared/cardTableBarrierSetAssembler_aarch64.cpp
+++ b/src/hotspot/cpu/aarch64/gc/shared/cardTableBarrierSetAssembler_aarch64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "gc/shared/barrierSet.hpp"
#include "gc/shared/cardTable.hpp"
diff --git a/src/hotspot/cpu/aarch64/gc/shared/modRefBarrierSetAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/gc/shared/modRefBarrierSetAssembler_aarch64.cpp
index a50152d244fba..6890159189310 100644
--- a/src/hotspot/cpu/aarch64/gc/shared/modRefBarrierSetAssembler_aarch64.cpp
+++ b/src/hotspot/cpu/aarch64/gc/shared/modRefBarrierSetAssembler_aarch64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "gc/shared/modRefBarrierSetAssembler.hpp"
diff --git a/src/hotspot/cpu/aarch64/gc/shenandoah/c1/shenandoahBarrierSetC1_aarch64.cpp b/src/hotspot/cpu/aarch64/gc/shenandoah/c1/shenandoahBarrierSetC1_aarch64.cpp
index 666335330ed1b..e33ef47cf3c38 100644
--- a/src/hotspot/cpu/aarch64/gc/shenandoah/c1/shenandoahBarrierSetC1_aarch64.cpp
+++ b/src/hotspot/cpu/aarch64/gc/shenandoah/c1/shenandoahBarrierSetC1_aarch64.cpp
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "c1/c1_LIRAssembler.hpp"
#include "c1/c1_MacroAssembler.hpp"
#include "compiler/compilerDefinitions.inline.hpp"
diff --git a/src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp
index f682e86cdfbdd..19270d9fecf57 100644
--- a/src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp
+++ b/src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "gc/shenandoah/shenandoahBarrierSet.hpp"
#include "gc/shenandoah/shenandoahBarrierSetAssembler.hpp"
#include "gc/shenandoah/shenandoahForwarding.hpp"
diff --git a/src/hotspot/cpu/aarch64/gc/z/zAddress_aarch64.cpp b/src/hotspot/cpu/aarch64/gc/z/zAddress_aarch64.cpp
index c656736aa6473..a58c91a6a41e1 100644
--- a/src/hotspot/cpu/aarch64/gc/z/zAddress_aarch64.cpp
+++ b/src/hotspot/cpu/aarch64/gc/z/zAddress_aarch64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -21,7 +21,6 @@
* questions.
*/
-#include "precompiled.hpp"
#include "gc/shared/gcLogPrecious.hpp"
#include "gc/shared/gc_globals.hpp"
#include "gc/z/zAddress.hpp"
@@ -85,7 +84,7 @@ static size_t probe_valid_max_address_bit() {
munmap(result_addr, page_size);
}
}
- log_info_p(gc, init)("Probing address space for the highest valid bit: " SIZE_FORMAT, max_address_bit);
+ log_info_p(gc, init)("Probing address space for the highest valid bit: %zu", max_address_bit);
return MAX2(max_address_bit, MINIMUM_MAX_ADDRESS_BIT);
#else // LINUX
return DEFAULT_MAX_ADDRESS_BIT;
diff --git a/src/hotspot/cpu/aarch64/gc/z/zBarrierSetAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/gc/z/zBarrierSetAssembler_aarch64.cpp
index 3f1898b6742e1..5d4f0801ec62f 100644
--- a/src/hotspot/cpu/aarch64/gc/z/zBarrierSetAssembler_aarch64.cpp
+++ b/src/hotspot/cpu/aarch64/gc/z/zBarrierSetAssembler_aarch64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -21,7 +21,6 @@
* questions.
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "code/codeBlob.hpp"
#include "code/vmreg.inline.hpp"
diff --git a/src/hotspot/cpu/aarch64/icache_aarch64.cpp b/src/hotspot/cpu/aarch64/icache_aarch64.cpp
index 8bdddd4f1516a..311f3a7de1f73 100644
--- a/src/hotspot/cpu/aarch64/icache_aarch64.cpp
+++ b/src/hotspot/cpu/aarch64/icache_aarch64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2020 Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "runtime/icache.hpp"
void ICacheStubGenerator::generate_icache_flush(
diff --git a/src/hotspot/cpu/aarch64/immediate_aarch64.cpp b/src/hotspot/cpu/aarch64/immediate_aarch64.cpp
index 9c67a0dfeada9..024d554b98f54 100644
--- a/src/hotspot/cpu/aarch64/immediate_aarch64.cpp
+++ b/src/hotspot/cpu/aarch64/immediate_aarch64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -26,7 +26,6 @@
#include
#include
-#include "precompiled.hpp"
#include "immediate_aarch64.hpp"
#include "metaprogramming/primitiveConversions.hpp"
#include "utilities/globalDefinitions.hpp"
diff --git a/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp b/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp
index 836caa86cb0af..9892de21a8114 100644
--- a/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp
+++ b/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "compiler/compiler_globals.hpp"
#include "gc/shared/barrierSet.hpp"
@@ -503,7 +502,7 @@ void InterpreterMacroAssembler::remove_activation(
// get method access flags
ldr(r1, Address(rfp, frame::interpreter_frame_method_offset * wordSize));
- ldr(r2, Address(r1, Method::access_flags_offset()));
+ ldrh(r2, Address(r1, Method::access_flags_offset()));
tbz(r2, exact_log2(JVM_ACC_SYNCHRONIZED), unlocked);
// Don't unlock anything if the _do_not_unlock_if_synchronized flag
diff --git a/src/hotspot/cpu/aarch64/interpreterRT_aarch64.cpp b/src/hotspot/cpu/aarch64/interpreterRT_aarch64.cpp
index 90c7ca6f08a3d..d6310a2d326c9 100644
--- a/src/hotspot/cpu/aarch64/interpreterRT_aarch64.cpp
+++ b/src/hotspot/cpu/aarch64/interpreterRT_aarch64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved.
* Copyright (c) 2021, Azul Systems, Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -24,7 +24,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "interpreter/interp_masm.hpp"
#include "interpreter/interpreter.hpp"
diff --git a/src/hotspot/cpu/aarch64/jniFastGetField_aarch64.cpp b/src/hotspot/cpu/aarch64/jniFastGetField_aarch64.cpp
index aea268ea94443..8bec45b4b479a 100644
--- a/src/hotspot/cpu/aarch64/jniFastGetField_aarch64.cpp
+++ b/src/hotspot/cpu/aarch64/jniFastGetField_aarch64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.hpp"
#include "gc/shared/barrierSet.hpp"
#include "gc/shared/barrierSetAssembler.hpp"
diff --git a/src/hotspot/cpu/aarch64/jvmciCodeInstaller_aarch64.cpp b/src/hotspot/cpu/aarch64/jvmciCodeInstaller_aarch64.cpp
index 45ad873ae2747..3015206dadc4d 100644
--- a/src/hotspot/cpu/aarch64/jvmciCodeInstaller_aarch64.cpp
+++ b/src/hotspot/cpu/aarch64/jvmciCodeInstaller_aarch64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -21,7 +21,6 @@
* questions.
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.hpp"
#include "jvmci/jvmci.hpp"
#include "jvmci/jvmciCodeInstaller.hpp"
diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
index d561fb912a311..b6472b1b94812 100644
--- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
+++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2024, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/assembler.hpp"
#include "asm/assembler.inline.hpp"
#include "ci/ciEnv.hpp"
diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.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 fa48092fd505a..b0b299876018a 100644
--- a/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp
+++ b/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2021, Red Hat Inc. All rights reserved.
* Copyright (c) 2021, Azul Systems, Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -24,7 +24,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "code/codeCache.hpp"
@@ -760,7 +759,7 @@ AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm
Label L_skip_barrier;
{ // Bypass the barrier for non-static methods
- __ ldrw(rscratch1, Address(rmethod, Method::access_flags_offset()));
+ __ ldrh(rscratch1, Address(rmethod, Method::access_flags_offset()));
__ andsw(zr, rscratch1, JVM_ACC_STATIC);
__ br(Assembler::EQ, L_skip_barrier); // non-static
}
diff --git a/src/hotspot/cpu/aarch64/stubDeclarations_aarch64.hpp b/src/hotspot/cpu/aarch64/stubDeclarations_aarch64.hpp
new file mode 100644
index 0000000000000..1830bdf4a88d6
--- /dev/null
+++ b/src/hotspot/cpu/aarch64/stubDeclarations_aarch64.hpp
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2025, Red Hat, Inc. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef CPU_AARCH64_STUBDECLARATIONS_HPP
+#define CPU_AARCH64_STUBDECLARATIONS_HPP
+
+#define STUBGEN_INITIAL_BLOBS_ARCH_DO(do_stub, \
+ do_arch_blob, \
+ do_arch_entry, \
+ do_arch_entry_init) \
+ do_arch_blob(initial, 10000) \
+
+
+#define STUBGEN_CONTINUATION_BLOBS_ARCH_DO(do_stub, \
+ do_arch_blob, \
+ do_arch_entry, \
+ do_arch_entry_init) \
+ do_arch_blob(continuation, 2000) \
+
+
+#define STUBGEN_COMPILER_BLOBS_ARCH_DO(do_stub, \
+ do_arch_blob, \
+ do_arch_entry, \
+ do_arch_entry_init) \
+ do_arch_blob(compiler, 30000 ZGC_ONLY(+10000)) \
+ do_stub(compiler, vector_iota_indices) \
+ do_arch_entry(aarch64, compiler, vector_iota_indices, \
+ vector_iota_indices, vector_iota_indices) \
+ do_stub(compiler, large_array_equals) \
+ do_arch_entry(aarch64, compiler, large_array_equals, \
+ large_array_equals, large_array_equals) \
+ do_stub(compiler, large_arrays_hashcode_boolean) \
+ do_arch_entry(aarch64, compiler, large_arrays_hashcode_boolean, \
+ large_arrays_hashcode_boolean, \
+ large_arrays_hashcode_boolean) \
+ do_stub(compiler, large_arrays_hashcode_byte) \
+ do_arch_entry(aarch64, compiler, large_arrays_hashcode_byte, \
+ large_arrays_hashcode_byte, \
+ large_arrays_hashcode_byte) \
+ do_stub(compiler, large_arrays_hashcode_char) \
+ do_arch_entry(aarch64, compiler, large_arrays_hashcode_char, \
+ large_arrays_hashcode_char, \
+ large_arrays_hashcode_char) \
+ do_stub(compiler, large_arrays_hashcode_short) \
+ do_arch_entry(aarch64, compiler, large_arrays_hashcode_short, \
+ large_arrays_hashcode_short, \
+ large_arrays_hashcode_short) \
+ do_stub(compiler, large_arrays_hashcode_int) \
+ do_arch_entry(aarch64, compiler, large_arrays_hashcode_int, \
+ large_arrays_hashcode_int, \
+ large_arrays_hashcode_int) \
+ do_stub(compiler, large_byte_array_inflate) \
+ do_arch_entry(aarch64, compiler, large_byte_array_inflate, \
+ large_byte_array_inflate, large_byte_array_inflate) \
+ do_stub(compiler, count_positives) \
+ do_arch_entry(aarch64, compiler, count_positives, count_positives, \
+ count_positives) \
+ do_stub(compiler, count_positives_long) \
+ do_arch_entry(aarch64, compiler, count_positives_long, \
+ count_positives_long, count_positives_long) \
+ do_stub(compiler, compare_long_string_LL) \
+ do_arch_entry(aarch64, compiler, compare_long_string_LL, \
+ compare_long_string_LL, compare_long_string_LL) \
+ do_stub(compiler, compare_long_string_UU) \
+ do_arch_entry(aarch64, compiler, compare_long_string_UU, \
+ compare_long_string_UU, compare_long_string_UU) \
+ do_stub(compiler, compare_long_string_LU) \
+ do_arch_entry(aarch64, compiler, compare_long_string_LU, \
+ compare_long_string_LU, compare_long_string_LU) \
+ do_stub(compiler, compare_long_string_UL) \
+ do_arch_entry(aarch64, compiler, compare_long_string_UL, \
+ compare_long_string_UL, compare_long_string_UL) \
+ do_stub(compiler, string_indexof_linear_ll) \
+ do_arch_entry(aarch64, compiler, string_indexof_linear_ll, \
+ string_indexof_linear_ll, string_indexof_linear_ll) \
+ do_stub(compiler, string_indexof_linear_uu) \
+ do_arch_entry(aarch64, compiler, string_indexof_linear_uu, \
+ string_indexof_linear_uu, string_indexof_linear_uu) \
+ do_stub(compiler, string_indexof_linear_ul) \
+ do_arch_entry(aarch64, compiler, string_indexof_linear_ul, \
+ string_indexof_linear_ul, string_indexof_linear_ul) \
+ /* this uses the entry for ghash_processBlocks */ \
+ do_stub(compiler, ghash_processBlocks_wide) \
+
+
+#define STUBGEN_FINAL_BLOBS_ARCH_DO(do_stub, \
+ do_arch_blob, \
+ do_arch_entry, \
+ do_arch_entry_init) \
+ do_arch_blob(final, 20000 ZGC_ONLY(+100000)) \
+ do_stub(final, copy_byte_f) \
+ do_arch_entry(aarch64, final, copy_byte_f, copy_byte_f, \
+ copy_byte_f) \
+ do_stub(final, copy_byte_b) \
+ do_arch_entry(aarch64, final, copy_byte_b, copy_byte_b, \
+ copy_byte_b) \
+ do_stub(final, copy_oop_f) \
+ do_arch_entry(aarch64, final, copy_oop_f, copy_oop_f, copy_oop_f) \
+ do_stub(final, copy_oop_b) \
+ do_arch_entry(aarch64, final, copy_oop_b, copy_oop_b, copy_oop_b) \
+ do_stub(final, copy_oop_uninit_f) \
+ do_arch_entry(aarch64, final, copy_oop_uninit_f, copy_oop_uninit_f, \
+ copy_oop_uninit_f) \
+ do_stub(final, copy_oop_uninit_b) \
+ do_arch_entry(aarch64, final, copy_oop_uninit_b, copy_oop_uninit_b, \
+ copy_oop_uninit_b) \
+ do_stub(final, zero_blocks) \
+ do_arch_entry(aarch64, final, zero_blocks, zero_blocks, \
+ zero_blocks) \
+ do_stub(final, spin_wait) \
+ do_arch_entry_init(aarch64, final, spin_wait, spin_wait, \
+ spin_wait, empty_spin_wait) \
+ /* stub only -- entries are not stored in StubRoutines::aarch64 */ \
+ /* n.b. these are not the same as the generic atomic stubs */ \
+ do_stub(final, atomic_entry_points) \
+
+
+#endif // CPU_AARCH64_STUBDECLARATIONS_HPP
diff --git a/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp b/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp
index de5df5c1af156..5f901a5e9ea11 100644
--- a/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp
+++ b/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2014, 2024, Red Hat Inc. All rights reserved.
+ * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2025, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "asm/register.hpp"
@@ -203,7 +202,8 @@ class StubGenerator: public StubCodeGenerator {
(int)frame::entry_frame_call_wrapper_offset == (int)call_wrapper_off,
"adjust this code");
- StubCodeMark mark(this, "StubRoutines", "call_stub");
+ StubGenStubId stub_id = StubGenStubId::call_stub_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
const Address sp_after_call (rfp, sp_after_call_off * wordSize);
@@ -422,7 +422,8 @@ class StubGenerator: public StubCodeGenerator {
// r0: exception oop
address generate_catch_exception() {
- StubCodeMark mark(this, "StubRoutines", "catch_exception");
+ StubGenStubId stub_id = StubGenStubId::catch_exception_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
// same as in generate_call_stub():
@@ -477,7 +478,8 @@ class StubGenerator: public StubCodeGenerator {
// so it just needs to be generated code with no x86 prolog
address generate_forward_exception() {
- StubCodeMark mark(this, "StubRoutines", "forward exception");
+ StubGenStubId stub_id = StubGenStubId::forward_exception_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
// Upon entry, LR points to the return address returning into
@@ -566,8 +568,8 @@ class StubGenerator: public StubCodeGenerator {
// [tos + 4]: saved r0
// [tos + 5]: saved rscratch1
address generate_verify_oop() {
-
- StubCodeMark mark(this, "StubRoutines", "verify_oop");
+ StubGenStubId stub_id = StubGenStubId::verify_oop_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Label exit, error;
@@ -615,9 +617,9 @@ class StubGenerator: public StubCodeGenerator {
}
// Generate indices for iota vector.
- address generate_iota_indices(const char *stub_name) {
+ address generate_iota_indices(StubGenStubId stub_id) {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", stub_name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
// B
__ emit_data64(0x0706050403020100, relocInfo::none);
@@ -660,7 +662,8 @@ class StubGenerator: public StubCodeGenerator {
Register base = r10, cnt = r11;
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "zero_blocks");
+ StubGenStubId stub_id = StubGenStubId::zero_blocks_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
if (UseBlockZeroing) {
@@ -799,8 +802,39 @@ class StubGenerator: public StubCodeGenerator {
//
// s and d are adjusted to point to the remaining words to copy
//
- void generate_copy_longs(DecoratorSet decorators, BasicType type, Label &start, Register s, Register d, Register count,
- copy_direction direction) {
+ void generate_copy_longs(StubGenStubId stub_id, DecoratorSet decorators, Label &start, Register s, Register d, Register count) {
+ BasicType type;
+ copy_direction direction;
+
+ switch (stub_id) {
+ case copy_byte_f_id:
+ direction = copy_forwards;
+ type = T_BYTE;
+ break;
+ case copy_byte_b_id:
+ direction = copy_backwards;
+ type = T_BYTE;
+ break;
+ case copy_oop_f_id:
+ direction = copy_forwards;
+ type = T_OBJECT;
+ break;
+ case copy_oop_b_id:
+ direction = copy_backwards;
+ type = T_OBJECT;
+ break;
+ case copy_oop_uninit_f_id:
+ direction = copy_forwards;
+ type = T_OBJECT;
+ break;
+ case copy_oop_uninit_b_id:
+ direction = copy_backwards;
+ type = T_OBJECT;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+
int unit = wordSize * direction;
int bias = (UseSIMDForMemoryOps ? 4:2) * wordSize;
@@ -815,15 +849,10 @@ class StubGenerator: public StubCodeGenerator {
assert_different_registers(s, d, count, rscratch1, rscratch2);
Label again, drain;
- const char *stub_name;
- if (direction == copy_forwards)
- stub_name = "forward_copy_longs";
- else
- stub_name = "backward_copy_longs";
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", stub_name);
+ StubCodeMark mark(this, stub_id);
__ bind(start);
@@ -1478,10 +1507,11 @@ class StubGenerator: public StubCodeGenerator {
}
// Arguments:
- // aligned - true => Input and output aligned on a HeapWord == 8-byte boundary
- // ignored
- // is_oop - true => oop array, so generate store check code
- // name - stub name string
+ // stub_id - is used to name the stub and identify all details of
+ // how to perform the copy.
+ //
+ // entry - is assigned to the stub's post push entry point unless
+ // it is null
//
// Inputs:
// c_rarg0 - source array address
@@ -1492,16 +1522,96 @@ class StubGenerator: public StubCodeGenerator {
// the hardware handle it. The two dwords within qwords that span
// cache line boundaries will still be loaded and stored atomically.
//
- // Side Effects:
- // disjoint_int_copy_entry is set to the no-overlap entry point
- // used by generate_conjoint_int_oop_copy().
+ // Side Effects: entry is set to the (post push) entry point so it
+ // can be used by the corresponding conjoint copy
+ // method
//
- address generate_disjoint_copy(int size, bool aligned, bool is_oop, address *entry,
- const char *name, bool dest_uninitialized = false) {
+ address generate_disjoint_copy(StubGenStubId stub_id, address *entry) {
Register s = c_rarg0, d = c_rarg1, count = c_rarg2;
RegSet saved_reg = RegSet::of(s, d, count);
+ int size;
+ bool aligned;
+ bool is_oop;
+ bool dest_uninitialized;
+ switch (stub_id) {
+ case jbyte_disjoint_arraycopy_id:
+ size = sizeof(jbyte);
+ aligned = false;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case arrayof_jbyte_disjoint_arraycopy_id:
+ size = sizeof(jbyte);
+ aligned = true;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case jshort_disjoint_arraycopy_id:
+ size = sizeof(jshort);
+ aligned = false;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case arrayof_jshort_disjoint_arraycopy_id:
+ size = sizeof(jshort);
+ aligned = true;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case jint_disjoint_arraycopy_id:
+ size = sizeof(jint);
+ aligned = false;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case arrayof_jint_disjoint_arraycopy_id:
+ size = sizeof(jint);
+ aligned = true;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case jlong_disjoint_arraycopy_id:
+ // since this is always aligned we can (should!) use the same
+ // stub as for case arrayof_jlong_disjoint_arraycopy
+ ShouldNotReachHere();
+ break;
+ case arrayof_jlong_disjoint_arraycopy_id:
+ size = sizeof(jlong);
+ aligned = true;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case oop_disjoint_arraycopy_id:
+ size = UseCompressedOops ? sizeof (jint) : sizeof (jlong);
+ aligned = !UseCompressedOops;
+ is_oop = true;
+ dest_uninitialized = false;
+ break;
+ case arrayof_oop_disjoint_arraycopy_id:
+ size = UseCompressedOops ? sizeof (jint) : sizeof (jlong);
+ aligned = !UseCompressedOops;
+ is_oop = true;
+ dest_uninitialized = false;
+ break;
+ case oop_disjoint_arraycopy_uninit_id:
+ size = UseCompressedOops ? sizeof (jint) : sizeof (jlong);
+ aligned = !UseCompressedOops;
+ is_oop = true;
+ dest_uninitialized = true;
+ break;
+ case arrayof_oop_disjoint_arraycopy_uninit_id:
+ size = UseCompressedOops ? sizeof (jint) : sizeof (jlong);
+ aligned = !UseCompressedOops;
+ is_oop = true;
+ dest_uninitialized = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ break;
+ }
+
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ enter();
@@ -1548,10 +1658,16 @@ class StubGenerator: public StubCodeGenerator {
}
// Arguments:
- // aligned - true => Input and output aligned on a HeapWord == 8-byte boundary
- // ignored
- // is_oop - true => oop array, so generate store check code
- // name - stub name string
+ // stub_id - is used to name the stub and identify all details of
+ // how to perform the copy.
+ //
+ // nooverlap_target - identifes the (post push) entry for the
+ // corresponding disjoint copy routine which can be
+ // jumped to if the ranges do not actually overlap
+ //
+ // entry - is assigned to the stub's post push entry point unless
+ // it is null
+ //
//
// Inputs:
// c_rarg0 - source array address
@@ -1562,12 +1678,94 @@ class StubGenerator: public StubCodeGenerator {
// the hardware handle it. The two dwords within qwords that span
// cache line boundaries will still be loaded and stored atomically.
//
- address generate_conjoint_copy(int size, bool aligned, bool is_oop, address nooverlap_target,
- address *entry, const char *name,
- bool dest_uninitialized = false) {
+ // Side Effects:
+ // entry is set to the no-overlap entry point so it can be used by
+ // some other conjoint copy method
+ //
+ address generate_conjoint_copy(StubGenStubId stub_id, address nooverlap_target, address *entry) {
Register s = c_rarg0, d = c_rarg1, count = c_rarg2;
RegSet saved_regs = RegSet::of(s, d, count);
- StubCodeMark mark(this, "StubRoutines", name);
+ int size;
+ bool aligned;
+ bool is_oop;
+ bool dest_uninitialized;
+ switch (stub_id) {
+ case jbyte_arraycopy_id:
+ size = sizeof(jbyte);
+ aligned = false;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case arrayof_jbyte_arraycopy_id:
+ size = sizeof(jbyte);
+ aligned = true;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case jshort_arraycopy_id:
+ size = sizeof(jshort);
+ aligned = false;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case arrayof_jshort_arraycopy_id:
+ size = sizeof(jshort);
+ aligned = true;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case jint_arraycopy_id:
+ size = sizeof(jint);
+ aligned = false;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case arrayof_jint_arraycopy_id:
+ size = sizeof(jint);
+ aligned = true;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case jlong_arraycopy_id:
+ // since this is always aligned we can (should!) use the same
+ // stub as for case arrayof_jlong_disjoint_arraycopy
+ ShouldNotReachHere();
+ break;
+ case arrayof_jlong_arraycopy_id:
+ size = sizeof(jlong);
+ aligned = true;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case oop_arraycopy_id:
+ size = UseCompressedOops ? sizeof (jint) : sizeof (jlong);
+ aligned = !UseCompressedOops;
+ is_oop = true;
+ dest_uninitialized = false;
+ break;
+ case arrayof_oop_arraycopy_id:
+ size = UseCompressedOops ? sizeof (jint) : sizeof (jlong);
+ aligned = !UseCompressedOops;
+ is_oop = true;
+ dest_uninitialized = false;
+ break;
+ case oop_arraycopy_uninit_id:
+ size = UseCompressedOops ? sizeof (jint) : sizeof (jlong);
+ aligned = !UseCompressedOops;
+ is_oop = true;
+ dest_uninitialized = true;
+ break;
+ case arrayof_oop_arraycopy_uninit_id:
+ size = UseCompressedOops ? sizeof (jint) : sizeof (jlong);
+ aligned = !UseCompressedOops;
+ is_oop = true;
+ dest_uninitialized = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ enter();
@@ -1613,230 +1811,8 @@ class StubGenerator: public StubCodeGenerator {
__ mov(r0, zr); // return 0
__ ret(lr);
return start;
-}
-
- // Arguments:
- // aligned - true => Input and output aligned on a HeapWord == 8-byte boundary
- // ignored
- // name - stub name string
- //
- // Inputs:
- // c_rarg0 - source array address
- // c_rarg1 - destination array address
- // c_rarg2 - element count, treated as ssize_t, can be zero
- //
- // If 'from' and/or 'to' are aligned on 4-, 2-, or 1-byte boundaries,
- // we let the hardware handle it. The one to eight bytes within words,
- // dwords or qwords that span cache line boundaries will still be loaded
- // and stored atomically.
- //
- // Side Effects:
- // disjoint_byte_copy_entry is set to the no-overlap entry point //
- // If 'from' and/or 'to' are aligned on 4-, 2-, or 1-byte boundaries,
- // we let the hardware handle it. The one to eight bytes within words,
- // dwords or qwords that span cache line boundaries will still be loaded
- // and stored atomically.
- //
- // Side Effects:
- // disjoint_byte_copy_entry is set to the no-overlap entry point
- // used by generate_conjoint_byte_copy().
- //
- address generate_disjoint_byte_copy(bool aligned, address* entry, const char *name) {
- const bool not_oop = false;
- return generate_disjoint_copy(sizeof (jbyte), aligned, not_oop, entry, name);
- }
-
- // Arguments:
- // aligned - true => Input and output aligned on a HeapWord == 8-byte boundary
- // ignored
- // name - stub name string
- //
- // Inputs:
- // c_rarg0 - source array address
- // c_rarg1 - destination array address
- // c_rarg2 - element count, treated as ssize_t, can be zero
- //
- // If 'from' and/or 'to' are aligned on 4-, 2-, or 1-byte boundaries,
- // we let the hardware handle it. The one to eight bytes within words,
- // dwords or qwords that span cache line boundaries will still be loaded
- // and stored atomically.
- //
- address generate_conjoint_byte_copy(bool aligned, address nooverlap_target,
- address* entry, const char *name) {
- const bool not_oop = false;
- return generate_conjoint_copy(sizeof (jbyte), aligned, not_oop, nooverlap_target, entry, name);
- }
-
- // Arguments:
- // aligned - true => Input and output aligned on a HeapWord == 8-byte boundary
- // ignored
- // name - stub name string
- //
- // Inputs:
- // c_rarg0 - source array address
- // c_rarg1 - destination array address
- // c_rarg2 - element count, treated as ssize_t, can be zero
- //
- // If 'from' and/or 'to' are aligned on 4- or 2-byte boundaries, we
- // let the hardware handle it. The two or four words within dwords
- // or qwords that span cache line boundaries will still be loaded
- // and stored atomically.
- //
- // Side Effects:
- // disjoint_short_copy_entry is set to the no-overlap entry point
- // used by generate_conjoint_short_copy().
- //
- address generate_disjoint_short_copy(bool aligned,
- address* entry, const char *name) {
- const bool not_oop = false;
- return generate_disjoint_copy(sizeof (jshort), aligned, not_oop, entry, name);
- }
-
- // Arguments:
- // aligned - true => Input and output aligned on a HeapWord == 8-byte boundary
- // ignored
- // name - stub name string
- //
- // Inputs:
- // c_rarg0 - source array address
- // c_rarg1 - destination array address
- // c_rarg2 - element count, treated as ssize_t, can be zero
- //
- // If 'from' and/or 'to' are aligned on 4- or 2-byte boundaries, we
- // let the hardware handle it. The two or four words within dwords
- // or qwords that span cache line boundaries will still be loaded
- // and stored atomically.
- //
- address generate_conjoint_short_copy(bool aligned, address nooverlap_target,
- address *entry, const char *name) {
- const bool not_oop = false;
- return generate_conjoint_copy(sizeof (jshort), aligned, not_oop, nooverlap_target, entry, name);
-
- }
- // Arguments:
- // aligned - true => Input and output aligned on a HeapWord == 8-byte boundary
- // ignored
- // name - stub name string
- //
- // Inputs:
- // c_rarg0 - source array address
- // c_rarg1 - destination array address
- // c_rarg2 - element count, treated as ssize_t, can be zero
- //
- // If 'from' and/or 'to' are aligned on 4-byte boundaries, we let
- // the hardware handle it. The two dwords within qwords that span
- // cache line boundaries will still be loaded and stored atomically.
- //
- // Side Effects:
- // disjoint_int_copy_entry is set to the no-overlap entry point
- // used by generate_conjoint_int_oop_copy().
- //
- address generate_disjoint_int_copy(bool aligned, address *entry,
- const char *name, bool dest_uninitialized = false) {
- const bool not_oop = false;
- return generate_disjoint_copy(sizeof (jint), aligned, not_oop, entry, name);
- }
-
- // Arguments:
- // aligned - true => Input and output aligned on a HeapWord == 8-byte boundary
- // ignored
- // name - stub name string
- //
- // Inputs:
- // c_rarg0 - source array address
- // c_rarg1 - destination array address
- // c_rarg2 - element count, treated as ssize_t, can be zero
- //
- // If 'from' and/or 'to' are aligned on 4-byte boundaries, we let
- // the hardware handle it. The two dwords within qwords that span
- // cache line boundaries will still be loaded and stored atomically.
- //
- address generate_conjoint_int_copy(bool aligned, address nooverlap_target,
- address *entry, const char *name,
- bool dest_uninitialized = false) {
- const bool not_oop = false;
- return generate_conjoint_copy(sizeof (jint), aligned, not_oop, nooverlap_target, entry, name);
- }
-
-
- // Arguments:
- // aligned - true => Input and output aligned on a HeapWord boundary == 8 bytes
- // ignored
- // name - stub name string
- //
- // Inputs:
- // c_rarg0 - source array address
- // c_rarg1 - destination array address
- // c_rarg2 - element count, treated as size_t, can be zero
- //
- // Side Effects:
- // disjoint_oop_copy_entry or disjoint_long_copy_entry is set to the
- // no-overlap entry point used by generate_conjoint_long_oop_copy().
- //
- address generate_disjoint_long_copy(bool aligned, address *entry,
- const char *name, bool dest_uninitialized = false) {
- const bool not_oop = false;
- return generate_disjoint_copy(sizeof (jlong), aligned, not_oop, entry, name);
}
- // Arguments:
- // aligned - true => Input and output aligned on a HeapWord boundary == 8 bytes
- // ignored
- // name - stub name string
- //
- // Inputs:
- // c_rarg0 - source array address
- // c_rarg1 - destination array address
- // c_rarg2 - element count, treated as size_t, can be zero
- //
- address generate_conjoint_long_copy(bool aligned,
- address nooverlap_target, address *entry,
- const char *name, bool dest_uninitialized = false) {
- const bool not_oop = false;
- return generate_conjoint_copy(sizeof (jlong), aligned, not_oop, nooverlap_target, entry, name);
- }
-
- // Arguments:
- // aligned - true => Input and output aligned on a HeapWord boundary == 8 bytes
- // ignored
- // name - stub name string
- //
- // Inputs:
- // c_rarg0 - source array address
- // c_rarg1 - destination array address
- // c_rarg2 - element count, treated as size_t, can be zero
- //
- // Side Effects:
- // disjoint_oop_copy_entry or disjoint_long_copy_entry is set to the
- // no-overlap entry point used by generate_conjoint_long_oop_copy().
- //
- address generate_disjoint_oop_copy(bool aligned, address *entry,
- const char *name, bool dest_uninitialized) {
- const bool is_oop = true;
- const int size = UseCompressedOops ? sizeof (jint) : sizeof (jlong);
- return generate_disjoint_copy(size, aligned, is_oop, entry, name, dest_uninitialized);
- }
-
- // Arguments:
- // aligned - true => Input and output aligned on a HeapWord boundary == 8 bytes
- // ignored
- // name - stub name string
- //
- // Inputs:
- // c_rarg0 - source array address
- // c_rarg1 - destination array address
- // c_rarg2 - element count, treated as size_t, can be zero
- //
- address generate_conjoint_oop_copy(bool aligned,
- address nooverlap_target, address *entry,
- const char *name, bool dest_uninitialized) {
- const bool is_oop = true;
- const int size = UseCompressedOops ? sizeof (jint) : sizeof (jlong);
- return generate_conjoint_copy(size, aligned, is_oop, nooverlap_target, entry,
- name, dest_uninitialized);
- }
-
-
// Helper for generating a dynamic type check.
// Smashes rscratch1, rscratch2.
void generate_type_check(Register sub_klass,
@@ -1874,8 +1850,18 @@ class StubGenerator: public StubCodeGenerator {
// r0 == 0 - success
// r0 == -1^K - failure, where K is partial transfer count
//
- address generate_checkcast_copy(const char *name, address *entry,
- bool dest_uninitialized = false) {
+ address generate_checkcast_copy(StubGenStubId stub_id, address *entry) {
+ bool dest_uninitialized;
+ switch (stub_id) {
+ case checkcast_arraycopy_id:
+ dest_uninitialized = false;
+ break;
+ case checkcast_arraycopy_uninit_id:
+ dest_uninitialized = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
Label L_load_element, L_store_element, L_do_card_marks, L_done, L_done_pop;
@@ -1909,7 +1895,7 @@ class StubGenerator: public StubCodeGenerator {
copied_oop, r19_klass, count_save);
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ enter(); // required for proper stackwalking of RuntimeStub frame
@@ -2081,16 +2067,17 @@ class StubGenerator: public StubCodeGenerator {
// Examines the alignment of the operands and dispatches
// to a long, int, short, or byte copy loop.
//
- address generate_unsafe_copy(const char *name,
- address byte_copy_entry,
+ address generate_unsafe_copy(address byte_copy_entry,
address short_copy_entry,
address int_copy_entry,
address long_copy_entry) {
+ StubGenStubId stub_id = StubGenStubId::unsafe_arraycopy_id;
+
Label L_long_aligned, L_int_aligned, L_short_aligned;
Register s = c_rarg0, d = c_rarg1, count = c_rarg2;
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ enter(); // required for proper stackwalking of RuntimeStub frame
@@ -2134,10 +2121,10 @@ class StubGenerator: public StubCodeGenerator {
// r0 == 0 - success
// r0 == -1^K - failure, where K is partial transfer count
//
- address generate_generic_copy(const char *name,
- address byte_copy_entry, address short_copy_entry,
+ address generate_generic_copy(address byte_copy_entry, address short_copy_entry,
address int_copy_entry, address oop_copy_entry,
address long_copy_entry, address checkcast_copy_entry) {
+ StubGenStubId stub_id = StubGenStubId::generic_arraycopy_id;
Label L_failed, L_objArray;
Label L_copy_bytes, L_copy_shorts, L_copy_ints, L_copy_longs;
@@ -2155,7 +2142,7 @@ class StubGenerator: public StubCodeGenerator {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
@@ -2408,9 +2395,41 @@ class StubGenerator: public StubCodeGenerator {
// value: c_rarg1
// count: c_rarg2 treated as signed
//
- address generate_fill(BasicType t, bool aligned, const char *name) {
+ address generate_fill(StubGenStubId stub_id) {
+ BasicType t;
+ bool aligned;
+
+ switch (stub_id) {
+ case jbyte_fill_id:
+ t = T_BYTE;
+ aligned = false;
+ break;
+ case jshort_fill_id:
+ t = T_SHORT;
+ aligned = false;
+ break;
+ case jint_fill_id:
+ t = T_INT;
+ aligned = false;
+ break;
+ case arrayof_jbyte_fill_id:
+ t = T_BYTE;
+ aligned = true;
+ break;
+ case arrayof_jshort_fill_id:
+ t = T_SHORT;
+ aligned = true;
+ break;
+ case arrayof_jint_fill_id:
+ t = T_INT;
+ aligned = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ };
+
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
BLOCK_COMMENT("Entry:");
@@ -2552,7 +2571,8 @@ class StubGenerator: public StubCodeGenerator {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "_data_cache_writeback");
+ StubGenStubId stub_id = StubGenStubId::data_cache_writeback_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ enter();
@@ -2568,7 +2588,8 @@ class StubGenerator: public StubCodeGenerator {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "_data_cache_writeback_sync");
+ StubGenStubId stub_id = StubGenStubId::data_cache_writeback_sync_id;
+ StubCodeMark mark(this, stub_id);
// pre wbsync is a no-op
// post wbsync translates to an sfence
@@ -2594,61 +2615,44 @@ class StubGenerator: public StubCodeGenerator {
address entry_jlong_arraycopy;
address entry_checkcast_arraycopy;
- generate_copy_longs(IN_HEAP | IS_ARRAY, T_BYTE, copy_f, r0, r1, r15, copy_forwards);
- generate_copy_longs(IN_HEAP | IS_ARRAY, T_BYTE, copy_b, r0, r1, r15, copy_backwards);
+ generate_copy_longs(StubGenStubId::copy_byte_f_id, IN_HEAP | IS_ARRAY, copy_f, r0, r1, r15);
+ generate_copy_longs(StubGenStubId::copy_byte_b_id, IN_HEAP | IS_ARRAY, copy_b, r0, r1, r15);
- generate_copy_longs(IN_HEAP | IS_ARRAY, T_OBJECT, copy_obj_f, r0, r1, r15, copy_forwards);
- generate_copy_longs(IN_HEAP | IS_ARRAY, T_OBJECT, copy_obj_b, r0, r1, r15, copy_backwards);
+ generate_copy_longs(StubGenStubId::copy_oop_f_id, IN_HEAP | IS_ARRAY, copy_obj_f, r0, r1, r15);
+ generate_copy_longs(StubGenStubId::copy_oop_b_id, IN_HEAP | IS_ARRAY, copy_obj_b, r0, r1, r15);
- generate_copy_longs(IN_HEAP | IS_ARRAY | IS_DEST_UNINITIALIZED, T_OBJECT, copy_obj_uninit_f, r0, r1, r15, copy_forwards);
- generate_copy_longs(IN_HEAP | IS_ARRAY | IS_DEST_UNINITIALIZED, T_OBJECT, copy_obj_uninit_b, r0, r1, r15, copy_backwards);
+ generate_copy_longs(StubGenStubId::copy_oop_uninit_f_id, IN_HEAP | IS_ARRAY | IS_DEST_UNINITIALIZED, copy_obj_uninit_f, r0, r1, r15);
+ generate_copy_longs(StubGenStubId::copy_oop_uninit_b_id, IN_HEAP | IS_ARRAY | IS_DEST_UNINITIALIZED, copy_obj_uninit_b, r0, r1, r15);
StubRoutines::aarch64::_zero_blocks = generate_zero_blocks();
//*** jbyte
// Always need aligned and unaligned versions
- StubRoutines::_jbyte_disjoint_arraycopy = generate_disjoint_byte_copy(false, &entry,
- "jbyte_disjoint_arraycopy");
- StubRoutines::_jbyte_arraycopy = generate_conjoint_byte_copy(false, entry,
- &entry_jbyte_arraycopy,
- "jbyte_arraycopy");
- StubRoutines::_arrayof_jbyte_disjoint_arraycopy = generate_disjoint_byte_copy(true, &entry,
- "arrayof_jbyte_disjoint_arraycopy");
- StubRoutines::_arrayof_jbyte_arraycopy = generate_conjoint_byte_copy(true, entry, nullptr,
- "arrayof_jbyte_arraycopy");
+ StubRoutines::_jbyte_disjoint_arraycopy = generate_disjoint_copy(StubGenStubId::jbyte_disjoint_arraycopy_id, &entry);
+ StubRoutines::_jbyte_arraycopy = generate_conjoint_copy(StubGenStubId::jbyte_arraycopy_id, entry, &entry_jbyte_arraycopy);
+ StubRoutines::_arrayof_jbyte_disjoint_arraycopy = generate_disjoint_copy(StubGenStubId::arrayof_jbyte_disjoint_arraycopy_id, &entry);
+ StubRoutines::_arrayof_jbyte_arraycopy = generate_conjoint_copy(StubGenStubId::arrayof_jbyte_arraycopy_id, entry, nullptr);
//*** jshort
// Always need aligned and unaligned versions
- StubRoutines::_jshort_disjoint_arraycopy = generate_disjoint_short_copy(false, &entry,
- "jshort_disjoint_arraycopy");
- StubRoutines::_jshort_arraycopy = generate_conjoint_short_copy(false, entry,
- &entry_jshort_arraycopy,
- "jshort_arraycopy");
- StubRoutines::_arrayof_jshort_disjoint_arraycopy = generate_disjoint_short_copy(true, &entry,
- "arrayof_jshort_disjoint_arraycopy");
- StubRoutines::_arrayof_jshort_arraycopy = generate_conjoint_short_copy(true, entry, nullptr,
- "arrayof_jshort_arraycopy");
+ StubRoutines::_jshort_disjoint_arraycopy = generate_disjoint_copy(StubGenStubId::jshort_disjoint_arraycopy_id, &entry);
+ StubRoutines::_jshort_arraycopy = generate_conjoint_copy(StubGenStubId::jshort_arraycopy_id, entry, &entry_jshort_arraycopy);
+ StubRoutines::_arrayof_jshort_disjoint_arraycopy = generate_disjoint_copy(StubGenStubId::arrayof_jshort_disjoint_arraycopy_id, &entry);
+ StubRoutines::_arrayof_jshort_arraycopy = generate_conjoint_copy(StubGenStubId::arrayof_jshort_arraycopy_id, entry, nullptr);
//*** jint
// Aligned versions
- StubRoutines::_arrayof_jint_disjoint_arraycopy = generate_disjoint_int_copy(true, &entry,
- "arrayof_jint_disjoint_arraycopy");
- StubRoutines::_arrayof_jint_arraycopy = generate_conjoint_int_copy(true, entry, &entry_jint_arraycopy,
- "arrayof_jint_arraycopy");
+ StubRoutines::_arrayof_jint_disjoint_arraycopy = generate_disjoint_copy(StubGenStubId::arrayof_jint_disjoint_arraycopy_id, &entry);
+ StubRoutines::_arrayof_jint_arraycopy = generate_conjoint_copy(StubGenStubId::arrayof_jint_arraycopy_id, entry, &entry_jint_arraycopy);
// In 64 bit we need both aligned and unaligned versions of jint arraycopy.
// entry_jint_arraycopy always points to the unaligned version
- StubRoutines::_jint_disjoint_arraycopy = generate_disjoint_int_copy(false, &entry,
- "jint_disjoint_arraycopy");
- StubRoutines::_jint_arraycopy = generate_conjoint_int_copy(false, entry,
- &entry_jint_arraycopy,
- "jint_arraycopy");
+ StubRoutines::_jint_disjoint_arraycopy = generate_disjoint_copy(StubGenStubId::jint_disjoint_arraycopy_id, &entry);
+ StubRoutines::_jint_arraycopy = generate_conjoint_copy(StubGenStubId::jint_arraycopy_id, entry, &entry_jint_arraycopy);
//*** jlong
// It is always aligned
- StubRoutines::_arrayof_jlong_disjoint_arraycopy = generate_disjoint_long_copy(true, &entry,
- "arrayof_jlong_disjoint_arraycopy");
- StubRoutines::_arrayof_jlong_arraycopy = generate_conjoint_long_copy(true, entry, &entry_jlong_arraycopy,
- "arrayof_jlong_arraycopy");
+ StubRoutines::_arrayof_jlong_disjoint_arraycopy = generate_disjoint_copy(StubGenStubId::arrayof_jlong_disjoint_arraycopy_id, &entry);
+ StubRoutines::_arrayof_jlong_arraycopy = generate_conjoint_copy(StubGenStubId::arrayof_jlong_arraycopy_id, entry, &entry_jlong_arraycopy);
StubRoutines::_jlong_disjoint_arraycopy = StubRoutines::_arrayof_jlong_disjoint_arraycopy;
StubRoutines::_jlong_arraycopy = StubRoutines::_arrayof_jlong_arraycopy;
@@ -2659,18 +2663,14 @@ class StubGenerator: public StubCodeGenerator {
bool aligned = !UseCompressedOops;
StubRoutines::_arrayof_oop_disjoint_arraycopy
- = generate_disjoint_oop_copy(aligned, &entry, "arrayof_oop_disjoint_arraycopy",
- /*dest_uninitialized*/false);
+ = generate_disjoint_copy(StubGenStubId::arrayof_oop_disjoint_arraycopy_id, &entry);
StubRoutines::_arrayof_oop_arraycopy
- = generate_conjoint_oop_copy(aligned, entry, &entry_oop_arraycopy, "arrayof_oop_arraycopy",
- /*dest_uninitialized*/false);
+ = generate_conjoint_copy(StubGenStubId::arrayof_oop_arraycopy_id, entry, &entry_oop_arraycopy);
// Aligned versions without pre-barriers
StubRoutines::_arrayof_oop_disjoint_arraycopy_uninit
- = generate_disjoint_oop_copy(aligned, &entry, "arrayof_oop_disjoint_arraycopy_uninit",
- /*dest_uninitialized*/true);
+ = generate_disjoint_copy(StubGenStubId::arrayof_oop_disjoint_arraycopy_uninit_id, &entry);
StubRoutines::_arrayof_oop_arraycopy_uninit
- = generate_conjoint_oop_copy(aligned, entry, nullptr, "arrayof_oop_arraycopy_uninit",
- /*dest_uninitialized*/true);
+ = generate_conjoint_copy(StubGenStubId::arrayof_oop_arraycopy_uninit_id, entry, nullptr);
}
StubRoutines::_oop_disjoint_arraycopy = StubRoutines::_arrayof_oop_disjoint_arraycopy;
@@ -2678,30 +2678,27 @@ class StubGenerator: public StubCodeGenerator {
StubRoutines::_oop_disjoint_arraycopy_uninit = StubRoutines::_arrayof_oop_disjoint_arraycopy_uninit;
StubRoutines::_oop_arraycopy_uninit = StubRoutines::_arrayof_oop_arraycopy_uninit;
- StubRoutines::_checkcast_arraycopy = generate_checkcast_copy("checkcast_arraycopy", &entry_checkcast_arraycopy);
- StubRoutines::_checkcast_arraycopy_uninit = generate_checkcast_copy("checkcast_arraycopy_uninit", nullptr,
- /*dest_uninitialized*/true);
+ StubRoutines::_checkcast_arraycopy = generate_checkcast_copy(StubGenStubId::checkcast_arraycopy_id, &entry_checkcast_arraycopy);
+ StubRoutines::_checkcast_arraycopy_uninit = generate_checkcast_copy(StubGenStubId::checkcast_arraycopy_uninit_id, nullptr);
- StubRoutines::_unsafe_arraycopy = generate_unsafe_copy("unsafe_arraycopy",
- entry_jbyte_arraycopy,
+ StubRoutines::_unsafe_arraycopy = generate_unsafe_copy(entry_jbyte_arraycopy,
entry_jshort_arraycopy,
entry_jint_arraycopy,
entry_jlong_arraycopy);
- StubRoutines::_generic_arraycopy = generate_generic_copy("generic_arraycopy",
- entry_jbyte_arraycopy,
+ StubRoutines::_generic_arraycopy = generate_generic_copy(entry_jbyte_arraycopy,
entry_jshort_arraycopy,
entry_jint_arraycopy,
entry_oop_arraycopy,
entry_jlong_arraycopy,
entry_checkcast_arraycopy);
- StubRoutines::_jbyte_fill = generate_fill(T_BYTE, false, "jbyte_fill");
- StubRoutines::_jshort_fill = generate_fill(T_SHORT, false, "jshort_fill");
- StubRoutines::_jint_fill = generate_fill(T_INT, false, "jint_fill");
- StubRoutines::_arrayof_jbyte_fill = generate_fill(T_BYTE, true, "arrayof_jbyte_fill");
- StubRoutines::_arrayof_jshort_fill = generate_fill(T_SHORT, true, "arrayof_jshort_fill");
- StubRoutines::_arrayof_jint_fill = generate_fill(T_INT, true, "arrayof_jint_fill");
+ StubRoutines::_jbyte_fill = generate_fill(StubGenStubId::jbyte_fill_id);
+ StubRoutines::_jshort_fill = generate_fill(StubGenStubId::jshort_fill_id);
+ StubRoutines::_jint_fill = generate_fill(StubGenStubId::jint_fill_id);
+ StubRoutines::_arrayof_jbyte_fill = generate_fill(StubGenStubId::arrayof_jbyte_fill_id);
+ StubRoutines::_arrayof_jshort_fill = generate_fill(StubGenStubId::arrayof_jshort_fill_id);
+ StubRoutines::_arrayof_jint_fill = generate_fill(StubGenStubId::arrayof_jint_fill_id);
}
void generate_math_stubs() { Unimplemented(); }
@@ -2715,7 +2712,8 @@ class StubGenerator: public StubCodeGenerator {
//
address generate_aescrypt_encryptBlock() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "aescrypt_encryptBlock");
+ StubGenStubId stub_id = StubGenStubId::aescrypt_encryptBlock_id;
+ StubCodeMark mark(this, stub_id);
const Register from = c_rarg0; // source array address
const Register to = c_rarg1; // destination array address
@@ -2748,7 +2746,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_aescrypt_decryptBlock() {
assert(UseAES, "need AES cryptographic extension support");
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "aescrypt_decryptBlock");
+ StubGenStubId stub_id = StubGenStubId::aescrypt_decryptBlock_id;
+ StubCodeMark mark(this, stub_id);
Label L_doLast;
const Register from = c_rarg0; // source array address
@@ -2786,7 +2785,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_cipherBlockChaining_encryptAESCrypt() {
assert(UseAES, "need AES cryptographic extension support");
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "cipherBlockChaining_encryptAESCrypt");
+ StubGenStubId stub_id = StubGenStubId::cipherBlockChaining_encryptAESCrypt_id;
+ StubCodeMark mark(this, stub_id);
Label L_loadkeys_44, L_loadkeys_52, L_aes_loop, L_rounds_44, L_rounds_52;
@@ -2890,7 +2890,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_cipherBlockChaining_decryptAESCrypt() {
assert(UseAES, "need AES cryptographic extension support");
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "cipherBlockChaining_decryptAESCrypt");
+ StubGenStubId stub_id = StubGenStubId::cipherBlockChaining_decryptAESCrypt_id;
+ StubCodeMark mark(this, stub_id);
Label L_loadkeys_44, L_loadkeys_52, L_aes_loop, L_rounds_44, L_rounds_52;
@@ -3076,7 +3077,8 @@ class StubGenerator: public StubCodeGenerator {
// Wide bulk encryption of whole blocks.
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "counterMode_AESCrypt");
+ StubGenStubId stub_id = StubGenStubId::counterMode_AESCrypt_id;
+ StubCodeMark mark(this, stub_id);
const address start = __ pc();
__ enter();
@@ -3285,7 +3287,8 @@ class StubGenerator: public StubCodeGenerator {
__ emit_int64(0x87);
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "galoisCounterMode_AESCrypt");
+ StubGenStubId stub_id = StubGenStubId::galoisCounterMode_AESCrypt_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ enter();
@@ -3494,9 +3497,21 @@ class StubGenerator: public StubCodeGenerator {
// c_rarg2 - int offset
// c_rarg3 - int limit
//
- address generate_md5_implCompress(bool multi_block, const char *name) {
+ address generate_md5_implCompress(StubGenStubId stub_id) {
+ bool multi_block;
+ switch (stub_id) {
+ case md5_implCompress_id:
+ multi_block = false;
+ break;
+ case md5_implCompressMB_id:
+ multi_block = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Register buf = c_rarg0;
@@ -3635,9 +3650,22 @@ class StubGenerator: public StubCodeGenerator {
// c_rarg2 - int offset
// c_rarg3 - int limit
//
- address generate_sha1_implCompress(bool multi_block, const char *name) {
+ address generate_sha1_implCompress(StubGenStubId stub_id) {
+ bool multi_block;
+ switch (stub_id) {
+ case sha1_implCompress_id:
+ multi_block = false;
+ break;
+ case sha1_implCompressMB_id:
+ multi_block = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Register buf = c_rarg0;
@@ -3727,7 +3755,19 @@ class StubGenerator: public StubCodeGenerator {
// c_rarg2 - int offset
// c_rarg3 - int limit
//
- address generate_sha256_implCompress(bool multi_block, const char *name) {
+ address generate_sha256_implCompress(StubGenStubId stub_id) {
+ bool multi_block;
+ switch (stub_id) {
+ case sha256_implCompress_id:
+ multi_block = false;
+ break;
+ case sha256_implCompressMB_id:
+ multi_block = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+
static const uint32_t round_consts[64] = {
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
@@ -3746,8 +3786,10 @@ class StubGenerator: public StubCodeGenerator {
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
};
+
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Register buf = c_rarg0;
@@ -3869,7 +3911,19 @@ class StubGenerator: public StubCodeGenerator {
// c_rarg2 - int offset
// c_rarg3 - int limit
//
- address generate_sha512_implCompress(bool multi_block, const char *name) {
+ address generate_sha512_implCompress(StubGenStubId stub_id) {
+ bool multi_block;
+ switch (stub_id) {
+ case sha512_implCompress_id:
+ multi_block = false;
+ break;
+ case sha512_implCompressMB_id:
+ multi_block = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+
static const uint64_t round_consts[80] = {
0x428A2F98D728AE22L, 0x7137449123EF65CDL, 0xB5C0FBCFEC4D3B2FL,
0xE9B5DBA58189DBBCL, 0x3956C25BF348B538L, 0x59F111F1B605D019L,
@@ -3901,7 +3955,8 @@ class StubGenerator: public StubCodeGenerator {
};
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Register buf = c_rarg0;
@@ -4017,7 +4072,19 @@ class StubGenerator: public StubCodeGenerator {
// c_rarg3 - int offset
// c_rarg4 - int limit
//
- address generate_sha3_implCompress(bool multi_block, const char *name) {
+ address generate_sha3_implCompress(StubGenStubId stub_id) {
+ bool multi_block;
+ switch (stub_id) {
+ case sha3_implCompress_id:
+ multi_block = false;
+ break;
+ case sha3_implCompressMB_id:
+ multi_block = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+
static const uint64_t round_consts[24] = {
0x0000000000000001L, 0x0000000000008082L, 0x800000000000808AL,
0x8000000080008000L, 0x000000000000808BL, 0x0000000080000001L,
@@ -4030,7 +4097,8 @@ class StubGenerator: public StubCodeGenerator {
};
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Register buf = c_rarg0;
@@ -4247,7 +4315,8 @@ class StubGenerator: public StubCodeGenerator {
assert(UseCRC32Intrinsics, "what are we doing here?");
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "updateBytesCRC32");
+ StubGenStubId stub_id = StubGenStubId::updateBytesCRC32_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
@@ -4272,124 +4341,195 @@ class StubGenerator: public StubCodeGenerator {
return start;
}
- // ChaCha20 block function. This version parallelizes by loading
- // individual 32-bit state elements into vectors for four blocks
- // (e.g. all four blocks' worth of state[0] in one register, etc.)
+ // ChaCha20 block function. This version parallelizes 4 quarter
+ // round operations at a time. It uses 16 SIMD registers to
+ // produce 4 blocks of key stream.
//
// state (int[16]) = c_rarg0
- // keystream (byte[1024]) = c_rarg1
+ // keystream (byte[256]) = c_rarg1
// return - number of bytes of keystream (always 256)
- address generate_chacha20Block_blockpar() {
- Label L_twoRounds, L_cc20_const;
+ //
+ // In this approach, we load the 512-bit start state sequentially into
+ // 4 128-bit vectors. We then make 4 4-vector copies of that starting
+ // state, with each successive set of 4 vectors having a +1 added into
+ // the first 32-bit lane of the 4th vector in that group (the counter).
+ // By doing this, we can perform the block function on 4 512-bit blocks
+ // within one run of this intrinsic.
+ // The alignment of the data across the 4-vector group is such that at
+ // the start it is already aligned for the first round of each two-round
+ // loop iteration. In other words, the corresponding lanes of each vector
+ // will contain the values needed for that quarter round operation (e.g.
+ // elements 0/4/8/12, 1/5/9/13, 2/6/10/14, etc.).
+ // In between each full round, a lane shift must occur. Within a loop
+ // iteration, between the first and second rounds, the 2nd, 3rd, and 4th
+ // vectors are rotated left 32, 64 and 96 bits, respectively. The result
+ // is effectively a diagonal orientation in columnar form. After the
+ // second full round, those registers are left-rotated again, this time
+ // 96, 64, and 32 bits - returning the vectors to their columnar organization.
+ // After all 10 iterations, the original state is added to each 4-vector
+ // working state along with the add mask, and the 4 vector groups are
+ // sequentially written to the memory dedicated for the output key stream.
+ //
+ // For a more detailed explanation, see Goll and Gueron, "Vectorization of
+ // ChaCha Stream Cipher", 2014 11th Int. Conf. on Information Technology:
+ // New Generations, Las Vegas, NV, USA, April 2014, DOI: 10.1109/ITNG.2014.33
+ address generate_chacha20Block_qrpar() {
+ Label L_Q_twoRounds, L_Q_cc20_const;
// The constant data is broken into two 128-bit segments to be loaded
- // onto FloatRegisters. The first 128 bits are a counter add overlay
- // that adds +0/+1/+2/+3 to the vector holding replicated state[12].
+ // onto SIMD registers. The first 128 bits are a counter add overlay
+ // that adds +1/+0/+0/+0 to the vectors holding replicated state[12].
// The second 128-bits is a table constant used for 8-bit left rotations.
- __ BIND(L_cc20_const);
- __ emit_int64(0x0000000100000000UL);
- __ emit_int64(0x0000000300000002UL);
+ // on 32-bit lanes within a SIMD register.
+ __ BIND(L_Q_cc20_const);
+ __ emit_int64(0x0000000000000001UL);
+ __ emit_int64(0x0000000000000000UL);
__ emit_int64(0x0605040702010003UL);
__ emit_int64(0x0E0D0C0F0A09080BUL);
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "chacha20Block");
+ StubGenStubId stub_id = StubGenStubId::chacha20Block_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ enter();
- int i, j;
const Register state = c_rarg0;
const Register keystream = c_rarg1;
const Register loopCtr = r10;
const Register tmpAddr = r11;
- const FloatRegister stateFirst = v0;
- const FloatRegister stateSecond = v1;
- const FloatRegister stateThird = v2;
- const FloatRegister stateFourth = v3;
- const FloatRegister origCtrState = v28;
- const FloatRegister scratch = v29;
+ const FloatRegister aState = v0;
+ const FloatRegister bState = v1;
+ const FloatRegister cState = v2;
+ const FloatRegister dState = v3;
+ const FloatRegister a1Vec = v4;
+ const FloatRegister b1Vec = v5;
+ const FloatRegister c1Vec = v6;
+ const FloatRegister d1Vec = v7;
+ // Skip the callee-saved registers v8 - v15
+ const FloatRegister a2Vec = v16;
+ const FloatRegister b2Vec = v17;
+ const FloatRegister c2Vec = v18;
+ const FloatRegister d2Vec = v19;
+ const FloatRegister a3Vec = v20;
+ const FloatRegister b3Vec = v21;
+ const FloatRegister c3Vec = v22;
+ const FloatRegister d3Vec = v23;
+ const FloatRegister a4Vec = v24;
+ const FloatRegister b4Vec = v25;
+ const FloatRegister c4Vec = v26;
+ const FloatRegister d4Vec = v27;
+ const FloatRegister scratch = v28;
+ const FloatRegister addMask = v29;
const FloatRegister lrot8Tbl = v30;
- // Organize SIMD registers in an array that facilitates
- // putting repetitive opcodes into loop structures. It is
- // important that each grouping of 4 registers is monotonically
- // increasing to support the requirements of multi-register
- // instructions (e.g. ld4r, st4, etc.)
- const FloatRegister workSt[16] = {
- v4, v5, v6, v7, v16, v17, v18, v19,
- v20, v21, v22, v23, v24, v25, v26, v27
- };
-
- // Load from memory and interlace across 16 SIMD registers,
- // With each word from memory being broadcast to all lanes of
- // each successive SIMD register.
- // Addr(0) -> All lanes in workSt[i]
- // Addr(4) -> All lanes workSt[i + 1], etc.
- __ mov(tmpAddr, state);
- for (i = 0; i < 16; i += 4) {
- __ ld4r(workSt[i], workSt[i + 1], workSt[i + 2], workSt[i + 3], __ T4S,
- __ post(tmpAddr, 16));
- }
-
- // Pull in constant data. The first 16 bytes are the add overlay
- // which is applied to the vector holding the counter (state[12]).
- // The second 16 bytes is the index register for the 8-bit left
- // rotation tbl instruction.
- __ adr(tmpAddr, L_cc20_const);
- __ ldpq(origCtrState, lrot8Tbl, Address(tmpAddr));
- __ addv(workSt[12], __ T4S, workSt[12], origCtrState);
-
- // Set up the 10 iteration loop and perform all 8 quarter round ops
+ // Load the initial state in the first 4 quadword registers,
+ // then copy the initial state into the next 4 quadword registers
+ // that will be used for the working state.
+ __ ld1(aState, bState, cState, dState, __ T16B, Address(state));
+
+ // Load the index register for 2 constant 128-bit data fields.
+ // The first represents the +1/+0/+0/+0 add mask. The second is
+ // the 8-bit left rotation.
+ __ adr(tmpAddr, L_Q_cc20_const);
+ __ ldpq(addMask, lrot8Tbl, Address(tmpAddr));
+
+ __ mov(a1Vec, __ T16B, aState);
+ __ mov(b1Vec, __ T16B, bState);
+ __ mov(c1Vec, __ T16B, cState);
+ __ mov(d1Vec, __ T16B, dState);
+
+ __ mov(a2Vec, __ T16B, aState);
+ __ mov(b2Vec, __ T16B, bState);
+ __ mov(c2Vec, __ T16B, cState);
+ __ addv(d2Vec, __ T4S, d1Vec, addMask);
+
+ __ mov(a3Vec, __ T16B, aState);
+ __ mov(b3Vec, __ T16B, bState);
+ __ mov(c3Vec, __ T16B, cState);
+ __ addv(d3Vec, __ T4S, d2Vec, addMask);
+
+ __ mov(a4Vec, __ T16B, aState);
+ __ mov(b4Vec, __ T16B, bState);
+ __ mov(c4Vec, __ T16B, cState);
+ __ addv(d4Vec, __ T4S, d3Vec, addMask);
+
+ // Set up the 10 iteration loop
__ mov(loopCtr, 10);
- __ BIND(L_twoRounds);
-
- __ cc20_quarter_round(workSt[0], workSt[4], workSt[8], workSt[12],
- scratch, lrot8Tbl);
- __ cc20_quarter_round(workSt[1], workSt[5], workSt[9], workSt[13],
- scratch, lrot8Tbl);
- __ cc20_quarter_round(workSt[2], workSt[6], workSt[10], workSt[14],
- scratch, lrot8Tbl);
- __ cc20_quarter_round(workSt[3], workSt[7], workSt[11], workSt[15],
- scratch, lrot8Tbl);
-
- __ cc20_quarter_round(workSt[0], workSt[5], workSt[10], workSt[15],
- scratch, lrot8Tbl);
- __ cc20_quarter_round(workSt[1], workSt[6], workSt[11], workSt[12],
- scratch, lrot8Tbl);
- __ cc20_quarter_round(workSt[2], workSt[7], workSt[8], workSt[13],
- scratch, lrot8Tbl);
- __ cc20_quarter_round(workSt[3], workSt[4], workSt[9], workSt[14],
- scratch, lrot8Tbl);
+ __ BIND(L_Q_twoRounds);
+
+ // The first set of operations on the vectors covers the first 4 quarter
+ // round operations:
+ // Qround(state, 0, 4, 8,12)
+ // Qround(state, 1, 5, 9,13)
+ // Qround(state, 2, 6,10,14)
+ // Qround(state, 3, 7,11,15)
+ __ cc20_quarter_round(a1Vec, b1Vec, c1Vec, d1Vec, scratch, lrot8Tbl);
+ __ cc20_quarter_round(a2Vec, b2Vec, c2Vec, d2Vec, scratch, lrot8Tbl);
+ __ cc20_quarter_round(a3Vec, b3Vec, c3Vec, d3Vec, scratch, lrot8Tbl);
+ __ cc20_quarter_round(a4Vec, b4Vec, c4Vec, d4Vec, scratch, lrot8Tbl);
+
+ // Shuffle the b1Vec/c1Vec/d1Vec to reorganize the state vectors to
+ // diagonals. The a1Vec does not need to change orientation.
+ __ cc20_shift_lane_org(b1Vec, c1Vec, d1Vec, true);
+ __ cc20_shift_lane_org(b2Vec, c2Vec, d2Vec, true);
+ __ cc20_shift_lane_org(b3Vec, c3Vec, d3Vec, true);
+ __ cc20_shift_lane_org(b4Vec, c4Vec, d4Vec, true);
+
+ // The second set of operations on the vectors covers the second 4 quarter
+ // round operations, now acting on the diagonals:
+ // Qround(state, 0, 5,10,15)
+ // Qround(state, 1, 6,11,12)
+ // Qround(state, 2, 7, 8,13)
+ // Qround(state, 3, 4, 9,14)
+ __ cc20_quarter_round(a1Vec, b1Vec, c1Vec, d1Vec, scratch, lrot8Tbl);
+ __ cc20_quarter_round(a2Vec, b2Vec, c2Vec, d2Vec, scratch, lrot8Tbl);
+ __ cc20_quarter_round(a3Vec, b3Vec, c3Vec, d3Vec, scratch, lrot8Tbl);
+ __ cc20_quarter_round(a4Vec, b4Vec, c4Vec, d4Vec, scratch, lrot8Tbl);
+
+ // Before we start the next iteration, we need to perform shuffles
+ // on the b/c/d vectors to move them back to columnar organizations
+ // from their current diagonal orientation.
+ __ cc20_shift_lane_org(b1Vec, c1Vec, d1Vec, false);
+ __ cc20_shift_lane_org(b2Vec, c2Vec, d2Vec, false);
+ __ cc20_shift_lane_org(b3Vec, c3Vec, d3Vec, false);
+ __ cc20_shift_lane_org(b4Vec, c4Vec, d4Vec, false);
// Decrement and iterate
__ sub(loopCtr, loopCtr, 1);
- __ cbnz(loopCtr, L_twoRounds);
-
- __ mov(tmpAddr, state);
-
- // Add the starting state back to the post-loop keystream
- // state. We read/interlace the state array from memory into
- // 4 registers similar to what we did in the beginning. Then
- // add the counter overlay onto workSt[12] at the end.
- for (i = 0; i < 16; i += 4) {
- __ ld4r(stateFirst, stateSecond, stateThird, stateFourth, __ T4S,
- __ post(tmpAddr, 16));
- __ addv(workSt[i], __ T4S, workSt[i], stateFirst);
- __ addv(workSt[i + 1], __ T4S, workSt[i + 1], stateSecond);
- __ addv(workSt[i + 2], __ T4S, workSt[i + 2], stateThird);
- __ addv(workSt[i + 3], __ T4S, workSt[i + 3], stateFourth);
- }
- __ addv(workSt[12], __ T4S, workSt[12], origCtrState); // Add ctr mask
-
- // Write to key stream, storing the same element out of workSt[0..15]
- // to consecutive 4-byte offsets in the key stream buffer, then repeating
- // for the next element position.
- for (i = 0; i < 4; i++) {
- for (j = 0; j < 16; j += 4) {
- __ st4(workSt[j], workSt[j + 1], workSt[j + 2], workSt[j + 3], __ S, i,
- __ post(keystream, 16));
- }
- }
+ __ cbnz(loopCtr, L_Q_twoRounds);
+
+ // Once the counter reaches zero, we fall out of the loop
+ // and need to add the initial state back into the working state
+ // represented by the a/b/c/d1Vec registers. This is destructive
+ // on the dState register but we no longer will need it.
+ __ addv(a1Vec, __ T4S, a1Vec, aState);
+ __ addv(b1Vec, __ T4S, b1Vec, bState);
+ __ addv(c1Vec, __ T4S, c1Vec, cState);
+ __ addv(d1Vec, __ T4S, d1Vec, dState);
+
+ __ addv(a2Vec, __ T4S, a2Vec, aState);
+ __ addv(b2Vec, __ T4S, b2Vec, bState);
+ __ addv(c2Vec, __ T4S, c2Vec, cState);
+ __ addv(dState, __ T4S, dState, addMask);
+ __ addv(d2Vec, __ T4S, d2Vec, dState);
+
+ __ addv(a3Vec, __ T4S, a3Vec, aState);
+ __ addv(b3Vec, __ T4S, b3Vec, bState);
+ __ addv(c3Vec, __ T4S, c3Vec, cState);
+ __ addv(dState, __ T4S, dState, addMask);
+ __ addv(d3Vec, __ T4S, d3Vec, dState);
+
+ __ addv(a4Vec, __ T4S, a4Vec, aState);
+ __ addv(b4Vec, __ T4S, b4Vec, bState);
+ __ addv(c4Vec, __ T4S, c4Vec, cState);
+ __ addv(dState, __ T4S, dState, addMask);
+ __ addv(d4Vec, __ T4S, d4Vec, dState);
+
+ // Write the final state back to the result buffer
+ __ st1(a1Vec, b1Vec, c1Vec, d1Vec, __ T16B, __ post(keystream, 64));
+ __ st1(a2Vec, b2Vec, c2Vec, d2Vec, __ T16B, __ post(keystream, 64));
+ __ st1(a3Vec, b3Vec, c3Vec, d3Vec, __ T16B, __ post(keystream, 64));
+ __ st1(a4Vec, b4Vec, c4Vec, d4Vec, __ T16B, __ post(keystream, 64));
__ mov(r0, 256); // Return length of output keystream
__ leave();
@@ -4414,7 +4554,8 @@ class StubGenerator: public StubCodeGenerator {
assert(UseCRC32CIntrinsics, "what are we doing here?");
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "updateBytesCRC32C");
+ StubGenStubId stub_id = StubGenStubId::updateBytesCRC32C_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
@@ -4452,7 +4593,8 @@ class StubGenerator: public StubCodeGenerator {
*/
address generate_updateBytesAdler32() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "updateBytesAdler32");
+ StubGenStubId stub_id = StubGenStubId::updateBytesAdler32_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Label L_simple_by1_loop, L_nmax, L_nmax_loop, L_by16, L_by16_loop, L_by1_loop, L_do_mod, L_combine, L_by1;
@@ -4673,7 +4815,8 @@ class StubGenerator: public StubCodeGenerator {
*/
address generate_multiplyToLen() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "multiplyToLen");
+ StubGenStubId stub_id = StubGenStubId::multiplyToLen_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
const Register x = r0;
@@ -4705,7 +4848,8 @@ class StubGenerator: public StubCodeGenerator {
// faster than multiply_to_len on some CPUs and slower on others, but
// multiply_to_len shows a bit better overall results
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "squareToLen");
+ StubGenStubId stub_id = StubGenStubId::squareToLen_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
const Register x = r0;
@@ -4738,7 +4882,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_mulAdd() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "mulAdd");
+ StubGenStubId stub_id = StubGenStubId::mulAdd_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
@@ -4768,7 +4913,8 @@ class StubGenerator: public StubCodeGenerator {
//
address generate_bigIntegerRightShift() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "bigIntegerRightShiftWorker");
+ StubGenStubId stub_id = StubGenStubId::bigIntegerRightShiftWorker_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Label ShiftSIMDLoop, ShiftTwoLoop, ShiftThree, ShiftTwo, ShiftOne, Exit;
@@ -4890,7 +5036,8 @@ class StubGenerator: public StubCodeGenerator {
//
address generate_bigIntegerLeftShift() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "bigIntegerLeftShiftWorker");
+ StubGenStubId stub_id = StubGenStubId::bigIntegerLeftShiftWorker_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Label ShiftSIMDLoop, ShiftTwoLoop, ShiftThree, ShiftTwo, ShiftOne, Exit;
@@ -4998,7 +5145,8 @@ class StubGenerator: public StubCodeGenerator {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "count_positives");
+ StubGenStubId stub_id = StubGenStubId::count_positives_id;
+ StubCodeMark mark(this, stub_id);
address entry = __ pc();
@@ -5259,7 +5407,8 @@ class StubGenerator: public StubCodeGenerator {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "large_array_equals");
+ StubGenStubId stub_id = StubGenStubId::large_array_equals_id;
+ StubCodeMark mark(this, stub_id);
address entry = __ pc();
__ enter();
@@ -5384,29 +5533,29 @@ class StubGenerator: public StubCodeGenerator {
__ align(CodeEntryAlignment);
- const char *mark_name = "";
+ StubGenStubId stub_id;
switch (eltype) {
case T_BOOLEAN:
- mark_name = "_large_arrays_hashcode_boolean";
+ stub_id = StubGenStubId::large_arrays_hashcode_boolean_id;
break;
case T_BYTE:
- mark_name = "_large_arrays_hashcode_byte";
+ stub_id = StubGenStubId::large_arrays_hashcode_byte_id;
break;
case T_CHAR:
- mark_name = "_large_arrays_hashcode_char";
+ stub_id = StubGenStubId::large_arrays_hashcode_char_id;
break;
case T_SHORT:
- mark_name = "_large_arrays_hashcode_short";
+ stub_id = StubGenStubId::large_arrays_hashcode_short_id;
break;
case T_INT:
- mark_name = "_large_arrays_hashcode_int";
+ stub_id = StubGenStubId::large_arrays_hashcode_int_id;
break;
default:
- mark_name = "_large_arrays_hashcode_incorrect_type";
- __ should_not_reach_here();
+ stub_id = StubGenStubId::NO_STUBID;
+ ShouldNotReachHere();
};
- StubCodeMark mark(this, "StubRoutines", mark_name);
+ StubCodeMark mark(this, stub_id);
address entry = __ pc();
__ enter();
@@ -5639,7 +5788,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_dsin_dcos(bool isCos) {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", isCos ? "libmDcos" : "libmDsin");
+ StubGenStubId stub_id = (isCos ? StubGenStubId::dcos_id : StubGenStubId::dsin_id);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ generate_dsin_dcos(isCos, (address)StubRoutines::aarch64::_npio2_hw,
(address)StubRoutines::aarch64::_two_over_pi,
@@ -5690,9 +5840,8 @@ class StubGenerator: public StubCodeGenerator {
// r11 = tmp2
address generate_compare_long_string_different_encoding(bool isLU) {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", isLU
- ? "compare_long_string_different_encoding LU"
- : "compare_long_string_different_encoding UL");
+ StubGenStubId stub_id = (isLU ? StubGenStubId::compare_long_string_LU_id : StubGenStubId::compare_long_string_UL_id);
+ StubCodeMark mark(this, stub_id);
address entry = __ pc();
Label SMALL_LOOP, TAIL, TAIL_LOAD_16, LOAD_LAST, DIFF1, DIFF2,
DONE, CALCULATE_DIFFERENCE, LARGE_LOOP_PREFETCH, NO_PREFETCH,
@@ -5801,7 +5950,8 @@ class StubGenerator: public StubCodeGenerator {
// v1 = temporary float register
address generate_float16ToFloat() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "float16ToFloat");
+ StubGenStubId stub_id = StubGenStubId::hf2f_id;
+ StubCodeMark mark(this, stub_id);
address entry = __ pc();
BLOCK_COMMENT("Entry:");
__ flt16_to_flt(v0, r0, v1);
@@ -5814,7 +5964,8 @@ class StubGenerator: public StubCodeGenerator {
// v1 = temporary float register
address generate_floatToFloat16() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "floatToFloat16");
+ StubGenStubId stub_id = StubGenStubId::f2hf_id;
+ StubCodeMark mark(this, stub_id);
address entry = __ pc();
BLOCK_COMMENT("Entry:");
__ flt_to_flt16(r0, v0, v1);
@@ -5824,7 +5975,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_method_entry_barrier() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "nmethod_entry_barrier");
+ StubGenStubId stub_id = StubGenStubId::method_entry_barrier_id;
+ StubCodeMark mark(this, stub_id);
Label deoptimize_label;
@@ -5889,9 +6041,8 @@ class StubGenerator: public StubCodeGenerator {
// r11 = tmp2
address generate_compare_long_string_same_encoding(bool isLL) {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", isLL
- ? "compare_long_string_same_encoding LL"
- : "compare_long_string_same_encoding UU");
+ StubGenStubId stub_id = (isLL ? StubGenStubId::compare_long_string_LL_id : StubGenStubId::compare_long_string_UU_id);
+ StubCodeMark mark(this, stub_id);
address entry = __ pc();
Register result = r0, str1 = r1, cnt1 = r2, str2 = r3, cnt2 = r4,
tmp1 = r10, tmp2 = r11, tmp1h = rscratch1, tmp2h = rscratch2;
@@ -6021,6 +6172,15 @@ class StubGenerator: public StubCodeGenerator {
// p0 = pgtmp1
// p1 = pgtmp2
address generate_compare_long_string_sve(string_compare_mode mode) {
+ StubGenStubId stub_id;
+ switch (mode) {
+ case LL: stub_id = StubGenStubId::compare_long_string_LL_id; break;
+ case LU: stub_id = StubGenStubId::compare_long_string_LU_id; break;
+ case UL: stub_id = StubGenStubId::compare_long_string_UL_id; break;
+ case UU: stub_id = StubGenStubId::compare_long_string_UU_id; break;
+ default: ShouldNotReachHere();
+ }
+
__ align(CodeEntryAlignment);
address entry = __ pc();
Register result = r0, str1 = r1, cnt1 = r2, str2 = r3, cnt2 = r4,
@@ -6056,16 +6216,7 @@ class StubGenerator: public StubCodeGenerator {
ShouldNotReachHere(); \
}
- const char* stubname;
- switch (mode) {
- case LL: stubname = "compare_long_string_same_encoding LL"; break;
- case LU: stubname = "compare_long_string_different_encoding LU"; break;
- case UL: stubname = "compare_long_string_different_encoding UL"; break;
- case UU: stubname = "compare_long_string_same_encoding UU"; break;
- default: ShouldNotReachHere();
- }
-
- StubCodeMark mark(this, "StubRoutines", stubname);
+ StubCodeMark mark(this, stub_id);
__ mov(idx, 0);
__ sve_whilelt(pgtmp1, mode == LL ? __ B : __ H, idx, cnt);
@@ -6157,11 +6308,22 @@ class StubGenerator: public StubCodeGenerator {
// larger and a bit less readable, however, most of extra operations are
// issued during loads or branches, so, penalty is minimal
address generate_string_indexof_linear(bool str1_isL, bool str2_isL) {
- const char* stubName = str1_isL
- ? (str2_isL ? "indexof_linear_ll" : "indexof_linear_ul")
- : "indexof_linear_uu";
+ StubGenStubId stub_id;
+ if (str1_isL) {
+ if (str2_isL) {
+ stub_id = StubGenStubId::string_indexof_linear_ll_id;
+ } else {
+ stub_id = StubGenStubId::string_indexof_linear_ul_id;
+ }
+ } else {
+ if (str2_isL) {
+ ShouldNotReachHere();
+ } else {
+ stub_id = StubGenStubId::string_indexof_linear_uu_id;
+ }
+ }
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", stubName);
+ StubCodeMark mark(this, stub_id);
address entry = __ pc();
int str1_chr_size = str1_isL ? 1 : 2;
@@ -6459,7 +6621,8 @@ class StubGenerator: public StubCodeGenerator {
// Clobbers: r0, r1, r3, rscratch1, rflags, v0-v6
address generate_large_byte_array_inflate() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "large_byte_array_inflate");
+ StubGenStubId stub_id = StubGenStubId::large_byte_array_inflate_id;
+ StubCodeMark mark(this, stub_id);
address entry = __ pc();
Label LOOP, LOOP_START, LOOP_PRFM, LOOP_PRFM_START, DONE;
Register src = r0, dst = r1, len = r2, octetCounter = r3;
@@ -6524,7 +6687,8 @@ class StubGenerator: public StubCodeGenerator {
// that) and keep the data in little-endian bit order through the
// calculation, bit-reversing the inputs and outputs.
- StubCodeMark mark(this, "StubRoutines", "ghash_processBlocks");
+ StubGenStubId stub_id = StubGenStubId::ghash_processBlocks_id;
+ StubCodeMark mark(this, stub_id);
__ align(wordSize * 2);
address p = __ pc();
__ emit_int64(0x87); // The low-order bits of the field
@@ -6590,7 +6754,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_ghash_processBlocks_wide() {
address small = generate_ghash_processBlocks();
- StubCodeMark mark(this, "StubRoutines", "ghash_processBlocks_wide");
+ StubGenStubId stub_id = StubGenStubId::ghash_processBlocks_wide_id;
+ StubCodeMark mark(this, stub_id);
__ align(wordSize * 2);
address p = __ pc();
__ emit_int64(0x87); // The low-order bits of the field
@@ -6701,7 +6866,8 @@ class StubGenerator: public StubCodeGenerator {
};
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "encodeBlock");
+ StubGenStubId stub_id = StubGenStubId::base64_encodeBlock_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Register src = c_rarg0; // source array
@@ -6969,7 +7135,8 @@ class StubGenerator: public StubCodeGenerator {
};
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "decodeBlock");
+ StubGenStubId stub_id = StubGenStubId::base64_decodeBlock_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Register src = c_rarg0; // source array
@@ -7085,7 +7252,8 @@ class StubGenerator: public StubCodeGenerator {
// Support for spin waits.
address generate_spin_wait() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "spin_wait");
+ StubGenStubId stub_id = StubGenStubId::spin_wait_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ spin_wait();
@@ -7094,10 +7262,10 @@ class StubGenerator: public StubCodeGenerator {
return start;
}
- address generate_lookup_secondary_supers_table_stub(u1 super_klass_index) {
- StubCodeMark mark(this, "StubRoutines", "lookup_secondary_supers_table");
+ void generate_lookup_secondary_supers_table_stub() {
+ StubGenStubId stub_id = StubGenStubId::lookup_secondary_supers_table_id;
+ StubCodeMark mark(this, stub_id);
- address start = __ pc();
const Register
r_super_klass = r0,
r_array_base = r1,
@@ -7109,21 +7277,23 @@ class StubGenerator: public StubCodeGenerator {
const FloatRegister
vtemp = v0;
- Label L_success;
- __ enter();
- __ lookup_secondary_supers_table_const(r_sub_klass, r_super_klass,
- r_array_base, r_array_length, r_array_index,
- vtemp, result, super_klass_index,
- /*stub_is_near*/true);
- __ leave();
- __ ret(lr);
-
- return start;
+ for (int slot = 0; slot < Klass::SECONDARY_SUPERS_TABLE_SIZE; slot++) {
+ StubRoutines::_lookup_secondary_supers_table_stubs[slot] = __ pc();
+ Label L_success;
+ __ enter();
+ __ lookup_secondary_supers_table_const(r_sub_klass, r_super_klass,
+ r_array_base, r_array_length, r_array_index,
+ vtemp, result, slot,
+ /*stub_is_near*/true);
+ __ leave();
+ __ ret(lr);
+ }
}
// Slow path implementation for UseSecondarySupersTable.
address generate_lookup_secondary_supers_table_slow_path_stub() {
- StubCodeMark mark(this, "StubRoutines", "lookup_secondary_supers_table_slow_path");
+ StubGenStubId stub_id = StubGenStubId::lookup_secondary_supers_table_slow_path_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
const Register
@@ -7276,9 +7446,9 @@ class StubGenerator: public StubCodeGenerator {
if (! UseLSE) {
return;
}
-
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "atomic entry points");
+ StubGenStubId stub_id = StubGenStubId::atomic_entry_points_id;
+ StubCodeMark mark(this, stub_id);
address first_entry = __ pc();
// ADD, memory_order_conservative
@@ -7437,7 +7607,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_cont_thaw() {
if (!Continuations::enabled()) return nullptr;
- StubCodeMark mark(this, "StubRoutines", "Cont thaw");
+ StubGenStubId stub_id = StubGenStubId::cont_thaw_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
generate_cont_thaw(Continuation::thaw_top);
return start;
@@ -7447,7 +7618,8 @@ class StubGenerator: public StubCodeGenerator {
if (!Continuations::enabled()) return nullptr;
// TODO: will probably need multiple return barriers depending on return type
- StubCodeMark mark(this, "StubRoutines", "cont return barrier");
+ StubGenStubId stub_id = StubGenStubId::cont_returnBarrier_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
generate_cont_thaw(Continuation::thaw_return_barrier);
@@ -7458,7 +7630,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_cont_returnBarrier_exception() {
if (!Continuations::enabled()) return nullptr;
- StubCodeMark mark(this, "StubRoutines", "cont return barrier exception handler");
+ StubGenStubId stub_id = StubGenStubId::cont_returnBarrierExc_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
generate_cont_thaw(Continuation::thaw_return_barrier_exception);
@@ -7468,7 +7641,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_cont_preempt_stub() {
if (!Continuations::enabled()) return nullptr;
- StubCodeMark mark(this, "StubRoutines","Continuation preempt stub");
+ StubGenStubId stub_id = StubGenStubId::cont_preempt_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ reset_last_Java_frame(true);
@@ -7550,7 +7724,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_poly1305_processBlocks() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "poly1305_processBlocks");
+ StubGenStubId stub_id = StubGenStubId::poly1305_processBlocks_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Label here;
__ enter();
@@ -7664,7 +7839,8 @@ class StubGenerator: public StubCodeGenerator {
// exception handler for upcall stubs
address generate_upcall_stub_exception_handler() {
- StubCodeMark mark(this, "StubRoutines", "upcall stub exception handler");
+ StubGenStubId stub_id = StubGenStubId::upcall_stub_exception_handler_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
// Native caller has no idea how to handle exceptions,
@@ -7681,7 +7857,8 @@ class StubGenerator: public StubCodeGenerator {
// j_rarg0 = jobject receiver
// rmethod = result
address generate_upcall_stub_load_target() {
- StubCodeMark mark(this, "StubRoutines", "upcall_stub_load_target");
+ StubGenStubId stub_id = StubGenStubId::upcall_stub_load_target_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ resolve_global_jobject(j_rarg0, rscratch1, rscratch2);
@@ -8670,9 +8847,8 @@ class StubGenerator: public StubCodeGenerator {
StubRoutines::aarch64::_spin_wait = generate_spin_wait();
- if (UsePoly1305Intrinsics) {
- StubRoutines::_poly1305_processBlocks = generate_poly1305_processBlocks();
- }
+ StubRoutines::_upcall_stub_exception_handler = generate_upcall_stub_exception_handler();
+ StubRoutines::_upcall_stub_load_target = generate_upcall_stub_load_target();
#if defined (LINUX) && !defined (__ARM_FEATURE_ATOMICS)
@@ -8684,17 +8860,11 @@ class StubGenerator: public StubCodeGenerator {
if (UseSecondarySupersTable) {
StubRoutines::_lookup_secondary_supers_table_slow_path_stub = generate_lookup_secondary_supers_table_slow_path_stub();
if (! InlineSecondarySupersTest) {
- for (int slot = 0; slot < Klass::SECONDARY_SUPERS_TABLE_SIZE; slot++) {
- StubRoutines::_lookup_secondary_supers_table_stubs[slot]
- = generate_lookup_secondary_supers_table_stub(slot);
- }
+ generate_lookup_secondary_supers_table_stub();
}
}
#endif
- StubRoutines::_upcall_stub_exception_handler = generate_upcall_stub_exception_handler();
- StubRoutines::_upcall_stub_load_target = generate_upcall_stub_load_target();
-
StubRoutines::aarch64::set_completed(); // Inidicate that arraycopy and zero_blocks stubs are generated
}
@@ -8702,7 +8872,7 @@ class StubGenerator: public StubCodeGenerator {
#if COMPILER2_OR_JVMCI
if (UseSVE == 0) {
- StubRoutines::aarch64::_vector_iota_indices = generate_iota_indices("iota_indices");
+ StubRoutines::aarch64::_vector_iota_indices = generate_iota_indices(StubGenStubId::vector_iota_indices_id);
}
// array equals stub for large arrays.
@@ -8746,13 +8916,15 @@ class StubGenerator: public StubCodeGenerator {
}
if (UseMontgomeryMultiplyIntrinsic) {
- StubCodeMark mark(this, "StubRoutines", "montgomeryMultiply");
+ StubGenStubId stub_id = StubGenStubId::montgomeryMultiply_id;
+ StubCodeMark mark(this, stub_id);
MontgomeryMultiplyGenerator g(_masm, /*squaring*/false);
StubRoutines::_montgomeryMultiply = g.generate_multiply();
}
if (UseMontgomerySquareIntrinsic) {
- StubCodeMark mark(this, "StubRoutines", "montgomerySquare");
+ StubGenStubId stub_id = StubGenStubId::montgomerySquare_id;
+ StubCodeMark mark(this, stub_id);
MontgomeryMultiplyGenerator g(_masm, /*squaring*/true);
// We use generate_multiply() rather than generate_square()
// because it's faster for the sizes of modulus we care about.
@@ -8764,7 +8936,7 @@ class StubGenerator: public StubCodeGenerator {
#endif // COMPILER2
if (UseChaCha20Intrinsics) {
- StubRoutines::_chacha20Block = generate_chacha20Block_blockpar();
+ StubRoutines::_chacha20Block = generate_chacha20Block_qrpar();
}
if (UseBASE64Intrinsics) {
@@ -8792,24 +8964,28 @@ class StubGenerator: public StubCodeGenerator {
}
if (UseMD5Intrinsics) {
- StubRoutines::_md5_implCompress = generate_md5_implCompress(false, "md5_implCompress");
- StubRoutines::_md5_implCompressMB = generate_md5_implCompress(true, "md5_implCompressMB");
+ StubRoutines::_md5_implCompress = generate_md5_implCompress(StubGenStubId::md5_implCompress_id);
+ StubRoutines::_md5_implCompressMB = generate_md5_implCompress(StubGenStubId::md5_implCompressMB_id);
}
if (UseSHA1Intrinsics) {
- StubRoutines::_sha1_implCompress = generate_sha1_implCompress(false, "sha1_implCompress");
- StubRoutines::_sha1_implCompressMB = generate_sha1_implCompress(true, "sha1_implCompressMB");
+ StubRoutines::_sha1_implCompress = generate_sha1_implCompress(StubGenStubId::sha1_implCompress_id);
+ StubRoutines::_sha1_implCompressMB = generate_sha1_implCompress(StubGenStubId::sha1_implCompressMB_id);
}
if (UseSHA256Intrinsics) {
- StubRoutines::_sha256_implCompress = generate_sha256_implCompress(false, "sha256_implCompress");
- StubRoutines::_sha256_implCompressMB = generate_sha256_implCompress(true, "sha256_implCompressMB");
+ StubRoutines::_sha256_implCompress = generate_sha256_implCompress(StubGenStubId::sha256_implCompress_id);
+ StubRoutines::_sha256_implCompressMB = generate_sha256_implCompress(StubGenStubId::sha256_implCompressMB_id);
}
if (UseSHA512Intrinsics) {
- StubRoutines::_sha512_implCompress = generate_sha512_implCompress(false, "sha512_implCompress");
- StubRoutines::_sha512_implCompressMB = generate_sha512_implCompress(true, "sha512_implCompressMB");
+ StubRoutines::_sha512_implCompress = generate_sha512_implCompress(StubGenStubId::sha512_implCompress_id);
+ StubRoutines::_sha512_implCompressMB = generate_sha512_implCompress(StubGenStubId::sha512_implCompressMB_id);
}
if (UseSHA3Intrinsics) {
- StubRoutines::_sha3_implCompress = generate_sha3_implCompress(false, "sha3_implCompress");
- StubRoutines::_sha3_implCompressMB = generate_sha3_implCompress(true, "sha3_implCompressMB");
+ StubRoutines::_sha3_implCompress = generate_sha3_implCompress(StubGenStubId::sha3_implCompress_id);
+ StubRoutines::_sha3_implCompressMB = generate_sha3_implCompress(StubGenStubId::sha3_implCompressMB_id);
+ }
+
+ if (UsePoly1305Intrinsics) {
+ StubRoutines::_poly1305_processBlocks = generate_poly1305_processBlocks();
}
// generate Adler32 intrinsics code
@@ -8821,29 +8997,29 @@ class StubGenerator: public StubCodeGenerator {
}
public:
- StubGenerator(CodeBuffer* code, StubsKind kind) : StubCodeGenerator(code) {
- switch(kind) {
- case Initial_stubs:
+ StubGenerator(CodeBuffer* code, StubGenBlobId blob_id) : StubCodeGenerator(code, blob_id) {
+ switch(blob_id) {
+ case initial_id:
generate_initial_stubs();
break;
- case Continuation_stubs:
+ case continuation_id:
generate_continuation_stubs();
break;
- case Compiler_stubs:
+ case compiler_id:
generate_compiler_stubs();
break;
- case Final_stubs:
+ case final_id:
generate_final_stubs();
break;
default:
- fatal("unexpected stubs kind: %d", kind);
+ fatal("unexpected blob id: %d", blob_id);
break;
};
}
}; // end class declaration
-void StubGenerator_generate(CodeBuffer* code, StubCodeGenerator::StubsKind kind) {
- StubGenerator g(code, kind);
+void StubGenerator_generate(CodeBuffer* code, StubGenBlobId blob_id) {
+ StubGenerator g(code, blob_id);
}
diff --git a/src/hotspot/cpu/aarch64/stubRoutines_aarch64.cpp b/src/hotspot/cpu/aarch64/stubRoutines_aarch64.cpp
index dee615df5a51f..3fa1616bf6586 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,47 +23,28 @@
*
*/
-#include "precompiled.hpp"
#include "runtime/deoptimization.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/javaThread.hpp"
#include "runtime/stubRoutines.hpp"
#include "utilities/globalDefinitions.hpp"
-// Implementation of the platform-specific part of StubRoutines - for
-// a description of how to extend it, see the stubRoutines.hpp file.
+// function used as default for spin_wait stub
-address StubRoutines::aarch64::_get_previous_sp_entry = nullptr;
+static void empty_spin_wait() { }
-address StubRoutines::aarch64::_f2i_fixup = nullptr;
-address StubRoutines::aarch64::_f2l_fixup = nullptr;
-address StubRoutines::aarch64::_d2i_fixup = nullptr;
-address StubRoutines::aarch64::_d2l_fixup = nullptr;
-address StubRoutines::aarch64::_vector_iota_indices = nullptr;
-address StubRoutines::aarch64::_float_sign_mask = nullptr;
-address StubRoutines::aarch64::_float_sign_flip = nullptr;
-address StubRoutines::aarch64::_double_sign_mask = nullptr;
-address StubRoutines::aarch64::_double_sign_flip = nullptr;
-address StubRoutines::aarch64::_zero_blocks = nullptr;
-address StubRoutines::aarch64::_count_positives = nullptr;
-address StubRoutines::aarch64::_count_positives_long = nullptr;
-address StubRoutines::aarch64::_large_array_equals = nullptr;
-address StubRoutines::aarch64::_large_arrays_hashcode_boolean = nullptr;
-address StubRoutines::aarch64::_large_arrays_hashcode_byte = nullptr;
-address StubRoutines::aarch64::_large_arrays_hashcode_char = nullptr;
-address StubRoutines::aarch64::_large_arrays_hashcode_int = nullptr;
-address StubRoutines::aarch64::_large_arrays_hashcode_short = nullptr;
-address StubRoutines::aarch64::_compare_long_string_LL = nullptr;
-address StubRoutines::aarch64::_compare_long_string_UU = nullptr;
-address StubRoutines::aarch64::_compare_long_string_LU = nullptr;
-address StubRoutines::aarch64::_compare_long_string_UL = nullptr;
-address StubRoutines::aarch64::_string_indexof_linear_ll = nullptr;
-address StubRoutines::aarch64::_string_indexof_linear_uu = nullptr;
-address StubRoutines::aarch64::_string_indexof_linear_ul = nullptr;
-address StubRoutines::aarch64::_large_byte_array_inflate = nullptr;
+// define fields for arch-specific entries
-static void empty_spin_wait() { }
-address StubRoutines::aarch64::_spin_wait = CAST_FROM_FN_PTR(address, empty_spin_wait);
+#define DEFINE_ARCH_ENTRY(arch, blob_name, stub_name, field_name, getter_name) \
+ address StubRoutines:: arch :: STUB_FIELD_NAME(field_name) = nullptr;
+
+#define DEFINE_ARCH_ENTRY_INIT(arch, blob_name, stub_name, field_name, getter_name, init_function) \
+ address StubRoutines:: arch :: STUB_FIELD_NAME(field_name) = CAST_FROM_FN_PTR(address, init_function);
+
+STUBGEN_ARCH_ENTRIES_DO(DEFINE_ARCH_ENTRY, DEFINE_ARCH_ENTRY_INIT)
+
+#undef DEFINE_ARCH_ENTRY_INIT
+#undef DEFINE_ARCH_ENTRY
bool StubRoutines::aarch64::_completed = false;
diff --git a/src/hotspot/cpu/aarch64/stubRoutines_aarch64.hpp b/src/hotspot/cpu/aarch64/stubRoutines_aarch64.hpp
index 7d3b72a88363d..a5ed87cdca454 100644
--- a/src/hotspot/cpu/aarch64/stubRoutines_aarch64.hpp
+++ b/src/hotspot/cpu/aarch64/stubRoutines_aarch64.hpp
@@ -34,134 +34,66 @@ static bool returns_to_call_stub(address return_pc) {
return return_pc == _call_stub_return_address;
}
+// emit enum used to size per-blob code buffers
+
+#define DEFINE_BLOB_SIZE(blob_name, size) \
+ _ ## blob_name ## _code_size = size,
+
enum platform_dependent_constants {
- // simply increase sizes if too small (assembler will crash if too small)
- _initial_stubs_code_size = 10000,
- _continuation_stubs_code_size = 2000,
- _compiler_stubs_code_size = 30000 ZGC_ONLY(+10000),
- _final_stubs_code_size = 20000 ZGC_ONLY(+100000)
+ STUBGEN_ARCH_BLOBS_DO(DEFINE_BLOB_SIZE)
};
+#undef DEFINE_BLOB_SIZE
+
class aarch64 {
friend class StubGenerator;
+#if INCLUDE_JVMCI
+ friend class JVMCIVMStructs;
+#endif
- private:
- static address _get_previous_sp_entry;
-
- static address _f2i_fixup;
- static address _f2l_fixup;
- static address _d2i_fixup;
- static address _d2l_fixup;
-
- static address _vector_iota_indices;
- static address _float_sign_mask;
- static address _float_sign_flip;
- static address _double_sign_mask;
- static address _double_sign_flip;
-
- static address _zero_blocks;
-
- static address _large_array_equals;
- static address _large_arrays_hashcode_boolean;
- static address _large_arrays_hashcode_byte;
- static address _large_arrays_hashcode_char;
- static address _large_arrays_hashcode_int;
- static address _large_arrays_hashcode_short;
- static address _compare_long_string_LL;
- static address _compare_long_string_LU;
- static address _compare_long_string_UL;
- static address _compare_long_string_UU;
- static address _string_indexof_linear_ll;
- static address _string_indexof_linear_uu;
- static address _string_indexof_linear_ul;
- static address _large_byte_array_inflate;
-
- static address _spin_wait;
-
- static bool _completed;
-
- public:
-
- static address _count_positives;
- static address _count_positives_long;
-
- static address get_previous_sp_entry()
- {
- return _get_previous_sp_entry;
- }
+ // declare fields for arch-specific entries
- static address f2i_fixup()
- {
- return _f2i_fixup;
- }
+#define DECLARE_ARCH_ENTRY(arch, blob_name, stub_name, field_name, getter_name) \
+ static address STUB_FIELD_NAME(field_name) ;
- static address f2l_fixup()
- {
- return _f2l_fixup;
- }
+#define DECLARE_ARCH_ENTRY_INIT(arch, blob_name, stub_name, field_name, getter_name, init_function) \
+ DECLARE_ARCH_ENTRY(arch, blob_name, stub_name, field_name, getter_name)
- static address d2i_fixup()
- {
- return _d2i_fixup;
- }
-
- static address d2l_fixup()
- {
- return _d2l_fixup;
- }
+private:
+ STUBGEN_ARCH_ENTRIES_DO(DECLARE_ARCH_ENTRY, DECLARE_ARCH_ENTRY_INIT)
- static address vector_iota_indices() {
- return _vector_iota_indices;
- }
+#undef DECLARE_ARCH_ENTRY_INIT
+#undef DECLARE_ARCH_ENTRY
- static address float_sign_mask()
- {
- return _float_sign_mask;
- }
-
- static address float_sign_flip()
- {
- return _float_sign_flip;
- }
+ static bool _completed;
- static address double_sign_mask()
- {
- return _double_sign_mask;
- }
+ public:
- static address double_sign_flip()
- {
- return _double_sign_flip;
- }
+ // declare getters for arch-specific entries
- static address zero_blocks() {
- return _zero_blocks;
- }
+#define DEFINE_ARCH_ENTRY_GETTER(arch, blob_name, stub_name, field_name, getter_name) \
+ static address getter_name() { return STUB_FIELD_NAME(field_name) ; }
- static address count_positives() {
- return _count_positives;
- }
+#define DEFINE_ARCH_ENTRY_GETTER_INIT(arch, blob_name, stub_name, field_name, getter_name, init_function) \
+ DEFINE_ARCH_ENTRY_GETTER(arch, blob_name, stub_name, field_name, getter_name)
- static address count_positives_long() {
- return _count_positives_long;
- }
+ STUBGEN_ARCH_ENTRIES_DO(DEFINE_ARCH_ENTRY_GETTER, DEFINE_ARCH_ENTRY_GETTER_INIT)
- static address large_array_equals() {
- return _large_array_equals;
- }
+#undef DEFINE_ARCH_ENTRY_GETTER_INIT
+#undef DEFINE_ARCH_ENTRY_GETTER
static address large_arrays_hashcode(BasicType eltype) {
switch (eltype) {
case T_BOOLEAN:
- return _large_arrays_hashcode_boolean;
+ return large_arrays_hashcode_boolean();
case T_BYTE:
- return _large_arrays_hashcode_byte;
+ return large_arrays_hashcode_byte();
case T_CHAR:
- return _large_arrays_hashcode_char;
+ return large_arrays_hashcode_char();
case T_SHORT:
- return _large_arrays_hashcode_short;
+ return large_arrays_hashcode_short();
case T_INT:
- return _large_arrays_hashcode_int;
+ return large_arrays_hashcode_int();
default:
ShouldNotReachHere();
}
@@ -169,42 +101,6 @@ class aarch64 {
return nullptr;
}
- static address compare_long_string_LL() {
- return _compare_long_string_LL;
- }
-
- static address compare_long_string_LU() {
- return _compare_long_string_LU;
- }
-
- static address compare_long_string_UL() {
- return _compare_long_string_UL;
- }
-
- static address compare_long_string_UU() {
- return _compare_long_string_UU;
- }
-
- static address string_indexof_linear_ul() {
- return _string_indexof_linear_ul;
- }
-
- static address string_indexof_linear_ll() {
- return _string_indexof_linear_ll;
- }
-
- static address string_indexof_linear_uu() {
- return _string_indexof_linear_uu;
- }
-
- static address large_byte_array_inflate() {
- return _large_byte_array_inflate;
- }
-
- static address spin_wait() {
- return _spin_wait;
- }
-
static bool complete() {
return _completed;
}
diff --git a/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp b/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp
index f70450b722223..fbe06a6d78138 100644
--- a/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp
+++ b/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "classfile/javaClasses.hpp"
#include "compiler/disassembler.hpp"
@@ -809,7 +808,7 @@ void TemplateInterpreterGenerator::lock_method() {
#ifdef ASSERT
{
Label L;
- __ ldrw(r0, access_flags);
+ __ ldrh(r0, access_flags);
__ tst(r0, JVM_ACC_SYNCHRONIZED);
__ br(Assembler::NE, L);
__ stop("method doesn't need synchronization");
@@ -820,7 +819,7 @@ void TemplateInterpreterGenerator::lock_method() {
// get synchronization object
{
Label done;
- __ ldrw(r0, access_flags);
+ __ ldrh(r0, access_flags);
__ tst(r0, JVM_ACC_STATIC);
// get receiver (assume this is frequent case)
__ ldr(r0, Address(rlocals, Interpreter::local_offset_in_bytes(0)));
@@ -1225,7 +1224,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
// make sure method is native & not abstract
#ifdef ASSERT
- __ ldrw(r0, access_flags);
+ __ ldrh(r0, access_flags);
{
Label L;
__ tst(r0, JVM_ACC_NATIVE);
@@ -1277,7 +1276,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
#ifdef ASSERT
{
Label L;
- __ ldrw(r0, access_flags);
+ __ ldrh(r0, access_flags);
__ tst(r0, JVM_ACC_SYNCHRONIZED);
__ br(Assembler::EQ, L);
__ stop("method needs synchronization");
@@ -1354,7 +1353,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
// pass mirror handle if static call
{
Label L;
- __ ldrw(t, Address(rmethod, Method::access_flags_offset()));
+ __ ldrh(t, Address(rmethod, Method::access_flags_offset()));
__ tbz(t, exact_log2(JVM_ACC_STATIC), L);
// get mirror
__ load_mirror(t, rmethod, r10, rscratch2);
@@ -1564,7 +1563,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
// do unlocking if necessary
{
Label L;
- __ ldrw(t, Address(rmethod, Method::access_flags_offset()));
+ __ ldrh(t, Address(rmethod, Method::access_flags_offset()));
__ tbz(t, exact_log2(JVM_ACC_SYNCHRONIZED), L);
// the code below should be shared with interpreter macro
// assembler implementation
@@ -1695,7 +1694,7 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) {
// make sure method is not native & not abstract
#ifdef ASSERT
- __ ldrw(r0, access_flags);
+ __ ldrh(r0, access_flags);
{
Label L;
__ tst(r0, JVM_ACC_NATIVE);
@@ -1751,7 +1750,7 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) {
#ifdef ASSERT
{
Label L;
- __ ldrw(r0, access_flags);
+ __ ldrh(r0, access_flags);
__ tst(r0, JVM_ACC_SYNCHRONIZED);
__ br(Assembler::EQ, L);
__ stop("method needs synchronization");
diff --git a/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp b/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp
index 60d4c3c511009..e50810486c80d 100644
--- a/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp
+++ b/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "compiler/disassembler.hpp"
#include "compiler/compilerDefinitions.inline.hpp"
diff --git a/src/hotspot/cpu/aarch64/upcallLinker_aarch64.cpp b/src/hotspot/cpu/aarch64/upcallLinker_aarch64.cpp
index a2925f00b053f..ac597bea07d5c 100644
--- a/src/hotspot/cpu/aarch64/upcallLinker_aarch64.cpp
+++ b/src/hotspot/cpu/aarch64/upcallLinker_aarch64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2022, Arm Limited. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -22,7 +22,6 @@
* questions.
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.hpp"
#include "classfile/javaClasses.hpp"
#include "logging/logStream.hpp"
diff --git a/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp b/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp
index 87c7862e2503d..874f8a380ae48 100644
--- a/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp
+++ b/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2020, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "pauth_aarch64.hpp"
#include "register_aarch64.hpp"
#include "runtime/arguments.hpp"
@@ -158,6 +157,10 @@ void VM_Version::initialize() {
if (FLAG_IS_DEFAULT(OnSpinWaitInstCount)) {
FLAG_SET_DEFAULT(OnSpinWaitInstCount, 2);
}
+ if (FLAG_IS_DEFAULT(CodeEntryAlignment) &&
+ (_model == CPU_MODEL_AMPERE_1A || _model == CPU_MODEL_AMPERE_1B)) {
+ FLAG_SET_DEFAULT(CodeEntryAlignment, 32);
+ }
}
// ThunderX
diff --git a/src/hotspot/cpu/aarch64/vmreg_aarch64.cpp b/src/hotspot/cpu/aarch64/vmreg_aarch64.cpp
index 49adb39834005..47ca0b30708b9 100644
--- a/src/hotspot/cpu/aarch64/vmreg_aarch64.cpp
+++ b/src/hotspot/cpu/aarch64/vmreg_aarch64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/assembler.hpp"
#include "code/vmreg.hpp"
#include "vmreg_aarch64.inline.hpp"
diff --git a/src/hotspot/cpu/aarch64/vtableStubs_aarch64.cpp b/src/hotspot/cpu/aarch64/vtableStubs_aarch64.cpp
index 56da06433e0b8..11ea02621d765 100644
--- a/src/hotspot/cpu/aarch64/vtableStubs_aarch64.cpp
+++ b/src/hotspot/cpu/aarch64/vtableStubs_aarch64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/assembler.inline.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "code/compiledIC.hpp"
diff --git a/src/hotspot/cpu/arm/abstractInterpreter_arm.cpp b/src/hotspot/cpu/arm/abstractInterpreter_arm.cpp
index 53e557fad86c8..075db4736f132 100644
--- a/src/hotspot/cpu/arm/abstractInterpreter_arm.cpp
+++ b/src/hotspot/cpu/arm/abstractInterpreter_arm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/assembler.hpp"
#include "interpreter/bytecode.hpp"
#include "interpreter/interpreter.hpp"
diff --git a/src/hotspot/cpu/arm/arm.ad b/src/hotspot/cpu/arm/arm.ad
index a3db5c0619ced..617745dee20ab 100644
--- a/src/hotspot/cpu/arm/arm.ad
+++ b/src/hotspot/cpu/arm/arm.ad
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
+// Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
//
// This code is free software; you can redistribute it and/or modify it
@@ -283,7 +283,7 @@ void MachPrologNode::format( PhaseRegAlloc *ra_, outputStream *st ) const {
}
st->print_cr("PUSH R_FP|R_LR_LR"); st->print("\t");
if (framesize != 0) {
- st->print ("SUB R_SP, R_SP, " SIZE_FORMAT,framesize);
+ st->print ("SUB R_SP, R_SP, %zu", framesize);
}
if (C->stub_function() == nullptr && BarrierSet::barrier_set()->barrier_set_nmethod() != nullptr) {
@@ -362,7 +362,7 @@ void MachEpilogNode::format( PhaseRegAlloc *ra_, outputStream *st ) const {
framesize -= 2*wordSize;
if (framesize != 0) {
- st->print("ADD R_SP, R_SP, " SIZE_FORMAT "\n\t",framesize);
+ st->print("ADD R_SP, R_SP, %zu\n\t",framesize);
}
st->print("POP R_FP|R_LR_LR");
diff --git a/src/hotspot/cpu/arm/assembler_arm.cpp b/src/hotspot/cpu/arm/assembler_arm.cpp
index ec34912ad5113..246c25c6575c1 100644
--- a/src/hotspot/cpu/arm/assembler_arm.cpp
+++ b/src/hotspot/cpu/arm/assembler_arm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/assembler.hpp"
#include "asm/assembler.inline.hpp"
#include "ci/ciEnv.hpp"
diff --git a/src/hotspot/cpu/arm/assembler_arm_32.cpp b/src/hotspot/cpu/arm/assembler_arm_32.cpp
index b140bce707633..36a0ae6ebacaa 100644
--- a/src/hotspot/cpu/arm/assembler_arm_32.cpp
+++ b/src/hotspot/cpu/arm/assembler_arm_32.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/assembler.hpp"
#include "asm/assembler.inline.hpp"
#include "ci/ciEnv.hpp"
diff --git a/src/hotspot/cpu/arm/c1_CodeStubs_arm.cpp b/src/hotspot/cpu/arm/c1_CodeStubs_arm.cpp
index 8e85fa88a8749..bca6c7ca30cb8 100644
--- a/src/hotspot/cpu/arm/c1_CodeStubs_arm.cpp
+++ b/src/hotspot/cpu/arm/c1_CodeStubs_arm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "c1/c1_CodeStubs.hpp"
#include "c1/c1_FrameMap.hpp"
diff --git a/src/hotspot/cpu/arm/c1_FrameMap_arm.cpp b/src/hotspot/cpu/arm/c1_FrameMap_arm.cpp
index 7eb4009be1136..0fd113c8ceb1b 100644
--- a/src/hotspot/cpu/arm/c1_FrameMap_arm.cpp
+++ b/src/hotspot/cpu/arm/c1_FrameMap_arm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "c1/c1_FrameMap.hpp"
#include "c1/c1_LIR.hpp"
#include "runtime/sharedRuntime.hpp"
diff --git a/src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp b/src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp
index b14e6f0b4ca0c..14a51bf4b1352 100644
--- a/src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp
+++ b/src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "c1/c1_Compilation.hpp"
#include "c1/c1_LIRAssembler.hpp"
diff --git a/src/hotspot/cpu/arm/c1_LIRGenerator_arm.cpp b/src/hotspot/cpu/arm/c1_LIRGenerator_arm.cpp
index a70bf2cbda953..ef5691f84a32c 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"
@@ -1126,6 +1125,11 @@ void LIRGenerator::do_InstanceOf(InstanceOf* x) {
x->direct_compare(), patching_info, x->profiled_method(), x->profiled_bci());
}
+// Intrinsic for Class::isInstance
+address LIRGenerator::isInstance_entry() {
+ return CAST_FROM_FN_PTR(address, Runtime1::is_instance_of);
+}
+
#ifdef __SOFTFP__
// Turn operator if (f g) into runtime call:
diff --git a/src/hotspot/cpu/arm/c1_LIR_arm.cpp b/src/hotspot/cpu/arm/c1_LIR_arm.cpp
index 9d70fd12f3558..b8d693093483b 100644
--- a/src/hotspot/cpu/arm/c1_LIR_arm.cpp
+++ b/src/hotspot/cpu/arm/c1_LIR_arm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "c1/c1_LIR.hpp"
FloatRegister LIR_Opr::as_float_reg() const {
diff --git a/src/hotspot/cpu/arm/c1_LinearScan_arm.cpp b/src/hotspot/cpu/arm/c1_LinearScan_arm.cpp
index 21030b9a23f95..f1d6c6a0ff94f 100644
--- a/src/hotspot/cpu/arm/c1_LinearScan_arm.cpp
+++ b/src/hotspot/cpu/arm/c1_LinearScan_arm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "c1/c1_Instruction.hpp"
#include "c1/c1_LinearScan.hpp"
#include "utilities/bitMap.inline.hpp"
diff --git a/src/hotspot/cpu/arm/c1_MacroAssembler_arm.cpp b/src/hotspot/cpu/arm/c1_MacroAssembler_arm.cpp
index 70542d278acf7..195607d5c9119 100644
--- a/src/hotspot/cpu/arm/c1_MacroAssembler_arm.cpp
+++ b/src/hotspot/cpu/arm/c1_MacroAssembler_arm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "c1/c1_MacroAssembler.hpp"
#include "c1/c1_Runtime1.hpp"
#include "gc/shared/barrierSet.hpp"
diff --git a/src/hotspot/cpu/arm/c1_Runtime1_arm.cpp b/src/hotspot/cpu/arm/c1_Runtime1_arm.cpp
index bae882ea93d93..949e985ab1eea 100644
--- a/src/hotspot/cpu/arm/c1_Runtime1_arm.cpp
+++ b/src/hotspot/cpu/arm/c1_Runtime1_arm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "c1/c1_Defs.hpp"
#include "c1/c1_LIRAssembler.hpp"
diff --git a/src/hotspot/cpu/arm/c2_MacroAssembler_arm.cpp b/src/hotspot/cpu/arm/c2_MacroAssembler_arm.cpp
index 900bd33fd9d46..89be6d288ffeb 100644
--- a/src/hotspot/cpu/arm/c2_MacroAssembler_arm.cpp
+++ b/src/hotspot/cpu/arm/c2_MacroAssembler_arm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/assembler.hpp"
#include "asm/assembler.inline.hpp"
#include "opto/c2_MacroAssembler.hpp"
diff --git a/src/hotspot/cpu/arm/compiledIC_arm.cpp b/src/hotspot/cpu/arm/compiledIC_arm.cpp
index 2556a79126a6d..86927cd24ab9e 100644
--- a/src/hotspot/cpu/arm/compiledIC_arm.cpp
+++ b/src/hotspot/cpu/arm/compiledIC_arm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "code/compiledIC.hpp"
#include "code/nativeInst.hpp"
diff --git a/src/hotspot/cpu/arm/downcallLinker_arm.cpp b/src/hotspot/cpu/arm/downcallLinker_arm.cpp
index eb15424eb38cf..e0d32dbe154e0 100644
--- a/src/hotspot/cpu/arm/downcallLinker_arm.cpp
+++ b/src/hotspot/cpu/arm/downcallLinker_arm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, Red Hat, Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -22,7 +22,6 @@
* questions.
*/
-#include "precompiled.hpp"
#include "prims/downcallLinker.hpp"
#include "utilities/debug.hpp"
diff --git a/src/hotspot/cpu/arm/foreignGlobals_arm.cpp b/src/hotspot/cpu/arm/foreignGlobals_arm.cpp
index 5f5a4eb32e0c7..677440e380235 100644
--- a/src/hotspot/cpu/arm/foreignGlobals_arm.cpp
+++ b/src/hotspot/cpu/arm/foreignGlobals_arm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, Red Hat, Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -22,7 +22,6 @@
* questions.
*/
-#include "precompiled.hpp"
#include "code/vmreg.hpp"
#include "prims/foreignGlobals.hpp"
#include "utilities/debug.hpp"
diff --git a/src/hotspot/cpu/arm/frame_arm.cpp b/src/hotspot/cpu/arm/frame_arm.cpp
index 13a5c471c6fea..2722f93edec55 100644
--- a/src/hotspot/cpu/arm/frame_arm.cpp
+++ b/src/hotspot/cpu/arm/frame_arm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "compiler/oopMap.hpp"
#include "interpreter/interpreter.hpp"
#include "memory/resourceArea.hpp"
diff --git a/src/hotspot/cpu/arm/gc/g1/g1BarrierSetAssembler_arm.cpp b/src/hotspot/cpu/arm/gc/g1/g1BarrierSetAssembler_arm.cpp
index 17ac726ada774..466dcc8fe66c1 100644
--- a/src/hotspot/cpu/arm/gc/g1/g1BarrierSetAssembler_arm.cpp
+++ b/src/hotspot/cpu/arm/gc/g1/g1BarrierSetAssembler_arm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "gc/g1/g1BarrierSet.hpp"
#include "gc/g1/g1BarrierSetAssembler.hpp"
diff --git a/src/hotspot/cpu/arm/gc/shared/barrierSetAssembler_arm.cpp b/src/hotspot/cpu/arm/gc/shared/barrierSetAssembler_arm.cpp
index 521c766bcd072..704ca71ce990d 100644
--- a/src/hotspot/cpu/arm/gc/shared/barrierSetAssembler_arm.cpp
+++ b/src/hotspot/cpu/arm/gc/shared/barrierSetAssembler_arm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "gc/shared/barrierSet.hpp"
#include "gc/shared/barrierSetAssembler.hpp"
#include "gc/shared/barrierSetNMethod.hpp"
diff --git a/src/hotspot/cpu/arm/gc/shared/barrierSetNMethod_arm.cpp b/src/hotspot/cpu/arm/gc/shared/barrierSetNMethod_arm.cpp
index ed15cc5ebcfe7..224a499ff5420 100644
--- a/src/hotspot/cpu/arm/gc/shared/barrierSetNMethod_arm.cpp
+++ b/src/hotspot/cpu/arm/gc/shared/barrierSetNMethod_arm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "code/nativeInst.hpp"
#include "gc/shared/barrierSetAssembler.hpp"
#include "gc/shared/barrierSetNMethod.hpp"
diff --git a/src/hotspot/cpu/arm/gc/shared/cardTableBarrierSetAssembler_arm.cpp b/src/hotspot/cpu/arm/gc/shared/cardTableBarrierSetAssembler_arm.cpp
index 11b2ca2ef1d8c..91d3b8e9e5cee 100644
--- a/src/hotspot/cpu/arm/gc/shared/cardTableBarrierSetAssembler_arm.cpp
+++ b/src/hotspot/cpu/arm/gc/shared/cardTableBarrierSetAssembler_arm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "gc/shared/barrierSet.hpp"
#include "gc/shared/cardTable.hpp"
diff --git a/src/hotspot/cpu/arm/gc/shared/modRefBarrierSetAssembler_arm.cpp b/src/hotspot/cpu/arm/gc/shared/modRefBarrierSetAssembler_arm.cpp
index 73208cec4e8fe..cb4058d48edb9 100644
--- a/src/hotspot/cpu/arm/gc/shared/modRefBarrierSetAssembler_arm.cpp
+++ b/src/hotspot/cpu/arm/gc/shared/modRefBarrierSetAssembler_arm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "gc/shared/modRefBarrierSetAssembler.hpp"
diff --git a/src/hotspot/cpu/arm/icache_arm.cpp b/src/hotspot/cpu/arm/icache_arm.cpp
index 61fcb8a358048..53e9824756a2e 100644
--- a/src/hotspot/cpu/arm/icache_arm.cpp
+++ b/src/hotspot/cpu/arm/icache_arm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/assembler.inline.hpp"
#include "asm/macroAssembler.hpp"
#include "runtime/icache.hpp"
diff --git a/src/hotspot/cpu/arm/interp_masm_arm.cpp b/src/hotspot/cpu/arm/interp_masm_arm.cpp
index 3a81fdddb3c32..e9e6187a6d181 100644
--- a/src/hotspot/cpu/arm/interp_masm_arm.cpp
+++ b/src/hotspot/cpu/arm/interp_masm_arm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "gc/shared/barrierSet.hpp"
#include "gc/shared/cardTable.hpp"
@@ -736,7 +735,7 @@ void InterpreterMacroAssembler::remove_activation(TosState state, Register ret_a
ldrb(Rflag, do_not_unlock_if_synchronized);
// get method access flags
- ldr_u32(Raccess_flags, Address(Rmethod, Method::access_flags_offset()));
+ ldrh(Raccess_flags, Address(Rmethod, Method::access_flags_offset()));
strb(zero_register(Rtemp), do_not_unlock_if_synchronized); // reset the flag
diff --git a/src/hotspot/cpu/arm/interpreterRT_arm.cpp b/src/hotspot/cpu/arm/interpreterRT_arm.cpp
index c8996bc266ca3..20dcbcdd8be0e 100644
--- a/src/hotspot/cpu/arm/interpreterRT_arm.cpp
+++ b/src/hotspot/cpu/arm/interpreterRT_arm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "interpreter/interp_masm.hpp"
#include "interpreter/interpreter.hpp"
diff --git a/src/hotspot/cpu/arm/jniFastGetField_arm.cpp b/src/hotspot/cpu/arm/jniFastGetField_arm.cpp
index 2a7e16578fffa..3a5dd10e82eba 100644
--- a/src/hotspot/cpu/arm/jniFastGetField_arm.cpp
+++ b/src/hotspot/cpu/arm/jniFastGetField_arm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/assembler.inline.hpp"
#include "asm/macroAssembler.hpp"
#include "code/codeBlob.hpp"
diff --git a/src/hotspot/cpu/arm/macroAssembler_arm.cpp b/src/hotspot/cpu/arm/macroAssembler_arm.cpp
index 8e7b323e535f1..638b3a5404c25 100644
--- a/src/hotspot/cpu/arm/macroAssembler_arm.cpp
+++ b/src/hotspot/cpu/arm/macroAssembler_arm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/assembler.hpp"
#include "asm/assembler.inline.hpp"
#include "asm/macroAssembler.hpp"
diff --git a/src/hotspot/cpu/arm/methodHandles_arm.cpp b/src/hotspot/cpu/arm/methodHandles_arm.cpp
index f59e01112e904..3710fa33f365e 100644
--- a/src/hotspot/cpu/arm/methodHandles_arm.cpp
+++ b/src/hotspot/cpu/arm/methodHandles_arm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,6 @@
// cross platform development for JSR292.
// Last synchronization: changeset f8c9417e3571
-#include "precompiled.hpp"
#include "classfile/javaClasses.inline.hpp"
#include "classfile/vmClasses.hpp"
#include "interpreter/interpreter.hpp"
@@ -497,7 +496,7 @@ void trace_method_handle_stub(const char* adaptername,
if (!has_mh) {
mh_reg_name = "R5";
}
- log_info(methodhandles)("MH %s %s=" PTR_FORMAT " sp=(" PTR_FORMAT "+" INTX_FORMAT ") stack_size=" INTX_FORMAT " bp=" PTR_FORMAT,
+ log_info(methodhandles)("MH %s %s=" PTR_FORMAT " sp=(" PTR_FORMAT "+%zd) stack_size=%zd bp=" PTR_FORMAT,
adaptername, mh_reg_name, mh_reg,
(intptr_t)entry_sp, (intptr_t)saved_sp - (intptr_t)entry_sp, (intptr_t)(base_sp - last_sp), (intptr_t)saved_bp);
diff --git a/src/hotspot/cpu/arm/nativeInst_arm_32.cpp b/src/hotspot/cpu/arm/nativeInst_arm_32.cpp
index 6a4062f29b3ba..2caf2d7587e53 100644
--- a/src/hotspot/cpu/arm/nativeInst_arm_32.cpp
+++ b/src/hotspot/cpu/arm/nativeInst_arm_32.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/assembler.inline.hpp"
#include "code/codeCache.hpp"
#include "memory/resourceArea.hpp"
diff --git a/src/hotspot/cpu/arm/register_arm.cpp b/src/hotspot/cpu/arm/register_arm.cpp
index a0ae9ff4f92a9..ea3ef87e6708f 100644
--- a/src/hotspot/cpu/arm/register_arm.cpp
+++ b/src/hotspot/cpu/arm/register_arm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "register_arm.hpp"
#include "utilities/debug.hpp"
diff --git a/src/hotspot/cpu/arm/relocInfo_arm.cpp b/src/hotspot/cpu/arm/relocInfo_arm.cpp
index fb112cdcfc0fa..2006be978bcdf 100644
--- a/src/hotspot/cpu/arm/relocInfo_arm.cpp
+++ b/src/hotspot/cpu/arm/relocInfo_arm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/assembler.inline.hpp"
#include "code/relocInfo.hpp"
#include "nativeInst_arm.hpp"
diff --git a/src/hotspot/cpu/arm/runtime_arm.cpp b/src/hotspot/cpu/arm/runtime_arm.cpp
index cd76843d6dfef..cf4b398cf1fb9 100644
--- a/src/hotspot/cpu/arm/runtime_arm.cpp
+++ b/src/hotspot/cpu/arm/runtime_arm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#ifdef COMPILER2
#include "asm/assembler.inline.hpp"
#include "code/vmreg.hpp"
diff --git a/src/hotspot/cpu/arm/sharedRuntime_arm.cpp b/src/hotspot/cpu/arm/sharedRuntime_arm.cpp
index 82e16836acb57..c63d72920a5b6 100644
--- a/src/hotspot/cpu/arm/sharedRuntime_arm.cpp
+++ b/src/hotspot/cpu/arm/sharedRuntime_arm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/assembler.inline.hpp"
#include "code/compiledIC.hpp"
#include "code/debugInfoRec.hpp"
diff --git a/src/hotspot/cpu/arm/stubDeclarations_arm.hpp b/src/hotspot/cpu/arm/stubDeclarations_arm.hpp
new file mode 100644
index 0000000000000..35df4b924d276
--- /dev/null
+++ b/src/hotspot/cpu/arm/stubDeclarations_arm.hpp
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2025, Red Hat, Inc. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef CPU_ARM_STUBDECLARATIONS_HPP
+#define CPU_ARM_STUBDECLARATIONS_HPP
+
+#define STUBGEN_INITIAL_BLOBS_ARCH_DO(do_stub, \
+ do_arch_blob, \
+ do_arch_entry, \
+ do_arch_entry_init) \
+ do_arch_blob(initial, 9000) \
+ do_stub(initial, idiv_irem) \
+ do_arch_entry(Arm, initial, idiv_irem, \
+ idiv_irem_entry, idiv_irem_entry) \
+ do_stub(initial, atomic_load_long) \
+ do_arch_entry(Arm, initial, atomic_load_long, \
+ atomic_load_long_entry, atomic_load_long_entry) \
+ do_stub(initial, atomic_store_long) \
+ do_arch_entry(Arm, initial, atomic_load_long, \
+ atomic_store_long_entry, atomic_store_long_entry) \
+
+#define STUBGEN_CONTINUATION_BLOBS_ARCH_DO(do_stub, \
+ do_arch_blob, \
+ do_arch_entry, \
+ do_arch_entry_init) \
+ do_arch_blob(continuation, 2000) \
+
+
+#define STUBGEN_COMPILER_BLOBS_ARCH_DO(do_stub, \
+ do_arch_blob, \
+ do_arch_entry, \
+ do_arch_entry_init) \
+ do_arch_blob(compiler, 22000) \
+ do_stub(compiler, partial_subtype_check) \
+ do_arch_entry(Arm, compiler, partial_subtype_check, \
+ partial_subtype_check, partial_subtype_check) \
+
+
+#define STUBGEN_FINAL_BLOBS_ARCH_DO(do_stub, \
+ do_arch_blob, \
+ do_arch_entry, \
+ do_arch_entry_init) \
+ do_arch_blob(final, 22000) \
+
+
+#endif // CPU_ARM_STUBDECLARATIONS_HPP
diff --git a/src/hotspot/cpu/arm/stubGenerator_arm.cpp b/src/hotspot/cpu/arm/stubGenerator_arm.cpp
index 9b91e02cf07f2..aad81e7891d46 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"
@@ -173,7 +172,8 @@ class StubGenerator: public StubCodeGenerator {
private:
address generate_call_stub(address& return_address) {
- StubCodeMark mark(this, "StubRoutines", "call_stub");
+ StubGenStubId stub_id = StubGenStubId::call_stub_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
@@ -252,7 +252,8 @@ class StubGenerator: public StubCodeGenerator {
// (in) Rexception_obj: exception oop
address generate_catch_exception() {
- StubCodeMark mark(this, "StubRoutines", "catch_exception");
+ StubGenStubId stub_id = StubGenStubId::catch_exception_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ str(Rexception_obj, Address(Rthread, Thread::pending_exception_offset()));
@@ -264,7 +265,8 @@ class StubGenerator: public StubCodeGenerator {
// (in) Rexception_pc: return address
address generate_forward_exception() {
- StubCodeMark mark(this, "StubRoutines", "forward exception");
+ StubGenStubId stub_id = StubGenStubId::forward_exception_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ mov(c_rarg0, Rthread);
@@ -313,6 +315,8 @@ class StubGenerator: public StubCodeGenerator {
Register tmp = LR;
assert(dividend == remainder, "must be");
+ StubGenStubId stub_id = StubGenStubId::idiv_irem_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
// Check for special cases: divisor <= 0 or dividend < 0
@@ -454,7 +458,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_atomic_add() {
address start;
- StubCodeMark mark(this, "StubRoutines", "atomic_add");
+ StubGenStubId stub_id = StubGenStubId::atomic_add_id;
+ StubCodeMark mark(this, stub_id);
Label retry;
start = __ pc();
Register addval = R0;
@@ -505,7 +510,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_atomic_xchg() {
address start;
- StubCodeMark mark(this, "StubRoutines", "atomic_xchg");
+ StubGenStubId stub_id = StubGenStubId::atomic_xchg_id;
+ StubCodeMark mark(this, stub_id);
start = __ pc();
Register newval = R0;
Register dest = R1;
@@ -555,7 +561,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_atomic_cmpxchg() {
address start;
- StubCodeMark mark(this, "StubRoutines", "atomic_cmpxchg");
+ StubGenStubId stub_id = StubGenStubId::atomic_cmpxchg_id;
+ StubCodeMark mark(this, stub_id);
start = __ pc();
Register cmp = R0;
Register newval = R1;
@@ -593,7 +600,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_atomic_cmpxchg_long() {
address start;
- StubCodeMark mark(this, "StubRoutines", "atomic_cmpxchg_long");
+ StubGenStubId stub_id = StubGenStubId::atomic_cmpxchg_long_id;
+ StubCodeMark mark(this, stub_id);
start = __ pc();
Register cmp_lo = R0;
Register cmp_hi = R1;
@@ -630,7 +638,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_atomic_load_long() {
address start;
- StubCodeMark mark(this, "StubRoutines", "atomic_load_long");
+ StubGenStubId stub_id = StubGenStubId::atomic_load_long_id;
+ StubCodeMark mark(this, stub_id);
start = __ pc();
Register result_lo = R0;
Register result_hi = R1;
@@ -654,7 +663,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_atomic_store_long() {
address start;
- StubCodeMark mark(this, "StubRoutines", "atomic_store_long");
+ StubGenStubId stub_id = StubGenStubId::atomic_store_long_id;
+ StubCodeMark mark(this, stub_id);
start = __ pc();
Register newval_lo = R0;
Register newval_hi = R1;
@@ -696,7 +706,8 @@ class StubGenerator: public StubCodeGenerator {
// raddr: LR, blown by call
address generate_partial_subtype_check() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "partial_subtype_check");
+ StubGenStubId stub_id = StubGenStubId::partial_subtype_check_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
// based on SPARC check_klass_subtype_[fast|slow]_path (without CompressedOops)
@@ -785,7 +796,8 @@ class StubGenerator: public StubCodeGenerator {
// Non-destructive plausibility checks for oops
address generate_verify_oop() {
- StubCodeMark mark(this, "StubRoutines", "verify_oop");
+ StubGenStubId stub_id = StubGenStubId::verify_oop_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
// Incoming arguments:
@@ -1986,6 +1998,23 @@ class StubGenerator: public StubCodeGenerator {
return start_pc;
}
+ /* Internal development flag */
+ /* enabled by defining TEST_C2_GENERIC_ARRAYCOPY */
+
+ // With this flag, the C2 stubs are tested by generating calls to
+ // generic_arraycopy instead of Runtime1::arraycopy
+
+ // Runtime1::arraycopy return a status in R0 (0 if OK, else ~copied)
+ // and the result is tested to see whether the arraycopy stub should
+ // be called.
+
+ // When we test arraycopy this way, we must generate extra code in the
+ // arraycopy methods callable from C2 generic_arraycopy to set the
+ // status to 0 for those who always succeed (calling the slow path stub might
+ // lead to errors since the copy has already been performed).
+
+ static const bool set_status;
+
//
// Generate stub for primitive array copy. If "aligned" is true, the
// "from" and "to" addresses are assumed to be heapword aligned.
@@ -1998,9 +2027,109 @@ class StubGenerator: public StubCodeGenerator {
// to: R1
// count: R2 treated as signed 32-bit int
//
- address generate_primitive_copy(bool aligned, const char * name, bool status, int bytes_per_count, bool disjoint, address nooverlap_target = nullptr) {
+ address generate_primitive_copy(StubGenStubId stub_id, address nooverlap_target = nullptr) {
+ bool aligned;
+ bool status;
+ int bytes_per_count;
+ bool disjoint;
+
+ switch (stub_id) {
+ case jbyte_disjoint_arraycopy_id:
+ aligned = false;
+ status = true;
+ bytes_per_count = 1;
+ disjoint = true;
+ break;
+ case jshort_disjoint_arraycopy_id:
+ aligned = false;
+ status = true;
+ bytes_per_count = 2;
+ disjoint = true;
+ break;
+ case jint_disjoint_arraycopy_id:
+ aligned = false;
+ status = true;
+ bytes_per_count = 4;
+ disjoint = true;
+ break;
+ case jlong_disjoint_arraycopy_id:
+ aligned = false;
+ status = true;
+ bytes_per_count = 8;
+ disjoint = true;
+ break;
+ case arrayof_jbyte_disjoint_arraycopy_id:
+ aligned = true;
+ status = set_status;
+ bytes_per_count = 1;
+ disjoint = true;
+ break;
+ case arrayof_jshort_disjoint_arraycopy_id:
+ aligned = true;
+ status = set_status;
+ bytes_per_count = 2;
+ disjoint = true;
+ break;
+ case arrayof_jint_disjoint_arraycopy_id:
+ aligned = true;
+ status = set_status;
+ bytes_per_count = 4;
+ disjoint = true;
+ break;
+ case arrayof_jlong_disjoint_arraycopy_id:
+ aligned = false;
+ status = set_status;
+ bytes_per_count = 8;
+ disjoint = true;
+ break;
+ case jbyte_arraycopy_id:
+ aligned = false;
+ status = true;
+ bytes_per_count = 1;
+ disjoint = false;
+ break;
+ case jshort_arraycopy_id:
+ aligned = false;
+ status = true;
+ bytes_per_count = 2;
+ disjoint = false;
+ break;
+ case jint_arraycopy_id:
+ aligned = false;
+ status = true;
+ bytes_per_count = 4;
+ disjoint = false;
+ break;
+ case jlong_arraycopy_id:
+ aligned = false;
+ status = true;
+ bytes_per_count = 8;
+ disjoint = false;
+ break;
+ case arrayof_jbyte_arraycopy_id:
+ aligned = true;
+ status = set_status;
+ bytes_per_count = 1;
+ disjoint = false;
+ break;
+ case arrayof_jshort_arraycopy_id:
+ aligned = true;
+ status = set_status;
+ bytes_per_count = 2;
+ disjoint = false;
+ break;
+ case arrayof_jint_arraycopy_id:
+ aligned = true;
+ status = set_status;
+ bytes_per_count = 4;
+ disjoint = false;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
const Register from = R0; // source array address
@@ -2172,9 +2301,38 @@ class StubGenerator: public StubCodeGenerator {
// to: R1
// count: R2 treated as signed 32-bit int
//
- address generate_oop_copy(bool aligned, const char * name, bool status, bool disjoint, address nooverlap_target = nullptr) {
+ address generate_oop_copy(StubGenStubId stub_id, address nooverlap_target = nullptr) {
+ bool aligned;
+ bool status;
+ bool disjoint;
+
+ switch (stub_id) {
+ case oop_disjoint_arraycopy_id:
+ aligned = false;
+ status = true;
+ disjoint = true;
+ break;
+ case arrayof_oop_disjoint_arraycopy_id:
+ aligned = true;
+ status = set_status;
+ disjoint = true;
+ break;
+ case oop_arraycopy_id:
+ aligned = false;
+ status = true;
+ disjoint = false;
+ break;
+ case arrayof_oop_arraycopy_id:
+ aligned = true;
+ status = set_status;
+ disjoint = false;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Register from = R0;
@@ -2309,7 +2467,7 @@ class StubGenerator: public StubCodeGenerator {
// Examines the alignment of the operands and dispatches
// to a long, int, short, or byte copy loop.
//
- address generate_unsafe_copy(const char* name) {
+ address generate_unsafe_copy() {
const Register R0_from = R0; // source array address
const Register R1_to = R1; // destination array address
@@ -2318,7 +2476,8 @@ class StubGenerator: public StubCodeGenerator {
const Register R3_bits = R3; // test copy of low bits
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubGenStubId stub_id = StubGenStubId::unsafe_arraycopy_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
const Register tmp = Rtemp;
@@ -2443,9 +2602,10 @@ class StubGenerator: public StubCodeGenerator {
// ckval: R4 (super_klass)
// ret: R0 zero for success; (-1^K) where K is partial transfer count (32-bit)
//
- address generate_checkcast_copy(const char * name) {
+ address generate_checkcast_copy() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubGenStubId stub_id = StubGenStubId::checkcast_arraycopy_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
const Register from = R0; // source array address
@@ -2596,7 +2756,7 @@ class StubGenerator: public StubCodeGenerator {
// R0 == 0 - success
// R0 < 0 - need to call System.arraycopy
//
- address generate_generic_copy(const char *name) {
+ address generate_generic_copy() {
Label L_failed, L_objArray;
// Input registers
@@ -2612,7 +2772,8 @@ class StubGenerator: public StubCodeGenerator {
const Register R8_temp = R8;
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubGenStubId stub_id = StubGenStubId::generic_arraycopy_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ zap_high_non_significant_bits(R1);
@@ -2843,72 +3004,55 @@ class StubGenerator: public StubCodeGenerator {
// Note: the disjoint stubs must be generated first, some of
// the conjoint stubs use them.
- bool status = false; // non failing C2 stubs need not return a status in R0
-
-#ifdef TEST_C2_GENERIC_ARRAYCOPY /* Internal development flag */
- // With this flag, the C2 stubs are tested by generating calls to
- // generic_arraycopy instead of Runtime1::arraycopy
-
- // Runtime1::arraycopy return a status in R0 (0 if OK, else ~copied)
- // and the result is tested to see whether the arraycopy stub should
- // be called.
-
- // When we test arraycopy this way, we must generate extra code in the
- // arraycopy methods callable from C2 generic_arraycopy to set the
- // status to 0 for those who always succeed (calling the slow path stub might
- // lead to errors since the copy has already been performed).
-
- status = true; // generate a status compatible with C1 calls
-#endif
-
address ucm_common_error_exit = generate_unsafecopy_common_error_exit();
UnsafeMemoryAccess::set_common_exit_stub_pc(ucm_common_error_exit);
// these need always status in case they are called from generic_arraycopy
- StubRoutines::_jbyte_disjoint_arraycopy = generate_primitive_copy(false, "jbyte_disjoint_arraycopy", true, 1, true);
- StubRoutines::_jshort_disjoint_arraycopy = generate_primitive_copy(false, "jshort_disjoint_arraycopy", true, 2, true);
- StubRoutines::_jint_disjoint_arraycopy = generate_primitive_copy(false, "jint_disjoint_arraycopy", true, 4, true);
- StubRoutines::_jlong_disjoint_arraycopy = generate_primitive_copy(false, "jlong_disjoint_arraycopy", true, 8, true);
- StubRoutines::_oop_disjoint_arraycopy = generate_oop_copy (false, "oop_disjoint_arraycopy", true, true);
-
- StubRoutines::_arrayof_jbyte_disjoint_arraycopy = generate_primitive_copy(true, "arrayof_jbyte_disjoint_arraycopy", status, 1, true);
- StubRoutines::_arrayof_jshort_disjoint_arraycopy = generate_primitive_copy(true, "arrayof_jshort_disjoint_arraycopy",status, 2, true);
- StubRoutines::_arrayof_jint_disjoint_arraycopy = generate_primitive_copy(true, "arrayof_jint_disjoint_arraycopy", status, 4, true);
- StubRoutines::_arrayof_jlong_disjoint_arraycopy = generate_primitive_copy(true, "arrayof_jlong_disjoint_arraycopy", status, 8, true);
- StubRoutines::_arrayof_oop_disjoint_arraycopy = generate_oop_copy (true, "arrayof_oop_disjoint_arraycopy", status, true);
+ StubRoutines::_jbyte_disjoint_arraycopy = generate_primitive_copy(StubGenStubId::jbyte_disjoint_arraycopy_id);
+ StubRoutines::_jshort_disjoint_arraycopy = generate_primitive_copy(StubGenStubId::jshort_disjoint_arraycopy_id);
+ StubRoutines::_jint_disjoint_arraycopy = generate_primitive_copy(StubGenStubId::jint_disjoint_arraycopy_id);
+ StubRoutines::_jlong_disjoint_arraycopy = generate_primitive_copy(StubGenStubId::jlong_disjoint_arraycopy_id);
+ StubRoutines::_oop_disjoint_arraycopy = generate_oop_copy (StubGenStubId::oop_disjoint_arraycopy_id);
+
+ StubRoutines::_arrayof_jbyte_disjoint_arraycopy = generate_primitive_copy(StubGenStubId::arrayof_jbyte_disjoint_arraycopy_id);
+ StubRoutines::_arrayof_jshort_disjoint_arraycopy = generate_primitive_copy(StubGenStubId::arrayof_jshort_disjoint_arraycopy_id);
+ StubRoutines::_arrayof_jint_disjoint_arraycopy = generate_primitive_copy(StubGenStubId::arrayof_jint_disjoint_arraycopy_id);
+ StubRoutines::_arrayof_jlong_disjoint_arraycopy = generate_primitive_copy(StubGenStubId::arrayof_jlong_disjoint_arraycopy_id);
+ StubRoutines::_arrayof_oop_disjoint_arraycopy = generate_oop_copy (StubGenStubId::arrayof_oop_disjoint_arraycopy_id);
// these need always status in case they are called from generic_arraycopy
- StubRoutines::_jbyte_arraycopy = generate_primitive_copy(false, "jbyte_arraycopy", true, 1, false, StubRoutines::_jbyte_disjoint_arraycopy);
- StubRoutines::_jshort_arraycopy = generate_primitive_copy(false, "jshort_arraycopy", true, 2, false, StubRoutines::_jshort_disjoint_arraycopy);
- StubRoutines::_jint_arraycopy = generate_primitive_copy(false, "jint_arraycopy", true, 4, false, StubRoutines::_jint_disjoint_arraycopy);
- StubRoutines::_jlong_arraycopy = generate_primitive_copy(false, "jlong_arraycopy", true, 8, false, StubRoutines::_jlong_disjoint_arraycopy);
- StubRoutines::_oop_arraycopy = generate_oop_copy (false, "oop_arraycopy", true, false, StubRoutines::_oop_disjoint_arraycopy);
-
- StubRoutines::_arrayof_jbyte_arraycopy = generate_primitive_copy(true, "arrayof_jbyte_arraycopy", status, 1, false, StubRoutines::_arrayof_jbyte_disjoint_arraycopy);
- StubRoutines::_arrayof_jshort_arraycopy = generate_primitive_copy(true, "arrayof_jshort_arraycopy", status, 2, false, StubRoutines::_arrayof_jshort_disjoint_arraycopy);
+ StubRoutines::_jbyte_arraycopy = generate_primitive_copy(StubGenStubId::jbyte_arraycopy_id, StubRoutines::_jbyte_disjoint_arraycopy);
+ StubRoutines::_jshort_arraycopy = generate_primitive_copy(StubGenStubId::jshort_arraycopy_id, StubRoutines::_jshort_disjoint_arraycopy);
+ StubRoutines::_jint_arraycopy = generate_primitive_copy(StubGenStubId::jint_arraycopy_id, StubRoutines::_jint_disjoint_arraycopy);
+ StubRoutines::_jlong_arraycopy = generate_primitive_copy(StubGenStubId::jlong_arraycopy_id, StubRoutines::_jlong_disjoint_arraycopy);
+ StubRoutines::_oop_arraycopy = generate_oop_copy (StubGenStubId::oop_arraycopy_id, StubRoutines::_oop_disjoint_arraycopy);
+
+ StubRoutines::_arrayof_jbyte_arraycopy = generate_primitive_copy(StubGenStubId::arrayof_jbyte_arraycopy_id, StubRoutines::_arrayof_jbyte_disjoint_arraycopy);
+ StubRoutines::_arrayof_jshort_arraycopy = generate_primitive_copy(StubGenStubId::arrayof_jshort_arraycopy_id, StubRoutines::_arrayof_jshort_disjoint_arraycopy);
#ifdef _LP64
// since sizeof(jint) < sizeof(HeapWord), there's a different flavor:
- StubRoutines::_arrayof_jint_arraycopy = generate_primitive_copy(true, "arrayof_jint_arraycopy", status, 4, false, StubRoutines::_arrayof_jint_disjoint_arraycopy);
+ StubRoutines::_arrayof_jint_arraycopy = generate_primitive_copy(StubGenStubId::arrayof_jint_arraycopy_id, StubRoutines::_arrayof_jint_disjoint_arraycopy);
#else
StubRoutines::_arrayof_jint_arraycopy = StubRoutines::_jint_arraycopy;
#endif
if (BytesPerHeapOop < HeapWordSize) {
- StubRoutines::_arrayof_oop_arraycopy = generate_oop_copy (true, "arrayof_oop_arraycopy", status, false, StubRoutines::_arrayof_oop_disjoint_arraycopy);
+ StubRoutines::_arrayof_oop_arraycopy = generate_oop_copy (StubGenStubId::arrayof_oop_arraycopy_id, StubRoutines::_arrayof_oop_disjoint_arraycopy);
} else {
StubRoutines::_arrayof_oop_arraycopy = StubRoutines::_oop_arraycopy;
}
StubRoutines::_arrayof_jlong_arraycopy = StubRoutines::_jlong_arraycopy;
- StubRoutines::_checkcast_arraycopy = generate_checkcast_copy("checkcast_arraycopy");
- StubRoutines::_unsafe_arraycopy = generate_unsafe_copy("unsafe_arraycopy");
- StubRoutines::_generic_arraycopy = generate_generic_copy("generic_arraycopy");
+ StubRoutines::_checkcast_arraycopy = generate_checkcast_copy();
+ StubRoutines::_unsafe_arraycopy = generate_unsafe_copy();
+ StubRoutines::_generic_arraycopy = generate_generic_copy();
}
address generate_method_entry_barrier() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "nmethod_entry_barrier");
+ StubGenStubId stub_id = StubGenStubId::method_entry_barrier_id;
+ StubCodeMark mark(this, stub_id);
Label deoptimize_label;
@@ -2961,22 +3105,22 @@ class StubGenerator: public StubCodeGenerator {
#undef __
#define __ masm->
- address generate_cont_thaw(const char* label, Continuation::thaw_kind kind) {
+ address generate_cont_thaw(StubGenStubId stub_id) {
if (!Continuations::enabled()) return nullptr;
Unimplemented();
return nullptr;
}
address generate_cont_thaw() {
- return generate_cont_thaw("Cont thaw", Continuation::thaw_top);
+ return generate_cont_thaw(StubGenStubId::cont_thaw_id);
}
address generate_cont_returnBarrier() {
- return generate_cont_thaw("Cont thaw return barrier", Continuation::thaw_return_barrier);
+ return generate_cont_thaw(StubGenStubId::cont_returnBarrier_id);
}
address generate_cont_returnBarrier_exception() {
- return generate_cont_thaw("Cont thaw return barrier exception", Continuation::thaw_return_barrier_exception);
+ return generate_cont_thaw(StubGenStubId::cont_returnBarrierExc_id);
}
//---------------------------------------------------------------------------
@@ -3008,8 +3152,8 @@ class StubGenerator: public StubCodeGenerator {
StubRoutines::_atomic_xchg_entry = generate_atomic_xchg();
StubRoutines::_atomic_cmpxchg_entry = generate_atomic_cmpxchg();
StubRoutines::_atomic_cmpxchg_long_entry = generate_atomic_cmpxchg_long();
- StubRoutines::_atomic_load_long_entry = generate_atomic_load_long();
- StubRoutines::_atomic_store_long_entry = generate_atomic_store_long();
+ StubRoutines::Arm::_atomic_load_long_entry = generate_atomic_load_long();
+ StubRoutines::Arm::_atomic_store_long_entry = generate_atomic_store_long();
}
@@ -3059,27 +3203,36 @@ class StubGenerator: public StubCodeGenerator {
}
public:
- StubGenerator(CodeBuffer* code, StubsKind kind) : StubCodeGenerator(code) {
- switch(kind) {
- case Initial_stubs:
+ StubGenerator(CodeBuffer* code, StubGenBlobId blob_id) : StubCodeGenerator(code, blob_id) {
+ switch(blob_id) {
+ case initial_id:
generate_initial_stubs();
break;
- case Continuation_stubs:
+ case continuation_id:
generate_continuation_stubs();
break;
- case Compiler_stubs:
+ case compiler_id:
generate_compiler_stubs();
break;
- case Final_stubs:
+ case final_id:
generate_final_stubs();
break;
default:
- fatal("unexpected stubs kind: %d", kind);
+ fatal("unexpected blob id: %d", blob_id);
break;
};
}
}; // end class declaration
-void StubGenerator_generate(CodeBuffer* code, StubCodeGenerator::StubsKind kind) {
- StubGenerator g(code, kind);
+void StubGenerator_generate(CodeBuffer* code, StubGenBlobId blob_id) {
+ StubGenerator g(code, blob_id);
}
+
+// implementation of internal development flag
+
+#ifdef TEST_C2_GENERIC_ARRAYCOPY
+const bool StubGenerator::set_status = true; // generate a status compatible with C1 calls
+#else
+const bool StubGenerator::set_status = false; // non failing C2 stubs need not return a status in R0
+#endif
+
diff --git a/src/hotspot/cpu/arm/stubRoutinesCrypto_arm.cpp b/src/hotspot/cpu/arm/stubRoutinesCrypto_arm.cpp
index 350636fbe93e1..b663cfd92989d 100644
--- a/src/hotspot/cpu/arm/stubRoutinesCrypto_arm.cpp
+++ b/src/hotspot/cpu/arm/stubRoutinesCrypto_arm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -119,7 +119,8 @@ void aes_init() {
address generate_aescrypt_encryptBlock() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "aesencryptBlock");
+ StubGenStubId stub_id = StubGenStubId::aescrypt_encryptBlock_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
@@ -316,7 +317,8 @@ address generate_aescrypt_encryptBlock() {
address generate_aescrypt_decryptBlock() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "aesdecryptBlock");
+ StubGenStubId stub_id = StubGenStubId::aescrypt_decryptBlock_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
@@ -536,7 +538,8 @@ address generate_cipherBlockChaining_encryptAESCrypt() {
// [sp+4] Transposition Box reference
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "cipherBlockChaining_encryptAESCrypt");
+ StubGenStubId stub_id = StubGenStubId::cipherBlockChaining_encryptAESCrypt_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
@@ -601,7 +604,8 @@ address generate_cipherBlockChaining_encryptAESCrypt() {
address generate_cipherBlockChaining_decryptAESCrypt() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "cipherBlockChaining_decryptAESCrypt");
+ StubGenStubId stub_id = StubGenStubId::cipherBlockChaining_decryptAESCrypt_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
diff --git a/src/hotspot/cpu/arm/stubRoutines_arm.cpp b/src/hotspot/cpu/arm/stubRoutines_arm.cpp
index 0cd174d8da673..d843d89186ea1 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,14 +22,17 @@
*
*/
-#include "precompiled.hpp"
#include "runtime/deoptimization.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/stubRoutines.hpp"
-address StubRoutines::Arm::_idiv_irem_entry = nullptr;
+#define DEFINE_ARCH_ENTRY(arch, blob_name, stub_name, field_name, getter_name) \
+ address StubRoutines:: arch :: STUB_FIELD_NAME(field_name) = nullptr;
-address StubRoutines::Arm::_partial_subtype_check = nullptr;
+#define DEFINE_ARCH_ENTRY_INIT(arch, blob_name, stub_name, field_name, getter_name, init_function) \
+ address StubRoutines:: arch :: STUB_FIELD_NAME(field_name) = CAST_FROM_FN_PTR(address, init_function);
-address StubRoutines::_atomic_load_long_entry = nullptr;
-address StubRoutines::_atomic_store_long_entry = nullptr;
+STUBGEN_ARCH_ENTRIES_DO(DEFINE_ARCH_ENTRY, DEFINE_ARCH_ENTRY_INIT)
+
+#undef DEFINE_ARCH_ENTRY_INIT
+#undef DEFINE_ARCH_ENTRY
diff --git a/src/hotspot/cpu/arm/stubRoutines_arm.hpp b/src/hotspot/cpu/arm/stubRoutines_arm.hpp
index 05c82881cd5f6..838b3e6d3782f 100644
--- a/src/hotspot/cpu/arm/stubRoutines_arm.hpp
+++ b/src/hotspot/cpu/arm/stubRoutines_arm.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,38 +29,53 @@
// definition. See stubRoutines.hpp for a description on how to
// extend it.
+// emit enum used to size per-blob code buffers
+
+#define DEFINE_BLOB_SIZE(blob_name, size) \
+ _ ## blob_name ## _code_size = size,
+
enum platform_dependent_constants {
- // simply increase sizes if too small (assembler will crash if too small)
- _initial_stubs_code_size = 9000,
- _continuation_stubs_code_size = 2000,
- _compiler_stubs_code_size = 22000,
- _final_stubs_code_size = 22000
+ STUBGEN_ARCH_BLOBS_DO(DEFINE_BLOB_SIZE)
};
+#undef DEFINE_BLOB_SIZE
+
+public:
+ static bool returns_to_call_stub(address return_pc) {
+ return return_pc == _call_stub_return_address;
+ }
+
class Arm {
friend class StubGenerator;
friend class VMStructs;
- private:
+#define DECLARE_ARCH_ENTRY(arch, blob_name, stub_name, field_name, getter_name) \
+ static address STUB_FIELD_NAME(field_name) ;
- static address _idiv_irem_entry;
- static address _partial_subtype_check;
+#define DECLARE_ARCH_ENTRY_INIT(arch, blob_name, stub_name, field_name, getter_name, init_function) \
+ DECLARE_ARCH_ENTRY(arch, blob_name, stub_name, field_name, getter_name)
- public:
+private:
+ STUBGEN_ARCH_ENTRIES_DO(DECLARE_ARCH_ENTRY, DECLARE_ARCH_ENTRY_INIT)
- static address idiv_irem_entry() { return _idiv_irem_entry; }
- static address partial_subtype_check() { return _partial_subtype_check; }
-};
+#undef DECLARE_ARCH_ENTRY_INIT
+#undef DECLARE_ARCH_ENTRY
- static bool returns_to_call_stub(address return_pc) {
- return return_pc == _call_stub_return_address;
- }
+public:
+
+ // declare getters for arch-specific entries
- static address _atomic_load_long_entry;
- static address _atomic_store_long_entry;
+#define DEFINE_ARCH_ENTRY_GETTER(arch, blob_name, stub_name, field_name, getter_name) \
+ static address getter_name() { return STUB_FIELD_NAME(field_name) ; }
- static address atomic_load_long_entry() { return _atomic_load_long_entry; }
- static address atomic_store_long_entry() { return _atomic_store_long_entry; }
+#define DEFINE_ARCH_ENTRY_GETTER_INIT(arch, blob_name, stub_name, field_name, getter_name, init_function) \
+ DEFINE_ARCH_ENTRY_GETTER(arch, blob_name, stub_name, field_name, getter_name)
+ STUBGEN_ARCH_ENTRIES_DO(DEFINE_ARCH_ENTRY_GETTER, DEFINE_ARCH_ENTRY_GETTER_INIT)
+
+#undef DEFINE_ARCH_ENTRY_GETTER_INIT
+#undef DEFINE_ARCH_ENTRY_GETTER
+
+};
#endif // CPU_ARM_STUBROUTINES_ARM_HPP
diff --git a/src/hotspot/cpu/arm/templateInterpreterGenerator_arm.cpp b/src/hotspot/cpu/arm/templateInterpreterGenerator_arm.cpp
index 9df7a455eeb84..3f1cd1e23de8c 100644
--- a/src/hotspot/cpu/arm/templateInterpreterGenerator_arm.cpp
+++ b/src/hotspot/cpu/arm/templateInterpreterGenerator_arm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/assembler.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "classfile/javaClasses.hpp"
@@ -579,7 +578,7 @@ void TemplateInterpreterGenerator::lock_method() {
#ifdef ASSERT
{ Label L;
- __ ldr_u32(Rtemp, Address(Rmethod, Method::access_flags_offset()));
+ __ ldrh(Rtemp, Address(Rmethod, Method::access_flags_offset()));
__ tbnz(Rtemp, JVM_ACC_SYNCHRONIZED_BIT, L);
__ stop("method doesn't need synchronization");
__ bind(L);
@@ -588,7 +587,7 @@ void TemplateInterpreterGenerator::lock_method() {
// get synchronization object
{ Label done;
- __ ldr_u32(Rtemp, Address(Rmethod, Method::access_flags_offset()));
+ __ ldrh(Rtemp, Address(Rmethod, Method::access_flags_offset()));
__ tst(Rtemp, JVM_ACC_STATIC);
__ ldr(R0, Address(Rlocals, Interpreter::local_offset_in_bytes(0)), eq); // get receiver (assume this is frequent case)
__ b(done, eq);
@@ -851,7 +850,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
// make sure method is native & not abstract
#ifdef ASSERT
- __ ldr_u32(Rtemp, Address(Rmethod, Method::access_flags_offset()));
+ __ ldrh(Rtemp, Address(Rmethod, Method::access_flags_offset()));
{
Label L;
__ tbnz(Rtemp, JVM_ACC_NATIVE_BIT, L);
@@ -893,7 +892,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
// no synchronization necessary
#ifdef ASSERT
{ Label L;
- __ ldr_u32(Rtemp, Address(Rmethod, Method::access_flags_offset()));
+ __ ldrh(Rtemp, Address(Rmethod, Method::access_flags_offset()));
__ tbz(Rtemp, JVM_ACC_SYNCHRONIZED_BIT, L);
__ stop("method needs synchronization");
__ bind(L);
@@ -975,7 +974,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
// Pass JNIEnv and mirror for static methods
{
Label L;
- __ ldr_u32(Rtemp, Address(Rmethod, Method::access_flags_offset()));
+ __ ldrh(Rtemp, Address(Rmethod, Method::access_flags_offset()));
__ add(R0, Rthread, in_bytes(JavaThread::jni_environment_offset()));
__ tbz(Rtemp, JVM_ACC_STATIC_BIT, L);
__ load_mirror(Rtemp, Rmethod, Rtemp);
@@ -1204,7 +1203,7 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) {
// make sure method is not native & not abstract
#ifdef ASSERT
- __ ldr_u32(Rtemp, Address(Rmethod, Method::access_flags_offset()));
+ __ ldrh(Rtemp, Address(Rmethod, Method::access_flags_offset()));
{
Label L;
__ tbz(Rtemp, JVM_ACC_NATIVE_BIT, L);
@@ -1249,7 +1248,7 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) {
// no synchronization necessary
#ifdef ASSERT
{ Label L;
- __ ldr_u32(Rtemp, Address(Rmethod, Method::access_flags_offset()));
+ __ ldrh(Rtemp, Address(Rmethod, Method::access_flags_offset()));
__ tbz(Rtemp, JVM_ACC_SYNCHRONIZED_BIT, L);
__ stop("method needs synchronization");
__ bind(L);
diff --git a/src/hotspot/cpu/arm/templateTable_arm.cpp b/src/hotspot/cpu/arm/templateTable_arm.cpp
index 0974ff1f9a9c3..bbe5713090af5 100644
--- a/src/hotspot/cpu/arm/templateTable_arm.cpp
+++ b/src/hotspot/cpu/arm/templateTable_arm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "gc/shared/barrierSetAssembler.hpp"
#include "gc/shared/collectedHeap.hpp"
diff --git a/src/hotspot/cpu/arm/upcallLinker_arm.cpp b/src/hotspot/cpu/arm/upcallLinker_arm.cpp
index 696b2001e6b7b..532ff7be8bc31 100644
--- a/src/hotspot/cpu/arm/upcallLinker_arm.cpp
+++ b/src/hotspot/cpu/arm/upcallLinker_arm.cpp
@@ -21,7 +21,6 @@
* questions.
*/
-#include "precompiled.hpp"
#include "prims/upcallLinker.hpp"
#include "utilities/debug.hpp"
diff --git a/src/hotspot/cpu/arm/vm_version_arm_32.cpp b/src/hotspot/cpu/arm/vm_version_arm_32.cpp
index d3ba352f78b15..148786a55da41 100644
--- a/src/hotspot/cpu/arm/vm_version_arm_32.cpp
+++ b/src/hotspot/cpu/arm/vm_version_arm_32.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "jvm.h"
#include "memory/resourceArea.hpp"
diff --git a/src/hotspot/cpu/arm/vmreg_arm.cpp b/src/hotspot/cpu/arm/vmreg_arm.cpp
index c7c972db5c9b6..4ce1dd0be20f5 100644
--- a/src/hotspot/cpu/arm/vmreg_arm.cpp
+++ b/src/hotspot/cpu/arm/vmreg_arm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,6 @@
*/
-#include "precompiled.hpp"
#include "asm/assembler.hpp"
#include "code/vmreg.hpp"
diff --git a/src/hotspot/cpu/arm/vtableStubs_arm.cpp b/src/hotspot/cpu/arm/vtableStubs_arm.cpp
index 8f453558848b5..2d7ccd1969b0d 100644
--- a/src/hotspot/cpu/arm/vtableStubs_arm.cpp
+++ b/src/hotspot/cpu/arm/vtableStubs_arm.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/assembler.inline.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "code/compiledIC.hpp"
diff --git a/src/hotspot/cpu/ppc/abstractInterpreter_ppc.cpp b/src/hotspot/cpu/ppc/abstractInterpreter_ppc.cpp
index 56f8fce5ce926..cc094ad4f995b 100644
--- a/src/hotspot/cpu/ppc/abstractInterpreter_ppc.cpp
+++ b/src/hotspot/cpu/ppc/abstractInterpreter_ppc.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2023 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "interpreter/interpreter.hpp"
#include "oops/constMethod.hpp"
#include "oops/klass.inline.hpp"
diff --git a/src/hotspot/cpu/ppc/assembler_ppc.cpp b/src/hotspot/cpu/ppc/assembler_ppc.cpp
index 40c69dd290280..ab16fc437e9e1 100644
--- a/src/hotspot/cpu/ppc/assembler_ppc.cpp
+++ b/src/hotspot/cpu/ppc/assembler_ppc.cpp
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2024 SAP SE. All rights reserved.
+ * Copyright (c) 1997, 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 @@
*
*/
-#include "precompiled.hpp"
#include "asm/assembler.inline.hpp"
#include "gc/shared/cardTableBarrierSet.hpp"
#include "gc/shared/collectedHeap.inline.hpp"
@@ -563,20 +562,20 @@ void Assembler::test_asm() {
li( R3, -4711);
// PPC 1, section 3.3.9, Fixed-Point Compare Instructions
- cmpi( CCR7, 0, R27, 4711);
- cmp( CCR0, 1, R14, R11);
- cmpli( CCR5, 1, R17, 45);
- cmpl( CCR3, 0, R9, R10);
+ cmpi( CR7, 0, R27, 4711);
+ cmp( CR0, 1, R14, R11);
+ cmpli( CR5, 1, R17, 45);
+ cmpl( CR3, 0, R9, R10);
- cmpwi( CCR7, R27, 4711);
- cmpw( CCR0, R14, R11);
- cmplwi( CCR5, R17, 45);
- cmplw( CCR3, R9, R10);
+ cmpwi( CR7, R27, 4711);
+ cmpw( CR0, R14, R11);
+ cmplwi( CR5, R17, 45);
+ cmplw( CR3, R9, R10);
- cmpdi( CCR7, R27, 4711);
- cmpd( CCR0, R14, R11);
- cmpldi( CCR5, R17, 45);
- cmpld( CCR3, R9, R10);
+ cmpdi( CR7, R27, 4711);
+ cmpd( CR0, R14, R11);
+ cmpldi( CR5, R17, 45);
+ cmpld( CR3, R9, R10);
// PPC 1, section 3.3.11, Fixed-Point Logical Instructions
andi_( R4, R5, 0xff);
@@ -716,23 +715,23 @@ void Assembler::test_asm() {
bcctr( 4, 6, 0);
bcctrl(4, 6, 0);
- blt(CCR0, lbl2);
- bgt(CCR1, lbl2);
- beq(CCR2, lbl2);
- bso(CCR3, lbl2);
- bge(CCR4, lbl2);
- ble(CCR5, lbl2);
- bne(CCR6, lbl2);
- bns(CCR7, lbl2);
-
- bltl(CCR0, lbl2);
- bgtl(CCR1, lbl2);
- beql(CCR2, lbl2);
- bsol(CCR3, lbl2);
- bgel(CCR4, lbl2);
- blel(CCR5, lbl2);
- bnel(CCR6, lbl2);
- bnsl(CCR7, lbl2);
+ blt(CR0, lbl2);
+ bgt(CR1, lbl2);
+ beq(CR2, lbl2);
+ bso(CR3, lbl2);
+ bge(CR4, lbl2);
+ ble(CR5, lbl2);
+ bne(CR6, lbl2);
+ bns(CR7, lbl2);
+
+ bltl(CR0, lbl2);
+ bgtl(CR1, lbl2);
+ beql(CR2, lbl2);
+ bsol(CR3, lbl2);
+ bgel(CR4, lbl2);
+ blel(CR5, lbl2);
+ bnel(CR6, lbl2);
+ bnsl(CR7, lbl2);
blr();
sync();
@@ -795,7 +794,7 @@ void Assembler::test_asm() {
fcfid( F22, F23);
// PPC 1, section 4.6.7 Floating-Point Compare Instructions
- fcmpu( CCR7, F24, F25);
+ fcmpu( CR7, F24, F25);
tty->print_cr("\ntest_asm disassembly (0x%lx 0x%lx):", p2i(code()->insts_begin()), p2i(code()->insts_end()));
code()->decode();
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..ab026d356628b 100644
--- a/src/hotspot/cpu/ppc/assembler_ppc.inline.hpp
+++ b/src/hotspot/cpu/ppc/assembler_ppc.inline.hpp
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2024 SAP SE. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -246,9 +246,9 @@ inline void Assembler::nop() { Assembler::ori(R0, R
// NOP for FP and BR units (different versions to allow them to be in one group)
inline void Assembler::fpnop0() { Assembler::fmr(F30, F30); }
inline void Assembler::fpnop1() { Assembler::fmr(F31, F31); }
-inline void Assembler::brnop0() { Assembler::mcrf(CCR2, CCR2); }
-inline void Assembler::brnop1() { Assembler::mcrf(CCR3, CCR3); }
-inline void Assembler::brnop2() { Assembler::mcrf(CCR4, CCR4); }
+inline void Assembler::brnop0() { Assembler::mcrf(CR2, CR2); }
+inline void Assembler::brnop1() { Assembler::mcrf(CR3, CR3); }
+inline void Assembler::brnop2() { Assembler::mcrf(CR4, CR4); }
inline void Assembler::mr( Register d, Register s) { Assembler::orr(d, s, s); }
inline void Assembler::ori_opt( Register d, int ui16) { if (ui16!=0) Assembler::ori( d, d, ui16); }
@@ -303,7 +303,7 @@ inline void Assembler::clrlsldi_(Register a, Register s, int clrl6, int shl6) {
inline void Assembler::extrdi( Register a, Register s, int n, int b){ Assembler::rldicl(a, s, b+n, 64-n); }
// testbit with condition register.
inline void Assembler::testbitdi(ConditionRegister cr, Register a, Register s, int ui6) {
- if (cr == CCR0) {
+ if (cr == CR0) {
Assembler::rldicr_(a, s, 63-ui6, 0);
} else {
Assembler::rldicr(a, s, 63-ui6, 0);
@@ -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..d4f5faa29a869 100644
--- a/src/hotspot/cpu/ppc/c1_CodeStubs_ppc.cpp
+++ b/src/hotspot/cpu/ppc/c1_CodeStubs_ppc.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 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "c1/c1_CodeStubs.hpp"
#include "c1/c1_FrameMap.hpp"
@@ -368,9 +367,9 @@ void PatchingStub::emit_code(LIR_Assembler* ce) {
__ mr(R0, _obj); // spill
__ ld(_obj, java_lang_Class::klass_offset(), _obj);
__ ld(_obj, in_bytes(InstanceKlass::init_thread_offset()), _obj);
- __ cmpd(CCR0, _obj, R16_thread);
+ __ cmpd(CR0, _obj, R16_thread);
__ mr(_obj, R0); // restore
- __ bne(CCR0, call_patch);
+ __ bne(CR0, call_patch);
// Load_klass patches may execute the patched code before it's
// copied back into place so we need to jump back into the main
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..cae192982d56e 100644
--- a/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp
+++ b/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2024 SAP SE. All rights reserved.
+ * Copyright (c) 2000, 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 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "c1/c1_Compilation.hpp"
#include "c1/c1_LIRAssembler.hpp"
@@ -49,7 +48,7 @@
#define __ _masm->
-const ConditionRegister LIR_Assembler::BOOL_RESULT = CCR5;
+const ConditionRegister LIR_Assembler::BOOL_RESULT = CR5;
bool LIR_Assembler::is_small_constant(LIR_Opr opr) {
@@ -157,8 +156,8 @@ void LIR_Assembler::osr_entry() {
{
Label L;
__ ld(R0, slot_offset + 1*BytesPerWord, OSR_buf);
- __ cmpdi(CCR0, R0, 0);
- __ bne(CCR0, L);
+ __ cmpdi(CR0, R0, 0);
+ __ bne(CR0, L);
__ stop("locked object is null");
__ bind(L);
}
@@ -411,11 +410,11 @@ void LIR_Assembler::arithmetic_idiv(LIR_Code code, LIR_Opr left, LIR_Opr right,
Label regular, done;
if (is_int) {
- __ cmpwi(CCR0, Rdivisor, -1);
+ __ cmpwi(CR0, Rdivisor, -1);
} else {
- __ cmpdi(CCR0, Rdivisor, -1);
+ __ cmpdi(CR0, Rdivisor, -1);
}
- __ bne(CCR0, regular);
+ __ bne(CR0, regular);
if (code == lir_idiv) {
__ neg(Rresult, Rdividend);
__ b(done);
@@ -598,14 +597,14 @@ void LIR_Assembler::emit_opConvert(LIR_OpConvert* op) {
Address addr = dst_in_memory ? frame_map()->address_for_slot(dst->double_stack_ix()) : Address();
Label L;
// Result must be 0 if value is NaN; test by comparing value to itself.
- __ fcmpu(CCR0, rsrc, rsrc);
+ __ fcmpu(CR0, rsrc, rsrc);
if (dst_in_memory) {
__ li(R0, 0); // 0 in case of NAN
__ std(R0, addr);
} else {
__ li(dst->as_register(), 0);
}
- __ bso(CCR0, L);
+ __ bso(CR0, L);
__ fctiwz(rsrc, rsrc); // USE_KILL
if (dst_in_memory) {
__ stfd(rsrc, addr.disp(), addr.base());
@@ -622,14 +621,14 @@ void LIR_Assembler::emit_opConvert(LIR_OpConvert* op) {
Address addr = dst_in_memory ? frame_map()->address_for_slot(dst->double_stack_ix()) : Address();
Label L;
// Result must be 0 if value is NaN; test by comparing value to itself.
- __ fcmpu(CCR0, rsrc, rsrc);
+ __ fcmpu(CR0, rsrc, rsrc);
if (dst_in_memory) {
__ li(R0, 0); // 0 in case of NAN
__ std(R0, addr);
} else {
__ li(dst->as_register_lo(), 0);
}
- __ bso(CCR0, L);
+ __ bso(CR0, L);
__ fctidz(rsrc, rsrc); // USE_KILL
if (dst_in_memory) {
__ stfd(rsrc, addr.disp(), addr.base());
@@ -1531,15 +1530,15 @@ void LIR_Assembler::comp_fl2i(LIR_Code code, LIR_Opr left, LIR_Opr right, LIR_Op
if (code == lir_cmp_fd2i || code == lir_ucmp_fd2i) {
bool is_unordered_less = (code == lir_ucmp_fd2i);
if (left->is_single_fpu()) {
- __ fcmpu(CCR0, left->as_float_reg(), right->as_float_reg());
+ __ fcmpu(CR0, left->as_float_reg(), right->as_float_reg());
} else if (left->is_double_fpu()) {
- __ fcmpu(CCR0, left->as_double_reg(), right->as_double_reg());
+ __ fcmpu(CR0, left->as_double_reg(), right->as_double_reg());
} else {
ShouldNotReachHere();
}
__ set_cmpu3(Rdst, is_unordered_less); // is_unordered_less ? -1 : 1
} else if (code == lir_cmp_l2i) {
- __ cmpd(CCR0, left->as_register_lo(), right->as_register_lo());
+ __ cmpd(CR0, left->as_register_lo(), right->as_register_lo());
__ set_cmp3(Rdst); // set result as follows: <: -1, =: 0, >: 1
} else {
ShouldNotReachHere();
@@ -1894,8 +1893,8 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
__ add(src_pos, tmp, src_pos);
__ add(dst_pos, tmp, dst_pos);
- __ cmpwi(CCR0, R3_RET, 0);
- __ bc_far_optimized(Assembler::bcondCRbiIs1, __ bi0(CCR0, Assembler::less), *stub->entry());
+ __ cmpwi(CR0, R3_RET, 0);
+ __ bc_far_optimized(Assembler::bcondCRbiIs1, __ bi0(CR0, Assembler::less), *stub->entry());
__ bind(*stub->continuation());
return;
}
@@ -1911,12 +1910,12 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
// Use only one conditional branch for simple checks.
if (simple_check_flag_set) {
- ConditionRegister combined_check = CCR1, tmp_check = CCR1;
+ ConditionRegister combined_check = CR1, tmp_check = CR1;
// Make sure src and dst are non-null.
if (flags & LIR_OpArrayCopy::src_null_check) {
__ cmpdi(combined_check, src, 0);
- tmp_check = CCR0;
+ tmp_check = CR0;
}
if (flags & LIR_OpArrayCopy::dst_null_check) {
@@ -1924,13 +1923,13 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
if (tmp_check != combined_check) {
__ cror(combined_check, Assembler::equal, tmp_check, Assembler::equal);
}
- tmp_check = CCR0;
+ tmp_check = CR0;
}
// Clear combined_check.eq if not already used.
if (tmp_check == combined_check) {
__ crandc(combined_check, Assembler::equal, combined_check, Assembler::equal);
- tmp_check = CCR0;
+ tmp_check = CR0;
}
if (flags & LIR_OpArrayCopy::src_pos_positive_check) {
@@ -1961,15 +1960,15 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
if (!(flags & LIR_OpArrayCopy::dst_objarray)) {
__ load_klass(tmp, dst);
__ lwz(tmp2, in_bytes(Klass::layout_helper_offset()), tmp);
- __ cmpwi(CCR0, tmp2, Klass::_lh_neutral_value);
- __ bge(CCR0, slow);
+ __ cmpwi(CR0, tmp2, Klass::_lh_neutral_value);
+ __ bge(CR0, slow);
}
if (!(flags & LIR_OpArrayCopy::src_objarray)) {
__ load_klass(tmp, src);
__ lwz(tmp2, in_bytes(Klass::layout_helper_offset()), tmp);
- __ cmpwi(CCR0, tmp2, Klass::_lh_neutral_value);
- __ bge(CCR0, slow);
+ __ cmpwi(CR0, tmp2, Klass::_lh_neutral_value);
+ __ bge(CR0, slow);
}
}
@@ -1980,16 +1979,16 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
if (flags & LIR_OpArrayCopy::src_range_check) {
__ lwz(tmp2, arrayOopDesc::length_offset_in_bytes(), src);
__ add(tmp, length, src_pos);
- __ cmpld(CCR0, tmp2, tmp);
- __ ble(CCR0, slow);
+ __ cmpld(CR0, tmp2, tmp);
+ __ ble(CR0, slow);
}
__ extsw(dst_pos, dst_pos);
if (flags & LIR_OpArrayCopy::dst_range_check) {
__ lwz(tmp2, arrayOopDesc::length_offset_in_bytes(), dst);
__ add(tmp, length, dst_pos);
- __ cmpld(CCR0, tmp2, tmp);
- __ ble(CCR0, slow);
+ __ cmpld(CR0, tmp2, tmp);
+ __ ble(CR0, slow);
}
int shift = shift_amount(basic_type);
@@ -2004,8 +2003,8 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
// We don't know the array types are compatible.
if (basic_type != T_OBJECT) {
// Simple test for basic type arrays.
- __ cmp_klasses_from_objects(CCR0, src, dst, tmp, tmp2);
- __ beq(CCR0, cont);
+ __ cmp_klasses_from_objects(CR0, src, dst, tmp, tmp2);
+ __ beq(CR0, cont);
} else {
// For object arrays, if src is a sub class of dst then we can
// safely do the copy.
@@ -2025,7 +2024,7 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
__ calculate_address_from_global_toc(tmp, slow_stc, true, true, false);
__ mtctr(tmp);
__ bctrl(); // sets CR0
- __ beq(CCR0, cont);
+ __ beq(CR0, cont);
if (copyfunc_addr != nullptr) { // Use stub if available.
__ bind(copyfunc);
@@ -2045,8 +2044,8 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
jint objArray_lh = Klass::array_layout_helper(T_OBJECT);
__ load_const_optimized(tmp, objArray_lh);
- __ cmpw(CCR0, tmp, tmp2);
- __ bne(CCR0, slow);
+ __ cmpw(CR0, tmp, tmp2);
+ __ bne(CR0, slow);
}
Register src_ptr = R3_ARG1;
@@ -2081,8 +2080,8 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
#ifndef PRODUCT
if (PrintC1Statistics) {
Label failed;
- __ cmpwi(CCR0, R3_RET, 0);
- __ bne(CCR0, failed);
+ __ cmpwi(CR0, R3_RET, 0);
+ __ bne(CR0, failed);
address counter = (address)&Runtime1::_arraycopy_checkcast_cnt;
int simm16_offs = __ load_const_optimized(tmp, counter, tmp2, true);
__ lwz(R11_scratch1, simm16_offs, tmp);
@@ -2093,8 +2092,8 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
#endif
__ nand(tmp, R3_RET, R3_RET);
- __ cmpwi(CCR0, R3_RET, 0);
- __ beq(CCR0, *stub->continuation());
+ __ cmpwi(CR0, R3_RET, 0);
+ __ beq(CR0, *stub->continuation());
#ifndef PRODUCT
if (PrintC1Statistics) {
@@ -2127,15 +2126,15 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
// but not necessarily exactly of type default_type.
Label known_ok, halt;
metadata2reg(default_type->constant_encoding(), tmp);
- __ cmp_klass(CCR0, dst, tmp, R11_scratch1, R12_scratch2);
+ __ cmp_klass(CR0, dst, tmp, R11_scratch1, R12_scratch2);
if (basic_type != T_OBJECT) {
- __ bne(CCR0, halt);
- __ cmp_klass(CCR0, src, tmp, R11_scratch1, R12_scratch2);
- __ beq(CCR0, known_ok);
+ __ bne(CR0, halt);
+ __ cmp_klass(CR0, src, tmp, R11_scratch1, R12_scratch2);
+ __ beq(CR0, known_ok);
} else {
- __ beq(CCR0, known_ok);
- __ cmpw(CCR0, src, dst);
- __ beq(CCR0, known_ok);
+ __ beq(CR0, known_ok);
+ __ cmpw(CR0, src, dst);
+ __ beq(CR0, known_ok);
}
__ bind(halt);
__ stop("incorrect type information in arraycopy");
@@ -2270,8 +2269,8 @@ void LIR_Assembler::emit_alloc_obj(LIR_OpAllocObj* op) {
__ lbz(op->tmp1()->as_register(),
in_bytes(InstanceKlass::init_state_offset()), op->klass()->as_register());
// acquire barrier included in membar_storestore() which follows the allocation immediately.
- __ cmpwi(CCR0, op->tmp1()->as_register(), InstanceKlass::fully_initialized);
- __ bc_far_optimized(Assembler::bcondCRbiIs0, __ bi0(CCR0, Assembler::equal), *op->stub()->entry());
+ __ cmpwi(CR0, op->tmp1()->as_register(), InstanceKlass::fully_initialized);
+ __ bc_far_optimized(Assembler::bcondCRbiIs0, __ bi0(CR0, Assembler::equal), *op->stub()->entry());
}
__ allocate_object(op->obj()->as_register(),
op->tmp1()->as_register(),
@@ -2318,8 +2317,8 @@ void LIR_Assembler::type_profile_helper(Register mdo, int mdo_offset_bias,
// See if the receiver is receiver[n].
__ ld(tmp1, md->byte_offset_of_slot(data, ReceiverTypeData::receiver_offset(i)) - mdo_offset_bias, mdo);
__ verify_klass_ptr(tmp1);
- __ cmpd(CCR0, recv, tmp1);
- __ bne(CCR0, next_test);
+ __ cmpd(CR0, recv, tmp1);
+ __ bne(CR0, next_test);
__ ld(tmp1, md->byte_offset_of_slot(data, ReceiverTypeData::receiver_count_offset(i)) - mdo_offset_bias, mdo);
__ addi(tmp1, tmp1, DataLayout::counter_increment);
@@ -2333,8 +2332,8 @@ void LIR_Assembler::type_profile_helper(Register mdo, int mdo_offset_bias,
for (i = 0; i < VirtualCallData::row_limit(); i++) {
Label next_test;
__ ld(tmp1, md->byte_offset_of_slot(data, ReceiverTypeData::receiver_offset(i)) - mdo_offset_bias, mdo);
- __ cmpdi(CCR0, tmp1, 0);
- __ bne(CCR0, next_test);
+ __ cmpdi(CR0, tmp1, 0);
+ __ bne(CR0, next_test);
__ li(tmp1, DataLayout::counter_increment);
__ std(recv, md->byte_offset_of_slot(data, ReceiverTypeData::receiver_offset(i)) - mdo_offset_bias, mdo);
__ std(tmp1, md->byte_offset_of_slot(data, ReceiverTypeData::receiver_count_offset(i)) - mdo_offset_bias, mdo);
@@ -2395,8 +2394,8 @@ void LIR_Assembler::emit_typecheck_helper(LIR_OpTypeCheck *op, Label* success, L
Label not_null;
metadata2reg(md->constant_encoding(), mdo);
__ add_const_optimized(mdo, mdo, mdo_offset_bias, R0);
- __ cmpdi(CCR0, obj, 0);
- __ bne(CCR0, not_null);
+ __ cmpdi(CR0, obj, 0);
+ __ bne(CR0, not_null);
__ lbz(data_val, md->byte_offset_of_slot(data, DataLayout::flags_offset()) - mdo_offset_bias, mdo);
__ ori(data_val, data_val, BitData::null_seen_byte_constant());
__ stb(data_val, md->byte_offset_of_slot(data, DataLayout::flags_offset()) - mdo_offset_bias, mdo);
@@ -2413,8 +2412,8 @@ void LIR_Assembler::emit_typecheck_helper(LIR_OpTypeCheck *op, Label* success, L
__ std(Rtmp1, slot_offset, mdo);
__ bind(update_done);
} else {
- __ cmpdi(CCR0, obj, 0);
- __ beq(CCR0, *obj_is_null);
+ __ cmpdi(CR0, obj, 0);
+ __ beq(CR0, *obj_is_null);
}
// get object class
@@ -2428,8 +2427,8 @@ void LIR_Assembler::emit_typecheck_helper(LIR_OpTypeCheck *op, Label* success, L
if (op->fast_check()) {
assert_different_registers(klass_RInfo, k_RInfo);
- __ cmpd(CCR0, k_RInfo, klass_RInfo);
- __ beq(CCR0, *success);
+ __ cmpd(CR0, k_RInfo, klass_RInfo);
+ __ beq(CR0, *success);
// Fall through to failure case.
} else {
bool need_slow_path = true;
@@ -2463,7 +2462,7 @@ void LIR_Assembler::emit_typecheck_helper(LIR_OpTypeCheck *op, Label* success, L
__ mtctr(original_Rtmp1);
__ bctrl(); // sets CR0
if (keep_obj_alive) { __ mr(obj, dst); }
- __ beq(CCR0, *success);
+ __ beq(CR0, *success);
// Fall through to failure case.
}
}
@@ -2502,8 +2501,8 @@ void LIR_Assembler::emit_opTypeCheck(LIR_OpTypeCheck* op) {
Register data_val = Rtmp1;
metadata2reg(md->constant_encoding(), mdo);
__ add_const_optimized(mdo, mdo, mdo_offset_bias, R0);
- __ cmpdi(CCR0, value, 0);
- __ bne(CCR0, not_null);
+ __ cmpdi(CR0, value, 0);
+ __ bne(CR0, not_null);
__ lbz(data_val, md->byte_offset_of_slot(data, DataLayout::flags_offset()) - mdo_offset_bias, mdo);
__ ori(data_val, data_val, BitData::null_seen_byte_constant());
__ stb(data_val, md->byte_offset_of_slot(data, DataLayout::flags_offset()) - mdo_offset_bias, mdo);
@@ -2520,8 +2519,8 @@ void LIR_Assembler::emit_opTypeCheck(LIR_OpTypeCheck* op) {
__ std(Rtmp1, slot_offset, mdo);
__ bind(update_done);
} else {
- __ cmpdi(CCR0, value, 0);
- __ beq(CCR0, done);
+ __ cmpdi(CR0, value, 0);
+ __ beq(CR0, done);
}
if (!os::zero_page_read_protected() || !ImplicitNullChecks) {
explicit_null_check(array, op->info_for_exception());
@@ -2544,7 +2543,7 @@ void LIR_Assembler::emit_opTypeCheck(LIR_OpTypeCheck* op) {
__ add_const_optimized(R0, R29_TOC, MacroAssembler::offset_to_global_toc(slow_path));
__ mtctr(R0);
__ bctrl(); // sets CR0
- __ beq(CCR0, done);
+ __ beq(CR0, done);
__ bind(failure);
__ b(*stub->entry());
@@ -2840,25 +2839,28 @@ void LIR_Assembler::negate(LIR_Opr left, LIR_Opr dest, LIR_Opr tmp) {
void LIR_Assembler::rt_call(LIR_Opr result, address dest,
const LIR_OprList* args, LIR_Opr tmp, CodeEmitInfo* info) {
- // Stubs: Called via rt_call, but dest is a stub address (no function descriptor).
+ // Stubs: Called via rt_call, but dest is a stub address (no FunctionDescriptor).
if (dest == Runtime1::entry_for(C1StubId::register_finalizer_id) ||
- dest == Runtime1::entry_for(C1StubId::new_multi_array_id )) {
+ dest == Runtime1::entry_for(C1StubId::new_multi_array_id ) ||
+ dest == Runtime1::entry_for(C1StubId::is_instance_of_id )) {
+ assert(CodeCache::contains(dest), "simplified call is only for special C1 stubs");
//__ load_const_optimized(R0, dest);
__ add_const_optimized(R0, R29_TOC, MacroAssembler::offset_to_global_toc(dest));
__ mtctr(R0);
__ bctrl();
- assert(info != nullptr, "sanity");
- add_call_info_here(info);
- __ post_call_nop();
+ if (info != nullptr) {
+ add_call_info_here(info);
+ __ post_call_nop();
+ }
return;
}
__ call_c(dest, relocInfo::runtime_call_type);
+ assert(__ last_calls_return_pc() == __ pc(), "pcn not at return pc");
if (info != nullptr) {
add_call_info_here(info);
+ __ post_call_nop();
}
- assert(__ last_calls_return_pc() == __ pc(), "pcn not at return pc");
- __ post_call_nop();
}
@@ -3025,9 +3027,9 @@ void LIR_Assembler::atomic_op(LIR_Code code, LIR_Opr src, LIR_Opr data, LIR_Opr
}
if (UseStaticBranchPredictionInCompareAndSwapPPC64) {
- __ bne_predict_not_taken(CCR0, Lretry);
+ __ bne_predict_not_taken(CR0, Lretry);
} else {
- __ bne( CCR0, Lretry);
+ __ bne( CR0, Lretry);
}
if (UseCompressedOops && data->is_oop()) {
@@ -3064,8 +3066,8 @@ void LIR_Assembler::emit_profile_type(LIR_OpProfileType* op) {
if (do_null) {
if (!TypeEntries::was_null_seen(current_klass)) {
- __ cmpdi(CCR0, obj, 0);
- __ bne(CCR0, Lupdate);
+ __ cmpdi(CR0, obj, 0);
+ __ bne(CR0, Lupdate);
__ ld(R0, index_or_disp(mdo_addr), mdo_addr->base()->as_pointer_register());
__ ori(R0, R0, TypeEntries::null_seen);
if (do_update) {
@@ -3075,14 +3077,14 @@ void LIR_Assembler::emit_profile_type(LIR_OpProfileType* op) {
}
} else {
if (do_update) {
- __ cmpdi(CCR0, obj, 0);
- __ beq(CCR0, Ldone);
+ __ cmpdi(CR0, obj, 0);
+ __ beq(CR0, Ldone);
}
}
#ifdef ASSERT
} else {
- __ cmpdi(CCR0, obj, 0);
- __ bne(CCR0, Lupdate);
+ __ cmpdi(CR0, obj, 0);
+ __ bne(CR0, Lupdate);
__ stop("unexpected null obj");
#endif
}
@@ -3098,8 +3100,8 @@ void LIR_Assembler::emit_profile_type(LIR_OpProfileType* op) {
klass_reg_used = true;
__ load_klass(klass, obj);
metadata2reg(exact_klass->constant_encoding(), R0);
- __ cmpd(CCR0, klass, R0);
- __ beq(CCR0, ok);
+ __ cmpd(CR0, klass, R0);
+ __ beq(CR0, ok);
__ stop("exact klass and actual klass differ");
__ bind(ok);
}
@@ -3119,20 +3121,20 @@ void LIR_Assembler::emit_profile_type(LIR_OpProfileType* op) {
// Like InterpreterMacroAssembler::profile_obj_type
__ clrrdi(R0, tmp, exact_log2(-TypeEntries::type_klass_mask));
// Basically same as andi(R0, tmp, TypeEntries::type_klass_mask);
- __ cmpd(CCR1, R0, klass);
+ __ cmpd(CR1, R0, klass);
// Klass seen before, nothing to do (regardless of unknown bit).
- //beq(CCR1, do_nothing);
+ //beq(CR1, do_nothing);
__ andi_(R0, tmp, TypeEntries::type_unknown);
// Already unknown. Nothing to do anymore.
- //bne(CCR0, do_nothing);
- __ crorc(CCR0, Assembler::equal, CCR1, Assembler::equal); // cr0 eq = cr1 eq or cr0 ne
- __ beq(CCR0, Lnext);
+ //bne(CR0, do_nothing);
+ __ crorc(CR0, Assembler::equal, CR1, Assembler::equal); // cr0 eq = cr1 eq or cr0 ne
+ __ beq(CR0, Lnext);
if (TypeEntries::is_type_none(current_klass)) {
__ clrrdi_(R0, tmp, exact_log2(-TypeEntries::type_mask));
__ orr(R0, klass, tmp); // Combine klass and null_seen bit (only used if (tmp & type_mask)==0).
- __ beq(CCR0, Ldo_update); // First time here. Set profile type.
+ __ beq(CR0, Ldo_update); // First time here. Set profile type.
}
} else {
@@ -3142,7 +3144,7 @@ void LIR_Assembler::emit_profile_type(LIR_OpProfileType* op) {
__ ld(tmp, index_or_disp(mdo_addr), mdo_addr->base()->as_pointer_register());
__ andi_(R0, tmp, TypeEntries::type_unknown);
// Already unknown. Nothing to do anymore.
- __ bne(CCR0, Lnext);
+ __ bne(CR0, Lnext);
}
// Different than before. Cannot keep accurate profile.
@@ -3158,14 +3160,14 @@ void LIR_Assembler::emit_profile_type(LIR_OpProfileType* op) {
__ clrrdi(R0, tmp, exact_log2(-TypeEntries::type_klass_mask));
// Basically same as andi(R0, tmp, TypeEntries::type_klass_mask);
- __ cmpd(CCR1, R0, klass);
+ __ cmpd(CR1, R0, klass);
// Klass seen before, nothing to do (regardless of unknown bit).
- __ beq(CCR1, Lnext);
+ __ beq(CR1, Lnext);
#ifdef ASSERT
{
Label ok;
__ clrrdi_(R0, tmp, exact_log2(-TypeEntries::type_mask));
- __ beq(CCR0, ok); // First time here.
+ __ beq(CR0, ok); // First time here.
__ stop("unexpected profiling mismatch");
__ bind(ok);
@@ -3179,7 +3181,7 @@ void LIR_Assembler::emit_profile_type(LIR_OpProfileType* op) {
// Already unknown. Nothing to do anymore.
__ andi_(R0, tmp, TypeEntries::type_unknown);
- __ bne(CCR0, Lnext);
+ __ bne(CR0, Lnext);
// Different than before. Cannot keep accurate profile.
__ ori(R0, tmp, TypeEntries::type_unknown);
diff --git a/src/hotspot/cpu/ppc/c1_LIRGenerator_ppc.cpp b/src/hotspot/cpu/ppc/c1_LIRGenerator_ppc.cpp
index b332ffbcee7d1..b9c8ced8ef192 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;
}
@@ -1132,6 +1129,12 @@ void LIRGenerator::do_InstanceOf(InstanceOf* x) {
}
+// Intrinsic for Class::isInstance
+address LIRGenerator::isInstance_entry() {
+ return Runtime1::entry_for(C1StubId::is_instance_of_id);
+}
+
+
void LIRGenerator::do_If(If* x) {
assert(x->number_of_sux() == 2, "inconsistency");
ValueTag tag = x->x()->type()->tag();
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..ac9c5984de050 100644
--- a/src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.cpp
+++ b/src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.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 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "c1/c1_MacroAssembler.hpp"
#include "c1/c1_Runtime1.hpp"
@@ -87,8 +86,8 @@ void C1_MacroAssembler::lock_object(Register Rmark, Register Roop, Register Rbox
if (DiagnoseSyncOnValueBasedClasses != 0) {
load_klass(Rscratch, Roop);
lbz(Rscratch, in_bytes(Klass::misc_flags_offset()), Rscratch);
- testbitdi(CCR0, R0, Rscratch, exact_log2(KlassFlags::_misc_is_value_based_class));
- bne(CCR0, slow_int);
+ testbitdi(CR0, R0, Rscratch, exact_log2(KlassFlags::_misc_is_value_based_class));
+ bne(CR0, slow_int);
}
if (LockingMode == LM_LIGHTWEIGHT) {
@@ -102,7 +101,7 @@ void C1_MacroAssembler::lock_object(Register Rmark, Register Roop, Register Rbox
// Compare object markWord with Rmark and if equal exchange Rscratch with object markWord.
assert(oopDesc::mark_offset_in_bytes() == 0, "cas must take a zero displacement");
- cmpxchgd(/*flag=*/CCR0,
+ cmpxchgd(/*flag=*/CR0,
/*current_value=*/Rscratch,
/*compare_value=*/Rmark,
/*exchange_value=*/Rbox,
@@ -129,7 +128,7 @@ void C1_MacroAssembler::lock_object(Register Rmark, Register Roop, Register Rbox
load_const_optimized(R0, (~(os::vm_page_size()-1) | markWord::lock_mask_in_place));
and_(R0/*==0?*/, Rscratch, R0);
std(R0/*==0, perhaps*/, BasicLock::displaced_header_offset_in_bytes(), Rbox);
- bne(CCR0, slow_int);
+ bne(CR0, slow_int);
}
bind(done);
@@ -150,8 +149,8 @@ void C1_MacroAssembler::unlock_object(Register Rmark, Register Roop, Register Rb
if (LockingMode != LM_LIGHTWEIGHT) {
// Test first if it is a fast recursive unlock.
ld(Rmark, BasicLock::displaced_header_offset_in_bytes(), Rbox);
- cmpdi(CCR0, Rmark, 0);
- beq(CCR0, done);
+ cmpdi(CR0, Rmark, 0);
+ beq(CR0, done);
}
// Load object.
@@ -163,7 +162,7 @@ void C1_MacroAssembler::unlock_object(Register Rmark, Register Roop, Register Rb
} else if (LockingMode == LM_LEGACY) {
// Check if it is still a light weight lock, this is is true if we see
// the stack address of the basicLock in the markWord of the object.
- cmpxchgd(/*flag=*/CCR0,
+ cmpxchgd(/*flag=*/CR0,
/*current_value=*/R0,
/*compare_value=*/Rbox,
/*exchange_value=*/Rmark,
@@ -286,9 +285,9 @@ void C1_MacroAssembler::initialize_object(
{
lwz(t1, in_bytes(Klass::layout_helper_offset()), klass);
if (var_size_in_bytes != noreg) {
- cmpw(CCR0, t1, var_size_in_bytes);
+ cmpw(CR0, t1, var_size_in_bytes);
} else {
- cmpwi(CCR0, t1, con_size_in_bytes);
+ cmpwi(CR0, t1, con_size_in_bytes);
}
asm_assert_eq("bad size in initialize_object");
}
@@ -341,8 +340,8 @@ void C1_MacroAssembler::allocate_array(
if (max_tlab < max_length) { max_length = max_tlab; }
}
load_const_optimized(t1, max_length);
- cmpld(CCR0, len, t1);
- bc_far_optimized(Assembler::bcondCRbiIs1, bi0(CCR0, Assembler::greater), slow_case);
+ cmpld(CR0, len, t1);
+ bc_far_optimized(Assembler::bcondCRbiIs1, bi0(CR0, Assembler::greater), slow_case);
// compute array size
// note: If 0 <= len <= max_length, len*elt_size + header + alignment is
@@ -400,8 +399,8 @@ void C1_MacroAssembler::verify_stack_oop(int stack_offset) {
void C1_MacroAssembler::verify_not_null_oop(Register r) {
Label not_null;
- cmpdi(CCR0, r, 0);
- bne(CCR0, not_null);
+ cmpdi(CR0, r, 0);
+ bne(CR0, not_null);
stop("non-null oop required");
bind(not_null);
verify_oop(r, FILE_AND_LINE);
@@ -415,7 +414,7 @@ void C1_MacroAssembler::null_check(Register r, Label* Lnull) {
} else { // explicit
//const address exception_entry = Runtime1::entry_for(C1StubId::throw_null_pointer_exception_id);
assert(Lnull != nullptr, "must have Label for explicit check");
- cmpdi(CCR0, r, 0);
- bc_far_optimized(Assembler::bcondCRbiIs1, bi0(CCR0, Assembler::equal), *Lnull);
+ cmpdi(CR0, r, 0);
+ bc_far_optimized(Assembler::bcondCRbiIs1, bi0(CR0, Assembler::equal), *Lnull);
}
}
diff --git a/src/hotspot/cpu/ppc/c1_Runtime1_ppc.cpp b/src/hotspot/cpu/ppc/c1_Runtime1_ppc.cpp
index 47cafc45f33ea..11c01dcdc60e6 100644
--- a/src/hotspot/cpu/ppc/c1_Runtime1_ppc.cpp
+++ b/src/hotspot/cpu/ppc/c1_Runtime1_ppc.cpp
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2023 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 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "c1/c1_Defs.hpp"
#include "c1/c1_MacroAssembler.hpp"
@@ -70,14 +69,14 @@ int StubAssembler::call_RT(Register oop_result1, Register metadata_result,
// Check for pending exceptions.
{
ld(R0, in_bytes(Thread::pending_exception_offset()), R16_thread);
- cmpdi(CCR0, R0, 0);
+ cmpdi(CR0, R0, 0);
// This used to conditionally jump to forward_exception however it is
// possible if we relocate that the branch will not reach. So we must jump
// around so we can always reach.
Label ok;
- beq(CCR0, ok);
+ beq(CR0, ok);
// Make sure that the vm_results are cleared.
if (oop_result1->is_valid() || metadata_result->is_valid()) {
@@ -369,7 +368,7 @@ OopMapSet* Runtime1::generate_patching(StubAssembler* sasm, address target) {
int call_offset = __ call_RT(noreg, noreg, target);
OopMapSet* oop_maps = new OopMapSet();
oop_maps->add_gc_map(call_offset, oop_map);
- __ cmpdi(CCR0, R3_RET, 0);
+ __ cmpdi(CR0, R3_RET, 0);
// Re-execute the patched instruction or, if the nmethod was deoptmized,
// return to the deoptimization handler entry that will cause re-execution
@@ -383,7 +382,7 @@ OopMapSet* Runtime1::generate_patching(StubAssembler* sasm, address target) {
restore_live_registers(sasm, noreg, noreg);
// Return if patching routine returned 0.
- __ bclr(Assembler::bcondCRbiIs1, Assembler::bi0(CCR0, Assembler::equal), Assembler::bhintbhBCLRisReturn);
+ __ bclr(Assembler::bcondCRbiIs1, Assembler::bi0(CR0, Assembler::equal), Assembler::bhintbhBCLRisReturn);
address stub = deopt_blob->unpack_with_reexecution();
//__ load_const_optimized(R0, stub);
@@ -449,8 +448,8 @@ OopMapSet* Runtime1::generate_code_for(C1StubId id, StubAssembler* sasm) {
Label ok;
__ lwz(R0, in_bytes(Klass::layout_helper_offset()), R4_ARG2);
__ srawi(R0, R0, Klass::_lh_array_tag_shift);
- __ cmpwi(CCR0, R0, tag);
- __ beq(CCR0, ok);
+ __ cmpwi(CR0, R0, tag);
+ __ beq(CR0, ok);
__ stop("assert(is an array klass)");
__ should_not_reach_here();
__ bind(ok);
@@ -486,9 +485,9 @@ OopMapSet* Runtime1::generate_code_for(C1StubId id, StubAssembler* sasm) {
// Load the klass and check the has finalizer flag.
__ load_klass(t, R3_ARG1);
__ lbz(t, in_bytes(Klass::misc_flags_offset()), t);
- __ testbitdi(CCR0, R0, t, exact_log2(KlassFlags::_misc_has_finalizer));
+ __ testbitdi(CR0, R0, t, exact_log2(KlassFlags::_misc_has_finalizer));
// Return if has_finalizer bit == 0 (CR0.eq).
- __ bclr(Assembler::bcondCRbiIs1, Assembler::bi0(CCR0, Assembler::equal), Assembler::bhintbhBCLRisReturn);
+ __ bclr(Assembler::bcondCRbiIs1, Assembler::bi0(CR0, Assembler::equal), Assembler::bhintbhBCLRisReturn);
__ mflr(R0);
__ std(R0, _abi0(lr), R1_SP);
@@ -603,10 +602,76 @@ 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;
+
+ case C1StubId::is_instance_of_id:
+ {
+ // Called like a C function, but without FunctionDescriptor (see LIR_Assembler::rt_call).
+
+ // Arguments and return value.
+ Register mirror = R3_ARG1;
+ Register obj = R4_ARG2;
+ Register result = R3_RET;
+
+ // Other argument registers can be used as temp registers.
+ Register klass = R5;
+ Register offset = R6;
+ Register sub_klass = R7;
+
+ Label is_secondary, success;
+
+ // Get the Klass*.
+ __ ld(klass, java_lang_Class::klass_offset(), mirror);
+
+ // Return false if obj or klass is null.
+ mirror = noreg; // killed by next instruction
+ __ li(result, 0); // assume result is false
+ __ cmpdi(CR0, obj, 0);
+ __ cmpdi(CR1, klass, 0);
+ __ cror(CR0, Assembler::equal, CR1, Assembler::equal);
+ __ bclr(Assembler::bcondCRbiIs1, Assembler::bi0(CR0, Assembler::equal), Assembler::bhintbhBCLRisReturn);
+
+ __ lwz(offset, in_bytes(Klass::super_check_offset_offset()), klass);
+ __ load_klass(sub_klass, obj);
+ __ cmpwi(CR0, offset, in_bytes(Klass::secondary_super_cache_offset()));
+ __ beq(CR0, is_secondary); // Klass is a secondary superclass
+
+ // Klass is a concrete class
+ __ ldx(R0, sub_klass, offset);
+ __ cmpd(CR0, klass, R0);
+ if (VM_Version::has_brw()) {
+ // Power10 can set the result by one instruction. No need for a branch.
+ __ setbc(result, CR0, Assembler::equal);
+ } else {
+ __ beq(CR0, success);
+ }
+ __ blr();
+
+ __ bind(is_secondary);
+
+ // This is necessary because I am never in my own secondary_super list.
+ __ cmpd(CR0, sub_klass, klass);
+ __ beq(CR0, success);
+
+ __ lookup_secondary_supers_table_var(sub_klass, klass,
+ /*temps*/R9, R10, R11, R12,
+ /*result*/R8);
+ __ cmpdi(CR0, R8, 0); // 0 means is subclass
+ if (VM_Version::has_brw()) {
+ // Power10 can set the result by one instruction. No need for a branch.
+ __ setbc(result, CR0, Assembler::equal);
+ } else {
+ __ beq(CR0, success);
+ }
+ __ blr();
+
+ __ bind(success);
+ __ li(result, 1);
__ blr();
}
break;
@@ -807,10 +872,10 @@ OopMapSet* Runtime1::generate_handle_exception(C1StubId id, StubAssembler* sasm)
// Check that fields in JavaThread for exception oop and issuing pc are
// empty before writing to them.
__ ld(R0, in_bytes(JavaThread::exception_oop_offset()), R16_thread);
- __ cmpdi(CCR0, R0, 0);
+ __ cmpdi(CR0, R0, 0);
__ asm_assert_eq("exception oop already set");
__ ld(R0, in_bytes(JavaThread::exception_pc_offset() ), R16_thread);
- __ cmpdi(CCR0, R0, 0);
+ __ cmpdi(CR0, R0, 0);
__ asm_assert_eq("exception pc already set");
#endif
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..cddf08eceb15c 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"
@@ -71,7 +70,7 @@ void C2_MacroAssembler::string_compress_16(Register src, Register dst, Register
// Check if cnt >= 8 (= 16 bytes)
lis(tmp1, byte_mask); // tmp1 = 0x00FF00FF00FF00FF (non ascii case)
srwi_(tmp2, cnt, 3);
- beq(CCR0, Lslow);
+ beq(CR0, Lslow);
ori(tmp1, tmp1, byte_mask);
rldimi(tmp1, tmp1, 32, 0);
mtctr(tmp2);
@@ -88,7 +87,7 @@ void C2_MacroAssembler::string_compress_16(Register src, Register dst, Register
rldimi(tmp4, tmp4, 2*8, 2*8); // _4_6_7_7
andc_(tmp0, tmp0, tmp1);
- bne(CCR0, Lfailure); // Not latin1/ascii.
+ bne(CR0, Lfailure); // Not latin1/ascii.
addi(src, src, 16);
rlwimi(tmp3, tmp2, 0*8, 24, 31);// _____1_3
@@ -116,8 +115,8 @@ void C2_MacroAssembler::string_compress(Register src, Register dst, Register cnt
bind(Lloop);
lhz(tmp, 0, src);
- cmplwi(CCR0, tmp, byte_mask);
- bgt(CCR0, Lfailure); // Not latin1/ascii.
+ cmplwi(CR0, tmp, byte_mask);
+ bgt(CR0, Lfailure); // Not latin1/ascii.
addi(src, src, 2);
stb(tmp, 0, dst);
addi(dst, dst, 1);
@@ -131,7 +130,7 @@ void C2_MacroAssembler::encode_iso_array(Register src, Register dst, Register le
string_compress_16(src, dst, len, tmp1, tmp2, tmp3, tmp4, tmp5, Lfailure1, ascii);
rldicl_(result, len, 0, 64-3); // Remaining characters.
- beq(CCR0, Ldone);
+ beq(CR0, Ldone);
bind(Lslow);
string_compress(src, dst, result, tmp2, Lfailure2, ascii);
li(result, 0);
@@ -141,7 +140,7 @@ void C2_MacroAssembler::encode_iso_array(Register src, Register dst, Register le
mr(result, len);
mfctr(tmp1);
rldimi_(result, tmp1, 3, 0); // Remaining characters.
- beq(CCR0, Ldone);
+ beq(CR0, Ldone);
b(Lslow);
bind(Lfailure2);
@@ -160,7 +159,7 @@ void C2_MacroAssembler::string_inflate_16(Register src, Register dst, Register c
// Check if cnt >= 8
srwi_(tmp2, cnt, 3);
- beq(CCR0, Lslow);
+ beq(CR0, Lslow);
lis(tmp1, 0xFF); // tmp1 = 0x00FF00FF
ori(tmp1, tmp1, 0xFF);
mtctr(tmp2);
@@ -236,10 +235,10 @@ void C2_MacroAssembler::string_compare(Register str1, Register str2,
subf_(diff, cnt2, cnt1); // diff = cnt1 - cnt2
// if (diff > 0) { cnt1 = cnt2; }
if (VM_Version::has_isel()) {
- isel(cnt1, CCR0, Assembler::greater, /*invert*/ false, cnt2);
+ isel(cnt1, CR0, Assembler::greater, /*invert*/ false, cnt2);
} else {
Label Lskip;
- blt(CCR0, Lskip);
+ blt(CR0, Lskip);
mr(cnt1, cnt2);
bind(Lskip);
}
@@ -255,7 +254,7 @@ void C2_MacroAssembler::string_compare(Register str1, Register str2,
Label Lfastloop, Lskipfast;
srwi_(tmp0, cnt1, log2_chars_per_iter);
- beq(CCR0, Lskipfast);
+ beq(CR0, Lskipfast);
rldicl(cnt2, cnt1, 0, 64 - log2_chars_per_iter); // Remaining characters.
li(cnt1, 1 << log2_chars_per_iter); // Initialize for failure case: Rescan characters from current iteration.
mtctr(tmp0);
@@ -263,8 +262,8 @@ void C2_MacroAssembler::string_compare(Register str1, Register str2,
bind(Lfastloop);
ld(chr1, 0, str1);
ld(chr2, 0, str2);
- cmpd(CCR0, chr1, chr2);
- bne(CCR0, Lslow);
+ cmpd(CR0, chr1, chr2);
+ bne(CR0, Lslow);
addi(str1, str1, stride1);
addi(str2, str2, stride2);
bdnz(Lfastloop);
@@ -273,8 +272,8 @@ void C2_MacroAssembler::string_compare(Register str1, Register str2,
}
// Loop which searches the first difference character by character.
- cmpwi(CCR0, cnt1, 0);
- beq(CCR0, Lreturn_diff);
+ cmpwi(CR0, cnt1, 0);
+ beq(CR0, Lreturn_diff);
bind(Lslow);
mtctr(cnt1);
@@ -290,7 +289,7 @@ void C2_MacroAssembler::string_compare(Register str1, Register str2,
if (stride1 == 1) { lbz(chr1, 0, str1); } else { lhz(chr1, 0, str1); }
if (stride2 == 1) { lbz(chr2, 0, str2); } else { lhz(chr2, 0, str2); }
subf_(result, chr2, chr1); // result = chr1 - chr2
- bne(CCR0, Ldone);
+ bne(CR0, Ldone);
addi(str1, str1, stride1);
addi(str2, str2, stride2);
bdnz(Lloop);
@@ -318,23 +317,23 @@ void C2_MacroAssembler::array_equals(bool is_array_equ, Register ary1, Register
const int base_offset = arrayOopDesc::base_offset_in_bytes(is_byte ? T_BYTE : T_CHAR);
// Return true if the same array.
- cmpd(CCR0, ary1, ary2);
- beq(CCR0, Lskiploop);
+ cmpd(CR0, ary1, ary2);
+ beq(CR0, Lskiploop);
// Return false if one of them is null.
- cmpdi(CCR0, ary1, 0);
- cmpdi(CCR1, ary2, 0);
+ cmpdi(CR0, ary1, 0);
+ cmpdi(CR1, ary2, 0);
li(result, 0);
- cror(CCR0, Assembler::equal, CCR1, Assembler::equal);
- beq(CCR0, Ldone);
+ cror(CR0, Assembler::equal, CR1, Assembler::equal);
+ beq(CR0, Ldone);
// Load the lengths of arrays.
lwz(limit, length_offset, ary1);
lwz(tmp0, length_offset, ary2);
// Return false if the two arrays are not equal length.
- cmpw(CCR0, limit, tmp0);
- bne(CCR0, Ldone);
+ cmpw(CR0, limit, tmp0);
+ bne(CR0, Ldone);
// Load array addresses.
addi(ary1, ary1, base_offset);
@@ -352,7 +351,7 @@ void C2_MacroAssembler::array_equals(bool is_array_equ, Register ary1, Register
const int log2_chars_per_iter = is_byte ? 3 : 2;
srwi_(tmp0, limit, log2_chars_per_iter + (limit_needs_shift ? 1 : 0));
- beq(CCR0, Lskipfast);
+ beq(CR0, Lskipfast);
mtctr(tmp0);
bind(Lfastloop);
@@ -360,13 +359,13 @@ void C2_MacroAssembler::array_equals(bool is_array_equ, Register ary1, Register
ld(chr2, 0, ary2);
addi(ary1, ary1, 8);
addi(ary2, ary2, 8);
- cmpd(CCR0, chr1, chr2);
- bne(CCR0, Ldone);
+ cmpd(CR0, chr1, chr2);
+ bne(CR0, Ldone);
bdnz(Lfastloop);
bind(Lskipfast);
rldicl_(limit, limit, limit_needs_shift ? 64 - 1 : 0, 64 - log2_chars_per_iter); // Remaining characters.
- beq(CCR0, Lskiploop);
+ beq(CR0, Lskiploop);
mtctr(limit);
// Character by character.
@@ -382,8 +381,8 @@ void C2_MacroAssembler::array_equals(bool is_array_equ, Register ary1, Register
addi(ary1, ary1, 2);
addi(ary2, ary2, 2);
}
- cmpw(CCR0, chr1, chr2);
- bne(CCR0, Ldone);
+ cmpw(CR0, chr1, chr2);
+ bne(CR0, Ldone);
bdnz(Lloop);
bind(Lskiploop);
@@ -415,9 +414,9 @@ void C2_MacroAssembler::string_indexof(Register result, Register haystack, Regis
clrldi(haycnt, haycnt, 32); // Ensure positive int is valid as 64 bit value.
addi(addr, haystack, -h_csize); // Accesses use pre-increment.
if (needlecntval == 0) { // variable needlecnt
- cmpwi(CCR6, needlecnt, 2);
+ cmpwi(CR6, needlecnt, 2);
clrldi(needlecnt, needlecnt, 32); // Ensure positive int is valid as 64 bit value.
- blt(CCR6, L_TooShort); // Variable needlecnt: handle short needle separately.
+ blt(CR6, L_TooShort); // Variable needlecnt: handle short needle separately.
}
if (n_csize == 2) { lwz(n_start, 0, needle); } else { lhz(n_start, 0, needle); } // Load first 2 characters of needle.
@@ -448,7 +447,7 @@ void C2_MacroAssembler::string_indexof(Register result, Register haystack, Regis
subf(addr_diff, addr, last_addr); // Difference between already checked address and last address to check.
addi(addr, addr, h_csize); // This is the new address we want to use for comparing.
srdi_(ch2, addr_diff, h_csize);
- beq(CCR0, L_FinalCheck); // 2 characters left?
+ beq(CR0, L_FinalCheck); // 2 characters left?
mtctr(ch2); // num of characters / 2
bind(L_InnerLoop); // Main work horse (2x unrolled search loop)
if (h_csize == 2) { // Load 2 characters of haystack (ignore alignment).
@@ -458,18 +457,18 @@ void C2_MacroAssembler::string_indexof(Register result, Register haystack, Regis
lhz(ch1, 0, addr);
lhz(ch2, 1, addr);
}
- cmpw(CCR0, ch1, n_start); // Compare 2 characters (1 would be sufficient but try to reduce branches to CompLoop).
- cmpw(CCR1, ch2, n_start);
- beq(CCR0, L_Comp1); // Did we find the needle start?
- beq(CCR1, L_Comp2);
+ cmpw(CR0, ch1, n_start); // Compare 2 characters (1 would be sufficient but try to reduce branches to CompLoop).
+ cmpw(CR1, ch2, n_start);
+ beq(CR0, L_Comp1); // Did we find the needle start?
+ beq(CR1, L_Comp2);
addi(addr, addr, 2 * h_csize);
bdnz(L_InnerLoop);
bind(L_FinalCheck);
andi_(addr_diff, addr_diff, h_csize); // Remaining characters not covered by InnerLoop: (num of characters) & 1.
- beq(CCR0, L_NotFound);
+ beq(CR0, L_NotFound);
if (h_csize == 2) { lwz(ch1, 0, addr); } else { lhz(ch1, 0, addr); } // One position left at which we have to compare.
- cmpw(CCR1, ch1, n_start);
- beq(CCR1, L_Comp1);
+ cmpw(CR1, ch1, n_start);
+ beq(CR1, L_Comp1);
bind(L_NotFound);
li(result, -1); // not found
b(L_End);
@@ -484,8 +483,8 @@ void C2_MacroAssembler::string_indexof(Register result, Register haystack, Regis
if (n_csize == 2) { lhz(n_start, 0, needle); } else { lbz(n_start, 0, needle); } // First character of needle
bind(L_OneCharLoop);
if (h_csize == 2) { lhzu(ch1, 2, addr); } else { lbzu(ch1, 1, addr); }
- cmpw(CCR1, ch1, n_start);
- beq(CCR1, L_Found); // Did we find the one character needle?
+ cmpw(CR1, ch1, n_start);
+ beq(CR1, L_Found); // Did we find the one character needle?
bdnz(L_OneCharLoop);
li(result, -1); // Not found.
b(L_End);
@@ -501,7 +500,7 @@ void C2_MacroAssembler::string_indexof(Register result, Register haystack, Regis
bind(L_Comp1); // Addr points to possible needle start.
if (needlecntval != 2) { // Const needlecnt==2?
if (needlecntval != 3) {
- if (needlecntval == 0) { beq(CCR6, L_Found); } // Variable needlecnt==2?
+ if (needlecntval == 0) { beq(CR6, L_Found); } // Variable needlecnt==2?
Register n_ind = tmp4,
h_ind = n_ind;
li(n_ind, 2 * n_csize); // First 2 characters are already compared, use index 2.
@@ -514,15 +513,15 @@ void C2_MacroAssembler::string_indexof(Register result, Register haystack, Regis
}
if (n_csize == 2) { lhzx(ch2, needle, n_ind); } else { lbzx(ch2, needle, n_ind); }
if (h_csize == 2) { lhzx(ch1, addr, h_ind); } else { lbzx(ch1, addr, h_ind); }
- cmpw(CCR1, ch1, ch2);
- bne(CCR1, L_OuterLoop);
+ cmpw(CR1, ch1, ch2);
+ bne(CR1, L_OuterLoop);
addi(n_ind, n_ind, n_csize);
bdnz(L_CompLoop);
} else { // No loop required if there's only one needle character left.
if (n_csize == 2) { lhz(ch2, 2 * 2, needle); } else { lbz(ch2, 2 * 1, needle); }
if (h_csize == 2) { lhz(ch1, 2 * 2, addr); } else { lbz(ch1, 2 * 1, addr); }
- cmpw(CCR1, ch1, ch2);
- bne(CCR1, L_OuterLoop);
+ cmpw(CR1, ch1, ch2);
+ bne(CR1, L_OuterLoop);
}
}
// Return index ...
@@ -546,7 +545,7 @@ void C2_MacroAssembler::string_indexof_char(Register result, Register haystack,
//4:
srwi_(tmp2, haycnt, 1); // Shift right by exact_log2(UNROLL_FACTOR).
mr(addr, haystack);
- beq(CCR0, L_FinalCheck);
+ beq(CR0, L_FinalCheck);
mtctr(tmp2); // Move to count register.
//8:
bind(L_InnerLoop); // Main work horse (2x unrolled search loop).
@@ -557,19 +556,19 @@ void C2_MacroAssembler::string_indexof_char(Register result, Register haystack,
lbz(ch1, 0, addr);
lbz(ch2, 1, addr);
}
- (needle != R0) ? cmpw(CCR0, ch1, needle) : cmplwi(CCR0, ch1, (unsigned int)needleChar);
- (needle != R0) ? cmpw(CCR1, ch2, needle) : cmplwi(CCR1, ch2, (unsigned int)needleChar);
- beq(CCR0, L_Found1); // Did we find the needle?
- beq(CCR1, L_Found2);
+ (needle != R0) ? cmpw(CR0, ch1, needle) : cmplwi(CR0, ch1, (unsigned int)needleChar);
+ (needle != R0) ? cmpw(CR1, ch2, needle) : cmplwi(CR1, ch2, (unsigned int)needleChar);
+ beq(CR0, L_Found1); // Did we find the needle?
+ beq(CR1, L_Found2);
addi(addr, addr, 2 * h_csize);
bdnz(L_InnerLoop);
//16:
bind(L_FinalCheck);
andi_(R0, haycnt, 1);
- beq(CCR0, L_NotFound);
+ beq(CR0, L_NotFound);
if (!is_byte) { lhz(ch1, 0, addr); } else { lbz(ch1, 0, addr); } // One position left at which we have to compare.
- (needle != R0) ? cmpw(CCR1, ch1, needle) : cmplwi(CCR1, ch1, (unsigned int)needleChar);
- beq(CCR1, L_Found1);
+ (needle != R0) ? cmpw(CR1, ch1, needle) : cmplwi(CR1, ch1, (unsigned int)needleChar);
+ beq(CR1, L_Found1);
//21:
bind(L_NotFound);
li(result, -1); // Not found.
@@ -595,7 +594,7 @@ void C2_MacroAssembler::count_positives(Register src, Register cnt, Register res
lis(tmp1, (int)(short)0x8080); // tmp1 = 0x8080808080808080
srwi_(tmp2, cnt, 4);
mr(result, src); // Use result reg to point to the current position.
- beq(CCR0, Lslow);
+ beq(CR0, Lslow);
ori(tmp1, tmp1, 0x8080);
rldimi(tmp1, tmp1, 32, 0);
mtctr(tmp2);
@@ -608,19 +607,19 @@ void C2_MacroAssembler::count_positives(Register src, Register cnt, Register res
orr(tmp0, tmp2, tmp0);
and_(tmp0, tmp0, tmp1);
- bne(CCR0, Lslow); // Found negative byte.
+ bne(CR0, Lslow); // Found negative byte.
addi(result, result, 16);
bdnz(Lfastloop);
bind(Lslow); // Fallback to slow version.
subf(tmp0, src, result); // Bytes known positive.
subf_(tmp0, tmp0, cnt); // Remaining Bytes.
- beq(CCR0, Ldone);
+ beq(CR0, Ldone);
mtctr(tmp0);
bind(Lloop);
lbz(tmp0, 0, result);
andi_(tmp0, tmp0, 0x80);
- bne(CCR0, Ldone); // Found negative byte.
+ bne(CR0, Ldone); // Found negative byte.
addi(result, result, 1);
bdnz(Lloop);
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..ad8640453e687 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 SAP SE. 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"
@@ -283,8 +282,8 @@ void DowncallLinker::StubGenerator::generate() {
__ safepoint_poll(L_safepoint_poll_slow_path, tmp, true /* at_return */, false /* in_nmethod */);
__ lwz(tmp, in_bytes(JavaThread::suspend_flags_offset()), R16_thread);
- __ cmpwi(CCR0, tmp, 0);
- __ bne(CCR0, L_safepoint_poll_slow_path);
+ __ cmpwi(CR0, tmp, 0);
+ __ bne(CR0, L_safepoint_poll_slow_path);
__ bind(L_after_safepoint_poll);
// change thread state
@@ -294,8 +293,8 @@ void DowncallLinker::StubGenerator::generate() {
__ block_comment("reguard stack check");
__ lwz(tmp, in_bytes(JavaThread::stack_guard_state_offset()), R16_thread);
- __ cmpwi(CCR0, tmp, StackOverflow::stack_guard_yellow_reserved_disabled);
- __ beq(CCR0, L_reguard);
+ __ cmpwi(CR0, tmp, StackOverflow::stack_guard_yellow_reserved_disabled);
+ __ beq(CR0, L_reguard);
__ bind(L_after_reguard);
__ reset_last_Java_frame();
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..4fb13422f59a2 100644
--- a/src/hotspot/cpu/ppc/gc/g1/g1BarrierSetAssembler_ppc.cpp
+++ b/src/hotspot/cpu/ppc/gc/g1/g1BarrierSetAssembler_ppc.cpp
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2018, 2024 SAP SE. All rights reserved.
+ * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "gc/g1/g1BarrierSet.hpp"
#include "gc/g1/g1BarrierSetAssembler.hpp"
@@ -52,7 +51,7 @@ static void generate_marking_inactive_test(MacroAssembler* masm) {
int active_offset = in_bytes(G1ThreadLocalData::satb_mark_queue_active_offset());
assert(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption");
__ lbz(R0, active_offset, R16_thread); // tmp1 := *(mark queue active address)
- __ cmpwi(CCR0, R0, 0);
+ __ cmpwi(CR0, R0, 0);
}
void G1BarrierSetAssembler::gen_write_ref_array_pre_barrier(MacroAssembler* masm, DecoratorSet decorators,
@@ -69,7 +68,7 @@ void G1BarrierSetAssembler::gen_write_ref_array_pre_barrier(MacroAssembler* masm
// Is marking active?
generate_marking_inactive_test(masm);
- __ beq(CCR0, filtered);
+ __ beq(CR0, filtered);
__ save_LR(R0);
__ push_frame(frame_size, R0);
@@ -119,8 +118,8 @@ static void generate_queue_insertion(MacroAssembler* masm, ByteSize index_offset
// Can we store a value in the given thread's buffer?
// (The index field is typed as size_t.)
__ ld(temp, in_bytes(index_offset), R16_thread); // temp := *(index address)
- __ cmpdi(CCR0, temp, 0); // jump to runtime if index == 0 (full buffer)
- __ beq(CCR0, runtime);
+ __ cmpdi(CR0, temp, 0); // jump to runtime if index == 0 (full buffer)
+ __ beq(CR0, runtime);
// The buffer is not full, store value into it.
__ ld(R0, in_bytes(buffer_offset), R16_thread); // R0 := buffer address
__ addi(temp, temp, -wordSize); // temp := next index
@@ -155,7 +154,7 @@ void G1BarrierSetAssembler::g1_write_barrier_pre(MacroAssembler* masm, Decorator
Label runtime, filtered;
generate_marking_inactive_test(masm);
- __ beq(CCR0, filtered);
+ __ beq(CR0, filtered);
// Do we need to load the previous value?
if (!preloaded) {
@@ -172,12 +171,12 @@ void G1BarrierSetAssembler::g1_write_barrier_pre(MacroAssembler* masm, Decorator
// Is the previous value null?
if (preloaded && not_null) {
#ifdef ASSERT
- __ cmpdi(CCR0, pre_val, 0);
+ __ cmpdi(CR0, pre_val, 0);
__ asm_assert_ne("null oop not allowed (G1 pre)"); // Checked by caller.
#endif
} else {
- __ cmpdi(CCR0, pre_val, 0);
- __ beq(CCR0, filtered);
+ __ cmpdi(CR0, pre_val, 0);
+ __ beq(CR0, filtered);
}
if (!preloaded && UseCompressedOops) {
@@ -241,14 +240,14 @@ static Address generate_card_young_test(MacroAssembler* masm, const Register sto
__ load_const_optimized(tmp1, (address)(ct->card_table()->byte_map_base()), tmp2);
__ srdi(tmp2, store_addr, CardTable::card_shift()); // tmp1 := card address relative to card table base
__ lbzx(R0, tmp1, tmp2); // tmp1 := card address
- __ cmpwi(CCR0, R0, (int)G1CardTable::g1_young_card_val());
+ __ cmpwi(CR0, R0, (int)G1CardTable::g1_young_card_val());
return Address(tmp1, tmp2); // return card address
}
static void generate_card_dirty_test(MacroAssembler* masm, Address card_addr) {
__ membar(Assembler::StoreLoad); // Must reload after StoreLoad membar due to concurrent refinement
__ lbzx(R0, card_addr.base(), card_addr.index()); // tmp2 := card
- __ cmpwi(CCR0, R0, (int)G1CardTable::dirty_card_val()); // tmp2 := card == dirty_card_val?
+ __ cmpwi(CR0, R0, (int)G1CardTable::dirty_card_val()); // tmp2 := card == dirty_card_val?
}
void G1BarrierSetAssembler::g1_write_barrier_post(MacroAssembler* masm, DecoratorSet decorators,
@@ -263,24 +262,24 @@ void G1BarrierSetAssembler::g1_write_barrier_post(MacroAssembler* masm, Decorato
CardTableBarrierSet* ct = barrier_set_cast(BarrierSet::barrier_set());
generate_region_crossing_test(masm, store_addr, new_val);
- __ beq(CCR0, filtered);
+ __ beq(CR0, filtered);
// Crosses regions, storing null?
if (not_null) {
#ifdef ASSERT
- __ cmpdi(CCR0, new_val, 0);
+ __ cmpdi(CR0, new_val, 0);
__ asm_assert_ne("null oop not allowed (G1 post)"); // Checked by caller.
#endif
} else {
- __ cmpdi(CCR0, new_val, 0);
- __ beq(CCR0, filtered);
+ __ cmpdi(CR0, new_val, 0);
+ __ beq(CR0, filtered);
}
Address card_addr = generate_card_young_test(masm, store_addr, tmp1, tmp2);
- __ beq(CCR0, filtered);
+ __ beq(CR0, filtered);
generate_card_dirty_test(masm, card_addr);
- __ beq(CCR0, filtered);
+ __ beq(CR0, filtered);
__ li(R0, (int)G1CardTable::dirty_card_val());
__ stbx(R0, card_addr.base(), card_addr.index()); // *(card address) := dirty_card_val
@@ -372,14 +371,14 @@ void G1BarrierSetAssembler::resolve_jobject(MacroAssembler* masm, Register value
Register tmp1, Register tmp2,
MacroAssembler::PreservationLevel preservation_level) {
Label done, not_weak;
- __ cmpdi(CCR0, value, 0);
- __ beq(CCR0, done); // Use null as-is.
+ __ cmpdi(CR0, value, 0);
+ __ beq(CR0, done); // Use null as-is.
__ clrrdi(tmp1, value, JNIHandles::tag_size);
__ andi_(tmp2, value, JNIHandles::TypeTag::weak_global);
__ ld(value, 0, tmp1); // Resolve (untagged) jobject.
- __ beq(CCR0, not_weak); // Test for jweak tag.
+ __ beq(CR0, not_weak); // Test for jweak tag.
__ verify_oop(value, FILE_AND_LINE);
g1_write_barrier_pre(masm, IN_NATIVE | ON_PHANTOM_OOP_REF,
noreg, noreg, value,
@@ -410,7 +409,7 @@ void G1BarrierSetAssembler::g1_write_barrier_pre_c2(MacroAssembler* masm,
stub->initialize_registers(obj, pre_val, R16_thread, tmp1, tmp2);
generate_marking_inactive_test(masm);
- __ bc_far_optimized(Assembler::bcondCRbiIs0, __ bi0(CCR0, Assembler::equal), *stub->entry());
+ __ bc_far_optimized(Assembler::bcondCRbiIs0, __ bi0(CR0, Assembler::equal), *stub->entry());
__ bind(*stub->continuation());
}
@@ -434,8 +433,8 @@ void G1BarrierSetAssembler::generate_c2_pre_barrier_stub(MacroAssembler* masm,
__ ld(pre_val, 0, obj);
}
}
- __ cmpdi(CCR0, pre_val, 0);
- __ bc_far_optimized(Assembler::bcondCRbiIs1, __ bi0(CCR0, Assembler::equal), *stub->continuation());
+ __ cmpdi(CR0, pre_val, 0);
+ __ bc_far_optimized(Assembler::bcondCRbiIs1, __ bi0(CR0, Assembler::equal), *stub->continuation());
Register pre_val_decoded = pre_val;
if (UseCompressedOops) {
@@ -473,25 +472,25 @@ void G1BarrierSetAssembler::g1_write_barrier_post_c2(MacroAssembler* masm,
if (null_check_required && CompressedOops::base() != nullptr) {
// We prefer doing the null check after the region crossing check.
// Only compressed oop modes with base != null require a null check here.
- __ cmpwi(CCR0, new_val, 0);
- __ beq(CCR0, *stub->continuation());
+ __ cmpwi(CR0, new_val, 0);
+ __ beq(CR0, *stub->continuation());
null_check_required = false;
}
new_val_decoded = __ decode_heap_oop_not_null(tmp2, new_val);
}
generate_region_crossing_test(masm, store_addr, new_val_decoded);
- __ beq(CCR0, *stub->continuation());
+ __ beq(CR0, *stub->continuation());
// crosses regions, storing null?
if (null_check_required) {
- __ cmpdi(CCR0, new_val_decoded, 0);
- __ beq(CCR0, *stub->continuation());
+ __ cmpdi(CR0, new_val_decoded, 0);
+ __ beq(CR0, *stub->continuation());
}
Address card_addr = generate_card_young_test(masm, store_addr, tmp1, tmp2);
assert(card_addr.base() == tmp1 && card_addr.index() == tmp2, "needed by post barrier stub");
- __ bc_far_optimized(Assembler::bcondCRbiIs0, __ bi0(CCR0, Assembler::equal), *stub->entry());
+ __ bc_far_optimized(Assembler::bcondCRbiIs0, __ bi0(CR0, Assembler::equal), *stub->entry());
__ bind(*stub->continuation());
}
@@ -505,7 +504,7 @@ void G1BarrierSetAssembler::generate_c2_post_barrier_stub(MacroAssembler* masm,
__ bind(*stub->entry());
generate_card_dirty_test(masm, card_addr);
- __ bc_far_optimized(Assembler::bcondCRbiIs1, __ bi0(CCR0, Assembler::equal), *stub->continuation());
+ __ bc_far_optimized(Assembler::bcondCRbiIs1, __ bi0(CR0, Assembler::equal), *stub->continuation());
__ li(R0, (int)G1CardTable::dirty_card_val());
__ stbx(R0, card_addr.base(), card_addr.index()); // *(card address) := dirty_card_val
@@ -547,8 +546,8 @@ void G1BarrierSetAssembler::gen_pre_barrier_stub(LIR_Assembler* ce, G1PreBarrier
ce->mem2reg(stub->addr(), stub->pre_val(), T_OBJECT, stub->patch_code(), stub->info(), false /*wide*/);
}
- __ cmpdi(CCR0, pre_val_reg, 0);
- __ bc_far_optimized(Assembler::bcondCRbiIs1, __ bi0(CCR0, Assembler::equal), *stub->continuation());
+ __ cmpdi(CR0, pre_val_reg, 0);
+ __ bc_far_optimized(Assembler::bcondCRbiIs1, __ bi0(CR0, Assembler::equal), *stub->continuation());
address c_code = bs->pre_barrier_c1_runtime_code_blob()->code_begin();
//__ load_const_optimized(R0, c_code);
@@ -568,8 +567,8 @@ void G1BarrierSetAssembler::gen_post_barrier_stub(LIR_Assembler* ce, G1PostBarri
Register addr_reg = stub->addr()->as_pointer_register();
Register new_val_reg = stub->new_val()->as_register();
- __ cmpdi(CCR0, new_val_reg, 0);
- __ bc_far_optimized(Assembler::bcondCRbiIs1, __ bi0(CCR0, Assembler::equal), *stub->continuation());
+ __ cmpdi(CR0, new_val_reg, 0);
+ __ bc_far_optimized(Assembler::bcondCRbiIs1, __ bi0(CR0, Assembler::equal), *stub->continuation());
address c_code = bs->post_barrier_c1_runtime_code_blob()->code_begin();
//__ load_const_optimized(R0, c_code);
@@ -605,7 +604,7 @@ void G1BarrierSetAssembler::generate_c1_pre_barrier_runtime_stub(StubAssembler*
// Is marking still active?
generate_marking_inactive_test(sasm);
- __ beq(CCR0, marking_not_active);
+ __ beq(CR0, marking_not_active);
__ bind(restart);
// Load the index into the SATB buffer. SATBMarkQueue::_index is a
@@ -613,8 +612,8 @@ void G1BarrierSetAssembler::generate_c1_pre_barrier_runtime_stub(StubAssembler*
__ ld(tmp, satb_q_index_byte_offset, R16_thread);
// index == 0?
- __ cmpdi(CCR0, tmp, 0);
- __ beq(CCR0, refill);
+ __ cmpdi(CR0, tmp, 0);
+ __ beq(CR0, refill);
__ ld(tmp2, satb_q_buf_byte_offset, R16_thread);
__ ld(pre_val, -8, R1_SP); // Load from stack.
@@ -667,15 +666,15 @@ void G1BarrierSetAssembler::generate_c1_post_barrier_runtime_stub(StubAssembler*
__ lbz(tmp, 0, addr); // tmp := [addr + cardtable]
// Return if young card.
- __ cmpwi(CCR0, tmp, G1CardTable::g1_young_card_val());
- __ beq(CCR0, ret);
+ __ cmpwi(CR0, tmp, G1CardTable::g1_young_card_val());
+ __ beq(CR0, ret);
// Return if sequential consistent value is already dirty.
__ membar(Assembler::StoreLoad);
__ lbz(tmp, 0, addr); // tmp := [addr + cardtable]
- __ cmpwi(CCR0, tmp, G1CardTable::dirty_card_val());
- __ beq(CCR0, ret);
+ __ cmpwi(CR0, tmp, G1CardTable::dirty_card_val());
+ __ beq(CR0, ret);
// Not dirty.
@@ -693,8 +692,8 @@ void G1BarrierSetAssembler::generate_c1_post_barrier_runtime_stub(StubAssembler*
__ ld(tmp2, dirty_card_q_index_byte_offset, R16_thread);
// index == 0?
- __ cmpdi(CCR0, tmp2, 0);
- __ beq(CCR0, refill);
+ __ cmpdi(CR0, tmp2, 0);
+ __ beq(CR0, refill);
__ ld(tmp, dirty_card_q_buf_byte_offset, R16_thread);
__ addi(tmp2, tmp2, -oopSize);
diff --git a/src/hotspot/cpu/ppc/gc/g1/g1_ppc.ad b/src/hotspot/cpu/ppc/gc/g1/g1_ppc.ad
index f4163242cad7b..4f24efe872b87 100644
--- a/src/hotspot/cpu/ppc/gc/g1/g1_ppc.ad
+++ b/src/hotspot/cpu/ppc/gc/g1/g1_ppc.ad
@@ -1,6 +1,6 @@
//
-// Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
-// Copyright (c) 2024 SAP SE. All rights reserved.
+// Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
+// Copyright (c) 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
@@ -164,7 +164,7 @@ instruct g1CompareAndExchangeP(iRegPdst res, indirect mem, iRegPsrc oldval, iReg
format %{ "cmpxchgd $newval, $mem" %}
ins_encode %{
Label no_update;
- __ cmpxchgd(CCR0, $res$$Register, $oldval$$Register, $newval$$Register, $mem$$Register,
+ __ cmpxchgd(CR0, $res$$Register, $oldval$$Register, $newval$$Register, $mem$$Register,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
noreg, &no_update, true);
// Pass oldval to SATB which is the only value which can get overwritten.
@@ -194,7 +194,7 @@ instruct g1CompareAndExchangeP_acq(iRegPdst res, indirect mem, iRegPsrc oldval,
format %{ "cmpxchgd acq $newval, $mem" %}
ins_encode %{
Label no_update;
- __ cmpxchgd(CCR0, $res$$Register, $oldval$$Register, $newval$$Register, $mem$$Register,
+ __ cmpxchgd(CR0, $res$$Register, $oldval$$Register, $newval$$Register, $mem$$Register,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
noreg, &no_update, true);
// Pass oldval to SATB which is the only value which can get overwritten.
@@ -230,7 +230,7 @@ instruct g1CompareAndExchangeN(iRegNdst res, indirect mem, iRegNsrc oldval, iReg
format %{ "cmpxchgw $newval, $mem" %}
ins_encode %{
Label no_update;
- __ cmpxchgw(CCR0, $res$$Register, $oldval$$Register, $newval$$Register, $mem$$Register,
+ __ cmpxchgw(CR0, $res$$Register, $oldval$$Register, $newval$$Register, $mem$$Register,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
noreg, &no_update, true);
// Pass oldval to SATB which is the only value which can get overwritten.
@@ -261,7 +261,7 @@ instruct g1CompareAndExchangeN_acq(iRegNdst res, indirect mem, iRegNsrc oldval,
format %{ "cmpxchgw acq $newval, $mem" %}
ins_encode %{
Label no_update;
- __ cmpxchgw(CCR0, $res$$Register, $oldval$$Register, $newval$$Register, $mem$$Register,
+ __ cmpxchgw(CR0, $res$$Register, $oldval$$Register, $newval$$Register, $mem$$Register,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
noreg, &no_update, true);
// Pass oldval to SATB which is the only value which can get overwritten.
@@ -299,7 +299,7 @@ instruct g1CompareAndSwapP(iRegIdst res, indirect mem, iRegPsrc oldval, iRegPsrc
ins_encode %{
Label no_update;
__ li($res$$Register, 0);
- __ cmpxchgd(CCR0, R0, $oldval$$Register, $newval$$Register, $mem$$Register,
+ __ cmpxchgd(CR0, R0, $oldval$$Register, $newval$$Register, $mem$$Register,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
noreg, &no_update, true);
// Pass oldval to SATB which is the only value which can get overwritten.
@@ -332,7 +332,7 @@ instruct g1CompareAndSwapP_acq(iRegIdst res, indirect mem, iRegPsrc oldval, iReg
ins_encode %{
Label no_update;
__ li($res$$Register, 0);
- __ cmpxchgd(CCR0, R0, $oldval$$Register, $newval$$Register, $mem$$Register,
+ __ cmpxchgd(CR0, R0, $oldval$$Register, $newval$$Register, $mem$$Register,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
noreg, &no_update, true);
// Pass oldval to SATB which is the only value which can get overwritten.
@@ -371,7 +371,7 @@ instruct g1CompareAndSwapN(iRegIdst res, indirect mem, iRegNsrc oldval, iRegNsrc
ins_encode %{
Label no_update;
__ li($res$$Register, 0);
- __ cmpxchgw(CCR0, R0, $oldval$$Register, $newval$$Register, $mem$$Register,
+ __ cmpxchgw(CR0, R0, $oldval$$Register, $newval$$Register, $mem$$Register,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
noreg, &no_update, true);
// Pass oldval to SATB which is the only value which can get overwritten.
@@ -405,7 +405,7 @@ instruct g1CompareAndSwapN_acq(iRegIdst res, indirect mem, iRegNsrc oldval, iReg
ins_encode %{
Label no_update;
__ li($res$$Register, 0);
- __ cmpxchgw(CCR0, R0, $oldval$$Register, $newval$$Register, $mem$$Register,
+ __ cmpxchgw(CR0, R0, $oldval$$Register, $newval$$Register, $mem$$Register,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
noreg, &no_update, true);
// Pass oldval to SATB which is the only value which can get overwritten.
@@ -445,7 +445,7 @@ instruct weakG1CompareAndSwapP(iRegIdst res, indirect mem, iRegPsrc oldval, iReg
ins_encode %{
Label no_update;
__ li($res$$Register, 0);
- __ cmpxchgd(CCR0, R0, $oldval$$Register, $newval$$Register, $mem$$Register,
+ __ cmpxchgd(CR0, R0, $oldval$$Register, $newval$$Register, $mem$$Register,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
noreg, &no_update, true, true);
// Pass oldval to SATB which is the only value which can get overwritten.
@@ -478,7 +478,7 @@ instruct weakG1CompareAndSwapP_acq(iRegIdst res, indirect mem, iRegPsrc oldval,
ins_encode %{
Label no_update;
__ li($res$$Register, 0);
- __ cmpxchgd(CCR0, R0, $oldval$$Register, $newval$$Register, $mem$$Register,
+ __ cmpxchgd(CR0, R0, $oldval$$Register, $newval$$Register, $mem$$Register,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
noreg, &no_update, true, true);
// Pass oldval to SATB which is the only value which can get overwritten.
@@ -517,7 +517,7 @@ instruct weakG1CompareAndSwapN(iRegIdst res, indirect mem, iRegNsrc oldval, iReg
ins_encode %{
Label no_update;
__ li($res$$Register, 0);
- __ cmpxchgw(CCR0, R0, $oldval$$Register, $newval$$Register, $mem$$Register,
+ __ cmpxchgw(CR0, R0, $oldval$$Register, $newval$$Register, $mem$$Register,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
noreg, &no_update, true, true);
// Pass oldval to SATB which is the only value which can get overwritten.
@@ -551,7 +551,7 @@ instruct weakG1CompareAndSwapN_acq(iRegIdst res, indirect mem, iRegNsrc oldval,
ins_encode %{
Label no_update;
__ li($res$$Register, 0);
- __ cmpxchgw(CCR0, R0, $oldval$$Register, $newval$$Register, $mem$$Register,
+ __ cmpxchgw(CR0, R0, $oldval$$Register, $newval$$Register, $mem$$Register,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
noreg, &no_update, true, true);
// Pass oldval to SATB which is the only value which can get overwritten.
diff --git a/src/hotspot/cpu/ppc/gc/shared/barrierSetAssembler_ppc.cpp b/src/hotspot/cpu/ppc/gc/shared/barrierSetAssembler_ppc.cpp
index 956b082d194b4..fe10114a1954f 100644
--- a/src/hotspot/cpu/ppc/gc/shared/barrierSetAssembler_ppc.cpp
+++ b/src/hotspot/cpu/ppc/gc/shared/barrierSetAssembler_ppc.cpp
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2018, 2022 SAP SE. All rights reserved.
+ * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "classfile/classLoaderData.hpp"
#include "gc/shared/barrierSetAssembler.hpp"
@@ -90,8 +89,8 @@ void BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators,
if (UseCompressedOops && in_heap) {
if (L_handle_null != nullptr) { // Label provided.
__ lwz(dst, ind_or_offs, base);
- __ cmpwi(CCR0, dst, 0);
- __ beq(CCR0, *L_handle_null);
+ __ cmpwi(CR0, dst, 0);
+ __ beq(CR0, *L_handle_null);
__ decode_heap_oop_not_null(dst);
} else if (not_null) { // Guaranteed to be not null.
Register narrowOop = (tmp1 != noreg && CompressedOops::base_disjoint()) ? tmp1 : dst;
@@ -104,8 +103,8 @@ void BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators,
} else {
__ ld(dst, ind_or_offs, base);
if (L_handle_null != nullptr) {
- __ cmpdi(CCR0, dst, 0);
- __ beq(CCR0, *L_handle_null);
+ __ cmpdi(CR0, dst, 0);
+ __ beq(CR0, *L_handle_null);
}
}
break;
@@ -119,11 +118,11 @@ void BarrierSetAssembler::resolve_jobject(MacroAssembler* masm, Register value,
Register tmp1, Register tmp2,
MacroAssembler::PreservationLevel preservation_level) {
Label done, tagged, weak_tagged, verify;
- __ cmpdi(CCR0, value, 0);
- __ beq(CCR0, done); // Use null as-is.
+ __ cmpdi(CR0, value, 0);
+ __ beq(CR0, done); // Use null as-is.
__ andi_(tmp1, value, JNIHandles::tag_mask);
- __ bne(CCR0, tagged); // Test for tag.
+ __ bne(CR0, tagged); // Test for tag.
__ access_load_at(T_OBJECT, IN_NATIVE | AS_RAW, // no uncoloring
value, (intptr_t)0, value, tmp1, tmp2, preservation_level);
@@ -132,7 +131,7 @@ void BarrierSetAssembler::resolve_jobject(MacroAssembler* masm, Register value,
__ bind(tagged);
__ andi_(tmp1, value, JNIHandles::TypeTag::weak_global);
__ clrrdi(value, value, JNIHandles::tag_size); // Untag.
- __ bne(CCR0, weak_tagged); // Test for jweak tag.
+ __ bne(CR0, weak_tagged); // Test for jweak tag.
__ access_load_at(T_OBJECT, IN_NATIVE,
value, (intptr_t)0, value, tmp1, tmp2, preservation_level);
@@ -153,14 +152,14 @@ void BarrierSetAssembler::resolve_global_jobject(MacroAssembler* masm, Register
MacroAssembler::PreservationLevel preservation_level) {
Label done;
- __ cmpdi(CCR0, value, 0);
- __ beq(CCR0, done); // Use null as-is.
+ __ cmpdi(CR0, value, 0);
+ __ beq(CR0, done); // Use null as-is.
#ifdef ASSERT
{
Label valid_global_tag;
__ andi_(tmp1, value, JNIHandles::TypeTag::global);
- __ bne(CCR0, valid_global_tag); // Test for global tag.
+ __ bne(CR0, valid_global_tag); // Test for global tag.
__ stop("non global jobject using resolve_global_jobject");
__ bind(valid_global_tag);
}
@@ -201,9 +200,9 @@ void BarrierSetAssembler::nmethod_entry_barrier(MacroAssembler* masm, Register t
// Low order half of 64 bit value is currently used.
__ ld(R0, in_bytes(bs_nm->thread_disarmed_guard_value_offset()), R16_thread);
- __ cmpw(CCR0, R0, tmp);
+ __ cmpw(CR0, R0, tmp);
- __ bnectrl(CCR0);
+ __ bnectrl(CR0);
// Oops may have been changed. Make those updates observable.
// "isync" can serve both, data and instruction patching.
@@ -230,8 +229,8 @@ void BarrierSetAssembler::c2i_entry_barrier(MacroAssembler *masm, Register tmp1,
Label bad_call, skip_barrier;
// Fast path: If no method is given, the call is definitely bad.
- __ cmpdi(CCR0, R19_method, 0);
- __ beq(CCR0, bad_call);
+ __ cmpdi(CR0, R19_method, 0);
+ __ beq(CR0, bad_call);
// Load class loader data to determine whether the method's holder is concurrently unloading.
__ load_method_holder(tmp1, R19_method);
@@ -239,14 +238,14 @@ void BarrierSetAssembler::c2i_entry_barrier(MacroAssembler *masm, Register tmp1,
// Fast path: If class loader is strong, the holder cannot be unloaded.
__ lwz(tmp2, in_bytes(ClassLoaderData::keep_alive_ref_count_offset()), tmp1_class_loader_data);
- __ cmpdi(CCR0, tmp2, 0);
- __ bne(CCR0, skip_barrier);
+ __ cmpdi(CR0, tmp2, 0);
+ __ bne(CR0, skip_barrier);
// Class loader is weak. Determine whether the holder is still alive.
__ ld(tmp2, in_bytes(ClassLoaderData::holder_offset()), tmp1_class_loader_data);
__ resolve_weak_handle(tmp2, tmp1, tmp3, MacroAssembler::PreservationLevel::PRESERVATION_FRAME_LR_GP_FP_REGS);
- __ cmpdi(CCR0, tmp2, 0);
- __ bne(CCR0, skip_barrier);
+ __ cmpdi(CR0, tmp2, 0);
+ __ bne(CR0, skip_barrier);
__ bind(bad_call);
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..e1272ce508d72 100644
--- a/src/hotspot/cpu/ppc/gc/shared/cardTableBarrierSetAssembler_ppc.cpp
+++ b/src/hotspot/cpu/ppc/gc/shared/cardTableBarrierSetAssembler_ppc.cpp
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2018, 2021 SAP SE. All rights reserved.
+ * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "gc/shared/barrierSet.hpp"
#include "gc/shared/cardTable.hpp"
@@ -50,7 +49,7 @@ void CardTableBarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembl
Label Lskip_loop, Lstore_loop;
__ sldi_(count, count, LogBytesPerHeapOop);
- __ beq(CCR0, Lskip_loop); // zero length
+ __ beq(CR0, Lskip_loop); // zero length
__ addi(count, count, -BytesPerHeapOop);
__ add(count, addr, count);
// Use two shifts to clear out those low order two bits! (Cannot opt. into 1.)
diff --git a/src/hotspot/cpu/ppc/gc/shared/modRefBarrierSetAssembler_ppc.cpp b/src/hotspot/cpu/ppc/gc/shared/modRefBarrierSetAssembler_ppc.cpp
index a500a078c2d33..4cdf56f6ad60c 100644
--- a/src/hotspot/cpu/ppc/gc/shared/modRefBarrierSetAssembler_ppc.cpp
+++ b/src/hotspot/cpu/ppc/gc/shared/modRefBarrierSetAssembler_ppc.cpp
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2018, 2021 SAP SE. All rights reserved.
+ * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "gc/shared/modRefBarrierSetAssembler.hpp"
#include "runtime/jniHandles.hpp"
@@ -81,8 +80,8 @@ void ModRefBarrierSetAssembler::resolve_jobject(MacroAssembler* masm, Register v
Register tmp1, Register tmp2,
MacroAssembler::PreservationLevel preservation_level) {
Label done;
- __ cmpdi(CCR0, value, 0);
- __ beq(CCR0, done); // Use null as-is.
+ __ cmpdi(CR0, value, 0);
+ __ beq(CR0, done); // Use null as-is.
__ clrrdi(tmp1, value, JNIHandles::tag_size);
__ ld(value, 0, tmp1); // Resolve (untagged) jobject.
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..f7e3072f0811a 100644
--- a/src/hotspot/cpu/ppc/gc/shenandoah/shenandoahBarrierSetAssembler_ppc.cpp
+++ b/src/hotspot/cpu/ppc/gc/shenandoah/shenandoahBarrierSetAssembler_ppc.cpp
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 2018, 2024, Red Hat, Inc. All rights reserved.
- * Copyright (c) 2012, 2024 SAP SE. All rights reserved.
+ * Copyright (c) 2018, 2025, Red Hat, Inc. 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 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "gc/shared/gcArguments.hpp"
#include "gc/shared/gc_globals.hpp"
@@ -103,8 +102,8 @@ void ShenandoahBarrierSetAssembler::arraycopy_prologue(MacroAssembler *masm, Dec
Label skip_prologue;
// Fast path: Array is of length zero.
- __ cmpdi(CCR0, count, 0);
- __ beq(CCR0, skip_prologue);
+ __ cmpdi(CR0, count, 0);
+ __ beq(CR0, skip_prologue);
/* ==== Check whether barrier is required (gc state) ==== */
__ lbz(R11_tmp, in_bytes(ShenandoahThreadLocalData::gc_state_offset()),
@@ -119,7 +118,7 @@ void ShenandoahBarrierSetAssembler::arraycopy_prologue(MacroAssembler *masm, Dec
: ShenandoahHeap::HAS_FORWARDED | ShenandoahHeap::MARKING;
__ andi_(R11_tmp, R11_tmp, required_states);
- __ beq(CCR0, skip_prologue);
+ __ beq(CR0, skip_prologue);
/* ==== Invoke runtime ==== */
// Save to-be-preserved registers.
@@ -217,7 +216,7 @@ void ShenandoahBarrierSetAssembler::satb_write_barrier_impl(MacroAssembler *masm
__ lbz(tmp1, in_bytes(ShenandoahThreadLocalData::gc_state_offset()), R16_thread);
__ andi_(tmp1, tmp1, ShenandoahHeap::MARKING);
- __ beq(CCR0, skip_barrier);
+ __ beq(CR0, skip_barrier);
/* ==== Determine the reference's previous value ==== */
bool preloaded_mode = base == noreg;
@@ -236,12 +235,12 @@ void ShenandoahBarrierSetAssembler::satb_write_barrier_impl(MacroAssembler *masm
if ((decorators & IS_NOT_NULL) != 0) {
#ifdef ASSERT
- __ cmpdi(CCR0, pre_val, 0);
+ __ cmpdi(CR0, pre_val, 0);
__ asm_assert_ne("null oop is not allowed");
#endif // ASSERT
} else {
- __ cmpdi(CCR0, pre_val, 0);
- __ beq(CCR0, skip_barrier);
+ __ cmpdi(CR0, pre_val, 0);
+ __ beq(CR0, skip_barrier);
}
} else {
// Load from the reference address to determine the reference's current value (before the store is being performed).
@@ -255,8 +254,8 @@ void ShenandoahBarrierSetAssembler::satb_write_barrier_impl(MacroAssembler *masm
__ ld(pre_val, ind_or_offs, base);
}
- __ cmpdi(CCR0, pre_val, 0);
- __ beq(CCR0, skip_barrier);
+ __ cmpdi(CR0, pre_val, 0);
+ __ beq(CR0, skip_barrier);
if (UseCompressedOops) {
__ decode_heap_oop_not_null(pre_val);
@@ -272,8 +271,8 @@ void ShenandoahBarrierSetAssembler::satb_write_barrier_impl(MacroAssembler *masm
// If not, jump to the runtime to commit the buffer and to allocate a new one.
// (The buffer's index corresponds to the amount of remaining free space.)
__ ld(Rindex, in_bytes(ShenandoahThreadLocalData::satb_mark_queue_index_offset()), R16_thread);
- __ cmpdi(CCR0, Rindex, 0);
- __ beq(CCR0, runtime); // If index == 0 (buffer is full), goto runtime.
+ __ cmpdi(CR0, Rindex, 0);
+ __ beq(CR0, runtime); // If index == 0 (buffer is full), goto runtime.
// Capacity suffices. Decrement the queue's size by the size of one oop.
// (The buffer is filled contrary to the heap's growing direction, i.e., it is filled downwards.)
@@ -363,9 +362,9 @@ void ShenandoahBarrierSetAssembler::resolve_forward_pointer_not_null(MacroAssemb
"marked value must equal the value obtained when all lock bits are being set");
if (VM_Version::has_isel()) {
__ xori(tmp1, tmp1, markWord::lock_mask_in_place);
- __ isel(dst, CCR0, Assembler::equal, false, tmp1);
+ __ isel(dst, CR0, Assembler::equal, false, tmp1);
} else {
- __ bne(CCR0, done);
+ __ bne(CR0, done);
__ xori(dst, tmp1, markWord::lock_mask_in_place);
}
@@ -403,7 +402,7 @@ void ShenandoahBarrierSetAssembler::load_reference_barrier_impl(
if (is_strong) {
// For strong references, the heap is considered stable if "has forwarded" is not active.
__ andi_(tmp1, tmp2, ShenandoahHeap::HAS_FORWARDED | ShenandoahHeap::EVACUATION);
- __ beq(CCR0, skip_barrier);
+ __ beq(CR0, skip_barrier);
#ifdef ASSERT
// "evacuation" -> (implies) "has forwarded". If we reach this code, "has forwarded" must thus be set.
__ andi_(tmp1, tmp1, ShenandoahHeap::HAS_FORWARDED);
@@ -415,10 +414,10 @@ void ShenandoahBarrierSetAssembler::load_reference_barrier_impl(
// The additional phase conditions are in place to avoid the resurrection of weak references (see JDK-8266440).
Label skip_fastpath;
__ andi_(tmp1, tmp2, ShenandoahHeap::WEAK_ROOTS);
- __ bne(CCR0, skip_fastpath);
+ __ bne(CR0, skip_fastpath);
__ andi_(tmp1, tmp2, ShenandoahHeap::HAS_FORWARDED | ShenandoahHeap::EVACUATION);
- __ beq(CCR0, skip_barrier);
+ __ beq(CR0, skip_barrier);
#ifdef ASSERT
// "evacuation" -> (implies) "has forwarded". If we reach this code, "has forwarded" must thus be set.
__ andi_(tmp1, tmp1, ShenandoahHeap::HAS_FORWARDED);
@@ -454,7 +453,7 @@ void ShenandoahBarrierSetAssembler::load_reference_barrier_impl(
__ srdi(tmp1, dst, ShenandoahHeapRegion::region_size_bytes_shift_jint());
__ lbzx(tmp2, tmp1, tmp2);
__ andi_(tmp2, tmp2, 1);
- __ beq(CCR0, skip_barrier);
+ __ beq(CR0, skip_barrier);
}
/* ==== Invoke runtime ==== */
@@ -640,8 +639,8 @@ void ShenandoahBarrierSetAssembler::try_resolve_jobject_in_native(MacroAssembler
Label done;
// Fast path: Reference is null (JNI tags are zero for null pointers).
- __ cmpdi(CCR0, obj, 0);
- __ beq(CCR0, done);
+ __ cmpdi(CR0, obj, 0);
+ __ beq(CR0, done);
// Resolve jobject using standard implementation.
BarrierSetAssembler::try_resolve_jobject_in_native(masm, dst, jni_env, obj, tmp, slowpath);
@@ -652,7 +651,7 @@ void ShenandoahBarrierSetAssembler::try_resolve_jobject_in_native(MacroAssembler
jni_env);
__ andi_(tmp, tmp, ShenandoahHeap::EVACUATION | ShenandoahHeap::HAS_FORWARDED);
- __ bne(CCR0, slowpath);
+ __ bne(CR0, slowpath);
__ bind(done);
__ block_comment("} try_resolve_jobject_in_native (shenandoahgc)");
@@ -702,23 +701,23 @@ void ShenandoahBarrierSetAssembler::cmpxchg_oop(MacroAssembler *masm, Register b
// Given that 'expected' must refer to the to-space object of an evacuated object (strong to-space invariant),
// no special processing is required.
if (UseCompressedOops) {
- __ cmpxchgw(CCR0, current_value, expected, new_val, base_addr, MacroAssembler::MemBarNone,
+ __ cmpxchgw(CR0, current_value, expected, new_val, base_addr, MacroAssembler::MemBarNone,
false, success_flag, nullptr, true);
} else {
- __ cmpxchgd(CCR0, current_value, expected, new_val, base_addr, MacroAssembler::MemBarNone,
+ __ cmpxchgd(CR0, current_value, expected, new_val, base_addr, MacroAssembler::MemBarNone,
false, success_flag, nullptr, true);
}
// Skip the rest of the barrier if the CAS operation succeeds immediately.
// If it does not, the value stored at the address is either the from-space pointer of the
// referenced object (success criteria s2)) or simply another object.
- __ beq(CCR0, done);
+ __ beq(CR0, done);
/* ==== Step 2 (Null check) ==== */
// The success criteria s2) cannot be matched with a null pointer
// (null pointers cannot be subject to concurrent evacuation). The failure of the CAS operation is thus legitimate.
- __ cmpdi(CCR0, current_value, 0);
- __ beq(CCR0, done);
+ __ cmpdi(CR0, current_value, 0);
+ __ beq(CR0, done);
/* ==== Step 3 (reference pointer refers to from-space version; success criteria s2)) ==== */
// To check whether the reference pointer refers to the from-space version, the forward
@@ -738,15 +737,15 @@ void ShenandoahBarrierSetAssembler::cmpxchg_oop(MacroAssembler *masm, Register b
// Load zero into register for the potential failure case.
__ li(success_flag, 0);
}
- __ cmpd(CCR0, current_value, expected);
- __ bne(CCR0, done);
+ __ cmpd(CR0, current_value, expected);
+ __ bne(CR0, done);
// Discard fetched value as it might be a reference to the from-space version of an object.
if (UseCompressedOops) {
- __ cmpxchgw(CCR0, R0, initial_value, new_val, base_addr, MacroAssembler::MemBarNone,
+ __ cmpxchgw(CR0, R0, initial_value, new_val, base_addr, MacroAssembler::MemBarNone,
false, success_flag);
} else {
- __ cmpxchgd(CCR0, R0, initial_value, new_val, base_addr, MacroAssembler::MemBarNone,
+ __ cmpxchgd(CR0, R0, initial_value, new_val, base_addr, MacroAssembler::MemBarNone,
false, success_flag);
}
@@ -771,7 +770,7 @@ void ShenandoahBarrierSetAssembler::cmpxchg_oop(MacroAssembler *masm, Register b
// guaranteed to be the case.
// In case of a concurrent update, the CAS would be retried again. This is legitimate
// in terms of program correctness (even though it is not desired).
- __ bne(CCR0, step_four);
+ __ bne(CR0, step_four);
__ bind(done);
__ block_comment("} cmpxchg_oop (shenandoahgc)");
@@ -790,7 +789,7 @@ void ShenandoahBarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssemb
__ sldi_(count, count, LogBytesPerHeapOop);
// Zero length? Skip.
- __ beq(CCR0, L_skip_loop);
+ __ beq(CR0, L_skip_loop);
__ addi(count, count, -BytesPerHeapOop);
__ add(count, addr, count);
@@ -836,8 +835,8 @@ void ShenandoahBarrierSetAssembler::gen_pre_barrier_stub(LIR_Assembler *ce, Shen
}
// Fast path: Reference is null.
- __ cmpdi(CCR0, pre_val, 0);
- __ bc_far_optimized(Assembler::bcondCRbiIs1_bhintNoHint, __ bi0(CCR0, Assembler::equal), *stub->continuation());
+ __ cmpdi(CR0, pre_val, 0);
+ __ bc_far_optimized(Assembler::bcondCRbiIs1_bhintNoHint, __ bi0(CR0, Assembler::equal), *stub->continuation());
// Argument passing via the stack.
__ std(pre_val, -8, R1_SP);
@@ -867,7 +866,7 @@ void ShenandoahBarrierSetAssembler::gen_load_reference_barrier_stub(LIR_Assemble
// Ensure that 'res' is 'R3_ARG1' and contains the same value as 'obj' to reduce the number of required
// copy instructions.
assert(R3_RET == res, "res must be r3");
- __ cmpd(CCR0, res, obj);
+ __ cmpd(CR0, res, obj);
__ asm_assert_eq("result register must contain the reference stored in obj");
#endif
@@ -889,7 +888,7 @@ void ShenandoahBarrierSetAssembler::gen_load_reference_barrier_stub(LIR_Assemble
__ lbzx(tmp2, tmp1, tmp2);
__ andi_(tmp2, tmp2, 1);
- __ bc_far_optimized(Assembler::bcondCRbiIs1_bhintNoHint, __ bi0(CCR0, Assembler::equal), *stub->continuation());
+ __ bc_far_optimized(Assembler::bcondCRbiIs1_bhintNoHint, __ bi0(CR0, Assembler::equal), *stub->continuation());
}
address blob_addr = nullptr;
@@ -947,13 +946,13 @@ void ShenandoahBarrierSetAssembler::generate_c1_pre_barrier_runtime_stub(StubAss
__ lbz(R12_tmp2, in_bytes(ShenandoahThreadLocalData::gc_state_offset()), R16_thread);
__ andi_(R12_tmp2, R12_tmp2, ShenandoahHeap::MARKING);
- __ beq(CCR0, skip_barrier);
+ __ beq(CR0, skip_barrier);
/* ==== Add previous value directly to thread-local SATB mark queue ==== */
// Check queue's capacity. Jump to runtime if no free slot is available.
__ ld(R12_tmp2, in_bytes(ShenandoahThreadLocalData::satb_mark_queue_index_offset()), R16_thread);
- __ cmpdi(CCR0, R12_tmp2, 0);
- __ beq(CCR0, runtime);
+ __ cmpdi(CR0, R12_tmp2, 0);
+ __ beq(CR0, runtime);
// Capacity suffices. Decrement the queue's size by one slot (size of one oop).
__ addi(R12_tmp2, R12_tmp2, -wordSize);
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..e30e8c82d23c5 100644
--- a/src/hotspot/cpu/ppc/gc/z/zBarrierSetAssembler_ppc.cpp
+++ b/src/hotspot/cpu/ppc/gc/z/zBarrierSetAssembler_ppc.cpp
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2021, 2024 SAP SE. All rights reserved.
+ * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 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
@@ -22,7 +22,6 @@
* questions.
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "asm/register.hpp"
#include "code/codeBlob.hpp"
@@ -170,7 +169,7 @@ void ZBarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators
// if the pointer is not dirty.
// Only dirty pointers must be processed by this barrier, so we can skip it in case the latter condition holds true.
__ and_(tmp1, tmp1, dst);
- __ beq(CCR0, uncolor);
+ __ beq(CR0, uncolor);
/* ==== Invoke barrier ==== */
{
@@ -194,8 +193,8 @@ void ZBarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators
// Slow-path has already uncolored
if (L_handle_null != nullptr) {
- __ cmpdi(CCR0, dst, 0);
- __ beq(CCR0, *L_handle_null);
+ __ cmpdi(CR0, dst, 0);
+ __ beq(CR0, *L_handle_null);
}
__ b(done);
@@ -204,7 +203,7 @@ void ZBarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators
__ srdi(dst, dst, ZPointerLoadShift);
} else {
__ srdi_(dst, dst, ZPointerLoadShift);
- __ beq(CCR0, *L_handle_null);
+ __ beq(CR0, *L_handle_null);
}
__ bind(done);
@@ -235,7 +234,7 @@ static void emit_store_fast_path_check(MacroAssembler* masm, Register base, Regi
// A not relocatable object could have spurious raw null pointers in its fields after
// getting promoted to the old generation.
__ relocate(barrier_Relocation::spec(), ZBarrierRelocationFormatStoreGoodBits);
- __ cmplwi(CCR0, R0, barrier_Relocation::unpatched);
+ __ cmplwi(CR0, R0, barrier_Relocation::unpatched);
} else {
__ ld(R0, ind_or_offs, base);
// Stores on relocatable objects never need to deal with raw null pointers in fields.
@@ -245,7 +244,7 @@ static void emit_store_fast_path_check(MacroAssembler* masm, Register base, Regi
__ relocate(barrier_Relocation::spec(), ZBarrierRelocationFormatStoreBadMask);
__ andi_(R0, R0, barrier_Relocation::unpatched);
}
- __ bc_far_optimized(Assembler::bcondCRbiIs0, __ bi0(CCR0, Assembler::equal), medium_path);
+ __ bc_far_optimized(Assembler::bcondCRbiIs0, __ bi0(CR0, Assembler::equal), medium_path);
}
void ZBarrierSetAssembler::store_barrier_fast(MacroAssembler* masm,
@@ -275,7 +274,7 @@ void ZBarrierSetAssembler::store_barrier_fast(MacroAssembler* masm,
__ ld(R0, ind_or_offset, ref_base);
__ ld(rnew_zpointer, in_bytes(ZThreadLocalData::store_bad_mask_offset()), R16_thread);
__ and_(R0, R0, rnew_zpointer);
- __ bne(CCR0, medium_path);
+ __ bne(CR0, medium_path);
__ bind(medium_path_continuation);
__ ld(rnew_zpointer, in_bytes(ZThreadLocalData::store_good_mask_offset()), R16_thread);
}
@@ -294,7 +293,7 @@ static void store_barrier_buffer_add(MacroAssembler* masm,
// Combined pointer bump and check if the buffer is disabled or full
__ ld(R0, in_bytes(ZStoreBarrierBuffer::current_offset()), tmp1);
__ addic_(R0, R0, -(int)sizeof(ZStoreBarrierEntry));
- __ blt(CCR0, slow_path);
+ __ blt(CR0, slow_path);
__ std(R0, in_bytes(ZStoreBarrierBuffer::current_offset()), tmp1);
// Entry is at ZStoreBarrierBuffer (tmp1) + buffer_offset + scaled index (R0)
@@ -328,8 +327,8 @@ void ZBarrierSetAssembler::store_barrier_medium(MacroAssembler* masm,
// Atomic accesses can get to the medium fast path because the value was a
// raw null value. If it was not null, then there is no doubt we need to take a slow path.
__ ld(tmp, ind_or_offs, ref_base);
- __ cmpdi(CCR0, tmp, 0);
- __ bne(CCR0, slow_path);
+ __ cmpdi(CR0, tmp, 0);
+ __ bne(CR0, slow_path);
// If we get this far, we know there is a young raw null value in the field.
// Try to self-heal null values for atomic accesses
@@ -339,12 +338,12 @@ void ZBarrierSetAssembler::store_barrier_medium(MacroAssembler* masm,
need_restore = true;
}
__ ld(R0, in_bytes(ZThreadLocalData::store_good_mask_offset()), R16_thread);
- __ cmpxchgd(CCR0, tmp, (intptr_t)0, R0, ref_base,
+ __ cmpxchgd(CR0, tmp, (intptr_t)0, R0, ref_base,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
noreg, need_restore ? nullptr : &slow_path);
if (need_restore) {
__ sub(ref_base, ref_base, ind_or_offs);
- __ bne(CCR0, slow_path);
+ __ bne(CR0, slow_path);
}
} else {
// A non-atomic relocatable object won't get to the medium fast path due to a
@@ -448,7 +447,7 @@ void ZBarrierSetAssembler::copy_load_at_fast(MacroAssembler* masm,
Label& continuation) const {
__ ldx(zpointer, addr);
__ and_(R0, zpointer, load_bad_mask);
- __ bne(CCR0, slow_path);
+ __ bne(CR0, slow_path);
__ bind(continuation);
}
void ZBarrierSetAssembler::copy_load_at_slow(MacroAssembler* masm,
@@ -481,7 +480,7 @@ void ZBarrierSetAssembler::copy_store_at_fast(MacroAssembler* masm,
if (!dest_uninitialized) {
__ ldx(R0, addr);
__ and_(R0, R0, store_bad_mask);
- __ bne(CCR0, medium_path);
+ __ bne(CR0, medium_path);
__ bind(continuation);
}
__ rldimi(zpointer, store_good_mask, 0, 64 - ZPointerLoadShift); // Replace color bits.
@@ -516,8 +515,8 @@ void ZBarrierSetAssembler::copy_store_at_slow(MacroAssembler* masm,
void ZBarrierSetAssembler::generate_disjoint_oop_copy(MacroAssembler* masm, bool dest_uninitialized) {
const Register zpointer = R2, tmp = R9;
Label done, loop, load_bad, load_good, store_bad, store_good;
- __ cmpdi(CCR0, R5_ARG3, 0);
- __ beq(CCR0, done);
+ __ cmpdi(CR0, R5_ARG3, 0);
+ __ beq(CR0, done);
__ mtctr(R5_ARG3);
__ align(32);
@@ -540,7 +539,7 @@ void ZBarrierSetAssembler::generate_conjoint_oop_copy(MacroAssembler* masm, bool
const Register zpointer = R2, tmp = R9;
Label done, loop, load_bad, load_good, store_bad, store_good;
__ sldi_(R0, R5_ARG3, 3);
- __ beq(CCR0, done);
+ __ beq(CR0, done);
__ mtctr(R5_ARG3);
// Point behind last elements and copy backwards.
__ add(R3_ARG1, R3_ARG1, R0);
@@ -571,12 +570,12 @@ void ZBarrierSetAssembler::check_oop(MacroAssembler *masm, Register obj, const c
Label done, skip_uncolor;
// Skip (colored) null.
__ srdi_(R0, obj, ZPointerLoadShift);
- __ beq(CCR0, done);
+ __ beq(CR0, done);
// Check if ZAddressHeapBase << ZPointerLoadShift is set. If so, we need to uncolor.
__ rldicl_(R0, obj, 64 - ZAddressHeapBaseShift - ZPointerLoadShift, 63);
__ mr(R0, obj);
- __ beq(CCR0, skip_uncolor);
+ __ beq(CR0, skip_uncolor);
__ srdi(R0, obj, ZPointerLoadShift);
__ bind(skip_uncolor);
@@ -595,7 +594,7 @@ void ZBarrierSetAssembler::try_resolve_jobject_in_native(MacroAssembler* masm, R
// Test for tag
__ andi_(tmp, obj, JNIHandles::tag_mask);
- __ bne(CCR0, tagged);
+ __ bne(CR0, tagged);
// Resolve local handle
__ ld(dst, 0, obj);
@@ -606,7 +605,7 @@ void ZBarrierSetAssembler::try_resolve_jobject_in_native(MacroAssembler* masm, R
// Test for weak tag
__ andi_(tmp, obj, JNIHandles::TypeTag::weak_global);
__ clrrdi(dst, obj, JNIHandles::tag_size); // Untag.
- __ bne(CCR0, weak_tagged);
+ __ bne(CR0, weak_tagged);
// Resolve global handle
__ ld(dst, 0, dst);
@@ -621,7 +620,7 @@ void ZBarrierSetAssembler::try_resolve_jobject_in_native(MacroAssembler* masm, R
__ bind(check_color);
__ and_(tmp, tmp, dst);
- __ bne(CCR0, slowpath);
+ __ bne(CR0, slowpath);
// Uncolor
__ srdi(dst, dst, ZPointerLoadShift);
@@ -667,7 +666,7 @@ void ZBarrierSetAssembler::generate_c1_load_barrier(LIR_Assembler* ce,
ZLoadBarrierStubC1* stub,
bool on_non_strong) const {
check_color(ce, ref, on_non_strong);
- __ bc_far_optimized(Assembler::bcondCRbiIs0, __ bi0(CCR0, Assembler::equal), *stub->entry());
+ __ bc_far_optimized(Assembler::bcondCRbiIs0, __ bi0(CR0, Assembler::equal), *stub->entry());
z_uncolor(ce, ref);
__ bind(*stub->continuation());
}
diff --git a/src/hotspot/cpu/ppc/gc/z/z_ppc.ad b/src/hotspot/cpu/ppc/gc/z/z_ppc.ad
index 5205138a6ee35..65fb206ad7e6c 100644
--- a/src/hotspot/cpu/ppc/gc/z/z_ppc.ad
+++ b/src/hotspot/cpu/ppc/gc/z/z_ppc.ad
@@ -1,6 +1,6 @@
//
-// Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
-// Copyright (c) 2021 SAP SE. All rights reserved.
+// Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved.
+// Copyright (c) 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
@@ -70,7 +70,7 @@ static void z_load_barrier(MacroAssembler* masm, const MachNode* node, Address r
check_color(masm, ref, on_non_strong);
ZLoadBarrierStubC2* const stub = ZLoadBarrierStubC2::create(node, ref_addr, ref);
- __ bne_far(CCR0, *stub->entry(), MacroAssembler::bc_far_optimize_on_relocate);
+ __ bne_far(CR0, *stub->entry(), MacroAssembler::bc_far_optimize_on_relocate);
z_uncolor(masm, ref);
__ bind(*stub->continuation());
@@ -97,7 +97,7 @@ static void z_compare_and_swap(MacroAssembler* masm, const MachNode* node,
Register rold_zpointer = tmp1, rnew_zpointer = tmp2;
z_store_barrier(masm, node, mem, 0, newval, rnew_zpointer, true /* is_atomic */);
z_color(masm, rold_zpointer, oldval);
- __ cmpxchgd(CCR0, R0, rold_zpointer, rnew_zpointer, mem,
+ __ cmpxchgd(CR0, R0, rold_zpointer, rnew_zpointer, mem,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(), res, nullptr, true,
false /* we could support weak, but benefit is questionable */);
@@ -119,7 +119,7 @@ static void z_compare_and_exchange(MacroAssembler* masm, const MachNode* node,
Register rold_zpointer = R0, rnew_zpointer = tmp;
z_store_barrier(masm, node, mem, 0, newval, rnew_zpointer, true /* is_atomic */);
z_color(masm, rold_zpointer, oldval);
- __ cmpxchgd(CCR0, res, rold_zpointer, rnew_zpointer, mem,
+ __ cmpxchgd(CR0, res, rold_zpointer, rnew_zpointer, mem,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(), noreg, nullptr, true,
false /* we could support weak, but benefit is questionable */);
z_uncolor(masm, res);
diff --git a/src/hotspot/cpu/ppc/icache_ppc.cpp b/src/hotspot/cpu/ppc/icache_ppc.cpp
index 6901efc37b77a..05ad3c7a30d14 100644
--- a/src/hotspot/cpu/ppc/icache_ppc.cpp
+++ b/src/hotspot/cpu/ppc/icache_ppc.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2018 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "runtime/icache.hpp"
// Use inline assembler to implement icache flush.
diff --git a/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp b/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp
index 67b9bdc04142f..000e3cdf2d9c1 100644
--- a/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp
+++ b/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2024 SAP SE. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -24,7 +24,6 @@
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "gc/shared/barrierSet.hpp"
#include "gc/shared/barrierSetAssembler.hpp"
@@ -127,10 +126,10 @@ void InterpreterMacroAssembler::check_and_handle_popframe(Register scratch_reg)
// means that this code is called *during* popframe handling - we
// don't want to reenter.
andi_(R0, scratch_reg, JavaThread::popframe_pending_bit);
- beq(CCR0, L);
+ beq(CR0, L);
andi_(R0, scratch_reg, JavaThread::popframe_processing_bit);
- bne(CCR0, L);
+ bne(CR0, L);
// Call the Interpreter::remove_activation_preserving_args_entry()
// func to get the address of the same-named entrypoint in the
@@ -151,12 +150,12 @@ void InterpreterMacroAssembler::check_and_handle_earlyret(Register scratch_reg)
if (JvmtiExport::can_force_early_return()) {
Label Lno_early_ret;
ld(Rthr_state_addr, in_bytes(JavaThread::jvmti_thread_state_offset()), R16_thread);
- cmpdi(CCR0, Rthr_state_addr, 0);
- beq(CCR0, Lno_early_ret);
+ cmpdi(CR0, Rthr_state_addr, 0);
+ beq(CR0, Lno_early_ret);
lwz(R0, in_bytes(JvmtiThreadState::earlyret_state_offset()), Rthr_state_addr);
- cmpwi(CCR0, R0, JvmtiThreadState::earlyret_pending);
- bne(CCR0, Lno_early_ret);
+ cmpwi(CR0, R0, JvmtiThreadState::earlyret_pending);
+ bne(CR0, Lno_early_ret);
// Jump to Interpreter::_earlyret_entry.
lwz(R3_ARG1, in_bytes(JvmtiThreadState::earlyret_tos_offset()), Rthr_state_addr);
@@ -230,7 +229,7 @@ void InterpreterMacroAssembler::dispatch_Lbyte_code(TosState state, Register byt
ld(R0, in_bytes(JavaThread::polling_word_offset()), R16_thread);
// Armed page has poll_bit set, if poll bit is cleared just continue.
andi_(R0, R0, SafepointMechanism::poll_bit());
- beq(CCR0, dispatch);
+ beq(CR0, dispatch);
load_dispatch_table(R11_scratch1, sfpt_tbl);
align(32, 16);
bind(dispatch);
@@ -529,8 +528,8 @@ void InterpreterMacroAssembler::load_resolved_reference_at_index(Register result
Label index_ok;
lwa(R0, arrayOopDesc::length_offset_in_bytes(), result);
sldi(R0, R0, LogBytesPerHeapOop);
- cmpd(CCR0, index, R0);
- blt(CCR0, index_ok);
+ cmpd(CR0, index, R0);
+ blt(CR0, index_ok);
stop("resolved reference index out of bounds");
bind(index_ok);
#endif
@@ -593,8 +592,8 @@ void InterpreterMacroAssembler::index_check_without_pop(Register Rarray, Registe
// Array nullcheck
if (!ImplicitNullChecks) {
- cmpdi(CCR0, Rarray, 0);
- beq(CCR0, LisNull);
+ cmpdi(CR0, Rarray, 0);
+ beq(CR0, LisNull);
} else {
null_check_throw(Rarray, arrayOopDesc::length_offset_in_bytes(), /*temp*/RsxtIndex);
}
@@ -606,9 +605,9 @@ void InterpreterMacroAssembler::index_check_without_pop(Register Rarray, Registe
// Index check
lwz(Rlength, arrayOopDesc::length_offset_in_bytes(), Rarray);
- cmplw(CCR0, Rindex, Rlength);
+ cmplw(CR0, Rindex, Rlength);
sldi(RsxtIndex, RsxtIndex, index_shift);
- blt(CCR0, LnotOOR);
+ blt(CR0, LnotOOR);
// Index should be in R17_tos, array should be in R4_ARG2.
mr_if_needed(R17_tos, Rindex);
mr_if_needed(R4_ARG2, Rarray);
@@ -681,18 +680,18 @@ void InterpreterMacroAssembler::unlock_if_synchronized_method(TosState state,
// Check if synchronized method or unlocking prevented by
// JavaThread::do_not_unlock_if_synchronized flag.
lbz(Rdo_not_unlock_flag, in_bytes(JavaThread::do_not_unlock_if_synchronized_offset()), R16_thread);
- lwz(Raccess_flags, in_bytes(Method::access_flags_offset()), R19_method);
+ lhz(Raccess_flags, in_bytes(Method::access_flags_offset()), R19_method);
li(R0, 0);
stb(R0, in_bytes(JavaThread::do_not_unlock_if_synchronized_offset()), R16_thread); // reset flag
push(state);
// Skip if we don't have to unlock.
- rldicl_(R0, Raccess_flags, 64-JVM_ACC_SYNCHRONIZED_BIT, 63); // Extract bit and compare to 0.
- beq(CCR0, Lunlocked);
+ testbitdi(CR0, R0, Raccess_flags, JVM_ACC_SYNCHRONIZED_BIT);
+ beq(CR0, Lunlocked);
- cmpwi(CCR0, Rdo_not_unlock_flag, 0);
- bne(CCR0, Lno_unlock);
+ cmpwi(CR0, Rdo_not_unlock_flag, 0);
+ bne(CR0, Lno_unlock);
}
// Unlock
@@ -706,8 +705,8 @@ void InterpreterMacroAssembler::unlock_if_synchronized_method(TosState state,
-(frame::ijava_state_size + frame::interpreter_frame_monitor_size_in_bytes())); // Monitor base
ld(R0, BasicObjectLock::obj_offset(), Rmonitor_base);
- cmpdi(CCR0, R0, 0);
- bne(CCR0, Lunlock);
+ cmpdi(CR0, R0, 0);
+ bne(CR0, Lunlock);
// If it's already unlocked, throw exception.
if (throw_monitor_exception) {
@@ -741,7 +740,7 @@ void InterpreterMacroAssembler::unlock_if_synchronized_method(TosState state,
addi(Rmonitor_base, Rmonitor_base, - frame::ijava_state_size); // Monitor base
subf_(Riterations, R26_monitor, Rmonitor_base);
- ble(CCR0, Lno_unlock);
+ ble(CR0, Lno_unlock);
addi(Rcurrent_obj_addr, Rmonitor_base,
in_bytes(BasicObjectLock::obj_offset()) - frame::interpreter_frame_monitor_size_in_bytes());
@@ -760,8 +759,8 @@ void InterpreterMacroAssembler::unlock_if_synchronized_method(TosState state,
bind(Lloop);
// Check if current entry is used.
- cmpdi(CCR0, Rcurrent_obj, 0);
- bne(CCR0, Lexception);
+ cmpdi(CR0, Rcurrent_obj, 0);
+ bne(CR0, Lexception);
// Preload next iteration's compare value.
ld(Rcurrent_obj, 0, Rcurrent_obj_addr);
addi(Rcurrent_obj_addr, Rcurrent_obj_addr, -delta);
@@ -817,29 +816,29 @@ void InterpreterMacroAssembler::narrow(Register result) {
Label notBool, notByte, notChar, done;
// common case first
- cmpwi(CCR0, ret_type, T_INT);
- beq(CCR0, done);
+ cmpwi(CR0, ret_type, T_INT);
+ beq(CR0, done);
- cmpwi(CCR0, ret_type, T_BOOLEAN);
- bne(CCR0, notBool);
+ cmpwi(CR0, ret_type, T_BOOLEAN);
+ bne(CR0, notBool);
andi(result, result, 0x1);
b(done);
bind(notBool);
- cmpwi(CCR0, ret_type, T_BYTE);
- bne(CCR0, notByte);
+ cmpwi(CR0, ret_type, T_BYTE);
+ bne(CR0, notByte);
extsb(result, result);
b(done);
bind(notByte);
- cmpwi(CCR0, ret_type, T_CHAR);
- bne(CCR0, notChar);
+ cmpwi(CR0, ret_type, T_CHAR);
+ bne(CR0, notChar);
andi(result, result, 0xffff);
b(done);
bind(notChar);
- // cmpwi(CCR0, ret_type, T_SHORT); // all that's left
- // bne(CCR0, done);
+ // cmpwi(CR0, ret_type, T_SHORT); // all that's left
+ // bne(CR0, done);
extsh(result, result);
// Nothing to do for T_INT
@@ -894,8 +893,8 @@ void InterpreterMacroAssembler::remove_activation(TosState state,
// check if already enabled - if so no re-enabling needed
assert(sizeof(StackOverflow::StackGuardState) == 4, "unexpected size");
lwz(R0, in_bytes(JavaThread::stack_guard_state_offset()), R16_thread);
- cmpwi(CCR0, R0, StackOverflow::stack_guard_enabled);
- beq_predict_taken(CCR0, no_reserved_zone_enabling);
+ cmpwi(CR0, R0, StackOverflow::stack_guard_enabled);
+ beq_predict_taken(CR0, no_reserved_zone_enabling);
// Compare frame pointers. There is no good stack pointer, as with stack
// frame compression we can get different SPs when we do calls. A subsequent
@@ -903,8 +902,8 @@ void InterpreterMacroAssembler::remove_activation(TosState state,
// inner call of the method annotated with ReservedStack.
ld_ptr(R0, JavaThread::reserved_stack_activation_offset(), R16_thread);
ld_ptr(R11_scratch1, _abi0(callers_sp), R1_SP); // Load frame pointer.
- cmpld(CCR0, R11_scratch1, R0);
- blt_predict_taken(CCR0, no_reserved_zone_enabling);
+ cmpld(CR0, R11_scratch1, R0);
+ blt_predict_taken(CR0, no_reserved_zone_enabling);
// Enable reserved zone again, throw stack overflow exception.
call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::enable_stack_reserved_zone), R16_thread);
@@ -962,8 +961,8 @@ void InterpreterMacroAssembler::lock_object(Register monitor, Register object) {
if (DiagnoseSyncOnValueBasedClasses != 0) {
load_klass(tmp, object);
lbz(tmp, in_bytes(Klass::misc_flags_offset()), tmp);
- testbitdi(CCR0, R0, tmp, exact_log2(KlassFlags::_misc_is_value_based_class));
- bne(CCR0, slow_case);
+ testbitdi(CR0, R0, tmp, exact_log2(KlassFlags::_misc_is_value_based_class));
+ bne(CR0, slow_case);
}
if (LockingMode == LM_LIGHTWEIGHT) {
@@ -990,8 +989,8 @@ void InterpreterMacroAssembler::lock_object(Register monitor, Register object) {
addi(object_mark_addr, object, oopDesc::mark_offset_in_bytes());
// Must fence, otherwise, preceding store(s) may float below cmpxchg.
- // CmpxchgX sets CCR0 to cmpX(current, displaced).
- cmpxchgd(/*flag=*/CCR0,
+ // CmpxchgX sets CR0 to cmpX(current, displaced).
+ cmpxchgd(/*flag=*/CR0,
/*current_value=*/current_header,
/*compare_value=*/header, /*exchange_value=*/monitor,
/*where=*/object_mark_addr,
@@ -1022,7 +1021,7 @@ void InterpreterMacroAssembler::lock_object(Register monitor, Register object) {
and_(R0/*==0?*/, current_header, tmp);
// If condition is true we are done and hence we can store 0 in the displaced
// header indicating it is a recursive lock.
- bne(CCR0, slow_case);
+ bne(CR0, slow_case);
std(R0/*==0!*/, mark_offset, monitor);
b(count_locking);
}
@@ -1088,8 +1087,8 @@ void InterpreterMacroAssembler::unlock_object(Register monitor) {
BasicLock::displaced_header_offset_in_bytes(), monitor);
// If the displaced header is zero, we have a recursive unlock.
- cmpdi(CCR0, header, 0);
- beq(CCR0, free_slot); // recursive unlock
+ cmpdi(CR0, header, 0);
+ beq(CR0, free_slot); // recursive unlock
}
// } else if (Atomic::cmpxchg(obj->mark_addr(), monitor, displaced_header) == monitor) {
@@ -1109,8 +1108,8 @@ void InterpreterMacroAssembler::unlock_object(Register monitor) {
// We have the displaced header in displaced_header. If the lock is still
// lightweight, it will contain the monitor address and we'll store the
// displaced header back into the object's mark word.
- // CmpxchgX sets CCR0 to cmpX(current, monitor).
- cmpxchgd(/*flag=*/CCR0,
+ // CmpxchgX sets CR0 to cmpX(current, monitor).
+ cmpxchgd(/*flag=*/CR0,
/*current_value=*/current_header,
/*compare_value=*/monitor, /*exchange_value=*/header,
/*where=*/object_mark_addr,
@@ -1171,8 +1170,8 @@ void InterpreterMacroAssembler::call_from_interpreter(Register Rtarget_method, R
// compiled code in threads for which the event is enabled. Check here for
// interp_only_mode if these events CAN be enabled.
Label done;
- cmpwi(CCR0, Rinterp_only, 0);
- beq(CCR0, done);
+ cmpwi(CR0, Rinterp_only, 0);
+ beq(CR0, done);
ld(Rtarget_addr, in_bytes(Method::interpreter_entry_offset()), Rtarget_method);
align(32, 12);
bind(done);
@@ -1181,8 +1180,8 @@ void InterpreterMacroAssembler::call_from_interpreter(Register Rtarget_method, R
#ifdef ASSERT
{
Label Lok;
- cmpdi(CCR0, Rtarget_addr, 0);
- bne(CCR0, Lok);
+ cmpdi(CR0, Rtarget_addr, 0);
+ bne(CR0, Lok);
stop("null entry point");
bind(Lok);
}
@@ -1212,7 +1211,7 @@ void InterpreterMacroAssembler::call_from_interpreter(Register Rtarget_method, R
sldi(Rscratch1, Rscratch1, Interpreter::logStackElementSize);
add(Rscratch1, Rscratch1, Rscratch2); // Rscratch2 contains fp
// Compare sender_sp with the derelativized top_frame_sp
- cmpd(CCR0, R21_sender_SP, Rscratch1);
+ cmpd(CR0, R21_sender_SP, Rscratch1);
asm_assert_eq("top_frame_sp incorrect");
#endif
@@ -1235,8 +1234,8 @@ void InterpreterMacroAssembler::set_method_data_pointer_for_bcp() {
// Test ImethodDataPtr. If it is null, continue at the specified label.
void InterpreterMacroAssembler::test_method_data_pointer(Label& zero_continue) {
assert(ProfileInterpreter, "must be profiling interpreter");
- cmpdi(CCR0, R28_mdx, 0);
- beq(CCR0, zero_continue);
+ cmpdi(CR0, R28_mdx, 0);
+ beq(CR0, zero_continue);
}
void InterpreterMacroAssembler::verify_method_data_pointer() {
@@ -1251,8 +1250,8 @@ void InterpreterMacroAssembler::verify_method_data_pointer() {
ld(R12_scratch2, in_bytes(Method::const_offset()), R19_method);
addi(R11_scratch1, R11_scratch1, in_bytes(ConstMethod::codes_offset()));
add(R11_scratch1, R12_scratch2, R12_scratch2);
- cmpd(CCR0, R11_scratch1, R14_bcp);
- beq(CCR0, verify_continue);
+ cmpd(CR0, R11_scratch1, R14_bcp);
+ beq(CR0, verify_continue);
call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::verify_mdp ), R19_method, R14_bcp, R28_mdx);
@@ -1335,8 +1334,8 @@ void InterpreterMacroAssembler::test_mdp_data_at(int offset,
assert(ProfileInterpreter, "must be profiling interpreter");
ld(test_out, offset, R28_mdx);
- cmpd(CCR0, value, test_out);
- bne(CCR0, not_equal_continue);
+ cmpd(CR0, value, test_out);
+ bne(CR0, not_equal_continue);
}
// Update the method data pointer by the displacement located at some fixed
@@ -1492,8 +1491,8 @@ void InterpreterMacroAssembler::profile_virtual_call(Register Rreceiver,
Label skip_receiver_profile;
if (receiver_can_be_null) {
Label not_null;
- cmpdi(CCR0, Rreceiver, 0);
- bne(CCR0, not_null);
+ cmpdi(CR0, Rreceiver, 0);
+ bne(CR0, not_null);
// We are making a call. Increment the count for null receiver.
increment_mdp_data_at(in_bytes(CounterData::count_offset()), Rscratch1, Rscratch2);
b(skip_receiver_profile);
@@ -1682,8 +1681,8 @@ void InterpreterMacroAssembler::record_klass_in_profile_helper(
if (start_row == last_row) {
// The only thing left to do is handle the null case.
// Scratch1 contains test_out from test_mdp_data_at.
- cmpdi(CCR0, scratch1, 0);
- beq(CCR0, found_null);
+ cmpdi(CR0, scratch1, 0);
+ beq(CR0, found_null);
// Receiver did not match any saved receiver and there is no empty row for it.
// Increment total counter to indicate polymorphic case.
increment_mdp_data_at(in_bytes(CounterData::count_offset()), scratch1, scratch2);
@@ -1692,8 +1691,8 @@ void InterpreterMacroAssembler::record_klass_in_profile_helper(
break;
}
// Since null is rare, make it be the branch-taken case.
- cmpdi(CCR0, scratch1, 0);
- beq(CCR0, found_null);
+ cmpdi(CR0, scratch1, 0);
+ beq(CR0, found_null);
// Put all the "Case 3" tests here.
record_klass_in_profile_helper(receiver, scratch1, scratch2, start_row + 1, done);
@@ -1735,27 +1734,27 @@ void InterpreterMacroAssembler::profile_obj_type(Register obj, Register mdo_addr
ld(tmp, mdo_addr_offs, mdo_addr_base);
// Set null_seen if obj is 0.
- cmpdi(CCR0, obj, 0);
+ cmpdi(CR0, obj, 0);
ori(R0, tmp, TypeEntries::null_seen);
- beq(CCR0, do_update);
+ beq(CR0, do_update);
load_klass(klass, obj);
clrrdi(R0, tmp, exact_log2(-TypeEntries::type_klass_mask));
// Basically same as andi(R0, tmp, TypeEntries::type_klass_mask);
- cmpd(CCR1, R0, klass);
+ cmpd(CR1, R0, klass);
// Klass seen before, nothing to do (regardless of unknown bit).
- //beq(CCR1, do_nothing);
+ //beq(CR1, do_nothing);
andi_(R0, tmp, TypeEntries::type_unknown);
// Already unknown. Nothing to do anymore.
- //bne(CCR0, do_nothing);
- crorc(CCR0, Assembler::equal, CCR1, Assembler::equal); // cr0 eq = cr1 eq or cr0 ne
- beq(CCR0, do_nothing);
+ //bne(CR0, do_nothing);
+ crorc(CR0, Assembler::equal, CR1, Assembler::equal); // cr0 eq = cr1 eq or cr0 ne
+ beq(CR0, do_nothing);
clrrdi_(R0, tmp, exact_log2(-TypeEntries::type_mask));
orr(R0, klass, tmp); // Combine klass and null_seen bit (only used if (tmp & type_mask)==0).
- beq(CCR0, do_update); // First time here. Set profile type.
+ beq(CR0, do_update); // First time here. Set profile type.
// Different than before. Cannot keep accurate profile.
ori(R0, tmp, TypeEntries::type_unknown);
@@ -1786,8 +1785,8 @@ void InterpreterMacroAssembler::profile_arguments_type(Register callee,
in_bytes(VirtualCallData::virtual_call_data_size()) : in_bytes(CounterData::counter_data_size());
lbz(tmp1, in_bytes(DataLayout::tag_offset()) - off_to_start, R28_mdx);
- cmpwi(CCR0, tmp1, is_virtual ? DataLayout::virtual_call_type_data_tag : DataLayout::call_type_data_tag);
- bne(CCR0, profile_continue);
+ cmpwi(CR0, tmp1, is_virtual ? DataLayout::virtual_call_type_data_tag : DataLayout::call_type_data_tag);
+ bne(CR0, profile_continue);
if (MethodData::profile_arguments()) {
Label done;
@@ -1798,9 +1797,9 @@ void InterpreterMacroAssembler::profile_arguments_type(Register callee,
if (i > 0 || MethodData::profile_return()) {
// If return value type is profiled we may have no argument to profile.
ld(tmp1, in_bytes(TypeEntriesAtCall::cell_count_offset())-off_to_args, R28_mdx);
- cmpdi(CCR0, tmp1, (i+1)*TypeStackSlotEntries::per_arg_count());
+ cmpdi(CR0, tmp1, (i+1)*TypeStackSlotEntries::per_arg_count());
addi(tmp1, tmp1, -i*TypeStackSlotEntries::per_arg_count());
- blt(CCR0, done);
+ blt(CR0, done);
}
ld(tmp1, in_bytes(Method::const_offset()), callee);
lhz(tmp1, in_bytes(ConstMethod::size_of_parameters_offset()), tmp1);
@@ -1866,12 +1865,12 @@ void InterpreterMacroAssembler::profile_return_type(Register ret, Register tmp1,
// length.
lbz(tmp1, 0, R14_bcp);
lbz(tmp2, in_bytes(Method::intrinsic_id_offset()), R19_method);
- cmpwi(CCR0, tmp1, Bytecodes::_invokedynamic);
- cmpwi(CCR1, tmp1, Bytecodes::_invokehandle);
- cror(CCR0, Assembler::equal, CCR1, Assembler::equal);
- cmpwi(CCR1, tmp2, static_cast(vmIntrinsics::_compiledLambdaForm));
- cror(CCR0, Assembler::equal, CCR1, Assembler::equal);
- bne(CCR0, profile_continue);
+ cmpwi(CR0, tmp1, Bytecodes::_invokedynamic);
+ cmpwi(CR1, tmp1, Bytecodes::_invokehandle);
+ cror(CR0, Assembler::equal, CR1, Assembler::equal);
+ cmpwi(CR1, tmp2, static_cast(vmIntrinsics::_compiledLambdaForm));
+ cror(CR0, Assembler::equal, CR1, Assembler::equal);
+ bne(CR0, profile_continue);
}
profile_obj_type(ret, R28_mdx, -in_bytes(ReturnTypeEntry::size()), tmp1, tmp2);
@@ -1891,8 +1890,8 @@ void InterpreterMacroAssembler::profile_parameters_type(Register tmp1, Register
// Load the offset of the area within the MDO used for
// parameters. If it's negative we're not profiling any parameters.
lwz(tmp1, in_bytes(MethodData::parameters_type_data_di_offset()) - in_bytes(MethodData::data_offset()), R28_mdx);
- cmpwi(CCR0, tmp1, 0);
- blt(CCR0, profile_continue);
+ cmpwi(CR0, tmp1, 0);
+ blt(CR0, profile_continue);
// Compute a pointer to the area for parameters from the offset
// and move the pointer to the slot for the last
@@ -1937,9 +1936,9 @@ void InterpreterMacroAssembler::profile_parameters_type(Register tmp1, Register
// Go to next parameter.
int delta = TypeStackSlotEntries::per_arg_count() * DataLayout::cell_size + (type_base - off_base);
- cmpdi(CCR0, entry_offset, off_base + delta);
+ cmpdi(CR0, entry_offset, off_base + delta);
addi(entry_offset, entry_offset, -delta);
- bge(CCR0, loop);
+ bge(CR0, loop);
align(32, 12);
bind(profile_continue);
@@ -1976,7 +1975,7 @@ void InterpreterMacroAssembler::add_monitor_to_stack(bool stack_is_empty, Regist
subf(n_slots, esp, R26_monitor);
srdi_(n_slots, n_slots, LogBytesPerWord); // Compute number of slots to copy.
assert(LogBytesPerWord == 3, "conflicts assembler instructions");
- beq(CCR0, copy_slot_finished); // Nothing to copy.
+ beq(CR0, copy_slot_finished); // Nothing to copy.
mtctr(n_slots);
@@ -2116,8 +2115,8 @@ void InterpreterMacroAssembler::check_and_forward_exception(Register Rscratch1,
Label Ldone;
// Get pending exception oop.
ld(Rexception, thread_(pending_exception));
- cmpdi(CCR0, Rexception, 0);
- beq(CCR0, Ldone);
+ cmpdi(CR0, Rexception, 0);
+ beq(CR0, Ldone);
li(Rtmp, 0);
mr_if_needed(R3, Rexception);
std(Rtmp, thread_(pending_exception)); // Clear exception in thread
@@ -2169,7 +2168,7 @@ void InterpreterMacroAssembler::call_VM_preemptable(Register oop_result, address
Label resume_pc, not_preempted;
DEBUG_ONLY(ld(R0, in_bytes(JavaThread::preempt_alternate_return_offset()), R16_thread));
- DEBUG_ONLY(cmpdi(CCR0, R0, 0));
+ DEBUG_ONLY(cmpdi(CR0, R0, 0));
asm_assert_eq("Should not have alternate return address set");
// Preserve 2 registers
@@ -2187,8 +2186,8 @@ void InterpreterMacroAssembler::call_VM_preemptable(Register oop_result, address
// Jump to handler if the call was preempted
ld(R0, in_bytes(JavaThread::preempt_alternate_return_offset()), R16_thread);
- cmpdi(CCR0, R0, 0);
- beq(CCR0, not_preempted);
+ cmpdi(CR0, R0, 0);
+ beq(CR0, not_preempted);
mtlr(R0);
li(R0, 0);
std(R0, in_bytes(JavaThread::preempt_alternate_return_offset()), R16_thread);
@@ -2216,8 +2215,8 @@ void InterpreterMacroAssembler::restore_after_resume(Register fp) {
{
Label ok;
ld(R12_scratch2, 0, R1_SP); // load fp
- cmpd(CCR0, R12_scratch2, R11_scratch1);
- beq(CCR0, ok);
+ cmpd(CR0, R12_scratch2, R11_scratch1);
+ beq(CR0, ok);
stop(FILE_AND_LINE ": FP is expected in R11_scratch1");
bind(ok);
}
@@ -2299,8 +2298,8 @@ void InterpreterMacroAssembler::restore_interpreter_state(Register scratch, bool
{
Label Lok;
subf(R0, R1_SP, scratch);
- cmpdi(CCR0, R0, frame::top_ijava_frame_abi_size + frame::ijava_state_size);
- bge(CCR0, Lok);
+ cmpdi(CR0, R0, frame::top_ijava_frame_abi_size + frame::ijava_state_size);
+ bge(CR0, Lok);
stop("frame too small (restore istate)");
bind(Lok);
}
@@ -2313,13 +2312,13 @@ void InterpreterMacroAssembler::get_method_counters(Register method,
BLOCK_COMMENT("Load and ev. allocate counter object {");
Label has_counters;
ld(Rcounters, in_bytes(Method::method_counters_offset()), method);
- cmpdi(CCR0, Rcounters, 0);
- bne(CCR0, has_counters);
+ cmpdi(CR0, Rcounters, 0);
+ bne(CR0, has_counters);
call_VM(noreg, CAST_FROM_FN_PTR(address,
InterpreterRuntime::build_method_counters), method);
ld(Rcounters, in_bytes(Method::method_counters_offset()), method);
- cmpdi(CCR0, Rcounters, 0);
- beq(CCR0, skip); // No MethodCounters, OutOfMemory.
+ cmpdi(CR0, Rcounters, 0);
+ beq(CR0, skip); // No MethodCounters, OutOfMemory.
BLOCK_COMMENT("} Load and ev. allocate counter object");
bind(has_counters);
@@ -2399,7 +2398,7 @@ void InterpreterMacroAssembler::verify_oop_or_return_address(Register reg, Regis
const int log2_bytecode_size_limit = 16;
srdi_(Rtmp, reg, log2_bytecode_size_limit);
- bne(CCR0, test);
+ bne(CR0, test);
address fd = CAST_FROM_FN_PTR(address, verify_return_address);
const int nbytes_save = MacroAssembler::num_volatile_regs * 8;
@@ -2443,8 +2442,8 @@ void InterpreterMacroAssembler::notify_method_entry() {
Label jvmti_post_done;
lwz(R0, in_bytes(JavaThread::interp_only_mode_offset()), R16_thread);
- cmpwi(CCR0, R0, 0);
- beq(CCR0, jvmti_post_done);
+ cmpwi(CR0, R0, 0);
+ beq(CR0, jvmti_post_done);
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::post_method_entry));
bind(jvmti_post_done);
@@ -2477,8 +2476,8 @@ void InterpreterMacroAssembler::notify_method_exit(bool is_native_method, TosSta
Label jvmti_post_done;
lwz(R0, in_bytes(JavaThread::interp_only_mode_offset()), R16_thread);
- cmpwi(CCR0, R0, 0);
- beq(CCR0, jvmti_post_done);
+ cmpwi(CR0, R0, 0);
+ beq(CR0, jvmti_post_done);
if (!is_native_method) { push(state); } // Expose tos to GC.
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::post_method_exit), check_exceptions);
if (!is_native_method) { pop(state); }
diff --git a/src/hotspot/cpu/ppc/interpreterRT_ppc.cpp b/src/hotspot/cpu/ppc/interpreterRT_ppc.cpp
index e2043db71004b..dd2503bd54b8b 100644
--- a/src/hotspot/cpu/ppc/interpreterRT_ppc.cpp
+++ b/src/hotspot/cpu/ppc/interpreterRT_ppc.cpp
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2013 SAP SE. All rights reserved.
+ * Copyright (c) 1997, 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 @@
*
*/
-#include "precompiled.hpp"
#include "asm/assembler.inline.hpp"
#include "interpreter/interp_masm.hpp"
#include "interpreter/interpreter.hpp"
@@ -104,9 +103,9 @@ void InterpreterRuntime::SignatureHandlerGenerator::pass_object() {
Label do_null;
if (do_null_check) {
__ ld(R0, locals_j_arg_at(offset()));
- __ cmpdi(CCR0, R0, 0);
+ __ cmpdi(CR0, R0, 0);
__ li(r, 0);
- __ beq(CCR0, do_null);
+ __ beq(CR0, do_null);
}
__ addir(r, locals_j_arg_at(offset()));
__ bind(do_null);
diff --git a/src/hotspot/cpu/ppc/jniFastGetField_ppc.cpp b/src/hotspot/cpu/ppc/jniFastGetField_ppc.cpp
index 819ecaf550e38..1c48ee4412ec7 100644
--- a/src/hotspot/cpu/ppc/jniFastGetField_ppc.cpp
+++ b/src/hotspot/cpu/ppc/jniFastGetField_ppc.cpp
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2019 SAP SE. All rights reserved.
+ * Copyright (c) 1997, 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 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "gc/shared/barrierSet.hpp"
#include "gc/shared/barrierSetAssembler.hpp"
@@ -76,7 +75,7 @@ address JNI_FastGetField::generate_fast_get_int_field0(BasicType type) {
__ ld(Rcounter, counter_offs, Rcounter_addr);
__ andi_(R0, Rcounter, 1);
- __ bne(CCR0, slow);
+ __ bne(CR0, slow);
if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
// Field may be volatile.
@@ -92,8 +91,8 @@ address JNI_FastGetField::generate_fast_get_int_field0(BasicType type) {
int fac_offs = __ load_const_optimized(Rtmp, JvmtiExport::get_field_access_count_addr(),
R0, true);
__ lwa(Rtmp, fac_offs, Rtmp);
- __ cmpwi(CCR0, Rtmp, 0);
- __ bne(CCR0, slow);
+ __ cmpwi(CR0, Rtmp, 0);
+ __ bne(CR0, slow);
}
BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
@@ -119,8 +118,8 @@ address JNI_FastGetField::generate_fast_get_int_field0(BasicType type) {
// Order preceding load(s) wrt. succeeding check (LoadStore for volatile field).
if (is_fp) {
Label next;
- __ fcmpu(CCR0, F1_RET, F1_RET);
- __ bne(CCR0, next);
+ __ fcmpu(CR0, F1_RET, F1_RET);
+ __ bne(CR0, next);
__ bind(next);
} else {
__ twi_0(Rtmp);
@@ -128,8 +127,8 @@ address JNI_FastGetField::generate_fast_get_int_field0(BasicType type) {
__ isync();
__ ld(R0, counter_offs, Rcounter_addr);
- __ cmpd(CCR0, R0, Rcounter);
- __ bne(CCR0, slow);
+ __ cmpd(CR0, R0, Rcounter);
+ __ bne(CR0, slow);
if (!is_fp) {
__ mr(R3_RET, Rtmp);
diff --git a/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp b/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
index 971ed99f9eb50..6bdb4f8026643 100644
--- a/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
+++ b/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2024 SAP SE. All rights reserved.
+ * Copyright (c) 1997, 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 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "code/compiledIC.hpp"
#include "compiler/disassembler.hpp"
@@ -1304,8 +1303,8 @@ int MacroAssembler::ic_check(int end_alignment) {
mtctr(tmp1);
if (!implicit_null_checks_available) {
- cmpdi(CCR0, receiver, 0);
- beqctr(CCR0);
+ cmpdi(CR0, receiver, 0);
+ beqctr(CR0);
}
if (UseCompressedClassPointers) {
lwz(tmp1, oopDesc::klass_offset_in_bytes(), receiver);
@@ -1313,8 +1312,8 @@ int MacroAssembler::ic_check(int end_alignment) {
ld(tmp1, oopDesc::klass_offset_in_bytes(), receiver);
}
ld(tmp2, in_bytes(CompiledICData::speculated_klass_offset()), data);
- cmpd(CCR0, tmp1, tmp2);
- bnectr(CCR0);
+ cmpd(CR0, tmp1, tmp2);
+ bnectr(CR0);
}
assert((offset() % end_alignment) == 0, "Misaligned verified entry point");
@@ -1528,8 +1527,8 @@ void MacroAssembler::reserved_stack_check(Register return_pc) {
Label no_reserved_zone_enabling;
ld_ptr(R0, JavaThread::reserved_stack_activation_offset(), R16_thread);
- cmpld(CCR0, R1_SP, R0);
- blt_predict_taken(CCR0, no_reserved_zone_enabling);
+ cmpld(CR0, R1_SP, R0);
+ blt_predict_taken(CR0, no_reserved_zone_enabling);
// Enable reserved zone again, throw stack overflow exception.
push_frame_reg_args(0, R0);
@@ -1552,9 +1551,9 @@ void MacroAssembler::getandsetd(Register dest_current_value, Register exchange_v
ldarx(dest_current_value, addr_base, cmpxchgx_hint);
stdcx_(exchange_value, addr_base);
if (UseStaticBranchPredictionInCompareAndSwapPPC64) {
- bne_predict_not_taken(CCR0, retry); // StXcx_ sets CCR0.
+ bne_predict_not_taken(CR0, retry); // StXcx_ sets CR0.
} else {
- bne( CCR0, retry); // StXcx_ sets CCR0.
+ bne( CR0, retry); // StXcx_ sets CR0.
}
}
@@ -1566,9 +1565,9 @@ void MacroAssembler::getandaddd(Register dest_current_value, Register inc_value,
add(tmp, dest_current_value, inc_value);
stdcx_(tmp, addr_base);
if (UseStaticBranchPredictionInCompareAndSwapPPC64) {
- bne_predict_not_taken(CCR0, retry); // StXcx_ sets CCR0.
+ bne_predict_not_taken(CR0, retry); // StXcx_ sets CR0.
} else {
- bne( CCR0, retry); // StXcx_ sets CCR0.
+ bne( CR0, retry); // StXcx_ sets CR0.
}
}
@@ -1639,9 +1638,9 @@ void MacroAssembler::atomic_get_and_modify_generic(Register dest_current_value,
}
if (UseStaticBranchPredictionInCompareAndSwapPPC64) {
- bne_predict_not_taken(CCR0, retry); // StXcx_ sets CCR0.
+ bne_predict_not_taken(CR0, retry); // StXcx_ sets CR0.
} else {
- bne( CCR0, retry); // StXcx_ sets CCR0.
+ bne( CR0, retry); // StXcx_ sets CR0.
}
// l?arx zero-extends, but Java wants byte/short values sign-extended.
@@ -1745,7 +1744,7 @@ void MacroAssembler::cmpxchg_generic(ConditionRegister flag, Register dest_curre
bool preset_result_reg = (int_flag_success != dest_current_value && int_flag_success != compare_value.register_or_noreg() &&
int_flag_success != exchange_value && int_flag_success != addr_base &&
int_flag_success != tmp1 && int_flag_success != tmp2);
- assert(!weak || flag == CCR0, "weak only supported with CCR0");
+ assert(!weak || flag == CR0, "weak only supported with CR0");
assert(int_flag_success == noreg || failed_ext == nullptr, "cannot have both");
assert(size == 1 || size == 2 || size == 4, "unsupported");
@@ -1774,9 +1773,9 @@ void MacroAssembler::cmpxchg_generic(ConditionRegister flag, Register dest_curre
retry, failed, cmpxchgx_hint, size);
if (!weak || use_result_reg || failed_ext) {
if (UseStaticBranchPredictionInCompareAndSwapPPC64) {
- bne_predict_not_taken(CCR0, weak ? failed : retry); // StXcx_ sets CCR0.
+ bne_predict_not_taken(CR0, weak ? failed : retry); // StXcx_ sets CR0.
} else {
- bne( CCR0, weak ? failed : retry); // StXcx_ sets CCR0.
+ bne( CR0, weak ? failed : retry); // StXcx_ sets CR0.
}
}
// fall through => (flag == eq), (dest_current_value == compare_value), (swapped)
@@ -1838,7 +1837,7 @@ void MacroAssembler::cmpxchgd(ConditionRegister flag, Register dest_current_valu
bool use_result_reg = (int_flag_success!=noreg);
bool preset_result_reg = (int_flag_success!=dest_current_value && int_flag_success!=compare_value.register_or_noreg() &&
int_flag_success!=exchange_value && int_flag_success!=addr_base);
- assert(!weak || flag == CCR0, "weak only supported with CCR0");
+ assert(!weak || flag == CR0, "weak only supported with CR0");
assert(int_flag_success == noreg || failed_ext == nullptr, "cannot have both");
if (use_result_reg && preset_result_reg) {
@@ -1871,9 +1870,9 @@ void MacroAssembler::cmpxchgd(ConditionRegister flag, Register dest_current_valu
stdcx_(exchange_value, addr_base);
if (!weak || use_result_reg || failed_ext) {
if (UseStaticBranchPredictionInCompareAndSwapPPC64) {
- bne_predict_not_taken(CCR0, weak ? failed : retry); // stXcx_ sets CCR0
+ bne_predict_not_taken(CR0, weak ? failed : retry); // stXcx_ sets CR0
} else {
- bne( CCR0, weak ? failed : retry); // stXcx_ sets CCR0
+ bne( CR0, weak ? failed : retry); // stXcx_ sets CR0
}
}
@@ -1961,12 +1960,12 @@ void MacroAssembler::lookup_interface_method(Register recv_klass,
// Check that this entry is non-null. A null entry means that
// the receiver class doesn't implement the interface, and wasn't the
// same as when the caller was compiled.
- cmpd(CCR0, temp2, intf_klass);
+ cmpd(CR0, temp2, intf_klass);
if (peel) {
- beq(CCR0, found_method);
+ beq(CR0, found_method);
} else {
- bne(CCR0, search);
+ bne(CR0, search);
// (invert the test to fall through to found_method...)
}
@@ -1974,8 +1973,8 @@ void MacroAssembler::lookup_interface_method(Register recv_klass,
bind(search);
- cmpdi(CCR0, temp2, 0);
- beq(CCR0, L_no_such_interface);
+ cmpdi(CR0, temp2, 0);
+ beq(CR0, L_no_such_interface);
addi(scan_temp, scan_temp, scan_step);
}
@@ -2045,8 +2044,8 @@ void MacroAssembler::check_klass_subtype_fast_path(Register sub_klass,
// We move this check to the front of the fast path because many
// type checks are in fact trivially successful in this manner,
// so we get a nicely predicted branch right at the start of the check.
- cmpd(CCR0, sub_klass, super_klass);
- beq(CCR0, *L_success);
+ cmpd(CR0, sub_klass, super_klass);
+ beq(CR0, *L_success);
// Check the supertype display:
if (must_load_sco) {
@@ -2059,7 +2058,7 @@ void MacroAssembler::check_klass_subtype_fast_path(Register sub_klass,
// The loaded value is the offset from Klass.
ld(cached_super, super_check_offset, sub_klass);
- cmpd(CCR0, cached_super, super_klass);
+ cmpd(CR0, cached_super, super_klass);
// This check has worked decisively for primary supers.
// Secondary supers are sought in the super_cache ('super_cache_addr').
@@ -2075,29 +2074,29 @@ void MacroAssembler::check_klass_subtype_fast_path(Register sub_klass,
#define FINAL_JUMP(label) if (&(label) != &L_fallthrough) { b(label); }
if (super_check_offset.is_register()) {
- beq(CCR0, *L_success);
- cmpwi(CCR0, super_check_offset.as_register(), sc_offset);
+ beq(CR0, *L_success);
+ cmpwi(CR0, super_check_offset.as_register(), sc_offset);
if (L_failure == &L_fallthrough) {
- beq(CCR0, *L_slow_path);
+ beq(CR0, *L_slow_path);
} else {
- bne(CCR0, *L_failure);
+ bne(CR0, *L_failure);
FINAL_JUMP(*L_slow_path);
}
} else {
if (super_check_offset.as_constant() == sc_offset) {
// Need a slow path; fast failure is impossible.
if (L_slow_path == &L_fallthrough) {
- beq(CCR0, *L_success);
+ beq(CR0, *L_success);
} else {
- bne(CCR0, *L_slow_path);
+ bne(CR0, *L_slow_path);
FINAL_JUMP(*L_success);
}
} else {
// No slow path; it's a fast decision.
if (L_failure == &L_fallthrough) {
- beq(CCR0, *L_success);
+ beq(CR0, *L_success);
} else {
- bne(CCR0, *L_failure);
+ bne(CR0, *L_failure);
FINAL_JUMP(*L_success);
}
}
@@ -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());
@@ -2130,32 +2130,125 @@ 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
+ cmpwi(CR0, temp, 0);
+ beq(CR0, (L_success == nullptr) ? failure : fallthru); // indicate failure if length 0
mtctr(temp); // load ctr
bind(loop);
// Oops in table are NO MORE compressed.
ld(temp, base_offset, array_ptr);
- cmpd(CCR0, temp, super_klass);
- beq(CCR0, hit);
+ cmpd(CR0, temp, super_klass);
+ beq(CR0, hit);
addi(array_ptr, array_ptr, BytesPerWord);
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(CR0, Assembler::equal, CR0, 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(CR0, result_reg, 0);
+ }
+
+ // Unspill the temp. registers:
+ pop_set(pushed_regs);
+
+ if (L_success != nullptr) {
+ beq(CR0, *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,
@@ -2172,27 +2265,28 @@ void MacroAssembler::check_klass_subtype(Register sub_klass,
// generic (count must be >0)
// iff found: CR0 eq, scratch == 0
void MacroAssembler::repne_scan(Register addr, Register value, Register count, Register scratch) {
- Label Lloop, Lexit;
+ Label Lloop, Lafter_loop, Lexit;
-#ifdef ASSERT
- {
- Label ok;
- cmpdi(CCR0, count, 0);
- bgt(CCR0, ok);
- stop("count must be positive");
- bind(ok);
- }
-#endif
-
- mtctr(count);
+ srdi_(scratch, count, 1);
+ beq(CR0, Lafter_loop);
+ mtctr(scratch);
- bind(Lloop);
- ld(scratch, 0 , addr);
+ bind(Lloop); // 2x unrolled
+ ld(scratch, 0, addr);
+ xor_(scratch, scratch, value);
+ beq(CR0, Lexit);
+ ld(scratch, 8, addr);
xor_(scratch, scratch, value);
- beq(CCR0, Lexit);
- addi(addr, addr, wordSize);
+ beq(CR0, Lexit);
+ addi(addr, addr, 2 * wordSize);
bdnz(Lloop);
+ bind(Lafter_loop);
+ andi_(scratch, count, 1);
+ beq(CR0, Lexit); // if taken: CR0 eq and scratch == 0
+ ld(scratch, 0, addr);
+ xor_(scratch, scratch, value);
+
bind(Lexit);
}
@@ -2208,19 +2302,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 +2322,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);
@@ -2243,7 +2337,7 @@ void MacroAssembler::lookup_secondary_supers_table(Register r_sub_klass,
li(result, 1); // failure
// We test the MSB of r_array_index, i.e. its sign bit
- bge(CCR0, L_done);
+ bge(CR0, L_done);
// We will consult the secondary-super array.
ld(r_array_base, in_bytes(Klass::secondary_supers_offset()), r_sub_klass);
@@ -2267,11 +2361,11 @@ void MacroAssembler::lookup_secondary_supers_table(Register r_sub_klass,
}
xor_(result, result, r_super_klass);
- beq(CCR0, L_done); // Found a match (result == 0)
+ beq(CR0, L_done); // Found a match (result == 0)
// Is there another entry to check? Consult the bitmap.
- testbitdi(CCR0, /* temp */ r_array_length, r_bitmap, (bit + 1) & Klass::SECONDARY_SUPERS_TABLE_MASK);
- beq(CCR0, L_done); // (result != 0)
+ testbitdi(CR0, /* temp */ r_array_length, r_bitmap, (bit + 1) & Klass::SECONDARY_SUPERS_TABLE_MASK);
+ beq(CR0, L_done); // (result != 0)
// Linear probe. Rotate the bitmap so that the next bit to test is
// in Bit 2 for the look-ahead check in the slow path.
@@ -2290,7 +2384,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(CR0, 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(CR0, 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(CR0, 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 +2490,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.
@@ -2329,8 +2504,8 @@ void MacroAssembler::lookup_secondary_supers_table_slow_path(Register r_super_kl
// The bitmap is full to bursting.
// Implicit invariant: BITMAP_FULL implies (length > 0)
- cmpwi(CCR0, r_array_length, (int32_t)Klass::SECONDARY_SUPERS_TABLE_SIZE - 2);
- bgt(CCR0, L_huge);
+ cmpwi(CR0, r_array_length, (int32_t)Klass::SECONDARY_SUPERS_TABLE_SIZE - 2);
+ bgt(CR0, L_huge);
// NB! Our caller has checked bits 0 and 1 in the bitmap. The
// current slot (at secondary_supers[r_array_index]) has not yet
@@ -2348,8 +2523,8 @@ void MacroAssembler::lookup_secondary_supers_table_slow_path(Register r_super_kl
// We should only reach here after having found a bit in the bitmap.
// Invariant: array_length == popcount(bitmap)
Label ok;
- cmpdi(CCR0, r_array_length, 0);
- bgt(CCR0, ok);
+ cmpdi(CR0, r_array_length, 0);
+ bgt(CR0, ok);
stop("array_length must be positive");
bind(ok);
}
@@ -2363,16 +2538,16 @@ void MacroAssembler::lookup_secondary_supers_table_slow_path(Register r_super_kl
bind(L_loop);
// Check for wraparound.
- cmpd(CCR0, r_array_index, r_array_length);
- isel_0(r_array_index, CCR0, Assembler::greater);
+ cmpd(CR0, r_array_index, r_array_length);
+ isel_0(r_array_index, CR0, Assembler::greater);
ldx(result, r_array_base, r_array_index);
xor_(result, result, r_super_klass);
- beq(CCR0, L_done); // success (result == 0)
+ beq(CR0, L_done); // success (result == 0)
// look-ahead check (Bit 2); result is non-zero
- testbitdi(CCR0, R0, r_bitmap, 2);
- beq(CCR0, L_done); // fail (result != 0)
+ testbitdi(CR0, R0, r_bitmap, 2);
+ beq(CR0, L_done); // fail (result != 0)
rldicl(r_bitmap, r_bitmap, 64 - 1, 0);
addi(r_array_index, r_array_index, BytesPerWord);
@@ -2405,8 +2580,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;
@@ -2422,24 +2595,28 @@ void MacroAssembler::verify_secondary_supers_table(Register r_sub_klass,
normalize_bool(result, R0, true);
const Register linear_result = r_array_index; // reuse
li(linear_result, 1);
- cmpdi(CCR0, r_array_length, 0);
- ble(CCR0, failure);
+ cmpdi(CR0, r_array_length, 0);
+ ble(CR0, failure);
repne_scan(r_array_base, r_super_klass, r_array_length, linear_result);
bind(failure);
// convert !=0 to 1
normalize_bool(linear_result, R0, true);
- cmpd(CCR0, result, linear_result);
- beq(CCR0, passed);
+ cmpd(CR0, result, linear_result);
+ beq(CR0, passed);
+
+ // 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);
- 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);
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));
@@ -2463,19 +2640,19 @@ void MacroAssembler::clinit_barrier(Register klass, Register thread, Label* L_fa
// Fast path check: class is fully initialized
lbz(R0, in_bytes(InstanceKlass::init_state_offset()), klass);
// acquire by cmp-branch-isync if fully_initialized
- cmpwi(CCR0, R0, InstanceKlass::fully_initialized);
- bne(CCR0, L_check_thread);
+ cmpwi(CR0, R0, InstanceKlass::fully_initialized);
+ bne(CR0, L_check_thread);
isync();
b(*L_fast_path);
// Fast path check: current thread is initializer thread
bind(L_check_thread);
ld(R0, in_bytes(InstanceKlass::init_thread_offset()), klass);
- cmpd(CCR0, thread, R0);
+ cmpd(CR0, thread, R0);
if (L_slow_path == &L_fallthrough) {
- beq(CCR0, *L_fast_path);
+ beq(CR0, *L_fast_path);
} else if (L_fast_path == &L_fallthrough) {
- bne(CCR0, *L_slow_path);
+ bne(CR0, *L_slow_path);
} else {
Unimplemented();
}
@@ -2523,15 +2700,15 @@ void MacroAssembler::tlab_allocate(
} else {
add(new_top, obj, var_size_in_bytes);
}
- cmpld(CCR0, new_top, R0);
- bc_far_optimized(Assembler::bcondCRbiIs1, bi0(CCR0, Assembler::greater), slow_case);
+ cmpld(CR0, new_top, R0);
+ bc_far_optimized(Assembler::bcondCRbiIs1, bi0(CR0, Assembler::greater), slow_case);
#ifdef ASSERT
// make sure new free pointer is properly aligned
{
Label L;
andi_(R0, new_top, MinObjAlignmentInBytesMask);
- beq(CCR0, L);
+ beq(CR0, L);
stop("updated TLAB free is not properly aligned");
bind(L);
}
@@ -2608,7 +2785,7 @@ void MacroAssembler::compiler_fast_lock_object(ConditionRegister flag, Register
// Handle existing monitor.
// The object has an existing monitor iff (mark & monitor_value) != 0.
andi_(temp, displaced_header, markWord::monitor_value);
- bne(CCR0, object_has_monitor);
+ bne(CR0, object_has_monitor);
if (LockingMode == LM_MONITOR) {
// Set NE to indicate 'failure' -> take slow-path.
@@ -2654,10 +2831,10 @@ void MacroAssembler::compiler_fast_lock_object(ConditionRegister flag, Register
// displaced header in the box, which indicates that it is a recursive lock.
std(R0/*==0, perhaps*/, BasicLock::displaced_header_offset_in_bytes(), box);
- if (flag != CCR0) {
- mcrf(flag, CCR0);
+ if (flag != CR0) {
+ mcrf(flag, CR0);
}
- beq(CCR0, success);
+ beq(CR0, success);
b(failure);
}
@@ -2730,7 +2907,7 @@ void MacroAssembler::compiler_fast_unlock_object(ConditionRegister flag, Registe
// The object has an existing monitor iff (mark & monitor_value) != 0.
ld(current_header, oopDesc::mark_offset_in_bytes(), oop);
andi_(R0, current_header, markWord::monitor_value);
- bne(CCR0, object_has_monitor);
+ bne(CR0, object_has_monitor);
if (LockingMode == LM_MONITOR) {
// Set NE to indicate 'failure' -> take slow-path.
@@ -2761,12 +2938,12 @@ void MacroAssembler::compiler_fast_unlock_object(ConditionRegister flag, Registe
ld(displaced_header, in_bytes(ObjectMonitor::recursions_offset()), current_header);
addic_(displaced_header, displaced_header, -1);
- blt(CCR0, not_recursive); // Not recursive if negative after decrement.
+ blt(CR0, not_recursive); // Not recursive if negative after decrement.
// Recursive unlock
std(displaced_header, in_bytes(ObjectMonitor::recursions_offset()), current_header);
- if (flag == CCR0) { // Otherwise, flag is already EQ, here.
- crorc(CCR0, Assembler::equal, CCR0, Assembler::equal); // Set CCR0 EQ
+ if (flag == CR0) { // Otherwise, flag is already EQ, here.
+ crorc(CR0, Assembler::equal, CR0, Assembler::equal); // Set CR0 EQ
}
b(success);
@@ -2825,7 +3002,7 @@ void MacroAssembler::compiler_fast_lock_lightweight_object(ConditionRegister fla
Register tmp1, Register tmp2, Register tmp3) {
assert_different_registers(obj, box, tmp1, tmp2, tmp3);
assert(UseObjectMonitorTable || tmp3 == noreg, "tmp3 not needed");
- assert(flag == CCR0, "bad condition register");
+ assert(flag == CR0, "bad condition register");
// Handle inflated monitor.
Label inflated;
@@ -2843,8 +3020,8 @@ void MacroAssembler::compiler_fast_lock_lightweight_object(ConditionRegister fla
if (DiagnoseSyncOnValueBasedClasses != 0) {
load_klass(tmp1, obj);
lbz(tmp1, in_bytes(Klass::misc_flags_offset()), tmp1);
- testbitdi(CCR0, R0, tmp1, exact_log2(KlassFlags::_misc_is_value_based_class));
- bne(CCR0, slow_path);
+ testbitdi(CR0, R0, tmp1, exact_log2(KlassFlags::_misc_is_value_based_class));
+ bne(CR0, slow_path);
}
Register mark = tmp1;
@@ -2858,8 +3035,8 @@ void MacroAssembler::compiler_fast_lock_lightweight_object(ConditionRegister fla
// Check if lock-stack is full.
lwz(top, in_bytes(JavaThread::lock_stack_top_offset()), R16_thread);
- cmplwi(CCR0, top, LockStack::end_offset() - 1);
- bgt(CCR0, slow_path);
+ cmplwi(CR0, top, LockStack::end_offset() - 1);
+ bgt(CR0, slow_path);
// The underflow check is elided. The recursive check will always fail
// when the lock stack is empty because of the _bad_oop_sentinel field.
@@ -2867,15 +3044,15 @@ void MacroAssembler::compiler_fast_lock_lightweight_object(ConditionRegister fla
// Check if recursive.
subi(R0, top, oopSize);
ldx(R0, R16_thread, R0);
- cmpd(CCR0, obj, R0);
- beq(CCR0, push);
+ cmpd(CR0, obj, R0);
+ beq(CR0, push);
// Check for monitor (0b10) or locked (0b00).
ld(mark, oopDesc::mark_offset_in_bytes(), obj);
andi_(R0, mark, markWord::lock_mask_in_place);
- cmpldi(CCR0, R0, markWord::unlocked_value);
- bgt(CCR0, inflated);
- bne(CCR0, slow_path);
+ cmpldi(CR0, R0, markWord::unlocked_value);
+ bgt(CR0, inflated);
+ bne(CR0, slow_path);
// Not inflated.
@@ -2915,8 +3092,8 @@ void MacroAssembler::compiler_fast_lock_lightweight_object(ConditionRegister fla
const int num_unrolled = 2;
for (int i = 0; i < num_unrolled; i++) {
ld(R0, 0, cache_addr);
- cmpd(CCR0, R0, obj);
- beq(CCR0, monitor_found);
+ cmpd(CR0, R0, obj);
+ beq(CR0, monitor_found);
addi(cache_addr, cache_addr, in_bytes(OMCache::oop_to_oop_difference()));
}
@@ -2927,14 +3104,14 @@ void MacroAssembler::compiler_fast_lock_lightweight_object(ConditionRegister fla
// Check for match.
ld(R0, 0, cache_addr);
- cmpd(CCR0, R0, obj);
- beq(CCR0, monitor_found);
+ cmpd(CR0, R0, obj);
+ beq(CR0, monitor_found);
// Search until null encountered, guaranteed _null_sentinel at end.
addi(cache_addr, cache_addr, in_bytes(OMCache::oop_to_oop_difference()));
- cmpdi(CCR1, R0, 0);
- bne(CCR1, loop);
- // Cache Miss, CCR0.NE set from cmp above
+ cmpdi(CR1, R0, 0);
+ bne(CR1, loop);
+ // Cache Miss, CR0.NE set from cmp above
b(slow_path);
bind(monitor_found);
@@ -2947,18 +3124,18 @@ void MacroAssembler::compiler_fast_lock_lightweight_object(ConditionRegister fla
// Try to CAS owner (no owner => current thread's _monitor_owner_id).
assert_different_registers(thread_id, monitor, owner_addr, box, R0);
ld(thread_id, in_bytes(JavaThread::monitor_owner_id_offset()), R16_thread);
- cmpxchgd(/*flag=*/CCR0,
+ cmpxchgd(/*flag=*/CR0,
/*current_value=*/R0,
/*compare_value=*/(intptr_t)0,
/*exchange_value=*/thread_id,
/*where=*/owner_addr,
MacroAssembler::MemBarRel | MacroAssembler::MemBarAcq,
MacroAssembler::cmpxchgx_hint_acquire_lock());
- beq(CCR0, monitor_locked);
+ beq(CR0, monitor_locked);
// Check if recursive.
- cmpd(CCR0, R0, thread_id);
- bne(CCR0, slow_path);
+ cmpd(CR0, R0, thread_id);
+ bne(CR0, slow_path);
// Recursive.
if (!UseObjectMonitorTable) {
@@ -2984,13 +3161,13 @@ void MacroAssembler::compiler_fast_lock_lightweight_object(ConditionRegister fla
#ifdef ASSERT
// Check that locked label is reached with flag == EQ.
Label flag_correct;
- beq(CCR0, flag_correct);
+ beq(CR0, flag_correct);
stop("Fast Lock Flag != EQ");
#endif
bind(slow_path);
#ifdef ASSERT
// Check that slow_path label is reached with flag == NE.
- bne(CCR0, flag_correct);
+ bne(CR0, flag_correct);
stop("Fast Lock Flag != NE");
bind(flag_correct);
#endif
@@ -3000,7 +3177,7 @@ void MacroAssembler::compiler_fast_lock_lightweight_object(ConditionRegister fla
void MacroAssembler::compiler_fast_unlock_lightweight_object(ConditionRegister flag, Register obj, Register box,
Register tmp1, Register tmp2, Register tmp3) {
assert_different_registers(obj, tmp1, tmp2, tmp3);
- assert(flag == CCR0, "bad condition register");
+ assert(flag == CR0, "bad condition register");
// Handle inflated monitor.
Label inflated, inflated_load_monitor;
@@ -3020,9 +3197,9 @@ void MacroAssembler::compiler_fast_unlock_lightweight_object(ConditionRegister f
lwz(top, in_bytes(JavaThread::lock_stack_top_offset()), R16_thread);
subi(top, top, oopSize);
ldx(t, R16_thread, top);
- cmpd(CCR0, obj, t);
+ cmpd(CR0, obj, t);
// Top of lock stack was not obj. Must be monitor.
- bne(CCR0, inflated_load_monitor);
+ bne(CR0, inflated_load_monitor);
// Pop lock-stack.
DEBUG_ONLY(li(t, 0);)
@@ -3035,8 +3212,8 @@ void MacroAssembler::compiler_fast_unlock_lightweight_object(ConditionRegister f
// Check if recursive.
subi(t, top, oopSize);
ldx(t, R16_thread, t);
- cmpd(CCR0, obj, t);
- beq(CCR0, unlocked);
+ cmpd(CR0, obj, t);
+ beq(CR0, unlocked);
// Not recursive.
@@ -3044,16 +3221,16 @@ void MacroAssembler::compiler_fast_unlock_lightweight_object(ConditionRegister f
ld(mark, oopDesc::mark_offset_in_bytes(), obj);
andi_(t, mark, markWord::monitor_value);
if (!UseObjectMonitorTable) {
- bne(CCR0, inflated);
+ bne(CR0, inflated);
} else {
- bne(CCR0, push_and_slow);
+ bne(CR0, push_and_slow);
}
#ifdef ASSERT
// Check header not unlocked (0b01).
Label not_unlocked;
andi_(t, mark, markWord::unlocked_value);
- beq(CCR0, not_unlocked);
+ beq(CR0, not_unlocked);
stop("lightweight_unlock already unlocked");
bind(not_unlocked);
#endif
@@ -3075,7 +3252,7 @@ void MacroAssembler::compiler_fast_unlock_lightweight_object(ConditionRegister f
ld(mark, oopDesc::mark_offset_in_bytes(), obj);
#ifdef ASSERT
andi_(t, mark, markWord::monitor_value);
- bne(CCR0, inflated);
+ bne(CR0, inflated);
stop("Fast Unlock not monitor");
#endif
@@ -3084,11 +3261,11 @@ void MacroAssembler::compiler_fast_unlock_lightweight_object(ConditionRegister f
#ifdef ASSERT
Label check_done;
subi(top, top, oopSize);
- cmplwi(CCR0, top, in_bytes(JavaThread::lock_stack_base_offset()));
- blt(CCR0, check_done);
+ cmplwi(CR0, top, in_bytes(JavaThread::lock_stack_base_offset()));
+ blt(CR0, check_done);
ldx(t, R16_thread, top);
- cmpd(CCR0, obj, t);
- bne(CCR0, inflated);
+ cmpd(CR0, obj, t);
+ bne(CR0, inflated);
stop("Fast Unlock lock on stack");
bind(check_done);
#endif
@@ -3103,8 +3280,8 @@ void MacroAssembler::compiler_fast_unlock_lightweight_object(ConditionRegister f
} else {
ld(monitor, BasicLock::object_monitor_cache_offset_in_bytes(), box);
// null check with Flags == NE, no valid pointer below alignof(ObjectMonitor*)
- cmpldi(CCR0, monitor, checked_cast(alignof(ObjectMonitor*)));
- blt(CCR0, slow_path);
+ cmpldi(CR0, monitor, checked_cast(alignof(ObjectMonitor*)));
+ blt(CR0, slow_path);
}
const Register recursions = tmp2;
@@ -3113,11 +3290,11 @@ void MacroAssembler::compiler_fast_unlock_lightweight_object(ConditionRegister f
// Check if recursive.
ld(recursions, in_bytes(ObjectMonitor::recursions_offset()), monitor);
addic_(recursions, recursions, -1);
- blt(CCR0, not_recursive);
+ blt(CR0, not_recursive);
// Recursive unlock.
std(recursions, in_bytes(ObjectMonitor::recursions_offset()), monitor);
- crorc(CCR0, Assembler::equal, CCR0, Assembler::equal);
+ crorc(CR0, Assembler::equal, CR0, Assembler::equal);
b(unlocked);
bind(not_recursive);
@@ -3137,15 +3314,15 @@ void MacroAssembler::compiler_fast_unlock_lightweight_object(ConditionRegister f
ld(t, in_bytes(ObjectMonitor::EntryList_offset()), monitor);
ld(t2, in_bytes(ObjectMonitor::cxq_offset()), monitor);
orr(t, t, t2);
- cmpdi(CCR0, t, 0);
- beq(CCR0, unlocked); // If so we are done.
+ cmpdi(CR0, t, 0);
+ beq(CR0, unlocked); // If so we are done.
// Check if there is a successor.
ld(t, in_bytes(ObjectMonitor::succ_offset()), monitor);
- cmpdi(CCR0, t, 0);
+ cmpdi(CR0, t, 0);
// Invert equal bit
crnand(flag, Assembler::equal, flag, Assembler::equal);
- beq(CCR0, unlocked); // If there is a successor we are done.
+ beq(CR0, unlocked); // If there is a successor we are done.
// Save the monitor pointer in the current thread, so we can try
// to reacquire the lock in SharedRuntime::monitor_exit_helper().
@@ -3158,13 +3335,13 @@ void MacroAssembler::compiler_fast_unlock_lightweight_object(ConditionRegister f
#ifdef ASSERT
// Check that unlocked label is reached with flag == EQ.
Label flag_correct;
- beq(CCR0, flag_correct);
+ beq(CR0, flag_correct);
stop("Fast Lock Flag != EQ");
#endif
bind(slow_path);
#ifdef ASSERT
// Check that slow_path label is reached with flag == NE.
- bne(CCR0, flag_correct);
+ bne(CR0, flag_correct);
stop("Fast Lock Flag != NE");
bind(flag_correct);
#endif
@@ -3181,21 +3358,21 @@ void MacroAssembler::safepoint_poll(Label& slow_path, Register temp, bool at_ret
relocate(relocInfo::poll_return_type);
td(traptoGreaterThanUnsigned, R1_SP, temp);
} else {
- cmpld(CCR0, R1_SP, temp);
+ cmpld(CR0, R1_SP, temp);
// Stub may be out of range for short conditional branch.
- bc_far_optimized(Assembler::bcondCRbiIs1, bi0(CCR0, Assembler::greater), slow_path);
+ bc_far_optimized(Assembler::bcondCRbiIs1, bi0(CR0, Assembler::greater), slow_path);
}
} else { // Not in nmethod.
// Frame still on stack, need to get fp.
Register fp = R0;
ld(fp, _abi0(callers_sp), R1_SP);
- cmpld(CCR0, fp, temp);
- bgt(CCR0, slow_path);
+ cmpld(CR0, fp, temp);
+ bgt(CR0, slow_path);
}
} else { // Normal safepoint poll. Not at return.
assert(!in_nmethod, "should use load_from_polling_page");
andi_(temp, temp, SafepointMechanism::poll_bit());
- bne(CCR0, slow_path);
+ bne(CR0, slow_path);
}
}
@@ -3436,8 +3613,8 @@ void MacroAssembler::resolve_weak_handle(Register result, Register tmp1, Registe
Label resolved;
// A null weak handle resolves to null.
- cmpdi(CCR0, result, 0);
- beq(CCR0, resolved);
+ cmpdi(CR0, result, 0);
+ beq(CR0, resolved);
access_load_at(T_OBJECT, IN_NATIVE | ON_PHANTOM_OOP_REF, result, noreg, result, tmp1, tmp2,
preservation_level);
@@ -3498,11 +3675,11 @@ void MacroAssembler::clear_memory_doubleword(Register base_ptr, Register cnt_dwo
load_const_optimized(cnt_dwords, const_cnt, tmp);
} else {
// cnt_dwords already loaded in register. Need to check size.
- cmpdi(CCR1, cnt_dwords, min_cnt); // Big enough? (ensure >= dcbz_min lines included).
- blt(CCR1, small_rest);
+ cmpdi(CR1, cnt_dwords, min_cnt); // Big enough? (ensure >= dcbz_min lines included).
+ blt(CR1, small_rest);
}
rldicl_(tmp, base_ptr, 64-3, 64-cl_dw_addr_bits); // Extract dword offset within first cache line.
- beq(CCR0, fast); // Already 128byte aligned.
+ beq(CR0, fast); // Already 128byte aligned.
subfic(tmp, tmp, cl_dwords);
mtctr(tmp); // Set ctr to hit 128byte boundary (0=mainLoop_stepping is guaranteed).
} else {
sub(tmp, len, tmp2); // Remaining bytes for main loop.
- cmpdi(CCR0, tmp, mainLoop_stepping);
- blt(CCR0, L_tail); // For less than one mainloop_stepping left, do only tail processing
+ cmpdi(CR0, tmp, mainLoop_stepping);
+ blt(CR0, L_tail); // For less than one mainloop_stepping left, do only tail processing
mr(len, tmp); // remaining bytes for main loop (>=mainLoop_stepping is guaranteed).
}
update_byteLoop_crc32(crc, buf, tmp2, table, data, false);
@@ -3831,8 +4008,8 @@ void MacroAssembler::kernel_crc32_vpmsum(Register crc, Register buf, Register le
neg(prealign, buf);
addi(t1, len, -threshold);
andi(prealign, prealign, alignment - 1);
- cmpw(CCR0, t1, prealign);
- blt(CCR0, L_tail); // len - prealign < threshold?
+ cmpw(CR0, t1, prealign);
+ blt(CR0, L_tail); // len - prealign < threshold?
subf(len, prealign, len);
update_byteLoop_crc32(crc, buf, prealign, constants, t2, false);
@@ -3956,8 +4133,8 @@ void MacroAssembler::kernel_crc32_vpmsum_aligned(Register crc, Register buf, Reg
#define BE_swap_bytes(x) vperm(x, x, x, swap_bytes)
#endif
- cmpd(CCR0, len, num_bytes);
- blt(CCR0, L_last);
+ cmpd(CR0, len, num_bytes);
+ blt(CR0, L_last);
addi(cur_const, constants, outer_consts_size); // Point to consts for inner loop
load_const_optimized(loop_count, unroll_factor / (2 * unroll_factor2) - 1); // One double-iteration peeled off.
@@ -4044,8 +4221,8 @@ void MacroAssembler::kernel_crc32_vpmsum_aligned(Register crc, Register buf, Reg
vxor(data0[j], data0[j], data0[j+i]);
}
}
- cmpd(CCR0, len, num_bytes);
- bge(CCR0, L_outer_loop);
+ cmpd(CR0, len, num_bytes);
+ bge(CR0, L_outer_loop);
// Last chance with lower num_bytes.
bind(L_last);
@@ -4057,7 +4234,7 @@ void MacroAssembler::kernel_crc32_vpmsum_aligned(Register crc, Register buf, Reg
subf(cur_const, R0, cur_const); // Point to constant to be used first.
addic_(loop_count, loop_count, -1); // One double-iteration peeled off.
- bgt(CCR0, L_outer_loop);
+ bgt(CR0, L_outer_loop);
// ********** Main loop end **********
// Restore DSCR pre-fetch value.
@@ -4072,7 +4249,7 @@ void MacroAssembler::kernel_crc32_vpmsum_aligned(Register crc, Register buf, Reg
srdi_(t0, len, 4); // 16 bytes per iteration
clrldi(len, len, 64-4);
- beq(CCR0, L_done);
+ beq(CR0, L_done);
// Point to const (same as last const for inner loop).
add_const_optimized(cur_const, constants, outer_consts_size + inner_consts_size - 16);
@@ -4191,7 +4368,7 @@ void MacroAssembler::multiply_64_x_64_loop(Register x, Register xstart,
Label L_one_x, L_one_y, L_multiply;
addic_(xstart, xstart, -1);
- blt(CCR0, L_one_x); // Special case: length of x is 1.
+ blt(CR0, L_one_x); // Special case: length of x is 1.
// Load next two integers of x.
sldi(tmp, xstart, LogBytesPerInt);
@@ -4203,10 +4380,10 @@ void MacroAssembler::multiply_64_x_64_loop(Register x, Register xstart,
align(32, 16);
bind(L_first_loop);
- cmpdi(CCR0, idx, 1);
- blt(CCR0, L_first_loop_exit);
+ cmpdi(CR0, idx, 1);
+ blt(CR0, L_first_loop_exit);
addi(idx, idx, -2);
- beq(CCR0, L_one_y);
+ beq(CR0, L_one_y);
// Load next two integers of y.
sldi(tmp, idx, LogBytesPerInt);
@@ -4314,7 +4491,7 @@ void MacroAssembler::multiply_128_x_128_loop(Register x_xstart,
// Scale the index.
srdi_(jdx, idx, 2);
- beq(CCR0, L_third_loop_exit);
+ beq(CR0, L_third_loop_exit);
mtctr(jdx);
align(32, 16);
@@ -4332,12 +4509,12 @@ void MacroAssembler::multiply_128_x_128_loop(Register x_xstart,
bind(L_third_loop_exit); // Handle any left-over operand parts.
andi_(idx, idx, 0x3);
- beq(CCR0, L_post_third_loop_done);
+ beq(CR0, L_post_third_loop_done);
Label L_check_1;
addic_(idx, idx, -2);
- blt(CCR0, L_check_1);
+ blt(CR0, L_check_1);
multiply_add_128_x_128(x_xstart, y, z, yz_idx, idx, carry, product_high, product, tmp, 0);
mr_if_needed(carry, product_high);
@@ -4347,7 +4524,7 @@ void MacroAssembler::multiply_128_x_128_loop(Register x_xstart,
addi(idx, idx, 0x2);
andi_(idx, idx, 0x1);
addic_(idx, idx, -1);
- blt(CCR0, L_post_third_loop_done);
+ blt(CR0, L_post_third_loop_done);
sldi(tmp, idx, LogBytesPerInt);
lwzx(yz_idx, y, tmp);
@@ -4375,12 +4552,12 @@ void MacroAssembler::muladd(Register out, Register in,
Label LOOP, SKIP;
// Make sure length is positive.
- cmpdi (CCR0, len, 0);
+ cmpdi (CR0, len, 0);
// Prepare variables
subi (offset, offset, 4);
li (carry, 0);
- ble (CCR0, SKIP);
+ ble (CR0, SKIP);
mtctr (len);
subi (len, len, 1 );
@@ -4452,20 +4629,20 @@ void MacroAssembler::multiply_to_len(Register x, Register xlen,
Label L_done;
addic_(xstart, xlen, -1);
- blt(CCR0, L_done);
+ blt(CR0, L_done);
multiply_64_x_64_loop(x, xstart, x_xstart, y, y_idx, z,
carry, product_high, product, idx, kdx, tmp);
Label L_second_loop;
- cmpdi(CCR0, kdx, 0);
- beq(CCR0, L_second_loop);
+ cmpdi(CR0, kdx, 0);
+ beq(CR0, L_second_loop);
Label L_carry;
addic_(kdx, kdx, -1);
- beq(CCR0, L_carry);
+ beq(CR0, L_carry);
// Store lower 32 bits of carry.
sldi(tmp, kdx, LogBytesPerInt);
@@ -4500,7 +4677,7 @@ void MacroAssembler::multiply_to_len(Register x, Register xlen,
li(carry, 0); // carry = 0;
addic_(xstart, xstart, -1); // i = xstart-1;
- blt(CCR0, L_done);
+ blt(CR0, L_done);
Register zsave = tmp10;
@@ -4513,7 +4690,7 @@ void MacroAssembler::multiply_to_len(Register x, Register xlen,
add(z, z, tmp); // z = z + k - j
addi(z, z, 4);
addic_(xstart, xstart, -1); // i = xstart-1;
- blt(CCR0, L_last_x);
+ blt(CR0, L_last_x);
sldi(tmp, xstart, LogBytesPerInt);
ldx(x_xstart, x, tmp);
@@ -4547,7 +4724,7 @@ void MacroAssembler::multiply_to_len(Register x, Register xlen,
sldi(tmp, tmp3, LogBytesPerInt);
stwx(carry, z, tmp);
addic_(tmp3, tmp3, -1);
- blt(CCR0, L_done);
+ blt(CR0, L_done);
srdi(carry, carry, 32);
sldi(tmp, tmp3, LogBytesPerInt);
@@ -4567,9 +4744,9 @@ void MacroAssembler::asm_assert(bool check_equal, const char *msg) {
#ifdef ASSERT
Label ok;
if (check_equal) {
- beq(CCR0, ok);
+ beq(CR0, ok);
} else {
- bne(CCR0, ok);
+ bne(CR0, ok);
}
stop(msg);
bind(ok);
@@ -4582,11 +4759,11 @@ void MacroAssembler::asm_assert_mems_zero(bool check_equal, int size, int mem_of
switch (size) {
case 4:
lwz(R0, mem_offset, mem_base);
- cmpwi(CCR0, R0, 0);
+ cmpwi(CR0, R0, 0);
break;
case 8:
ld(R0, mem_offset, mem_base);
- cmpdi(CCR0, R0, 0);
+ cmpdi(CR0, R0, 0);
break;
default:
ShouldNotReachHere();
@@ -4708,8 +4885,8 @@ void MacroAssembler::zap_from_to(Register low, int before, Register high, int af
bind(loop);
std(val, 0, addr);
addi(addr, addr, 8);
- cmpd(CCR6, addr, high);
- ble(CCR6, loop);
+ cmpd(CR6, addr, high);
+ ble(CR6, loop);
if (after) addi(high, high, -after * BytesPerWord); // Correct back to old value.
}
BLOCK_COMMENT("} zap memory region");
@@ -4741,8 +4918,8 @@ void MacroAssembler::push_cont_fastpath() {
Label done;
ld_ptr(R0, JavaThread::cont_fastpath_offset(), R16_thread);
- cmpld(CCR0, R1_SP, R0);
- ble(CCR0, done);
+ cmpld(CR0, R1_SP, R0);
+ ble(CR0, done);
st_ptr(R1_SP, JavaThread::cont_fastpath_offset(), R16_thread);
bind(done);
}
@@ -4752,48 +4929,48 @@ void MacroAssembler::pop_cont_fastpath() {
Label done;
ld_ptr(R0, JavaThread::cont_fastpath_offset(), R16_thread);
- cmpld(CCR0, R1_SP, R0);
- ble(CCR0, done);
+ cmpld(CR0, R1_SP, R0);
+ ble(CR0, done);
li(R0, 0);
st_ptr(R0, JavaThread::cont_fastpath_offset(), R16_thread);
bind(done);
}
-// Note: Must preserve CCR0 EQ (invariant).
+// Note: Must preserve CR0 EQ (invariant).
void MacroAssembler::inc_held_monitor_count(Register tmp) {
assert(LockingMode == LM_LEGACY, "");
ld(tmp, in_bytes(JavaThread::held_monitor_count_offset()), R16_thread);
#ifdef ASSERT
Label ok;
- cmpdi(CCR0, tmp, 0);
- bge_predict_taken(CCR0, ok);
+ cmpdi(CR0, tmp, 0);
+ bge_predict_taken(CR0, ok);
stop("held monitor count is negativ at increment");
bind(ok);
- crorc(CCR0, Assembler::equal, CCR0, Assembler::equal); // Restore CCR0 EQ
+ crorc(CR0, Assembler::equal, CR0, Assembler::equal); // Restore CR0 EQ
#endif
addi(tmp, tmp, 1);
std(tmp, in_bytes(JavaThread::held_monitor_count_offset()), R16_thread);
}
-// Note: Must preserve CCR0 EQ (invariant).
+// Note: Must preserve CR0 EQ (invariant).
void MacroAssembler::dec_held_monitor_count(Register tmp) {
assert(LockingMode == LM_LEGACY, "");
ld(tmp, in_bytes(JavaThread::held_monitor_count_offset()), R16_thread);
#ifdef ASSERT
Label ok;
- cmpdi(CCR0, tmp, 0);
- bgt_predict_taken(CCR0, ok);
+ cmpdi(CR0, tmp, 0);
+ bgt_predict_taken(CR0, ok);
stop("held monitor count is <= 0 at decrement");
bind(ok);
- crorc(CCR0, Assembler::equal, CCR0, Assembler::equal); // Restore CCR0 EQ
+ crorc(CR0, Assembler::equal, CR0, Assembler::equal); // Restore CR0 EQ
#endif
addi(tmp, tmp, -1);
std(tmp, in_bytes(JavaThread::held_monitor_count_offset()), R16_thread);
}
// Function to flip between unlocked and locked state (fast locking).
-// Branches to failed if the state is not as expected with CCR0 NE.
-// Falls through upon success with CCR0 EQ.
+// Branches to failed if the state is not as expected with CR0 NE.
+// Falls through upon success with CR0 EQ.
// This requires fewer instructions and registers and is easier to use than the
// cmpxchg based implementation.
void MacroAssembler::atomically_flip_locked_state(bool is_unlock, Register obj, Register tmp, Label& failed, int semantics) {
@@ -4810,15 +4987,15 @@ void MacroAssembler::atomically_flip_locked_state(bool is_unlock, Register obj,
ldarx(tmp, obj, MacroAssembler::cmpxchgx_hint_acquire_lock());
xori(tmp, tmp, markWord::unlocked_value); // flip unlocked bit
andi_(R0, tmp, markWord::lock_mask_in_place);
- bne(CCR0, failed); // failed if new header doesn't contain locked_value (which is 0)
+ bne(CR0, failed); // failed if new header doesn't contain locked_value (which is 0)
} else {
ldarx(tmp, obj, MacroAssembler::cmpxchgx_hint_release_lock());
andi_(R0, tmp, markWord::lock_mask_in_place);
- bne(CCR0, failed); // failed if old header doesn't contain locked_value (which is 0)
+ bne(CR0, failed); // failed if old header doesn't contain locked_value (which is 0)
ori(tmp, tmp, markWord::unlocked_value); // set unlocked bit
}
stdcx_(tmp, obj);
- bne(CCR0, retry);
+ bne(CR0, retry);
if (semantics & MemBarFenceAfter) {
fence();
@@ -4848,8 +5025,8 @@ void MacroAssembler::lightweight_lock(Register box, Register obj, Register t1, R
// Check if the lock-stack is full.
lwz(top, in_bytes(JavaThread::lock_stack_top_offset()), R16_thread);
- cmplwi(CCR0, top, LockStack::end_offset());
- bge(CCR0, slow);
+ cmplwi(CR0, top, LockStack::end_offset());
+ bge(CR0, slow);
// The underflow check is elided. The recursive check will always fail
// when the lock stack is empty because of the _bad_oop_sentinel field.
@@ -4857,14 +5034,14 @@ void MacroAssembler::lightweight_lock(Register box, Register obj, Register t1, R
// Check for recursion.
subi(t, top, oopSize);
ldx(t, R16_thread, t);
- cmpd(CCR0, obj, t);
- beq(CCR0, push);
+ cmpd(CR0, obj, t);
+ beq(CR0, push);
// Check header for monitor (0b10) or locked (0b00).
ld(mark, oopDesc::mark_offset_in_bytes(), obj);
xori(t, mark, markWord::unlocked_value);
andi_(t, t, markWord::lock_mask_in_place);
- bne(CCR0, slow);
+ bne(CR0, slow);
// Try to lock. Transition lock bits 0b01 => 0b00
atomically_flip_locked_state(/* is_unlock */ false, obj, mark, slow, MacroAssembler::MemBarAcq);
@@ -4893,8 +5070,8 @@ void MacroAssembler::lightweight_unlock(Register obj, Register t1, Label& slow)
// Check for lock-stack underflow.
Label stack_ok;
lwz(t1, in_bytes(JavaThread::lock_stack_top_offset()), R16_thread);
- cmplwi(CCR0, t1, LockStack::start_offset());
- bge(CCR0, stack_ok);
+ cmplwi(CR0, t1, LockStack::start_offset());
+ bge(CR0, stack_ok);
stop("Lock-stack underflow");
bind(stack_ok);
}
@@ -4909,8 +5086,8 @@ void MacroAssembler::lightweight_unlock(Register obj, Register t1, Label& slow)
lwz(top, in_bytes(JavaThread::lock_stack_top_offset()), R16_thread);
subi(top, top, oopSize);
ldx(t, R16_thread, top);
- cmpd(CCR0, obj, t);
- bne(CCR0, slow);
+ cmpd(CR0, obj, t);
+ bne(CR0, slow);
// Pop lock-stack.
DEBUG_ONLY(li(t, 0);)
@@ -4923,8 +5100,8 @@ void MacroAssembler::lightweight_unlock(Register obj, Register t1, Label& slow)
// Check if recursive.
subi(t, top, oopSize);
ldx(t, R16_thread, t);
- cmpd(CCR0, obj, t);
- beq(CCR0, unlocked);
+ cmpd(CR0, obj, t);
+ beq(CR0, unlocked);
// Use top as tmp
t = top;
@@ -4932,13 +5109,13 @@ void MacroAssembler::lightweight_unlock(Register obj, Register t1, Label& slow)
// Not recursive. Check header for monitor (0b10).
ld(mark, oopDesc::mark_offset_in_bytes(), obj);
andi_(t, mark, markWord::monitor_value);
- bne(CCR0, push_and_slow);
+ bne(CR0, push_and_slow);
#ifdef ASSERT
// Check header not unlocked (0b01).
Label not_unlocked;
andi_(t, mark, markWord::unlocked_value);
- beq(CCR0, not_unlocked);
+ beq(CR0, not_unlocked);
stop("lightweight_unlock already unlocked");
bind(not_unlocked);
#endif
diff --git a/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp b/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp
index 3e82c1c678578..69570517866d6 100644
--- a/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp
+++ b/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2024 SAP SE. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -179,8 +179,8 @@ class MacroAssembler: public Assembler {
//
// branch, jump
//
- // set dst to -1, 0, +1 as follows: if CCR0bi is "greater than", dst is set to 1,
- // if CCR0bi is "equal", dst is set to 0, otherwise it's set to -1.
+ // set dst to -1, 0, +1 as follows: if CR0bi is "greater than", dst is set to 1,
+ // if CR0bi is "equal", dst is set to 0, otherwise it's set to -1.
void inline set_cmp3(Register dst);
// set dst to (treat_unordered_like_less ? -1 : +1)
void inline set_cmpu3(Register dst, bool treat_unordered_like_less);
@@ -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/macroAssembler_ppc.inline.hpp b/src/hotspot/cpu/ppc/macroAssembler_ppc.inline.hpp
index 6f5cd8fbd9671..b2bcf72bd353a 100644
--- a/src/hotspot/cpu/ppc/macroAssembler_ppc.inline.hpp
+++ b/src/hotspot/cpu/ppc/macroAssembler_ppc.inline.hpp
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2024 SAP SE. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -248,14 +248,14 @@ inline bool MacroAssembler::is_bc_far_variant3_at(address instruction_addr) {
is_endgroup(instruction_2);
}
-// set dst to -1, 0, +1 as follows: if CCR0bi is "greater than", dst is set to 1,
-// if CCR0bi is "equal", dst is set to 0, otherwise it's set to -1.
+// set dst to -1, 0, +1 as follows: if CR0bi is "greater than", dst is set to 1,
+// if CR0bi is "equal", dst is set to 0, otherwise it's set to -1.
inline void MacroAssembler::set_cmp3(Register dst) {
assert_different_registers(dst, R0);
// P10, prefer using setbc instructions
if (VM_Version::has_brw()) {
- setbc(R0, CCR0, Assembler::greater); // Set 1 to R0 if CCR0bi is "greater than", otherwise 0
- setnbc(dst, CCR0, Assembler::less); // Set -1 to dst if CCR0bi is "less than", otherwise 0
+ setbc(R0, CR0, Assembler::greater); // Set 1 to R0 if CR0bi is "greater than", otherwise 0
+ setnbc(dst, CR0, Assembler::less); // Set -1 to dst if CR0bi is "less than", otherwise 0
} else {
mfcr(R0); // copy CR register to R0
srwi(dst, R0, 30); // copy the first two bits to dst
@@ -267,9 +267,9 @@ inline void MacroAssembler::set_cmp3(Register dst) {
// set dst to (treat_unordered_like_less ? -1 : +1)
inline void MacroAssembler::set_cmpu3(Register dst, bool treat_unordered_like_less) {
if (treat_unordered_like_less) {
- cror(CCR0, Assembler::less, CCR0, Assembler::summary_overflow); // treat unordered like less
+ cror(CR0, Assembler::less, CR0, Assembler::summary_overflow); // treat unordered like less
} else {
- cror(CCR0, Assembler::greater, CCR0, Assembler::summary_overflow); // treat unordered like greater
+ cror(CR0, Assembler::greater, CR0, Assembler::summary_overflow); // treat unordered like greater
}
set_cmp3(dst);
}
@@ -280,11 +280,11 @@ inline void MacroAssembler::normalize_bool(Register dst, Register temp, bool is_
if (VM_Version::has_brw()) {
if (is_64bit) {
- cmpdi(CCR0, dst, 0);
+ cmpdi(CR0, dst, 0);
} else {
- cmpwi(CCR0, dst, 0);
+ cmpwi(CR0, dst, 0);
}
- setbcr(dst, CCR0, Assembler::equal);
+ setbcr(dst, CR0, Assembler::equal);
} else {
assert_different_registers(temp, dst);
neg(temp, dst);
@@ -373,8 +373,8 @@ inline void MacroAssembler::null_check_throw(Register a, int offset, Register te
trap_null_check(a);
} else {
Label ok;
- cmpdi(CCR0, a, 0);
- bne(CCR0, ok);
+ cmpdi(CR0, a, 0);
+ bne(CR0, ok);
load_const_optimized(temp_reg, exception_entry);
mtctr(temp_reg);
bctr();
@@ -390,8 +390,8 @@ inline void MacroAssembler::null_check(Register a, int offset, Label *Lis_null)
trap_null_check(a);
} else if (Lis_null){
Label ok;
- cmpdi(CCR0, a, 0);
- beq(CCR0, *Lis_null);
+ cmpdi(CR0, a, 0);
+ beq(CR0, *Lis_null);
}
}
}
@@ -468,14 +468,14 @@ inline Register MacroAssembler::encode_heap_oop_not_null(Register d, Register sr
inline Register MacroAssembler::encode_heap_oop(Register d, Register src) {
if (CompressedOops::base() != nullptr) {
if (VM_Version::has_isel()) {
- cmpdi(CCR0, src, 0);
+ cmpdi(CR0, src, 0);
Register co = encode_heap_oop_not_null(d, src);
assert(co == d, "sanity");
- isel_0(d, CCR0, Assembler::equal);
+ isel_0(d, CR0, Assembler::equal);
} else {
Label isNull;
or_(d, src, src); // move and compare 0
- beq(CCR0, isNull);
+ beq(CR0, isNull);
encode_heap_oop_not_null(d, src);
bind(isNull);
}
@@ -509,16 +509,16 @@ inline void MacroAssembler::decode_heap_oop(Register d) {
Label isNull;
bool use_isel = false;
if (CompressedOops::base() != nullptr) {
- cmpwi(CCR0, d, 0);
+ cmpwi(CR0, d, 0);
if (VM_Version::has_isel()) {
use_isel = true;
} else {
- beq(CCR0, isNull);
+ beq(CR0, isNull);
}
}
decode_heap_oop_not_null(d);
if (use_isel) {
- isel_0(d, CCR0, Assembler::equal);
+ isel_0(d, CR0, Assembler::equal);
}
bind(isNull);
}
diff --git a/src/hotspot/cpu/ppc/macroAssembler_ppc_sha.cpp b/src/hotspot/cpu/ppc/macroAssembler_ppc_sha.cpp
index 3d0b5dab2db2b..bdf2d8d268ac8 100644
--- a/src/hotspot/cpu/ppc/macroAssembler_ppc_sha.cpp
+++ b/src/hotspot/cpu/ppc/macroAssembler_ppc_sha.cpp
@@ -93,7 +93,7 @@ void MacroAssembler::sha256_load_h_vec(const VectorRegister a,
lvx (a, hptr);
addi (tmp, hptr, 16);
lvx (e, tmp);
- beq (CCR0, sha256_aligned);
+ beq (CR0, sha256_aligned);
// handle unaligned accesses
load_perm(vRb, hptr);
@@ -121,7 +121,7 @@ void MacroAssembler::sha256_load_w_plus_k_vec(const Register buf_in,
VectorRegister vRb = VR6;
andi_ (tmp, buf_in, 0xF);
- beq (CCR0, w_aligned); // address ends with 0x0, not 0x8
+ beq (CR0, w_aligned); // address ends with 0x0, not 0x8
// deal with unaligned addresses
lvx (ws[0], buf_in);
@@ -318,7 +318,7 @@ void MacroAssembler::sha256_update_sha_state(const VectorRegister a,
li (of16, 16);
lvx (vt0, hptr);
lvx (vt5, of16, hptr);
- beq (CCR0, state_load_aligned);
+ beq (CR0, state_load_aligned);
// handle unaligned accesses
li (of32, 32);
@@ -538,8 +538,8 @@ void MacroAssembler::sha256(bool multi_block) {
if (multi_block) {
addi(buf_in, buf_in, buf_size);
addi(ofs, ofs, buf_size);
- cmplw(CCR0, ofs, limit);
- ble(CCR0, sha_loop);
+ cmplw(CR0, ofs, limit);
+ ble(CR0, sha_loop);
// return ofs
mr(R3_RET, ofs);
@@ -567,7 +567,7 @@ void MacroAssembler::sha512_load_w_vec(const Register buf_in,
Label is_aligned, after_alignment;
andi_ (tmp, buf_in, 0xF);
- beq (CCR0, is_aligned); // address ends with 0x0, not 0x8
+ beq (CR0, is_aligned); // address ends with 0x0, not 0x8
// deal with unaligned addresses
lvx (ws[0], buf_in);
@@ -623,7 +623,7 @@ void MacroAssembler::sha512_update_sha_state(const Register state,
VectorRegister aux = VR9;
andi_(tmp, state, 0xf);
- beq(CCR0, state_save_aligned);
+ beq(CR0, state_save_aligned);
// deal with unaligned addresses
{
@@ -860,7 +860,7 @@ void MacroAssembler::sha512_load_h_vec(const Register state,
Label state_aligned, after_state_aligned;
andi_(tmp, state, 0xf);
- beq(CCR0, state_aligned);
+ beq(CR0, state_aligned);
// deal with unaligned addresses
VectorRegister aux = VR9;
@@ -1121,8 +1121,8 @@ void MacroAssembler::sha512(bool multi_block) {
if (multi_block) {
addi(buf_in, buf_in, buf_size);
addi(ofs, ofs, buf_size);
- cmplw(CCR0, ofs, limit);
- ble(CCR0, sha_loop);
+ cmplw(CR0, ofs, limit);
+ ble(CR0, sha_loop);
// return ofs
mr(R3_RET, ofs);
diff --git a/src/hotspot/cpu/ppc/matcher_ppc.hpp b/src/hotspot/cpu/ppc/matcher_ppc.hpp
index aaac79325c421..441339b94c61b 100644
--- a/src/hotspot/cpu/ppc/matcher_ppc.hpp
+++ b/src/hotspot/cpu/ppc/matcher_ppc.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
@@ -37,10 +37,12 @@
return false;
}
- // PPC implementation uses VSX load/store instructions (if
- // SuperwordUseVSX) which support 4 byte but not arbitrary alignment
+ // The PPC implementation uses VSX lxvd2x/stxvd2x instructions (if
+ // SuperwordUseVSX). They do not have alignment requirements.
+ // Some VSX storage access instructions cannot encode arbitrary displacements
+ // (e.g. lxv). None of them is currently used.
static constexpr bool misaligned_vectors_ok() {
- return false;
+ return true;
}
// Whether code generation need accurate ConvI2L types.
diff --git a/src/hotspot/cpu/ppc/methodHandles_ppc.cpp b/src/hotspot/cpu/ppc/methodHandles_ppc.cpp
index ccec05e710530..13fb8ef79d640 100644
--- a/src/hotspot/cpu/ppc/methodHandles_ppc.cpp
+++ b/src/hotspot/cpu/ppc/methodHandles_ppc.cpp
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2024 SAP SE. All rights reserved.
+ * Copyright (c) 1997, 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 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "classfile/javaClasses.inline.hpp"
#include "classfile/vmClasses.hpp"
@@ -84,16 +83,16 @@ void MethodHandles::verify_klass(MacroAssembler* _masm,
Label L_ok, L_bad;
BLOCK_COMMENT("verify_klass {");
__ verify_oop(obj_reg, FILE_AND_LINE);
- __ cmpdi(CCR0, obj_reg, 0);
- __ beq(CCR0, L_bad);
+ __ cmpdi(CR0, obj_reg, 0);
+ __ beq(CR0, L_bad);
__ load_klass(temp_reg, obj_reg);
__ load_const_optimized(temp2_reg, (address) klass_addr);
__ ld(temp2_reg, 0, temp2_reg);
- __ cmpd(CCR0, temp_reg, temp2_reg);
- __ beq(CCR0, L_ok);
+ __ cmpd(CR0, temp_reg, temp2_reg);
+ __ beq(CR0, L_ok);
__ ld(temp_reg, klass->super_check_offset(), temp_reg);
- __ cmpd(CCR0, temp_reg, temp2_reg);
- __ beq(CCR0, L_ok);
+ __ cmpd(CR0, temp_reg, temp2_reg);
+ __ beq(CR0, L_ok);
__ BIND(L_bad);
__ stop(error_message);
__ BIND(L_ok);
@@ -108,8 +107,8 @@ void MethodHandles::verify_ref_kind(MacroAssembler* _masm, int ref_kind, Registe
// assert(sizeof(u4) == sizeof(java.lang.invoke.MemberName.flags), "");
__ srwi( temp, temp, java_lang_invoke_MemberName::MN_REFERENCE_KIND_SHIFT);
__ andi(temp, temp, java_lang_invoke_MemberName::MN_REFERENCE_KIND_MASK);
- __ cmpwi(CCR1, temp, ref_kind);
- __ beq(CCR1, L);
+ __ cmpwi(CR1, temp, ref_kind);
+ __ beq(CR1, L);
{ char* buf = NEW_C_HEAP_ARRAY(char, 100, mtInternal);
jio_snprintf(buf, 100, "verify_ref_kind expected %x", ref_kind);
if (ref_kind == JVM_REF_invokeVirtual ||
@@ -136,11 +135,11 @@ void MethodHandles::jump_from_method_handle(MacroAssembler* _masm, Register meth
// compiled code in threads for which the event is enabled. Check here for
// interp_only_mode if these events CAN be enabled.
__ lwz(temp, in_bytes(JavaThread::interp_only_mode_offset()), R16_thread);
- __ cmplwi(CCR0, temp, 0);
- __ beq(CCR0, run_compiled_code);
+ __ cmplwi(CR0, temp, 0);
+ __ beq(CR0, run_compiled_code);
// Null method test is replicated below in compiled case.
- __ cmplwi(CCR0, R19_method, 0);
- __ beq(CCR0, L_no_such_method);
+ __ cmplwi(CR0, R19_method, 0);
+ __ beq(CR0, L_no_such_method);
__ ld(target, in_bytes(Method::interpreter_entry_offset()), R19_method);
__ mtctr(target);
__ bctr();
@@ -148,8 +147,8 @@ void MethodHandles::jump_from_method_handle(MacroAssembler* _masm, Register meth
}
// Compiled case, either static or fall-through from runtime conditional
- __ cmplwi(CCR0, R19_method, 0);
- __ beq(CCR0, L_no_such_method);
+ __ cmplwi(CR0, R19_method, 0);
+ __ beq(CR0, L_no_such_method);
const ByteSize entry_offset = for_compiler_entry ? Method::from_compiled_offset() :
Method::from_interpreted_offset();
@@ -201,8 +200,8 @@ void MethodHandles::jump_to_lambda_form(MacroAssembler* _masm,
// assert(sizeof(u2) == sizeof(ConstMethod::_size_of_parameters), "");
Label L;
__ ld(temp2, __ argument_offset(temp2, temp2, 0), R15_esp);
- __ cmpd(CCR1, temp2, recv);
- __ beq(CCR1, L);
+ __ cmpd(CR1, temp2, recv);
+ __ beq(CR1, L);
__ stop("receiver not on stack");
__ BIND(L);
}
@@ -249,8 +248,8 @@ address MethodHandles::generate_method_handle_interpreter_entry(MacroAssembler*
BLOCK_COMMENT("verify_intrinsic_id {");
__ load_sized_value(R30_tmp1, in_bytes(Method::intrinsic_id_offset()), R19_method,
sizeof(u2), /*is_signed*/ false);
- __ cmpwi(CCR1, R30_tmp1, (int) iid);
- __ beq(CCR1, L);
+ __ cmpwi(CR1, R30_tmp1, (int) iid);
+ __ beq(CR1, L);
if (iid == vmIntrinsics::_linkToVirtual ||
iid == vmIntrinsics::_linkToSpecial) {
// could do this for all kinds, but would explode assembly code size
@@ -426,8 +425,8 @@ void MethodHandles::generate_method_handle_dispatch(MacroAssembler* _masm,
if (VerifyMethodHandles) {
Label L_index_ok;
- __ cmpdi(CCR1, temp2_index, 0);
- __ bge(CCR1, L_index_ok);
+ __ cmpdi(CR1, temp2_index, 0);
+ __ bge(CR1, L_index_ok);
__ stop("no virtual index");
__ BIND(L_index_ok);
}
@@ -458,8 +457,8 @@ void MethodHandles::generate_method_handle_dispatch(MacroAssembler* _masm,
__ ld(vtable_index, NONZERO(java_lang_invoke_MemberName::vmindex_offset()), member_reg);
if (VerifyMethodHandles) {
Label L_index_ok;
- __ cmpdi(CCR1, vtable_index, 0);
- __ bge(CCR1, L_index_ok);
+ __ cmpdi(CR1, vtable_index, 0);
+ __ bge(CR1, L_index_ok);
__ stop("invalid vtable index for MH.invokeInterface");
__ BIND(L_index_ok);
}
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..2504c613d7855 100644
--- a/src/hotspot/cpu/ppc/ppc.ad
+++ b/src/hotspot/cpu/ppc/ppc.ad
@@ -1,6 +1,6 @@
//
-// Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
-// Copyright (c) 2012, 2024 SAP SE. All rights reserved.
+// Copyright (c) 2011, 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
@@ -236,14 +236,14 @@ register %{
// in the CR register.
// types: v = volatile, nv = non-volatile, s = system
- reg_def CCR0(SOC, SOC, Op_RegFlags, 0, CCR0->as_VMReg()); // v
- reg_def CCR1(SOC, SOC, Op_RegFlags, 1, CCR1->as_VMReg()); // v
- reg_def CCR2(SOC, SOC, Op_RegFlags, 2, CCR2->as_VMReg()); // nv
- reg_def CCR3(SOC, SOC, Op_RegFlags, 3, CCR3->as_VMReg()); // nv
- reg_def CCR4(SOC, SOC, Op_RegFlags, 4, CCR4->as_VMReg()); // nv
- reg_def CCR5(SOC, SOC, Op_RegFlags, 5, CCR5->as_VMReg()); // v
- reg_def CCR6(SOC, SOC, Op_RegFlags, 6, CCR6->as_VMReg()); // v
- reg_def CCR7(SOC, SOC, Op_RegFlags, 7, CCR7->as_VMReg()); // v
+ reg_def CR0(SOC, SOC, Op_RegFlags, 0, CR0->as_VMReg()); // v
+ reg_def CR1(SOC, SOC, Op_RegFlags, 1, CR1->as_VMReg()); // v
+ reg_def CR2(SOC, SOC, Op_RegFlags, 2, CR2->as_VMReg()); // nv
+ reg_def CR3(SOC, SOC, Op_RegFlags, 3, CR3->as_VMReg()); // nv
+ reg_def CR4(SOC, SOC, Op_RegFlags, 4, CR4->as_VMReg()); // nv
+ reg_def CR5(SOC, SOC, Op_RegFlags, 5, CR5->as_VMReg()); // v
+ reg_def CR6(SOC, SOC, Op_RegFlags, 6, CR6->as_VMReg()); // v
+ reg_def CR7(SOC, SOC, Op_RegFlags, 7, CR7->as_VMReg()); // v
// Special registers of PPC64
@@ -443,14 +443,14 @@ alloc_class chunk1 (
alloc_class chunk2 (
// Chunk2 contains *all* 8 condition code registers.
- CCR0,
- CCR1,
- CCR2,
- CCR3,
- CCR4,
- CCR5,
- CCR6,
- CCR7
+ CR0,
+ CR1,
+ CR2,
+ CR3,
+ CR4,
+ CR5,
+ CR6,
+ CR7
);
alloc_class chunk3 (
@@ -803,30 +803,30 @@ reg_class bits64_reg_ro(
// Special Class for Condition Code Flags Register
reg_class int_flags(
-/*CCR0*/ // scratch
-/*CCR1*/ // scratch
-/*CCR2*/ // nv!
-/*CCR3*/ // nv!
-/*CCR4*/ // nv!
- CCR5,
- CCR6,
- CCR7
+/*CR0*/ // scratch
+/*CR1*/ // scratch
+/*CR2*/ // nv!
+/*CR3*/ // nv!
+/*CR4*/ // nv!
+ CR5,
+ CR6,
+ CR7
);
reg_class int_flags_ro(
- CCR0,
- CCR1,
- CCR2,
- CCR3,
- CCR4,
- CCR5,
- CCR6,
- CCR7
+ CR0,
+ CR1,
+ CR2,
+ CR3,
+ CR4,
+ CR5,
+ CR6,
+ CR7
);
-reg_class int_flags_CR0(CCR0);
-reg_class int_flags_CR1(CCR1);
-reg_class int_flags_CR6(CCR6);
+reg_class int_flags_CR0(CR0);
+reg_class int_flags_CR1(CR1);
+reg_class int_flags_CR6(CR6);
reg_class ctr_reg(SR_CTR);
// ----------------------------
@@ -5568,8 +5568,8 @@ instruct loadF_ac(regF dst, memory mem, flagsRegCR0 cr0) %{
int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
Label next;
__ lfs($dst$$FloatRegister, Idisp, $mem$$base$$Register);
- __ fcmpu(CCR0, $dst$$FloatRegister, $dst$$FloatRegister);
- __ bne(CCR0, next);
+ __ fcmpu(CR0, $dst$$FloatRegister, $dst$$FloatRegister);
+ __ bne(CR0, next);
__ bind(next);
__ isync();
%}
@@ -5604,8 +5604,8 @@ instruct loadD_ac(regD dst, memory mem, flagsRegCR0 cr0) %{
int Idisp = $mem$$disp + frame_slots_bias($mem$$base, ra_);
Label next;
__ lfd($dst$$FloatRegister, Idisp, $mem$$base$$Register);
- __ fcmpu(CCR0, $dst$$FloatRegister, $dst$$FloatRegister);
- __ bne(CCR0, next);
+ __ fcmpu(CR0, $dst$$FloatRegister, $dst$$FloatRegister);
+ __ bne(CR0, next);
__ bind(next);
__ isync();
%}
@@ -7394,8 +7394,8 @@ instruct compareAndSwapB_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc
effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
format %{ "CMPXCHGB $res, $mem_ptr, $src1, $src2; as bool" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgb(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgb(CR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
$res$$Register, nullptr, true);
if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
@@ -7413,8 +7413,8 @@ instruct compareAndSwapB4_regP_regI_regI(iRegIdst res, rarg3RegP mem_ptr, iRegIs
effect(TEMP_DEF res, USE_KILL src2, USE_KILL mem_ptr, TEMP tmp1, TEMP tmp2, TEMP cr0); // TEMP_DEF to avoid jump
format %{ "CMPXCHGB $res, $mem_ptr, $src1, $src2; as bool" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgb(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, $tmp2$$Register,
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgb(CR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, $tmp2$$Register,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
$res$$Register, nullptr, true);
if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
@@ -7432,8 +7432,8 @@ instruct compareAndSwapS_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc
effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
format %{ "CMPXCHGH $res, $mem_ptr, $src1, $src2; as bool" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgh(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgh(CR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
$res$$Register, nullptr, true);
if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
@@ -7451,8 +7451,8 @@ instruct compareAndSwapS4_regP_regI_regI(iRegIdst res, rarg3RegP mem_ptr, iRegIs
effect(TEMP_DEF res, USE_KILL src2, USE_KILL mem_ptr, TEMP tmp1, TEMP tmp2, TEMP cr0); // TEMP_DEF to avoid jump
format %{ "CMPXCHGH $res, $mem_ptr, $src1, $src2; as bool" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgh(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, $tmp2$$Register,
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgh(CR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, $tmp2$$Register,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
$res$$Register, nullptr, true);
if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
@@ -7469,8 +7469,8 @@ instruct compareAndSwapI_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc
effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
format %{ "CMPXCHGW $res, $mem_ptr, $src1, $src2; as bool" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgw(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgw(CR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
$res$$Register, nullptr, true);
if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
@@ -7488,8 +7488,8 @@ instruct compareAndSwapN_regP_regN_regN(iRegIdst res, iRegPdst mem_ptr, iRegNsrc
effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
format %{ "CMPXCHGW $res, $mem_ptr, $src1, $src2; as bool" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgw(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgw(CR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
$res$$Register, nullptr, true);
if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
@@ -7506,8 +7506,8 @@ instruct compareAndSwapL_regP_regL_regL(iRegIdst res, iRegPdst mem_ptr, iRegLsrc
effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
format %{ "CMPXCHGD $res, $mem_ptr, $src1, $src2; as bool" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgd(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgd(CR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
$res$$Register, nullptr, true);
if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
@@ -7525,8 +7525,8 @@ instruct compareAndSwapP_regP_regP_regP(iRegIdst res, iRegPdst mem_ptr, iRegPsrc
predicate(n->as_LoadStore()->barrier_data() == 0);
format %{ "CMPXCHGD $res, $mem_ptr, $src1, $src2; as bool; ptr" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgd(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgd(CR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
$res$$Register, nullptr, true);
if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
@@ -7546,8 +7546,8 @@ instruct weakCompareAndSwapB_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iReg
effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
format %{ "weak CMPXCHGB $res, $mem_ptr, $src1, $src2; as bool" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgb(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgb(CR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
MacroAssembler::MemBarNone,
MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, nullptr, true, /*weak*/ true);
%}
@@ -7560,8 +7560,8 @@ instruct weakCompareAndSwapB4_regP_regI_regI(iRegIdst res, rarg3RegP mem_ptr, iR
effect(TEMP_DEF res, USE_KILL src2, USE_KILL mem_ptr, TEMP tmp1, TEMP tmp2, TEMP cr0); // TEMP_DEF to avoid jump
format %{ "weak CMPXCHGB $res, $mem_ptr, $src1, $src2; as bool" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgb(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, $tmp2$$Register,
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgb(CR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, $tmp2$$Register,
MacroAssembler::MemBarNone,
MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, nullptr, true, /*weak*/ true);
%}
@@ -7574,8 +7574,8 @@ instruct weakCompareAndSwapB_acq_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr,
effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
format %{ "weak CMPXCHGB acq $res, $mem_ptr, $src1, $src2; as bool" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgb(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgb(CR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
support_IRIW_for_not_multiple_copy_atomic_cpu ? MacroAssembler::MemBarAcq : MacroAssembler::MemBarFenceAfter,
MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, nullptr, true, /*weak*/ true);
%}
@@ -7588,8 +7588,8 @@ instruct weakCompareAndSwapB4_acq_regP_regI_regI(iRegIdst res, rarg3RegP mem_ptr
effect(TEMP_DEF res, USE_KILL src2, USE_KILL mem_ptr, TEMP tmp1, TEMP tmp2, TEMP cr0); // TEMP_DEF to avoid jump
format %{ "weak CMPXCHGB acq $res, $mem_ptr, $src1, $src2; as bool" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgb(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, $tmp2$$Register,
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgb(CR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, $tmp2$$Register,
support_IRIW_for_not_multiple_copy_atomic_cpu ? MacroAssembler::MemBarAcq : MacroAssembler::MemBarFenceAfter,
MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, nullptr, true, /*weak*/ true);
%}
@@ -7602,8 +7602,8 @@ instruct weakCompareAndSwapS_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iReg
effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
format %{ "weak CMPXCHGH $res, $mem_ptr, $src1, $src2; as bool" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgh(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgh(CR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
MacroAssembler::MemBarNone,
MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, nullptr, true, /*weak*/ true);
%}
@@ -7616,8 +7616,8 @@ instruct weakCompareAndSwapS4_regP_regI_regI(iRegIdst res, rarg3RegP mem_ptr, iR
effect(TEMP_DEF res, USE_KILL src2, USE_KILL mem_ptr, TEMP tmp1, TEMP tmp2, TEMP cr0); // TEMP_DEF to avoid jump
format %{ "weak CMPXCHGH $res, $mem_ptr, $src1, $src2; as bool" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgh(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, $tmp2$$Register,
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgh(CR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, $tmp2$$Register,
MacroAssembler::MemBarNone,
MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, nullptr, true, /*weak*/ true);
%}
@@ -7630,8 +7630,8 @@ instruct weakCompareAndSwapS_acq_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr,
effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
format %{ "weak CMPXCHGH acq $res, $mem_ptr, $src1, $src2; as bool" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgh(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgh(CR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
support_IRIW_for_not_multiple_copy_atomic_cpu ? MacroAssembler::MemBarAcq : MacroAssembler::MemBarFenceAfter,
MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, nullptr, true, /*weak*/ true);
%}
@@ -7644,8 +7644,8 @@ instruct weakCompareAndSwapS4_acq_regP_regI_regI(iRegIdst res, rarg3RegP mem_ptr
effect(TEMP_DEF res, USE_KILL src2, USE_KILL mem_ptr, TEMP tmp1, TEMP tmp2, TEMP cr0); // TEMP_DEF to avoid jump
format %{ "weak CMPXCHGH acq $res, $mem_ptr, $src1, $src2; as bool" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgh(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, $tmp2$$Register,
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgh(CR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, $tmp2$$Register,
support_IRIW_for_not_multiple_copy_atomic_cpu ? MacroAssembler::MemBarAcq : MacroAssembler::MemBarFenceAfter,
MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, nullptr, true, /*weak*/ true);
%}
@@ -7658,8 +7658,8 @@ instruct weakCompareAndSwapI_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iReg
effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
format %{ "weak CMPXCHGW $res, $mem_ptr, $src1, $src2; as bool" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgw(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgw(CR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
MacroAssembler::MemBarNone,
MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, nullptr, true, /*weak*/ true);
%}
@@ -7672,10 +7672,10 @@ instruct weakCompareAndSwapI_acq_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr,
effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
format %{ "weak CMPXCHGW acq $res, $mem_ptr, $src1, $src2; as bool" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
// Acquire only needed in successful case. Weak node is allowed to report unsuccessful in additional rare cases and
// value is never passed to caller.
- __ cmpxchgw(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
+ __ cmpxchgw(CR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
support_IRIW_for_not_multiple_copy_atomic_cpu ? MacroAssembler::MemBarAcq : MacroAssembler::MemBarFenceAfter,
MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, nullptr, true, /*weak*/ true);
%}
@@ -7688,8 +7688,8 @@ instruct weakCompareAndSwapN_regP_regN_regN(iRegIdst res, iRegPdst mem_ptr, iReg
effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
format %{ "weak CMPXCHGW $res, $mem_ptr, $src1, $src2; as bool" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgw(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgw(CR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
MacroAssembler::MemBarNone,
MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, nullptr, true, /*weak*/ true);
%}
@@ -7702,10 +7702,10 @@ instruct weakCompareAndSwapN_acq_regP_regN_regN(iRegIdst res, iRegPdst mem_ptr,
effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
format %{ "weak CMPXCHGW acq $res, $mem_ptr, $src1, $src2; as bool" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
// Acquire only needed in successful case. Weak node is allowed to report unsuccessful in additional rare cases and
// value is never passed to caller.
- __ cmpxchgw(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
+ __ cmpxchgw(CR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
support_IRIW_for_not_multiple_copy_atomic_cpu ? MacroAssembler::MemBarAcq : MacroAssembler::MemBarFenceAfter,
MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, nullptr, true, /*weak*/ true);
%}
@@ -7718,9 +7718,9 @@ instruct weakCompareAndSwapL_regP_regL_regL(iRegIdst res, iRegPdst mem_ptr, iReg
effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
format %{ "weak CMPXCHGD $res, $mem_ptr, $src1, $src2; as bool" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
// value is never passed to caller.
- __ cmpxchgd(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
+ __ cmpxchgd(CR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
MacroAssembler::MemBarNone,
MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, nullptr, true, /*weak*/ true);
%}
@@ -7733,10 +7733,10 @@ instruct weakCompareAndSwapL_acq_regP_regL_regL(iRegIdst res, iRegPdst mem_ptr,
effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
format %{ "weak CMPXCHGD acq $res, $mem_ptr, $src1, $src2; as bool" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
// Acquire only needed in successful case. Weak node is allowed to report unsuccessful in additional rare cases and
// value is never passed to caller.
- __ cmpxchgd(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
+ __ cmpxchgd(CR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
support_IRIW_for_not_multiple_copy_atomic_cpu ? MacroAssembler::MemBarAcq : MacroAssembler::MemBarFenceAfter,
MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, nullptr, true, /*weak*/ true);
%}
@@ -7749,8 +7749,8 @@ instruct weakCompareAndSwapP_regP_regP_regP(iRegIdst res, iRegPdst mem_ptr, iReg
effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
format %{ "weak CMPXCHGD $res, $mem_ptr, $src1, $src2; as bool; ptr" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgd(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgd(CR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
MacroAssembler::MemBarNone,
MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, nullptr, true, /*weak*/ true);
%}
@@ -7763,10 +7763,10 @@ instruct weakCompareAndSwapP_acq_regP_regP_regP(iRegIdst res, iRegPdst mem_ptr,
effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
format %{ "weak CMPXCHGD acq $res, $mem_ptr, $src1, $src2; as bool; ptr" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
// Acquire only needed in successful case. Weak node is allowed to report unsuccessful in additional rare cases and
// value is never passed to caller.
- __ cmpxchgd(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
+ __ cmpxchgd(CR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
support_IRIW_for_not_multiple_copy_atomic_cpu ? MacroAssembler::MemBarAcq : MacroAssembler::MemBarFenceAfter,
MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, nullptr, true, /*weak*/ true);
%}
@@ -7781,8 +7781,8 @@ instruct compareAndExchangeB_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iReg
effect(TEMP_DEF res, TEMP cr0);
format %{ "CMPXCHGB $res, $mem_ptr, $src1, $src2; as int" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgb(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgb(CR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
noreg, nullptr, true);
%}
@@ -7795,8 +7795,8 @@ instruct compareAndExchangeB4_regP_regI_regI(iRegIdst res, rarg3RegP mem_ptr, iR
effect(TEMP_DEF res, USE_KILL src2, USE_KILL mem_ptr, TEMP tmp1, TEMP cr0);
format %{ "CMPXCHGB $res, $mem_ptr, $src1, $src2; as int" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgb(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, R0,
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgb(CR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, R0,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
noreg, nullptr, true);
%}
@@ -7809,8 +7809,8 @@ instruct compareAndExchangeB_acq_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr,
effect(TEMP_DEF res, TEMP cr0);
format %{ "CMPXCHGB acq $res, $mem_ptr, $src1, $src2; as int" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgb(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgb(CR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
noreg, nullptr, true);
if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
@@ -7829,8 +7829,8 @@ instruct compareAndExchangeB4_acq_regP_regI_regI(iRegIdst res, rarg3RegP mem_ptr
effect(TEMP_DEF res, USE_KILL src2, USE_KILL mem_ptr, TEMP tmp1, TEMP cr0);
format %{ "CMPXCHGB acq $res, $mem_ptr, $src1, $src2; as int" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgb(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, R0,
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgb(CR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, R0,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
noreg, nullptr, true);
if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
@@ -7849,8 +7849,8 @@ instruct compareAndExchangeS_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iReg
effect(TEMP_DEF res, TEMP cr0);
format %{ "CMPXCHGH $res, $mem_ptr, $src1, $src2; as int" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgh(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgh(CR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
noreg, nullptr, true);
%}
@@ -7863,8 +7863,8 @@ instruct compareAndExchangeS4_regP_regI_regI(iRegIdst res, rarg3RegP mem_ptr, iR
effect(TEMP_DEF res, USE_KILL src2, USE_KILL mem_ptr, TEMP tmp1, TEMP cr0);
format %{ "CMPXCHGH $res, $mem_ptr, $src1, $src2; as int" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgh(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, R0,
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgh(CR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, R0,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
noreg, nullptr, true);
%}
@@ -7877,8 +7877,8 @@ instruct compareAndExchangeS_acq_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr,
effect(TEMP_DEF res, TEMP cr0);
format %{ "CMPXCHGH acq $res, $mem_ptr, $src1, $src2; as int" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgh(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgh(CR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
noreg, nullptr, true);
if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
@@ -7897,8 +7897,8 @@ instruct compareAndExchangeS4_acq_regP_regI_regI(iRegIdst res, rarg3RegP mem_ptr
effect(TEMP_DEF res, USE_KILL src2, USE_KILL mem_ptr, TEMP tmp1, TEMP cr0);
format %{ "CMPXCHGH acq $res, $mem_ptr, $src1, $src2; as int" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgh(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, R0,
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgh(CR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, R0,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
noreg, nullptr, true);
if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
@@ -7917,8 +7917,8 @@ instruct compareAndExchangeI_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iReg
effect(TEMP_DEF res, TEMP cr0);
format %{ "CMPXCHGW $res, $mem_ptr, $src1, $src2; as int" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgw(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgw(CR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
noreg, nullptr, true);
%}
@@ -7931,8 +7931,8 @@ instruct compareAndExchangeI_acq_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr,
effect(TEMP_DEF res, TEMP cr0);
format %{ "CMPXCHGW acq $res, $mem_ptr, $src1, $src2; as int" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgw(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgw(CR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
noreg, nullptr, true);
if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
@@ -7951,8 +7951,8 @@ instruct compareAndExchangeN_regP_regN_regN(iRegNdst res, iRegPdst mem_ptr, iReg
effect(TEMP_DEF res, TEMP cr0);
format %{ "CMPXCHGW $res, $mem_ptr, $src1, $src2; as narrow oop" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgw(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgw(CR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
noreg, nullptr, true);
%}
@@ -7965,8 +7965,8 @@ instruct compareAndExchangeN_acq_regP_regN_regN(iRegNdst res, iRegPdst mem_ptr,
effect(TEMP_DEF res, TEMP cr0);
format %{ "CMPXCHGW acq $res, $mem_ptr, $src1, $src2; as narrow oop" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgw(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgw(CR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
noreg, nullptr, true);
if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
@@ -7985,8 +7985,8 @@ instruct compareAndExchangeL_regP_regL_regL(iRegLdst res, iRegPdst mem_ptr, iReg
effect(TEMP_DEF res, TEMP cr0);
format %{ "CMPXCHGD $res, $mem_ptr, $src1, $src2; as long" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgd(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgd(CR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
noreg, nullptr, true);
%}
@@ -7999,8 +7999,8 @@ instruct compareAndExchangeL_acq_regP_regL_regL(iRegLdst res, iRegPdst mem_ptr,
effect(TEMP_DEF res, TEMP cr0);
format %{ "CMPXCHGD acq $res, $mem_ptr, $src1, $src2; as long" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgd(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgd(CR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
noreg, nullptr, true);
if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
@@ -8020,8 +8020,8 @@ instruct compareAndExchangeP_regP_regP_regP(iRegPdst res, iRegPdst mem_ptr, iReg
effect(TEMP_DEF res, TEMP cr0);
format %{ "CMPXCHGD $res, $mem_ptr, $src1, $src2; as ptr; ptr" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgd(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgd(CR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
noreg, nullptr, true);
%}
@@ -8035,8 +8035,8 @@ instruct compareAndExchangeP_acq_regP_regP_regP(iRegPdst res, iRegPdst mem_ptr,
effect(TEMP_DEF res, TEMP cr0);
format %{ "CMPXCHGD acq $res, $mem_ptr, $src1, $src2; as ptr; ptr" %}
ins_encode %{
- // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgd(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
+ // CmpxchgX sets CR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgd(CR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
noreg, nullptr, true);
if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
@@ -11389,7 +11389,7 @@ instruct cmpL3_reg_reg(iRegIdst dst, iRegLsrc src1, iRegLsrc src2, flagsRegCR0 c
format %{ "cmpL3_reg_reg $dst, $src1, $src2" %}
ins_encode %{
- __ cmpd(CCR0, $src1$$Register, $src2$$Register);
+ __ cmpd(CR0, $src1$$Register, $src2$$Register);
__ set_cmp3($dst$$Register);
%}
ins_pipe(pipe_class_default);
@@ -11661,11 +11661,11 @@ instruct cmpF_reg_reg_Ex(flagsReg crx, regF src1, regF src2) %{
//
// block BXX:
// 0: instruct cmpFUnordered_reg_reg (cmpF_reg_reg-0):
- // cmpFUrd CCR6, F11, F9
+ // cmpFUrd CR6, F11, F9
// 4: instruct cmov_bns_less (cmpF_reg_reg-1):
- // cmov CCR6
+ // cmov CR6
// 8: instruct branchConSched:
- // B_FARle CCR6, B56 P=0.500000 C=-1.000000
+ // B_FARle CR6, B56 P=0.500000 C=-1.000000
match(Set crx (CmpF src1 src2));
ins_cost(DEFAULT_COST+BRANCH_COST);
@@ -11724,7 +11724,7 @@ instruct cmpF3_reg_reg(iRegIdst dst, regF src1, regF src2, flagsRegCR0 cr0) %{
format %{ "cmpF3_reg_reg $dst, $src1, $src2" %}
ins_encode %{
- __ fcmpu(CCR0, $src1$$FloatRegister, $src2$$FloatRegister);
+ __ fcmpu(CR0, $src1$$FloatRegister, $src2$$FloatRegister);
__ set_cmpu3($dst$$Register, true); // C2 requires unordered to get treated like less
%}
ins_pipe(pipe_class_default);
@@ -11808,7 +11808,7 @@ instruct cmpD3_reg_reg(iRegIdst dst, regD src1, regD src2, flagsRegCR0 cr0) %{
format %{ "cmpD3_reg_reg $dst, $src1, $src2" %}
ins_encode %{
- __ fcmpu(CCR0, $src1$$FloatRegister, $src2$$FloatRegister);
+ __ fcmpu(CR0, $src1$$FloatRegister, $src2$$FloatRegister);
__ set_cmpu3($dst$$Register, true); // C2 requires unordered to get treated like less
%}
ins_pipe(pipe_class_default);
@@ -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;
@@ -12745,7 +12770,7 @@ instruct string_inflate(Universe dummy, rarg1RegP src, rarg2RegP dst, iRegIsrc l
__ string_inflate_16($src$$Register, $dst$$Register, $len$$Register, $tmp1$$Register,
$tmp2$$Register, $tmp3$$Register, $tmp4$$Register, $tmp5$$Register);
__ rldicl_($tmp1$$Register, $len$$Register, 0, 64-3); // Remaining characters.
- __ beq(CCR0, Ldone);
+ __ beq(CR0, Ldone);
__ string_inflate($src$$Register, $dst$$Register, $tmp1$$Register, $tmp2$$Register);
__ bind(Ldone);
%}
@@ -12829,8 +12854,8 @@ instruct minI_reg_reg_isel(iRegIdst dst, iRegIsrc src1, iRegIsrc src2, flagsRegC
ins_cost(DEFAULT_COST*2);
ins_encode %{
- __ cmpw(CCR0, $src1$$Register, $src2$$Register);
- __ isel($dst$$Register, CCR0, Assembler::less, /*invert*/false, $src1$$Register, $src2$$Register);
+ __ cmpw(CR0, $src1$$Register, $src2$$Register);
+ __ isel($dst$$Register, CR0, Assembler::less, /*invert*/false, $src1$$Register, $src2$$Register);
%}
ins_pipe(pipe_class_default);
%}
@@ -12862,8 +12887,8 @@ instruct maxI_reg_reg_isel(iRegIdst dst, iRegIsrc src1, iRegIsrc src2, flagsRegC
ins_cost(DEFAULT_COST*2);
ins_encode %{
- __ cmpw(CCR0, $src1$$Register, $src2$$Register);
- __ isel($dst$$Register, CCR0, Assembler::greater, /*invert*/false, $src1$$Register, $src2$$Register);
+ __ cmpw(CR0, $src1$$Register, $src2$$Register);
+ __ isel($dst$$Register, CR0, Assembler::greater, /*invert*/false, $src1$$Register, $src2$$Register);
%}
ins_pipe(pipe_class_default);
%}
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/register_ppc.hpp b/src/hotspot/cpu/ppc/register_ppc.hpp
index 1a7f496934780..565542ad7c0d2 100644
--- a/src/hotspot/cpu/ppc/register_ppc.hpp
+++ b/src/hotspot/cpu/ppc/register_ppc.hpp
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2023 SAP SE. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -179,14 +179,14 @@ inline constexpr ConditionRegister as_ConditionRegister(int encoding) {
return ConditionRegister(encoding);
}
-constexpr ConditionRegister CCR0 = as_ConditionRegister(0);
-constexpr ConditionRegister CCR1 = as_ConditionRegister(1);
-constexpr ConditionRegister CCR2 = as_ConditionRegister(2);
-constexpr ConditionRegister CCR3 = as_ConditionRegister(3);
-constexpr ConditionRegister CCR4 = as_ConditionRegister(4);
-constexpr ConditionRegister CCR5 = as_ConditionRegister(5);
-constexpr ConditionRegister CCR6 = as_ConditionRegister(6);
-constexpr ConditionRegister CCR7 = as_ConditionRegister(7);
+constexpr ConditionRegister CR0 = as_ConditionRegister(0);
+constexpr ConditionRegister CR1 = as_ConditionRegister(1);
+constexpr ConditionRegister CR2 = as_ConditionRegister(2);
+constexpr ConditionRegister CR3 = as_ConditionRegister(3);
+constexpr ConditionRegister CR4 = as_ConditionRegister(4);
+constexpr ConditionRegister CR5 = as_ConditionRegister(5);
+constexpr ConditionRegister CR6 = as_ConditionRegister(6);
+constexpr ConditionRegister CR7 = as_ConditionRegister(7);
class VectorSRegister;
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..c5990e01e0df4 100644
--- a/src/hotspot/cpu/ppc/runtime_ppc.cpp
+++ b/src/hotspot/cpu/ppc/runtime_ppc.cpp
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2023 SAP SE. All rights reserved.
+ * Copyright (c) 1998, 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 @@
*
*/
-#include "precompiled.hpp"
#ifdef COMPILER2
#include "asm/macroAssembler.inline.hpp"
#include "code/vmreg.hpp"
@@ -102,7 +101,7 @@ void OptoRuntime::generate_exception_blob() {
__ call_c((address) OptoRuntime::handle_exception_C);
address calls_return_pc = __ last_calls_return_pc();
# ifdef ASSERT
- __ cmpdi(CCR0, R3_RET, 0);
+ __ cmpdi(CR0, R3_RET, 0);
__ asm_assert_ne("handle_exception_C must not return null");
# endif
diff --git a/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp b/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp
index c2e4c2e9b55c9..f7e1410d10fa5 100644
--- a/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp
+++ b/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2024 SAP SE. All rights reserved.
+ * Copyright (c) 1997, 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 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "code/debugInfoRec.hpp"
#include "code/compiledIC.hpp"
@@ -909,9 +908,9 @@ static address gen_c2i_adapter(MacroAssembler *masm,
// Does compiled code exists? If yes, patch the caller's callsite.
__ ld(code, method_(code));
- __ cmpdi(CCR0, code, 0);
+ __ cmpdi(CR0, code, 0);
__ ld(ientry, method_(interpreter_entry)); // preloaded
- __ beq(CCR0, call_interpreter);
+ __ beq(CR0, call_interpreter);
// Patch caller's callsite, method_(code) was not null which means that
@@ -1185,9 +1184,9 @@ AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm
// Argument is valid and klass is as expected, continue.
__ ld(code, method_(code));
- __ cmpdi(CCR0, code, 0);
+ __ cmpdi(CR0, code, 0);
__ ld(ientry, method_(interpreter_entry)); // preloaded
- __ beq_predict_taken(CCR0, call_interpreter);
+ __ beq_predict_taken(CR0, call_interpreter);
// Branch to ic_miss_stub.
__ b64_patchable((address)SharedRuntime::get_ic_miss_stub(), relocInfo::runtime_call_type);
@@ -1202,9 +1201,9 @@ AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm
Label L_skip_barrier;
{ // Bypass the barrier for non-static methods
- __ lwz(R0, in_bytes(Method::access_flags_offset()), R19_method);
+ __ lhz(R0, in_bytes(Method::access_flags_offset()), R19_method);
__ andi_(R0, R0, JVM_ACC_STATIC);
- __ beq(CCR0, L_skip_barrier); // non-static
+ __ beq(CR0, L_skip_barrier); // non-static
}
Register klass = R11_scratch1;
@@ -1252,8 +1251,8 @@ static void object_move(MacroAssembler* masm,
__ addi(r_handle, r_caller_sp, reg2offset(src.first()));
__ ld( r_temp_2, reg2offset(src.first()), r_caller_sp);
- __ cmpdi(CCR0, r_temp_2, 0);
- __ bne(CCR0, skip);
+ __ cmpdi(CR0, r_temp_2, 0);
+ __ bne(CR0, skip);
// Use a null handle if oop is null.
__ li(r_handle, 0);
__ bind(skip);
@@ -1282,8 +1281,8 @@ static void object_move(MacroAssembler* masm,
__ std( r_oop, oop_offset, R1_SP);
__ addi(r_handle, R1_SP, oop_offset);
- __ cmpdi(CCR0, r_oop, 0);
- __ bne(CCR0, skip);
+ __ cmpdi(CR0, r_oop, 0);
+ __ bne(CR0, skip);
// Use a null handle if oop is null.
__ li(r_handle, 0);
__ bind(skip);
@@ -1643,7 +1642,7 @@ static void continuation_enter_cleanup(MacroAssembler* masm) {
#ifdef ASSERT
__ block_comment("clean {");
__ ld_ptr(tmp1, JavaThread::cont_entry_offset(), R16_thread);
- __ cmpd(CCR0, R1_SP, tmp1);
+ __ cmpd(CR0, R1_SP, tmp1);
__ asm_assert_eq(FILE_AND_LINE ": incorrect R1_SP");
#endif
@@ -1654,15 +1653,15 @@ static void continuation_enter_cleanup(MacroAssembler* masm) {
// Check if this is a virtual thread continuation
Label L_skip_vthread_code;
__ lwz(R0, in_bytes(ContinuationEntry::flags_offset()), R1_SP);
- __ cmpwi(CCR0, R0, 0);
- __ beq(CCR0, L_skip_vthread_code);
+ __ cmpwi(CR0, R0, 0);
+ __ beq(CR0, L_skip_vthread_code);
// If the held monitor count is > 0 and this vthread is terminating then
// it failed to release a JNI monitor. So we issue the same log message
// that JavaThread::exit does.
__ ld(R0, in_bytes(JavaThread::jni_monitor_count_offset()), R16_thread);
- __ cmpdi(CCR0, R0, 0);
- __ beq(CCR0, L_skip_vthread_code);
+ __ cmpdi(CR0, R0, 0);
+ __ beq(CR0, L_skip_vthread_code);
// Save return value potentially containing the exception oop
Register ex_oop = R15_esp; // nonvolatile register
@@ -1684,8 +1683,8 @@ static void continuation_enter_cleanup(MacroAssembler* masm) {
// Check if this is a virtual thread continuation
Label L_skip_vthread_code;
__ lwz(R0, in_bytes(ContinuationEntry::flags_offset()), R1_SP);
- __ cmpwi(CCR0, R0, 0);
- __ beq(CCR0, L_skip_vthread_code);
+ __ cmpwi(CR0, R0, 0);
+ __ beq(CR0, L_skip_vthread_code);
// See comment just above. If not checking JNI calls the JNI count is only
// needed for assertion checking.
@@ -1750,8 +1749,8 @@ static void gen_continuation_enter(MacroAssembler* masm,
#ifdef ASSERT
Label is_interp_only;
__ lwz(R0, in_bytes(JavaThread::interp_only_mode_offset()), R16_thread);
- __ cmpwi(CCR0, R0, 0);
- __ bne(CCR0, is_interp_only);
+ __ cmpwi(CR0, R0, 0);
+ __ bne(CR0, is_interp_only);
__ stop("enterSpecial interpreter entry called when not in interp_only_mode");
__ bind(is_interp_only);
#endif
@@ -1771,8 +1770,8 @@ static void gen_continuation_enter(MacroAssembler* masm,
fill_continuation_entry(masm, reg_cont_obj, reg_is_virtual);
// If isContinue, call to thaw. Otherwise, call Continuation.enter(Continuation c, boolean isContinue)
- __ cmpwi(CCR0, reg_is_cont, 0);
- __ bne(CCR0, L_thaw);
+ __ cmpwi(CR0, reg_is_cont, 0);
+ __ bne(CR0, L_thaw);
// --- call Continuation.enter(Continuation c, boolean isContinue)
@@ -1819,8 +1818,8 @@ static void gen_continuation_enter(MacroAssembler* masm,
fill_continuation_entry(masm, reg_cont_obj, reg_is_virtual);
// If isContinue, call to thaw. Otherwise, call Continuation.enter(Continuation c, boolean isContinue)
- __ cmpwi(CCR0, reg_is_cont, 0);
- __ bne(CCR0, L_thaw);
+ __ cmpwi(CR0, reg_is_cont, 0);
+ __ bne(CR0, L_thaw);
// --- call Continuation.enter(Continuation c, boolean isContinue)
@@ -1870,7 +1869,7 @@ static void gen_continuation_enter(MacroAssembler* masm,
// Pop frame and return
DEBUG_ONLY(__ ld_ptr(R0, 0, R1_SP));
__ addi(R1_SP, R1_SP, framesize_words*wordSize);
- DEBUG_ONLY(__ cmpd(CCR0, R0, R1_SP));
+ DEBUG_ONLY(__ cmpd(CR0, R0, R1_SP));
__ asm_assert_eq(FILE_AND_LINE ": inconsistent frame size");
__ ld(R0, _abi0(lr), R1_SP); // Return pc
__ mtlr(R0);
@@ -1938,8 +1937,8 @@ static void gen_continuation_yield(MacroAssembler* masm,
Label L_pinned;
- __ cmpwi(CCR0, R3_RET, 0);
- __ bne(CCR0, L_pinned);
+ __ cmpwi(CR0, R3_RET, 0);
+ __ bne(CR0, L_pinned);
// yield succeeded
@@ -1962,8 +1961,8 @@ static void gen_continuation_yield(MacroAssembler* masm,
// handle pending exception thrown by freeze
__ ld(tmp, in_bytes(JavaThread::pending_exception_offset()), R16_thread);
- __ cmpdi(CCR0, tmp, 0);
- __ beq(CCR0, L_return); // return if no exception is pending
+ __ cmpdi(CR0, tmp, 0);
+ __ beq(CR0, L_return); // return if no exception is pending
__ pop_frame();
__ ld(R0, _abi0(lr), R1_SP); // Return pc
__ mtlr(R0);
@@ -2399,12 +2398,12 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
if (LockingMode == LM_LIGHTWEIGHT) {
// fast_lock kills r_temp_1, r_temp_2, r_temp_3.
Register r_temp_3_or_noreg = UseObjectMonitorTable ? r_temp_3 : noreg;
- __ compiler_fast_lock_lightweight_object(CCR0, r_oop, r_box, r_temp_1, r_temp_2, r_temp_3_or_noreg);
+ __ compiler_fast_lock_lightweight_object(CR0, r_oop, r_box, r_temp_1, r_temp_2, r_temp_3_or_noreg);
} else {
// fast_lock kills r_temp_1, r_temp_2, r_temp_3.
- __ compiler_fast_lock_object(CCR0, r_oop, r_box, r_temp_1, r_temp_2, r_temp_3);
+ __ compiler_fast_lock_object(CR0, r_oop, r_box, r_temp_1, r_temp_2, r_temp_3);
}
- __ beq(CCR0, locked);
+ __ beq(CR0, locked);
// None of the above fast optimizations worked so we have to get into the
// slow case of monitor enter. Inline a special case of call_VM that
@@ -2539,8 +2538,8 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
// Not suspended.
// TODO: PPC port assert(4 == Thread::sz_suspend_flags(), "unexpected field size");
__ lwz(suspend_flags, thread_(suspend_flags));
- __ cmpwi(CCR1, suspend_flags, 0);
- __ beq(CCR1, no_block);
+ __ cmpwi(CR1, suspend_flags, 0);
+ __ beq(CR1, no_block);
// Block. Save any potential method result value before the operation and
// use a leaf call to leave the last_Java_frame setup undisturbed. Doing this
@@ -2573,8 +2572,8 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
if (LockingMode != LM_LEGACY && method->is_object_wait0()) {
Label not_preempted;
__ ld(R0, in_bytes(JavaThread::preempt_alternate_return_offset()), R16_thread);
- __ cmpdi(CCR0, R0, 0);
- __ beq(CCR0, not_preempted);
+ __ cmpdi(CR0, R0, 0);
+ __ beq(CR0, not_preempted);
__ mtlr(R0);
__ li(R0, 0);
__ std(R0, in_bytes(JavaThread::preempt_alternate_return_offset()), R16_thread);
@@ -2592,8 +2591,8 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
Label no_reguard;
__ lwz(r_temp_1, thread_(stack_guard_state));
- __ cmpwi(CCR0, r_temp_1, StackOverflow::stack_guard_yellow_reserved_disabled);
- __ bne(CCR0, no_reguard);
+ __ cmpwi(CR0, r_temp_1, StackOverflow::stack_guard_yellow_reserved_disabled);
+ __ bne(CR0, no_reguard);
save_native_result(masm, ret_type, workspace_slot_offset);
__ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::reguard_yellow_pages));
@@ -2623,11 +2622,11 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
// Try fastpath for unlocking.
if (LockingMode == LM_LIGHTWEIGHT) {
- __ compiler_fast_unlock_lightweight_object(CCR0, r_oop, r_box, r_temp_1, r_temp_2, r_temp_3);
+ __ compiler_fast_unlock_lightweight_object(CR0, r_oop, r_box, r_temp_1, r_temp_2, r_temp_3);
} else {
- __ compiler_fast_unlock_object(CCR0, r_oop, r_box, r_temp_1, r_temp_2, r_temp_3);
+ __ compiler_fast_unlock_object(CR0, r_oop, r_box, r_temp_1, r_temp_2, r_temp_3);
}
- __ beq(CCR0, done);
+ __ beq(CR0, done);
// Save and restore any potential method result value around the unlocking operation.
save_native_result(masm, ret_type, workspace_slot_offset);
@@ -2694,8 +2693,8 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
// Check for pending exceptions.
// --------------------------------------------------------------------------
__ ld(r_temp_2, thread_(pending_exception));
- __ cmpdi(CCR0, r_temp_2, 0);
- __ bne(CCR0, handle_pending_exception);
+ __ cmpdi(CR0, r_temp_2, 0);
+ __ bne(CR0, handle_pending_exception);
// Return
// --------------------------------------------------------------------------
@@ -2852,7 +2851,7 @@ static void push_skeleton_frames(MacroAssembler* masm, bool deopt,
#ifdef ASSERT
// Make sure that there is at least one entry in the array.
- __ cmpdi(CCR0, number_of_frames_reg, 0);
+ __ cmpdi(CR0, number_of_frames_reg, 0);
__ asm_assert_ne("array_size must be > 0");
#endif
@@ -2867,8 +2866,8 @@ static void push_skeleton_frames(MacroAssembler* masm, bool deopt,
pcs_reg,
frame_size_reg,
pc_reg);
- __ cmpdi(CCR0, number_of_frames_reg, 0);
- __ bne(CCR0, loop);
+ __ cmpdi(CR0, number_of_frames_reg, 0);
+ __ bne(CR0, loop);
// Get the return address pointing into the frame manager.
__ ld(R0, 0, pcs_reg);
@@ -3015,8 +3014,8 @@ void SharedRuntime::generate_deopt_blob() {
// stored in the thread during exception entry above. The exception
// oop will be the return value of this stub.
Label skip_restore_excp;
- __ cmpdi(CCR0, exec_mode_reg, Deoptimization::Unpack_exception);
- __ bne(CCR0, skip_restore_excp);
+ __ cmpdi(CR0, exec_mode_reg, Deoptimization::Unpack_exception);
+ __ bne(CR0, skip_restore_excp);
__ ld(R3_RET, in_bytes(JavaThread::exception_oop_offset()), R16_thread);
__ ld(R4_ARG2, in_bytes(JavaThread::exception_pc_offset()), R16_thread);
__ li(R0, 0);
@@ -3166,7 +3165,7 @@ void OptoRuntime::generate_uncommon_trap_blob() {
#ifdef ASSERT
__ lwz(R22_tmp2, in_bytes(Deoptimization::UnrollBlock::unpack_kind_offset()), unroll_block_reg);
- __ cmpdi(CCR0, R22_tmp2, (unsigned)Deoptimization::Unpack_uncommon_trap);
+ __ cmpdi(CR0, R22_tmp2, (unsigned)Deoptimization::Unpack_uncommon_trap);
__ asm_assert_eq("OptoRuntime::generate_uncommon_trap_blob: expected Unpack_uncommon_trap");
#endif
@@ -3296,8 +3295,8 @@ SafepointBlob* SharedRuntime::generate_handler_blob(SharedStubId id, address cal
BLOCK_COMMENT(" Check pending exception.");
const Register pending_exception = R0;
__ ld(pending_exception, thread_(pending_exception));
- __ cmpdi(CCR0, pending_exception, 0);
- __ beq(CCR0, noException);
+ __ cmpdi(CR0, pending_exception, 0);
+ __ beq(CR0, noException);
// Exception pending
RegisterSaver::restore_live_registers_and_pop_frame(masm,
@@ -3316,8 +3315,8 @@ SafepointBlob* SharedRuntime::generate_handler_blob(SharedStubId id, address cal
Label no_adjust;
// If our stashed return pc was modified by the runtime we avoid touching it
__ ld(R0, frame_size_in_bytes + _abi0(lr), R1_SP);
- __ cmpd(CCR0, R0, R31);
- __ bne(CCR0, no_adjust);
+ __ cmpd(CR0, R0, R31);
+ __ bne(CR0, no_adjust);
// Adjust return pc forward to step over the safepoint poll instruction
__ addi(R31, R31, 4);
@@ -3396,8 +3395,8 @@ RuntimeStub* SharedRuntime::generate_resolve_blob(SharedStubId id, address desti
BLOCK_COMMENT("Check for pending exceptions.");
Label pending;
__ ld(R11_scratch1, thread_(pending_exception));
- __ cmpdi(CCR0, R11_scratch1, 0);
- __ bne(CCR0, pending);
+ __ cmpdi(CR0, R11_scratch1, 0);
+ __ bne(CR0, pending);
__ mtctr(R3_RET); // Ctr will not be touched by restore_live_registers_and_pop_frame.
@@ -3500,8 +3499,8 @@ RuntimeStub* SharedRuntime::generate_throw_exception(SharedStubId id, address ru
__ ld(R0,
in_bytes(Thread::pending_exception_offset()),
R16_thread);
- __ cmpdi(CCR0, R0, 0);
- __ bne(CCR0, L);
+ __ cmpdi(CR0, R0, 0);
+ __ bne(CR0, L);
__ stop("SharedRuntime::throw_exception: no pending exception");
__ bind(L);
}
diff --git a/src/hotspot/cpu/ppc/stubDeclarations_ppc.hpp b/src/hotspot/cpu/ppc/stubDeclarations_ppc.hpp
new file mode 100644
index 0000000000000..1a19f1b8cf280
--- /dev/null
+++ b/src/hotspot/cpu/ppc/stubDeclarations_ppc.hpp
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2025, Red Hat, Inc. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef CPU_PPC_STUBDECLARATIONS_HPP
+#define CPU_PPC_STUBDECLARATIONS_HPP
+
+#define STUBGEN_INITIAL_BLOBS_ARCH_DO(do_stub, \
+ do_arch_blob, \
+ do_arch_entry, \
+ do_arch_entry_init) \
+ do_arch_blob(initial, 20000) \
+
+
+#define STUBGEN_CONTINUATION_BLOBS_ARCH_DO(do_stub, \
+ do_arch_blob, \
+ do_arch_entry, \
+ do_arch_entry_init) \
+ do_arch_blob(continuation, 2000) \
+
+
+#define STUBGEN_COMPILER_BLOBS_ARCH_DO(do_stub, \
+ do_arch_blob, \
+ do_arch_entry, \
+ do_arch_entry_init) \
+ do_arch_blob(compiler, 24000) \
+
+
+#define STUBGEN_FINAL_BLOBS_ARCH_DO(do_stub, \
+ do_arch_blob, \
+ do_arch_entry, \
+ do_arch_entry_init) \
+ do_arch_blob(final, 24000) \
+
+
+#endif // CPU_PPC_STUBDECLARATIONS_HPP
diff --git a/src/hotspot/cpu/ppc/stubGenerator_ppc.cpp b/src/hotspot/cpu/ppc/stubGenerator_ppc.cpp
index f1168b5d07bf2..1749447d43bec 100644
--- a/src/hotspot/cpu/ppc/stubGenerator_ppc.cpp
+++ b/src/hotspot/cpu/ppc/stubGenerator_ppc.cpp
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2024 SAP SE. All rights reserved.
+ * Copyright (c) 1997, 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 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "compiler/oopMap.hpp"
#include "gc/shared/barrierSet.hpp"
@@ -90,7 +89,8 @@ class StubGenerator: public StubCodeGenerator {
// Setup a new c frame, copy java arguments, call frame manager or
// native_entry, and process result.
- StubCodeMark mark(this, "StubRoutines", "call_stub");
+ StubGenStubId stub_id = StubGenStubId::call_stub_id;
+ StubCodeMark mark(this, stub_id);
address start = __ function_entry();
@@ -195,8 +195,8 @@ class StubGenerator: public StubCodeGenerator {
r_top_of_arguments_addr, r_frame_alignment_in_bytes);
// any arguments to copy?
- __ cmpdi(CCR0, r_arg_argument_count, 0);
- __ beq(CCR0, arguments_copied);
+ __ cmpdi(CR0, r_arg_argument_count, 0);
+ __ beq(CR0, arguments_copied);
// prepare loop and copy arguments in reverse order
{
@@ -335,10 +335,10 @@ class StubGenerator: public StubCodeGenerator {
// Store result depending on type. Everything that is not
// T_OBJECT, T_LONG, T_FLOAT, or T_DOUBLE is treated as T_INT.
- __ cmpwi(CCR0, r_arg_result_type, T_OBJECT);
- __ cmpwi(CCR1, r_arg_result_type, T_LONG);
- __ cmpwi(CCR5, r_arg_result_type, T_FLOAT);
- __ cmpwi(CCR6, r_arg_result_type, T_DOUBLE);
+ __ cmpwi(CR0, r_arg_result_type, T_OBJECT);
+ __ cmpwi(CR1, r_arg_result_type, T_LONG);
+ __ cmpwi(CR5, r_arg_result_type, T_FLOAT);
+ __ cmpwi(CR6, r_arg_result_type, T_DOUBLE);
// restore non-volatile registers
__ restore_nonvolatile_gprs(R1_SP, _spill_nonvolatiles_neg(r14));
@@ -354,10 +354,10 @@ class StubGenerator: public StubCodeGenerator {
// All non-volatiles have been restored at this point!!
assert(R3_RET == R3, "R3_RET should be R3");
- __ beq(CCR0, ret_is_object);
- __ beq(CCR1, ret_is_long);
- __ beq(CCR5, ret_is_float);
- __ beq(CCR6, ret_is_double);
+ __ beq(CR0, ret_is_object);
+ __ beq(CR1, ret_is_long);
+ __ beq(CR5, ret_is_float);
+ __ beq(CR6, ret_is_double);
// default:
__ stw(R3_RET, 0, r_arg_result_addr);
@@ -393,7 +393,8 @@ class StubGenerator: public StubCodeGenerator {
// within the VM.
//
address generate_catch_exception() {
- StubCodeMark mark(this, "StubRoutines", "catch_exception");
+ StubGenStubId stub_id = StubGenStubId::catch_exception_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
@@ -448,7 +449,8 @@ class StubGenerator: public StubCodeGenerator {
// (LR is unchanged and is live out).
//
address generate_forward_exception() {
- StubCodeMark mark(this, "StubRoutines", "forward_exception");
+ StubGenStubId stub_id = StubGenStubId::forward_exception_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
if (VerifyOops) {
@@ -459,8 +461,8 @@ class StubGenerator: public StubCodeGenerator {
// Make sure that this code is only executed if there is a pending exception.
{
Label L;
- __ cmpdi(CCR0, R3_ARG1, 0);
- __ bne(CCR0, L);
+ __ cmpdi(CR0, R3_ARG1, 0);
+ __ bne(CR0, L);
__ stop("StubRoutines::forward exception: no pending exception (1)");
__ bind(L);
}
@@ -497,8 +499,8 @@ class StubGenerator: public StubCodeGenerator {
// Make sure exception is set.
{
Label L;
- __ cmpdi(CCR0, R3_ARG1, 0);
- __ bne(CCR0, L);
+ __ cmpdi(CR0, R3_ARG1, 0);
+ __ bne(CR0, L);
__ stop("StubRoutines::forward exception: no pending exception (2)");
__ bind(L);
}
@@ -518,93 +520,6 @@ class StubGenerator: public StubCodeGenerator {
#undef __
#define __ _masm->
-
- // Support for void zero_words_aligned8(HeapWord* to, size_t count)
- //
- // Arguments:
- // to:
- // count:
- //
- // Destroys:
- //
- address generate_zero_words_aligned8() {
- StubCodeMark mark(this, "StubRoutines", "zero_words_aligned8");
-
- // Implemented as in ClearArray.
- address start = __ function_entry();
-
- Register base_ptr_reg = R3_ARG1; // tohw (needs to be 8b aligned)
- Register cnt_dwords_reg = R4_ARG2; // count (in dwords)
- Register tmp1_reg = R5_ARG3;
- Register tmp2_reg = R6_ARG4;
- Register zero_reg = R7_ARG5;
-
- // Procedure for large arrays (uses data cache block zero instruction).
- Label dwloop, fast, fastloop, restloop, lastdword, done;
- int cl_size = VM_Version::L1_data_cache_line_size();
- int cl_dwords = cl_size >> 3;
- int cl_dwordaddr_bits = exact_log2(cl_dwords);
- int min_dcbz = 2; // Needs to be positive, apply dcbz only to at least min_dcbz cache lines.
-
- // Clear up to 128byte boundary if long enough, dword_cnt=(16-(base>>3))%16.
- __ dcbtst(base_ptr_reg); // Indicate write access to first cache line ...
- __ andi(tmp2_reg, cnt_dwords_reg, 1); // to check if number of dwords is even.
- __ srdi_(tmp1_reg, cnt_dwords_reg, 1); // number of double dwords
- __ load_const_optimized(zero_reg, 0L); // Use as zero register.
-
- __ cmpdi(CCR1, tmp2_reg, 0); // cnt_dwords even?
- __ beq(CCR0, lastdword); // size <= 1
- __ mtctr(tmp1_reg); // Speculatively preload counter for rest loop (>0).
- __ cmpdi(CCR0, cnt_dwords_reg, (min_dcbz+1)*cl_dwords-1); // Big enough to ensure >=min_dcbz cache lines are included?
- __ neg(tmp1_reg, base_ptr_reg); // bit 0..58: bogus, bit 57..60: (16-(base>>3))%16, bit 61..63: 000
-
- __ blt(CCR0, restloop); // Too small. (<31=(2*cl_dwords)-1 is sufficient, but bigger performs better.)
- __ rldicl_(tmp1_reg, tmp1_reg, 64-3, 64-cl_dwordaddr_bits); // Extract number of dwords to 128byte boundary=(16-(base>>3))%16.
-
- __ beq(CCR0, fast); // already 128byte aligned
- __ mtctr(tmp1_reg); // Set ctr to hit 128byte boundary (00 since size>=256-8)
-
- // Clear in first cache line dword-by-dword if not already 128byte aligned.
- __ bind(dwloop);
- __ std(zero_reg, 0, base_ptr_reg); // Clear 8byte aligned block.
- __ addi(base_ptr_reg, base_ptr_reg, 8);
- __ bdnz(dwloop);
-
- // clear 128byte blocks
- __ bind(fast);
- __ srdi(tmp1_reg, cnt_dwords_reg, cl_dwordaddr_bits); // loop count for 128byte loop (>0 since size>=256-8)
- __ andi(tmp2_reg, cnt_dwords_reg, 1); // to check if rest even
-
- __ mtctr(tmp1_reg); // load counter
- __ cmpdi(CCR1, tmp2_reg, 0); // rest even?
- __ rldicl_(tmp1_reg, cnt_dwords_reg, 63, 65-cl_dwordaddr_bits); // rest in double dwords
-
- __ bind(fastloop);
- __ dcbz(base_ptr_reg); // Clear 128byte aligned block.
- __ addi(base_ptr_reg, base_ptr_reg, cl_size);
- __ bdnz(fastloop);
-
- //__ dcbtst(base_ptr_reg); // Indicate write access to last cache line.
- __ beq(CCR0, lastdword); // rest<=1
- __ mtctr(tmp1_reg); // load counter
-
- // Clear rest.
- __ bind(restloop);
- __ std(zero_reg, 0, base_ptr_reg); // Clear 8byte aligned block.
- __ std(zero_reg, 8, base_ptr_reg); // Clear 8byte aligned block.
- __ addi(base_ptr_reg, base_ptr_reg, 16);
- __ bdnz(restloop);
-
- __ bind(lastdword);
- __ beq(CCR1, done);
- __ std(zero_reg, 0, base_ptr_reg);
- __ bind(done);
- __ blr(); // return
-
- return start;
- }
-
#if !defined(PRODUCT)
// Wrapper which calls oopDesc::is_oop_or_null()
// Only called by MacroAssembler::verify_oop
@@ -648,8 +563,40 @@ class StubGenerator: public StubCodeGenerator {
// value: R4_ARG2
// count: R5_ARG3 treated as signed
//
- address generate_fill(BasicType t, bool aligned, const char* name) {
- StubCodeMark mark(this, "StubRoutines", name);
+ address generate_fill(StubGenStubId stub_id) {
+ BasicType t;
+ bool aligned;
+
+ switch (stub_id) {
+ case jbyte_fill_id:
+ t = T_BYTE;
+ aligned = false;
+ break;
+ case jshort_fill_id:
+ t = T_SHORT;
+ aligned = false;
+ break;
+ case jint_fill_id:
+ t = T_INT;
+ aligned = false;
+ break;
+ case arrayof_jbyte_fill_id:
+ t = T_BYTE;
+ aligned = true;
+ break;
+ case arrayof_jshort_fill_id:
+ t = T_SHORT;
+ aligned = true;
+ break;
+ case arrayof_jint_fill_id:
+ t = T_INT;
+ aligned = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+
+ StubCodeMark mark(this, stub_id);
address start = __ function_entry();
const Register to = R3_ARG1; // source array address
@@ -668,21 +615,21 @@ class StubGenerator: public StubCodeGenerator {
shift = 2;
// Clone bytes (zero extend not needed because store instructions below ignore high order bytes).
__ rldimi(value, value, 8, 48); // 8 bit -> 16 bit
- __ cmpdi(CCR0, count, 2< 32 bit
break;
case T_SHORT:
shift = 1;
// Clone bytes (zero extend not needed because store instructions below ignore high order bytes).
__ rldimi(value, value, 16, 32); // 16 bit -> 32 bit
- __ cmpdi(CCR0, count, 2< to or from is aligned -> copy 8
+ __ bne(CR0, l_7); // not same alignment -> to or from is aligned -> copy 8
// copy a 2-element word if necessary to align to 8 bytes
__ andi_(R0, R3_ARG1, 7);
- __ beq(CCR0, l_7);
+ __ beq(CR0, l_7);
__ lwzx(tmp2, R3_ARG1, tmp3);
__ addi(R5_ARG3, R5_ARG3, -4);
@@ -958,8 +917,8 @@ class StubGenerator: public StubCodeGenerator {
__ bind(l_7);
{ // FasterArrayCopy
- __ cmpwi(CCR0, R5_ARG3, 31);
- __ ble(CCR0, l_6); // copy 2 at a time if less than 32 elements remain
+ __ cmpwi(CR0, R5_ARG3, 31);
+ __ ble(CR0, l_6); // copy 2 at a time if less than 32 elements remain
__ srdi(tmp1, R5_ARG3, 5);
__ andi_(R5_ARG3, R5_ARG3, 31);
@@ -1024,8 +983,8 @@ class StubGenerator: public StubCodeGenerator {
__ bind(l_6);
// copy 4 elements at a time
- __ cmpwi(CCR0, R5_ARG3, 4);
- __ blt(CCR0, l_1);
+ __ cmpwi(CR0, R5_ARG3, 4);
+ __ blt(CR0, l_1);
__ srdi(tmp1, R5_ARG3, 2);
__ mtctr(tmp1); // is > 0
__ andi_(R5_ARG3, R5_ARG3, 3);
@@ -1043,8 +1002,8 @@ class StubGenerator: public StubCodeGenerator {
// do single element copy
__ bind(l_1);
- __ cmpwi(CCR0, R5_ARG3, 0);
- __ beq(CCR0, l_4);
+ __ cmpwi(CR0, R5_ARG3, 0);
+ __ beq(CR0, l_4);
{ // FasterArrayCopy
__ mtctr(R5_ARG3);
@@ -1073,8 +1032,20 @@ class StubGenerator: public StubCodeGenerator {
// to: R4_ARG2
// count: R5_ARG3 treated as signed
//
- address generate_conjoint_byte_copy(bool aligned, const char * name) {
- StubCodeMark mark(this, "StubRoutines", name);
+ address generate_conjoint_byte_copy(StubGenStubId stub_id) {
+ bool aligned;
+ switch (stub_id) {
+ case jbyte_arraycopy_id:
+ aligned = false;
+ break;
+ case arrayof_jbyte_arraycopy_id:
+ aligned = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+
+ StubCodeMark mark(this, stub_id);
address start = __ function_entry();
assert_positive_int(R5_ARG3);
@@ -1099,7 +1070,7 @@ class StubGenerator: public StubCodeGenerator {
__ bind(l_2);
__ addic_(R5_ARG3, R5_ARG3, -1);
__ lbzx(tmp1, R3_ARG1, R5_ARG3);
- __ bge(CCR0, l_1);
+ __ bge(CR0, l_1);
}
__ li(R3_RET, 0); // return 0
__ blr();
@@ -1162,8 +1133,20 @@ class StubGenerator: public StubCodeGenerator {
//
// 1. check if aligning the backbranch target of loops is beneficial
//
- address generate_disjoint_short_copy(bool aligned, const char * name) {
- StubCodeMark mark(this, "StubRoutines", name);
+ address generate_disjoint_short_copy(StubGenStubId stub_id) {
+ bool aligned;
+ switch (stub_id) {
+ case jshort_disjoint_arraycopy_id:
+ aligned = false;
+ break;
+ case arrayof_jshort_disjoint_arraycopy_id:
+ aligned = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+
+ StubCodeMark mark(this, stub_id);
Register tmp1 = R6_ARG4;
Register tmp2 = R7_ARG5;
@@ -1182,19 +1165,19 @@ class StubGenerator: public StubCodeGenerator {
UnsafeMemoryAccessMark umam(this, !aligned, false);
// don't try anything fancy if arrays don't have many elements
__ li(tmp3, 0);
- __ cmpwi(CCR0, R5_ARG3, 9);
- __ ble(CCR0, l_6); // copy 2 at a time
+ __ cmpwi(CR0, R5_ARG3, 9);
+ __ ble(CR0, l_6); // copy 2 at a time
if (!aligned) {
__ xorr(tmp1, R3_ARG1, R4_ARG2);
__ andi_(tmp1, tmp1, 3);
- __ bne(CCR0, l_6); // if arrays don't have the same alignment mod 4, do 2 element copy
+ __ bne(CR0, l_6); // if arrays don't have the same alignment mod 4, do 2 element copy
// At this point it is guaranteed that both, from and to have the same alignment mod 4.
// Copy 1 element if necessary to align to 4 bytes.
__ andi_(tmp1, R3_ARG1, 3);
- __ beq(CCR0, l_2);
+ __ beq(CR0, l_2);
__ lhz(tmp2, 0, R3_ARG1);
__ addi(R3_ARG1, R3_ARG1, 2);
@@ -1209,11 +1192,11 @@ class StubGenerator: public StubCodeGenerator {
// Align to 8 bytes, but only if both, from and to, have same alignment mod 8.
__ xorr(tmp2, R3_ARG1, R4_ARG2);
__ andi_(tmp1, tmp2, 7);
- __ bne(CCR0, l_7); // not same alignment mod 8 -> copy 4, either from or to will be unaligned
+ __ bne(CR0, l_7); // not same alignment mod 8 -> copy 4, either from or to will be unaligned
// Copy a 2-element word if necessary to align to 8 bytes.
__ andi_(R0, R3_ARG1, 7);
- __ beq(CCR0, l_7);
+ __ beq(CR0, l_7);
__ lwzx(tmp2, R3_ARG1, tmp3);
__ addi(R5_ARG3, R5_ARG3, -2);
@@ -1230,8 +1213,8 @@ class StubGenerator: public StubCodeGenerator {
// be unaligned if aligned == false.
{ // FasterArrayCopy
- __ cmpwi(CCR0, R5_ARG3, 15);
- __ ble(CCR0, l_6); // copy 2 at a time if less than 16 elements remain
+ __ cmpwi(CR0, R5_ARG3, 15);
+ __ ble(CR0, l_6); // copy 2 at a time if less than 16 elements remain
__ srdi(tmp1, R5_ARG3, 4);
__ andi_(R5_ARG3, R5_ARG3, 15);
@@ -1295,8 +1278,8 @@ class StubGenerator: public StubCodeGenerator {
// copy 2 elements at a time
{ // FasterArrayCopy
- __ cmpwi(CCR0, R5_ARG3, 2);
- __ blt(CCR0, l_1);
+ __ cmpwi(CR0, R5_ARG3, 2);
+ __ blt(CR0, l_1);
__ srdi(tmp1, R5_ARG3, 1);
__ andi_(R5_ARG3, R5_ARG3, 1);
@@ -1315,8 +1298,8 @@ class StubGenerator: public StubCodeGenerator {
// do single element copy
__ bind(l_1);
- __ cmpwi(CCR0, R5_ARG3, 0);
- __ beq(CCR0, l_4);
+ __ cmpwi(CR0, R5_ARG3, 0);
+ __ beq(CR0, l_4);
{ // FasterArrayCopy
__ mtctr(R5_ARG3);
@@ -1345,8 +1328,20 @@ class StubGenerator: public StubCodeGenerator {
// to: R4_ARG2
// count: R5_ARG3 treated as signed
//
- address generate_conjoint_short_copy(bool aligned, const char * name) {
- StubCodeMark mark(this, "StubRoutines", name);
+ address generate_conjoint_short_copy(StubGenStubId stub_id) {
+ bool aligned;
+ switch (stub_id) {
+ case jshort_arraycopy_id:
+ aligned = false;
+ break;
+ case arrayof_jshort_arraycopy_id:
+ aligned = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+
+ StubCodeMark mark(this, stub_id);
address start = __ function_entry();
assert_positive_int(R5_ARG3);
@@ -1371,7 +1366,7 @@ class StubGenerator: public StubCodeGenerator {
__ bind(l_2);
__ addic_(tmp1, tmp1, -2);
__ lhzx(tmp2, R3_ARG1, tmp1);
- __ bge(CCR0, l_1);
+ __ bge(CR0, l_1);
}
__ li(R3_RET, 0); // return 0
__ blr();
@@ -1400,19 +1395,19 @@ class StubGenerator: public StubCodeGenerator {
// for short arrays, just do single element copy
__ li(tmp3, 0);
- __ cmpwi(CCR0, R5_ARG3, 5);
- __ ble(CCR0, l_2);
+ __ cmpwi(CR0, R5_ARG3, 5);
+ __ ble(CR0, l_2);
if (!aligned) {
// check if arrays have same alignment mod 8.
__ xorr(tmp1, R3_ARG1, R4_ARG2);
__ andi_(R0, tmp1, 7);
// Not the same alignment, but ld and std just need to be 4 byte aligned.
- __ bne(CCR0, l_4); // to OR from is 8 byte aligned -> copy 2 at a time
+ __ bne(CR0, l_4); // to OR from is 8 byte aligned -> copy 2 at a time
// copy 1 element to align to and from on an 8 byte boundary
__ andi_(R0, R3_ARG1, 7);
- __ beq(CCR0, l_4);
+ __ beq(CR0, l_4);
__ lwzx(tmp2, R3_ARG1, tmp3);
__ addi(R5_ARG3, R5_ARG3, -1);
@@ -1425,8 +1420,8 @@ class StubGenerator: public StubCodeGenerator {
}
{ // FasterArrayCopy
- __ cmpwi(CCR0, R5_ARG3, 7);
- __ ble(CCR0, l_2); // copy 1 at a time if less than 8 elements remain
+ __ cmpwi(CR0, R5_ARG3, 7);
+ __ ble(CR0, l_2); // copy 1 at a time if less than 8 elements remain
__ srdi(tmp1, R5_ARG3, 3);
__ andi_(R5_ARG3, R5_ARG3, 7);
@@ -1490,8 +1485,8 @@ class StubGenerator: public StubCodeGenerator {
// copy 1 element at a time
__ bind(l_2);
- __ cmpwi(CCR0, R5_ARG3, 0);
- __ beq(CCR0, l_1);
+ __ cmpwi(CR0, R5_ARG3, 0);
+ __ beq(CR0, l_1);
{ // FasterArrayCopy
__ mtctr(R5_ARG3);
@@ -1516,8 +1511,20 @@ class StubGenerator: public StubCodeGenerator {
// to: R4_ARG2
// count: R5_ARG3 treated as signed
//
- address generate_disjoint_int_copy(bool aligned, const char * name) {
- StubCodeMark mark(this, "StubRoutines", name);
+ address generate_disjoint_int_copy(StubGenStubId stub_id) {
+ bool aligned;
+ switch (stub_id) {
+ case jint_disjoint_arraycopy_id:
+ aligned = false;
+ break;
+ case arrayof_jint_disjoint_arraycopy_id:
+ aligned = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+
+ StubCodeMark mark(this, stub_id);
address start = __ function_entry();
assert_positive_int(R5_ARG3);
{
@@ -1554,8 +1561,8 @@ class StubGenerator: public StubCodeGenerator {
VectorSRegister tmp_vsr2 = VSR2;
{ // FasterArrayCopy
- __ cmpwi(CCR0, R5_ARG3, 0);
- __ beq(CCR0, l_6);
+ __ cmpwi(CR0, R5_ARG3, 0);
+ __ beq(CR0, l_6);
__ sldi(R5_ARG3, R5_ARG3, 2);
__ add(R3_ARG1, R3_ARG1, R5_ARG3);
@@ -1567,11 +1574,11 @@ class StubGenerator: public StubCodeGenerator {
__ xorr(tmp1, R3_ARG1, R4_ARG2);
__ andi_(R0, tmp1, 7);
// Not the same alignment, but ld and std just need to be 4 byte aligned.
- __ bne(CCR0, l_7); // to OR from is 8 byte aligned -> copy 2 at a time
+ __ bne(CR0, l_7); // to OR from is 8 byte aligned -> copy 2 at a time
// copy 1 element to align to and from on an 8 byte boundary
__ andi_(R0, R3_ARG1, 7);
- __ beq(CCR0, l_7);
+ __ beq(CR0, l_7);
__ addi(R3_ARG1, R3_ARG1, -4);
__ addi(R4_ARG2, R4_ARG2, -4);
@@ -1581,8 +1588,8 @@ class StubGenerator: public StubCodeGenerator {
__ bind(l_7);
}
- __ cmpwi(CCR0, R5_ARG3, 7);
- __ ble(CCR0, l_5); // copy 1 at a time if less than 8 elements remain
+ __ cmpwi(CR0, R5_ARG3, 7);
+ __ ble(CR0, l_5); // copy 1 at a time if less than 8 elements remain
__ srdi(tmp1, R5_ARG3, 3);
__ andi(R5_ARG3, R5_ARG3, 7);
@@ -1639,8 +1646,8 @@ class StubGenerator: public StubCodeGenerator {
}
}
- __ cmpwi(CCR0, R5_ARG3, 0);
- __ beq(CCR0, l_6);
+ __ cmpwi(CR0, R5_ARG3, 0);
+ __ beq(CR0, l_6);
__ bind(l_5);
__ mtctr(R5_ARG3);
@@ -1663,8 +1670,20 @@ class StubGenerator: public StubCodeGenerator {
// to: R4_ARG2
// count: R5_ARG3 treated as signed
//
- address generate_conjoint_int_copy(bool aligned, const char * name) {
- StubCodeMark mark(this, "StubRoutines", name);
+ address generate_conjoint_int_copy(StubGenStubId stub_id) {
+ bool aligned;
+ switch (stub_id) {
+ case jint_arraycopy_id:
+ aligned = false;
+ break;
+ case arrayof_jint_arraycopy_id:
+ aligned = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+
+ StubCodeMark mark(this, stub_id);
address start = __ function_entry();
assert_positive_int(R5_ARG3);
address nooverlap_target = aligned ?
@@ -1705,8 +1724,8 @@ class StubGenerator: public StubCodeGenerator {
VectorSRegister tmp_vsr2 = VSR2;
{ // FasterArrayCopy
- __ cmpwi(CCR0, R5_ARG3, 3);
- __ ble(CCR0, l_3); // copy 1 at a time if less than 4 elements remain
+ __ cmpwi(CR0, R5_ARG3, 3);
+ __ ble(CR0, l_3); // copy 1 at a time if less than 4 elements remain
__ srdi(tmp1, R5_ARG3, 2);
__ andi_(R5_ARG3, R5_ARG3, 3);
@@ -1769,8 +1788,8 @@ class StubGenerator: public StubCodeGenerator {
// copy 1 element at a time
__ bind(l_3);
- __ cmpwi(CCR0, R5_ARG3, 0);
- __ beq(CCR0, l_1);
+ __ cmpwi(CR0, R5_ARG3, 0);
+ __ beq(CR0, l_1);
{ // FasterArrayCopy
__ mtctr(R5_ARG3);
@@ -1794,8 +1813,20 @@ class StubGenerator: public StubCodeGenerator {
// to: R4_ARG2
// count: R5_ARG3 treated as signed
//
- address generate_disjoint_long_copy(bool aligned, const char * name) {
- StubCodeMark mark(this, "StubRoutines", name);
+ address generate_disjoint_long_copy(StubGenStubId stub_id) {
+ bool aligned;
+ switch (stub_id) {
+ case jlong_disjoint_arraycopy_id:
+ aligned = false;
+ break;
+ case arrayof_jlong_disjoint_arraycopy_id:
+ aligned = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+
+ StubCodeMark mark(this, stub_id);
address start = __ function_entry();
assert_positive_int(R5_ARG3);
{
@@ -1829,8 +1860,8 @@ class StubGenerator: public StubCodeGenerator {
Label l_1, l_2, l_3, l_4, l_5;
- __ cmpwi(CCR0, R5_ARG3, 0);
- __ beq(CCR0, l_1);
+ __ cmpwi(CR0, R5_ARG3, 0);
+ __ beq(CR0, l_1);
{ // FasterArrayCopy
__ sldi(R5_ARG3, R5_ARG3, 3);
@@ -1838,8 +1869,8 @@ class StubGenerator: public StubCodeGenerator {
__ add(R4_ARG2, R4_ARG2, R5_ARG3);
__ srdi(R5_ARG3, R5_ARG3, 3);
- __ cmpwi(CCR0, R5_ARG3, 3);
- __ ble(CCR0, l_5); // copy 1 at a time if less than 4 elements remain
+ __ cmpwi(CR0, R5_ARG3, 3);
+ __ ble(CR0, l_5); // copy 1 at a time if less than 4 elements remain
__ srdi(tmp1, R5_ARG3, 2);
__ andi(R5_ARG3, R5_ARG3, 3);
@@ -1896,8 +1927,8 @@ class StubGenerator: public StubCodeGenerator {
}
}
- __ cmpwi(CCR0, R5_ARG3, 0);
- __ beq(CCR0, l_1);
+ __ cmpwi(CR0, R5_ARG3, 0);
+ __ beq(CR0, l_1);
__ bind(l_5);
__ mtctr(R5_ARG3);
@@ -1920,8 +1951,20 @@ class StubGenerator: public StubCodeGenerator {
// to: R4_ARG2
// count: R5_ARG3 treated as signed
//
- address generate_conjoint_long_copy(bool aligned, const char * name) {
- StubCodeMark mark(this, "StubRoutines", name);
+ address generate_conjoint_long_copy(StubGenStubId stub_id) {
+ bool aligned;
+ switch (stub_id) {
+ case jlong_arraycopy_id:
+ aligned = false;
+ break;
+ case arrayof_jlong_arraycopy_id:
+ aligned = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+
+ StubCodeMark mark(this, stub_id);
address start = __ function_entry();
assert_positive_int(R5_ARG3);
address nooverlap_target = aligned ?
@@ -1949,9 +1992,31 @@ class StubGenerator: public StubCodeGenerator {
// count: R5_ARG3 treated as signed
// dest_uninitialized: G1 support
//
- address generate_conjoint_oop_copy(bool aligned, const char * name, bool dest_uninitialized) {
- StubCodeMark mark(this, "StubRoutines", name);
+ address generate_conjoint_oop_copy(StubGenStubId stub_id) {
+ bool aligned;
+ bool dest_uninitialized;
+ switch (stub_id) {
+ case oop_arraycopy_id:
+ aligned = false;
+ dest_uninitialized = false;
+ break;
+ case arrayof_oop_arraycopy_id:
+ aligned = true;
+ dest_uninitialized = false;
+ break;
+ case oop_arraycopy_uninit_id:
+ aligned = false;
+ dest_uninitialized = true;
+ break;
+ case arrayof_oop_arraycopy_uninit_id:
+ aligned = true;
+ dest_uninitialized = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+ StubCodeMark mark(this, stub_id);
address start = __ function_entry();
assert_positive_int(R5_ARG3);
address nooverlap_target = aligned ?
@@ -1998,8 +2063,31 @@ class StubGenerator: public StubCodeGenerator {
// count: R5_ARG3 treated as signed
// dest_uninitialized: G1 support
//
- address generate_disjoint_oop_copy(bool aligned, const char * name, bool dest_uninitialized) {
- StubCodeMark mark(this, "StubRoutines", name);
+ address generate_disjoint_oop_copy(StubGenStubId stub_id) {
+ bool aligned;
+ bool dest_uninitialized;
+ switch (stub_id) {
+ case oop_disjoint_arraycopy_id:
+ aligned = false;
+ dest_uninitialized = false;
+ break;
+ case arrayof_oop_disjoint_arraycopy_id:
+ aligned = true;
+ dest_uninitialized = false;
+ break;
+ case oop_disjoint_arraycopy_uninit_id:
+ aligned = false;
+ dest_uninitialized = true;
+ break;
+ case arrayof_oop_disjoint_arraycopy_uninit_id:
+ aligned = true;
+ dest_uninitialized = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+
+ StubCodeMark mark(this, stub_id);
address start = __ function_entry();
assert_positive_int(R5_ARG3);
@@ -2039,7 +2127,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 +2136,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);
@@ -2066,8 +2155,7 @@ class StubGenerator: public StubCodeGenerator {
// ckval: R7 (super_klass)
// ret: R3 zero for success; (-1^K) where K is partial transfer count
//
- address generate_checkcast_copy(const char *name, bool dest_uninitialized) {
-
+ address generate_checkcast_copy(StubGenStubId stub_id) {
const Register R3_from = R3_ARG1; // source array address
const Register R4_to = R4_ARG2; // destination array address
const Register R5_count = R5_ARG3; // elements count
@@ -2079,11 +2167,21 @@ 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_tmp = R2;
- const Register R2_minus1 = R2;
-
+ bool dest_uninitialized;
+ switch (stub_id) {
+ case checkcast_arraycopy_id:
+ dest_uninitialized = false;
+ break;
+ case checkcast_arraycopy_uninit_id:
+ dest_uninitialized = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
//__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ function_entry();
// Assert that int is 64 bit sign extended and arrays are not conjoint.
@@ -2094,12 +2192,12 @@ class StubGenerator: public StubCodeGenerator {
Label no_overlap;
__ subf(tmp1, R3_ARG1, R4_ARG2); // distance in bytes
__ sldi(tmp2, R5_ARG3, LogBytesPerHeapOop); // size in bytes
- __ cmpld(CCR0, R3_ARG1, R4_ARG2); // Use unsigned comparison!
- __ cmpld(CCR1, tmp1, tmp2);
- __ crnand(CCR0, Assembler::less, CCR1, Assembler::less);
+ __ cmpld(CR0, R3_ARG1, R4_ARG2); // Use unsigned comparison!
+ __ cmpld(CR1, tmp1, tmp2);
+ __ crnand(CR0, Assembler::less, CR1, Assembler::less);
// Overlaps if Src before dst and distance smaller than size.
// Branch to forward copy routine otherwise.
- __ blt(CCR0, no_overlap);
+ __ blt(CR0, no_overlap);
__ stop("overlap in checkcast_copy");
__ bind(no_overlap);
}
@@ -2118,8 +2216,7 @@ 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);
+ __ bne(CR0, load_element);
// Empty array: Nothing to do.
__ li(R3_RET, 0); // Return 0 on (trivial) success.
@@ -2146,8 +2243,8 @@ class StubGenerator: public StubCodeGenerator {
}
__ addi(R8_offset, R8_offset, heapOopSize); // Step to next offset.
- __ add_(R9_remain, R2_minus1, R9_remain); // Decrement the count.
- __ beq(CCR0, success);
+ __ addic_(R9_remain, R9_remain, -1); // Decrement the count.
+ __ beq(CR0, success);
// ======== loop entry is here ========
__ bind(load_element);
@@ -2166,7 +2263,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 ========
@@ -2177,7 +2274,7 @@ class StubGenerator: public StubCodeGenerator {
// and report their number to the caller.
__ subf_(R5_count, R9_remain, R5_count);
__ nand(R3_RET, R5_count, R5_count); // report (-1^K) to caller
- __ bne(CCR0, do_epilogue);
+ __ bne(CR0, do_epilogue);
__ blr();
__ bind(success);
@@ -2203,8 +2300,7 @@ class StubGenerator: public StubCodeGenerator {
// Examines the alignment of the operands and dispatches
// to a long, int, short, or byte copy loop.
//
- address generate_unsafe_copy(const char* name,
- address byte_copy_entry,
+ address generate_unsafe_copy(address byte_copy_entry,
address short_copy_entry,
address int_copy_entry,
address long_copy_entry) {
@@ -2217,7 +2313,8 @@ class StubGenerator: public StubCodeGenerator {
const Register R7_tmp = R7_ARG5;
//__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubGenStubId stub_id = StubGenStubId::unsafe_arraycopy_id;
+ StubCodeMark mark(this, stub_id);
address start = __ function_entry();
// Bump this on entry, not on exit:
@@ -2228,13 +2325,13 @@ class StubGenerator: public StubCodeGenerator {
__ orr(R6_bits, R3_from, R4_to);
__ orr(R6_bits, R6_bits, R5_count);
__ andi_(R0, R6_bits, (BytesPerLong-1));
- __ beq(CCR0, long_copy);
+ __ beq(CR0, long_copy);
__ andi_(R0, R6_bits, (BytesPerInt-1));
- __ beq(CCR0, int_copy);
+ __ beq(CR0, int_copy);
__ andi_(R0, R6_bits, (BytesPerShort-1));
- __ beq(CCR0, short_copy);
+ __ beq(CR0, short_copy);
// byte_copy:
__ b(byte_copy_entry);
@@ -2273,14 +2370,14 @@ class StubGenerator: public StubCodeGenerator {
// if (src_pos + length > arrayOop(src)->length() ) FAIL;
__ lwa(array_length, arrayOopDesc::length_offset_in_bytes(), src);
__ add(end_pos, src_pos, length); // src_pos + length
- __ cmpd(CCR0, end_pos, array_length);
- __ bgt(CCR0, L_failed);
+ __ cmpd(CR0, end_pos, array_length);
+ __ bgt(CR0, L_failed);
// if (dst_pos + length > arrayOop(dst)->length() ) FAIL;
__ lwa(array_length, arrayOopDesc::length_offset_in_bytes(), dst);
__ add(end_pos, dst_pos, length); // src_pos + length
- __ cmpd(CCR0, end_pos, array_length);
- __ bgt(CCR0, L_failed);
+ __ cmpd(CR0, end_pos, array_length);
+ __ bgt(CR0, L_failed);
BLOCK_COMMENT("arraycopy_range_checks done");
}
@@ -2300,8 +2397,7 @@ class StubGenerator: public StubCodeGenerator {
// R3 == 0 - success
// R3 == -1 - need to call System.arraycopy
//
- address generate_generic_copy(const char *name,
- address entry_jbyte_arraycopy,
+ address generate_generic_copy(address entry_jbyte_arraycopy,
address entry_jshort_arraycopy,
address entry_jint_arraycopy,
address entry_oop_arraycopy,
@@ -2324,7 +2420,8 @@ class StubGenerator: public StubCodeGenerator {
const Register temp = R2;
//__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubGenStubId stub_id = StubGenStubId::generic_arraycopy_id;
+ StubCodeMark mark(this, stub_id);
address start = __ function_entry();
// Bump this on entry, not on exit:
@@ -2346,16 +2443,16 @@ class StubGenerator: public StubCodeGenerator {
// (8) dst_pos + length must not exceed length of dst.
BLOCK_COMMENT("arraycopy initial argument checks");
- __ cmpdi(CCR1, src, 0); // if (src == nullptr) return -1;
+ __ cmpdi(CR1, src, 0); // if (src == nullptr) return -1;
__ extsw_(src_pos, src_pos); // if (src_pos < 0) return -1;
- __ cmpdi(CCR5, dst, 0); // if (dst == nullptr) return -1;
- __ cror(CCR1, Assembler::equal, CCR0, Assembler::less);
+ __ cmpdi(CR5, dst, 0); // if (dst == nullptr) return -1;
+ __ cror(CR1, Assembler::equal, CR0, Assembler::less);
__ extsw_(dst_pos, dst_pos); // if (src_pos < 0) return -1;
- __ cror(CCR5, Assembler::equal, CCR0, Assembler::less);
+ __ cror(CR5, Assembler::equal, CR0, Assembler::less);
__ extsw_(length, length); // if (length < 0) return -1;
- __ cror(CCR1, Assembler::equal, CCR5, Assembler::equal);
- __ cror(CCR1, Assembler::equal, CCR0, Assembler::less);
- __ beq(CCR1, L_failed);
+ __ cror(CR1, Assembler::equal, CR5, Assembler::equal);
+ __ cror(CR1, Assembler::equal, CR0, Assembler::less);
+ __ beq(CR1, L_failed);
BLOCK_COMMENT("arraycopy argument klass checks");
__ load_klass(src_klass, src);
@@ -2377,22 +2474,22 @@ class StubGenerator: public StubCodeGenerator {
// Handle objArrays completely differently...
jint objArray_lh = Klass::array_layout_helper(T_OBJECT);
__ load_const_optimized(temp, objArray_lh, R0);
- __ cmpw(CCR0, lh, temp);
- __ beq(CCR0, L_objArray);
+ __ cmpw(CR0, lh, temp);
+ __ beq(CR0, L_objArray);
- __ cmpd(CCR5, src_klass, dst_klass); // if (src->klass() != dst->klass()) return -1;
- __ cmpwi(CCR6, lh, Klass::_lh_neutral_value); // if (!src->is_Array()) return -1;
+ __ cmpd(CR5, src_klass, dst_klass); // if (src->klass() != dst->klass()) return -1;
+ __ cmpwi(CR6, lh, Klass::_lh_neutral_value); // if (!src->is_Array()) return -1;
- __ crnand(CCR5, Assembler::equal, CCR6, Assembler::less);
- __ beq(CCR5, L_failed);
+ __ crnand(CR5, Assembler::equal, CR6, Assembler::less);
+ __ beq(CR5, L_failed);
// At this point, it is known to be a typeArray (array_tag 0x3).
#ifdef ASSERT
{ Label L;
jint lh_prim_tag_in_place = (Klass::_lh_array_tag_type_value << Klass::_lh_array_tag_shift);
__ load_const_optimized(temp, lh_prim_tag_in_place, R0);
- __ cmpw(CCR0, lh, temp);
- __ bge(CCR0, L);
+ __ cmpw(CR0, lh, temp);
+ __ bge(CR0, L);
__ stop("must be a primitive array");
__ bind(L);
}
@@ -2432,17 +2529,17 @@ class StubGenerator: public StubCodeGenerator {
BLOCK_COMMENT("choose copy loop based on element size");
// Using conditional branches with range 32kB.
- const int bo = Assembler::bcondCRbiIs1, bi = Assembler::bi0(CCR0, Assembler::equal);
- __ cmpwi(CCR0, elsize, 0);
+ const int bo = Assembler::bcondCRbiIs1, bi = Assembler::bi0(CR0, Assembler::equal);
+ __ cmpwi(CR0, elsize, 0);
__ bc(bo, bi, entry_jbyte_arraycopy);
- __ cmpwi(CCR0, elsize, LogBytesPerShort);
+ __ cmpwi(CR0, elsize, LogBytesPerShort);
__ bc(bo, bi, entry_jshort_arraycopy);
- __ cmpwi(CCR0, elsize, LogBytesPerInt);
+ __ cmpwi(CR0, elsize, LogBytesPerInt);
__ bc(bo, bi, entry_jint_arraycopy);
#ifdef ASSERT
{ Label L;
- __ cmpwi(CCR0, elsize, LogBytesPerLong);
- __ beq(CCR0, L);
+ __ cmpwi(CR0, elsize, LogBytesPerLong);
+ __ beq(CR0, L);
__ stop("must be long copy, but elsize is wrong");
__ bind(L);
}
@@ -2455,8 +2552,8 @@ class StubGenerator: public StubCodeGenerator {
Label L_disjoint_plain_copy, L_checkcast_copy;
// test array classes for subtyping
- __ cmpd(CCR0, src_klass, dst_klass); // usual case is exact equality
- __ bne(CCR0, L_checkcast_copy);
+ __ cmpd(CR0, src_klass, dst_klass); // usual case is exact equality
+ __ bne(CR0, L_checkcast_copy);
// Identically typed arrays can be copied without element-wise checks.
arraycopy_range_checks(src, src_pos, dst, dst_pos, length,
@@ -2476,8 +2573,8 @@ class StubGenerator: public StubCodeGenerator {
{
// Before looking at dst.length, make sure dst is also an objArray.
__ lwz(temp, lh_offset, dst_klass);
- __ cmpw(CCR0, lh, temp);
- __ bne(CCR0, L_failed);
+ __ cmpw(CR0, lh, temp);
+ __ bne(CR0, L_failed);
// It is safe to examine both src.length and dst.length.
arraycopy_range_checks(src, src_pos, dst, dst_pos, length,
@@ -2500,7 +2597,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());
@@ -2526,7 +2623,8 @@ class StubGenerator: public StubCodeGenerator {
// R5_ARG3 - round key array
address generate_aescrypt_encryptBlock() {
assert(UseAES, "need AES instructions and misaligned SSE support");
- StubCodeMark mark(this, "StubRoutines", "aescrypt_encryptBlock");
+ StubGenStubId stub_id = StubGenStubId::aescrypt_encryptBlock_id;
+ StubCodeMark mark(this, stub_id);
address start = __ function_entry();
@@ -2654,8 +2752,8 @@ class StubGenerator: public StubCodeGenerator {
__ vec_perm (vKey2, vTmp1, keyPerm);
// if all round keys are loaded, skip next 4 rounds
- __ cmpwi (CCR0, keylen, 44);
- __ beq (CCR0, L_doLast);
+ __ cmpwi (CR0, keylen, 44);
+ __ beq (CR0, L_doLast);
// 10th - 11th rounds
__ vcipher (vRet, vRet, vKey1);
@@ -2672,12 +2770,12 @@ class StubGenerator: public StubCodeGenerator {
__ vec_perm (vKey2, vTmp1, keyPerm);
// if all round keys are loaded, skip next 2 rounds
- __ cmpwi (CCR0, keylen, 52);
- __ beq (CCR0, L_doLast);
+ __ cmpwi (CR0, keylen, 52);
+ __ beq (CR0, L_doLast);
#ifdef ASSERT
- __ cmpwi (CCR0, keylen, 60);
- __ bne (CCR0, L_error);
+ __ cmpwi (CR0, keylen, 60);
+ __ bne (CR0, L_error);
#endif
// 12th - 13th rounds
@@ -2733,7 +2831,8 @@ class StubGenerator: public StubCodeGenerator {
// R5_ARG3 - K (key) in little endian int array
address generate_aescrypt_decryptBlock() {
assert(UseAES, "need AES instructions and misaligned SSE support");
- StubCodeMark mark(this, "StubRoutines", "aescrypt_decryptBlock");
+ StubGenStubId stub_id = StubGenStubId::aescrypt_decryptBlock_id;
+ StubCodeMark mark(this, stub_id);
address start = __ function_entry();
@@ -2791,15 +2890,15 @@ class StubGenerator: public StubCodeGenerator {
__ vsldoi (keyPerm, keyPerm, keyPerm, 8);
#endif
- __ cmpwi (CCR0, keylen, 44);
- __ beq (CCR0, L_do44);
+ __ cmpwi (CR0, keylen, 44);
+ __ beq (CR0, L_do44);
- __ cmpwi (CCR0, keylen, 52);
- __ beq (CCR0, L_do52);
+ __ cmpwi (CR0, keylen, 52);
+ __ beq (CR0, L_do52);
#ifdef ASSERT
- __ cmpwi (CCR0, keylen, 60);
- __ bne (CCR0, L_error);
+ __ cmpwi (CR0, keylen, 60);
+ __ bne (CR0, L_error);
#endif
// load the 15th round key to vKey1
@@ -2970,9 +3069,20 @@ class StubGenerator: public StubCodeGenerator {
return start;
}
- address generate_sha256_implCompress(bool multi_block, const char *name) {
+ address generate_sha256_implCompress(StubGenStubId stub_id) {
assert(UseSHA, "need SHA instructions");
- StubCodeMark mark(this, "StubRoutines", name);
+ bool multi_block;
+ switch (stub_id) {
+ case sha256_implCompress_id:
+ multi_block = false;
+ break;
+ case sha256_implCompressMB_id:
+ multi_block = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+ StubCodeMark mark(this, stub_id);
address start = __ function_entry();
__ sha256 (multi_block);
@@ -2981,9 +3091,20 @@ class StubGenerator: public StubCodeGenerator {
return start;
}
- address generate_sha512_implCompress(bool multi_block, const char *name) {
+ address generate_sha512_implCompress(StubGenStubId stub_id) {
assert(UseSHA, "need SHA instructions");
- StubCodeMark mark(this, "StubRoutines", name);
+ bool multi_block;
+ switch (stub_id) {
+ case sha512_implCompress_id:
+ multi_block = false;
+ break;
+ case sha512_implCompressMB_id:
+ multi_block = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+ StubCodeMark mark(this, stub_id);
address start = __ function_entry();
__ sha512 (multi_block);
@@ -2994,7 +3115,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_data_cache_writeback() {
const Register cacheline = R3_ARG1;
- StubCodeMark mark(this, "StubRoutines", "_data_cache_writeback");
+ StubGenStubId stub_id = StubGenStubId::data_cache_writeback_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ cache_wb(Address(cacheline));
@@ -3007,12 +3129,12 @@ class StubGenerator: public StubCodeGenerator {
const Register is_presync = R3_ARG1;
Register temp = R4;
Label SKIP;
-
- StubCodeMark mark(this, "StubRoutines", "_data_cache_writeback_sync");
+ StubGenStubId stub_id = StubGenStubId::data_cache_writeback_sync_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ andi_(temp, is_presync, 1);
- __ bne(CCR0, SKIP);
+ __ bne(CR0, SKIP);
__ cache_wbsync(false); // post sync => emit 'sync'
__ bind(SKIP); // pre sync => emit nothing
__ blr();
@@ -3028,48 +3150,46 @@ class StubGenerator: public StubCodeGenerator {
UnsafeMemoryAccess::set_common_exit_stub_pc(ucm_common_error_exit);
// non-aligned disjoint versions
- StubRoutines::_jbyte_disjoint_arraycopy = generate_disjoint_byte_copy(false, "jbyte_disjoint_arraycopy");
- StubRoutines::_jshort_disjoint_arraycopy = generate_disjoint_short_copy(false, "jshort_disjoint_arraycopy");
- StubRoutines::_jint_disjoint_arraycopy = generate_disjoint_int_copy(false, "jint_disjoint_arraycopy");
- StubRoutines::_jlong_disjoint_arraycopy = generate_disjoint_long_copy(false, "jlong_disjoint_arraycopy");
- StubRoutines::_oop_disjoint_arraycopy = generate_disjoint_oop_copy(false, "oop_disjoint_arraycopy", false);
- StubRoutines::_oop_disjoint_arraycopy_uninit = generate_disjoint_oop_copy(false, "oop_disjoint_arraycopy_uninit", true);
+ StubRoutines::_jbyte_disjoint_arraycopy = generate_disjoint_byte_copy(StubGenStubId::jbyte_disjoint_arraycopy_id);
+ StubRoutines::_jshort_disjoint_arraycopy = generate_disjoint_short_copy(StubGenStubId::jshort_disjoint_arraycopy_id);
+ StubRoutines::_jint_disjoint_arraycopy = generate_disjoint_int_copy(StubGenStubId::jint_disjoint_arraycopy_id);
+ StubRoutines::_jlong_disjoint_arraycopy = generate_disjoint_long_copy(StubGenStubId::jlong_disjoint_arraycopy_id);
+ StubRoutines::_oop_disjoint_arraycopy = generate_disjoint_oop_copy(StubGenStubId::oop_disjoint_arraycopy_id);
+ StubRoutines::_oop_disjoint_arraycopy_uninit = generate_disjoint_oop_copy(StubGenStubId::oop_disjoint_arraycopy_uninit_id);
// aligned disjoint versions
- StubRoutines::_arrayof_jbyte_disjoint_arraycopy = generate_disjoint_byte_copy(true, "arrayof_jbyte_disjoint_arraycopy");
- StubRoutines::_arrayof_jshort_disjoint_arraycopy = generate_disjoint_short_copy(true, "arrayof_jshort_disjoint_arraycopy");
- StubRoutines::_arrayof_jint_disjoint_arraycopy = generate_disjoint_int_copy(true, "arrayof_jint_disjoint_arraycopy");
- StubRoutines::_arrayof_jlong_disjoint_arraycopy = generate_disjoint_long_copy(true, "arrayof_jlong_disjoint_arraycopy");
- StubRoutines::_arrayof_oop_disjoint_arraycopy = generate_disjoint_oop_copy(true, "arrayof_oop_disjoint_arraycopy", false);
- StubRoutines::_arrayof_oop_disjoint_arraycopy_uninit = generate_disjoint_oop_copy(true, "oop_disjoint_arraycopy_uninit", true);
+ StubRoutines::_arrayof_jbyte_disjoint_arraycopy = generate_disjoint_byte_copy(StubGenStubId::arrayof_jbyte_disjoint_arraycopy_id);
+ StubRoutines::_arrayof_jshort_disjoint_arraycopy = generate_disjoint_short_copy(StubGenStubId::arrayof_jshort_disjoint_arraycopy_id);
+ StubRoutines::_arrayof_jint_disjoint_arraycopy = generate_disjoint_int_copy(StubGenStubId::arrayof_jint_disjoint_arraycopy_id);
+ StubRoutines::_arrayof_jlong_disjoint_arraycopy = generate_disjoint_long_copy(StubGenStubId::arrayof_jlong_disjoint_arraycopy_id);
+ StubRoutines::_arrayof_oop_disjoint_arraycopy = generate_disjoint_oop_copy(StubGenStubId::arrayof_oop_disjoint_arraycopy_id);
+ StubRoutines::_arrayof_oop_disjoint_arraycopy_uninit = generate_disjoint_oop_copy(StubGenStubId::oop_disjoint_arraycopy_uninit_id);
// non-aligned conjoint versions
- StubRoutines::_jbyte_arraycopy = generate_conjoint_byte_copy(false, "jbyte_arraycopy");
- StubRoutines::_jshort_arraycopy = generate_conjoint_short_copy(false, "jshort_arraycopy");
- StubRoutines::_jint_arraycopy = generate_conjoint_int_copy(false, "jint_arraycopy");
- StubRoutines::_jlong_arraycopy = generate_conjoint_long_copy(false, "jlong_arraycopy");
- StubRoutines::_oop_arraycopy = generate_conjoint_oop_copy(false, "oop_arraycopy", false);
- StubRoutines::_oop_arraycopy_uninit = generate_conjoint_oop_copy(false, "oop_arraycopy_uninit", true);
+ StubRoutines::_jbyte_arraycopy = generate_conjoint_byte_copy(StubGenStubId::jbyte_arraycopy_id);
+ StubRoutines::_jshort_arraycopy = generate_conjoint_short_copy(StubGenStubId::jshort_arraycopy_id);
+ StubRoutines::_jint_arraycopy = generate_conjoint_int_copy(StubGenStubId::jint_arraycopy_id);
+ StubRoutines::_jlong_arraycopy = generate_conjoint_long_copy(StubGenStubId::jlong_arraycopy_id);
+ StubRoutines::_oop_arraycopy = generate_conjoint_oop_copy(StubGenStubId::oop_arraycopy_id);
+ StubRoutines::_oop_arraycopy_uninit = generate_conjoint_oop_copy(StubGenStubId::oop_arraycopy_uninit_id);
// aligned conjoint versions
- StubRoutines::_arrayof_jbyte_arraycopy = generate_conjoint_byte_copy(true, "arrayof_jbyte_arraycopy");
- StubRoutines::_arrayof_jshort_arraycopy = generate_conjoint_short_copy(true, "arrayof_jshort_arraycopy");
- StubRoutines::_arrayof_jint_arraycopy = generate_conjoint_int_copy(true, "arrayof_jint_arraycopy");
- StubRoutines::_arrayof_jlong_arraycopy = generate_conjoint_long_copy(true, "arrayof_jlong_arraycopy");
- StubRoutines::_arrayof_oop_arraycopy = generate_conjoint_oop_copy(true, "arrayof_oop_arraycopy", false);
- StubRoutines::_arrayof_oop_arraycopy_uninit = generate_conjoint_oop_copy(true, "arrayof_oop_arraycopy", true);
+ StubRoutines::_arrayof_jbyte_arraycopy = generate_conjoint_byte_copy(StubGenStubId::arrayof_jbyte_arraycopy_id);
+ StubRoutines::_arrayof_jshort_arraycopy = generate_conjoint_short_copy(StubGenStubId::arrayof_jshort_arraycopy_id);
+ StubRoutines::_arrayof_jint_arraycopy = generate_conjoint_int_copy(StubGenStubId::arrayof_jint_arraycopy_id);
+ StubRoutines::_arrayof_jlong_arraycopy = generate_conjoint_long_copy(StubGenStubId::arrayof_jlong_arraycopy_id);
+ StubRoutines::_arrayof_oop_arraycopy = generate_conjoint_oop_copy(StubGenStubId::arrayof_oop_arraycopy_id);
+ StubRoutines::_arrayof_oop_arraycopy_uninit = generate_conjoint_oop_copy(StubGenStubId::arrayof_oop_arraycopy_id);
// special/generic versions
- StubRoutines::_checkcast_arraycopy = generate_checkcast_copy("checkcast_arraycopy", false);
- StubRoutines::_checkcast_arraycopy_uninit = generate_checkcast_copy("checkcast_arraycopy_uninit", true);
+ StubRoutines::_checkcast_arraycopy = generate_checkcast_copy(StubGenStubId::checkcast_arraycopy_id);
+ StubRoutines::_checkcast_arraycopy_uninit = generate_checkcast_copy(StubGenStubId::checkcast_arraycopy_uninit_id);
- StubRoutines::_unsafe_arraycopy = generate_unsafe_copy("unsafe_arraycopy",
- STUB_ENTRY(jbyte_arraycopy()),
+ StubRoutines::_unsafe_arraycopy = generate_unsafe_copy(STUB_ENTRY(jbyte_arraycopy()),
STUB_ENTRY(jshort_arraycopy()),
STUB_ENTRY(jint_arraycopy()),
STUB_ENTRY(jlong_arraycopy()));
- StubRoutines::_generic_arraycopy = generate_generic_copy("generic_arraycopy",
- STUB_ENTRY(jbyte_arraycopy()),
+ StubRoutines::_generic_arraycopy = generate_generic_copy(STUB_ENTRY(jbyte_arraycopy()),
STUB_ENTRY(jshort_arraycopy()),
STUB_ENTRY(jint_arraycopy()),
STUB_ENTRY(oop_arraycopy()),
@@ -3080,12 +3200,12 @@ class StubGenerator: public StubCodeGenerator {
// fill routines
#ifdef COMPILER2
if (OptimizeFill) {
- StubRoutines::_jbyte_fill = generate_fill(T_BYTE, false, "jbyte_fill");
- StubRoutines::_jshort_fill = generate_fill(T_SHORT, false, "jshort_fill");
- StubRoutines::_jint_fill = generate_fill(T_INT, false, "jint_fill");
- StubRoutines::_arrayof_jbyte_fill = generate_fill(T_BYTE, true, "arrayof_jbyte_fill");
- StubRoutines::_arrayof_jshort_fill = generate_fill(T_SHORT, true, "arrayof_jshort_fill");
- StubRoutines::_arrayof_jint_fill = generate_fill(T_INT, true, "arrayof_jint_fill");
+ StubRoutines::_jbyte_fill = generate_fill(StubGenStubId::jbyte_fill_id);
+ StubRoutines::_jshort_fill = generate_fill(StubGenStubId::jshort_fill_id);
+ StubRoutines::_jint_fill = generate_fill(StubGenStubId::jint_fill_id);
+ StubRoutines::_arrayof_jbyte_fill = generate_fill(StubGenStubId::arrayof_jbyte_fill_id);
+ StubRoutines::_arrayof_jshort_fill = generate_fill(StubGenStubId::arrayof_jshort_fill_id);
+ StubRoutines::_arrayof_jint_fill = generate_fill(StubGenStubId::arrayof_jint_fill_id);
}
#endif
}
@@ -3103,7 +3223,8 @@ class StubGenerator: public StubCodeGenerator {
//
address generate_multiplyToLen() {
- StubCodeMark mark(this, "StubRoutines", "multiplyToLen");
+ StubGenStubId stub_id = StubGenStubId::multiplyToLen_id;
+ StubCodeMark mark(this, stub_id);
address start = __ function_entry();
@@ -3179,7 +3300,8 @@ class StubGenerator: public StubCodeGenerator {
*/
address generate_mulAdd() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "mulAdd");
+ StubGenStubId stub_id = StubGenStubId::mulAdd_id;
+ StubCodeMark mark(this, stub_id);
address start = __ function_entry();
@@ -3209,7 +3331,8 @@ class StubGenerator: public StubCodeGenerator {
*/
address generate_squareToLen() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "squareToLen");
+ StubGenStubId stub_id = StubGenStubId::squareToLen_id;
+ StubCodeMark mark(this, stub_id);
address start = __ function_entry();
@@ -3269,10 +3392,10 @@ class StubGenerator: public StubCodeGenerator {
// Store the squares, right shifted one bit (i.e., divided by 2)
__ subi (out_aux, out, 8);
__ subi (in_aux, in, 4);
- __ cmpwi (CCR0, in_len, 0);
+ __ cmpwi (CR0, in_len, 0);
// Initialize lplw outside of the loop
__ xorr (lplw, lplw, lplw);
- __ ble (CCR0, SKIP_LOOP_SQUARE); // in_len <= 0
+ __ ble (CR0, SKIP_LOOP_SQUARE); // in_len <= 0
__ mtctr (in_len);
__ bind(LOOP_SQUARE);
@@ -3295,8 +3418,8 @@ class StubGenerator: public StubCodeGenerator {
__ bind(SKIP_LOOP_SQUARE);
// Add in off-diagonal sums
- __ cmpwi (CCR0, in_len, 0);
- __ ble (CCR0, SKIP_DIAGONAL_SUM);
+ __ cmpwi (CR0, in_len, 0);
+ __ ble (CR0, SKIP_DIAGONAL_SUM);
// Avoid CTR usage here in order to use it at mulAdd
__ subi (i_minus1, in_len, 1);
__ li (offset, 4);
@@ -3327,25 +3450,25 @@ class StubGenerator: public StubCodeGenerator {
// if (((uint64_t)s >> 32) != 0) {
__ srdi_ (a, b, 32);
- __ beq (CCR0, SKIP_ADDONE);
+ __ beq (CR0, SKIP_ADDONE);
// while (--mlen >= 0) {
__ bind(LOOP_ADDONE);
__ subi (mlen, mlen, 4);
- __ cmpwi (CCR0, mlen, 0);
- __ beq (CCR0, SKIP_ADDONE);
+ __ cmpwi (CR0, mlen, 0);
+ __ beq (CR0, SKIP_ADDONE);
// if (--offset_aux < 0) { // Carry out of number
__ subi (off_aux, off_aux, 4);
- __ cmpwi (CCR0, off_aux, 0);
- __ blt (CCR0, SKIP_ADDONE);
+ __ cmpwi (CR0, off_aux, 0);
+ __ blt (CR0, SKIP_ADDONE);
// } else {
__ lwzx (b, off_aux, out);
__ addi (b, b, 1);
__ stwx (b, off_aux, out);
- __ cmpwi (CCR0, b, 0);
- __ bne (CCR0, SKIP_ADDONE);
+ __ cmpwi (CR0, b, 0);
+ __ bne (CR0, SKIP_ADDONE);
__ b (LOOP_ADDONE);
__ bind(SKIP_ADDONE);
@@ -3353,16 +3476,16 @@ class StubGenerator: public StubCodeGenerator {
__ addi (offset, offset, 8);
__ subi (i_minus1, i_minus1, 1);
- __ cmpwi (CCR0, i_minus1, 0);
- __ bge (CCR0, LOOP_DIAGONAL_SUM);
+ __ cmpwi (CR0, i_minus1, 0);
+ __ bge (CR0, LOOP_DIAGONAL_SUM);
__ bind(SKIP_DIAGONAL_SUM);
// Shift back up and set low bit
// Shifts 1 bit left up to len positions. Assumes no leading zeros
// begin
- __ cmpwi (CCR0, out_len, 0);
- __ ble (CCR0, SKIP_LSHIFT);
+ __ cmpwi (CR0, out_len, 0);
+ __ ble (CR0, SKIP_LSHIFT);
__ li (i, 0);
__ lwz (c, 0, out);
__ subi (b, out_len, 1);
@@ -3442,9 +3565,20 @@ class StubGenerator: public StubCodeGenerator {
* R3_RET - int crc result
*/
// Compute CRC32 function.
- address generate_CRC32_updateBytes(bool is_crc32c) {
+ address generate_CRC32_updateBytes(StubGenStubId stub_id) {
+ bool is_crc32c;
+ switch (stub_id) {
+ case updateBytesCRC32_id:
+ is_crc32c = false;
+ break;
+ case updateBytesCRC32C_id:
+ is_crc32c = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", is_crc32c ? "CRC32C_updateBytes" : "CRC32_updateBytes");
+ StubCodeMark mark(this, stub_id);
address start = __ function_entry(); // Remember stub start address (is rtn value).
__ crc32(R3_ARG1, R4_ARG2, R5_ARG3, R2, R6, R7, R8, R9, R10, R11, R12, is_crc32c);
__ blr();
@@ -3471,7 +3605,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_method_entry_barrier() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "nmethod_entry_barrier");
+ StubGenStubId stub_id = StubGenStubId::method_entry_barrier_id;
+ StubCodeMark mark(this, stub_id);
address stub_address = __ pc();
@@ -3495,10 +3630,10 @@ class StubGenerator: public StubCodeGenerator {
__ restore_LR(R3_RET /* used as tmp register */);
__ restore_volatile_gprs(R1_SP, -nbytes_save, true);
- __ cmpdi(CCR0, R0, 0);
+ __ cmpdi(CR0, R0, 0);
// Return to prologue if no deoptimization is required (bnelr)
- __ bclr(Assembler::bcondCRbiIs1, Assembler::bi0(CCR0, Assembler::equal), Assembler::bhintIsTaken);
+ __ bclr(Assembler::bcondCRbiIs1, Assembler::bi0(CR0, Assembler::equal), Assembler::bhintIsTaken);
// Deoptimization required.
// For actually handling the deoptimization, the 'wrong method stub' is invoked.
@@ -3568,7 +3703,8 @@ class StubGenerator: public StubCodeGenerator {
// Base64 decodeBlock intrinsic
address generate_base64_decodeBlock() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "base64_decodeBlock");
+ StubGenStubId stub_id = StubGenStubId::base64_decodeBlock_id;
+ StubCodeMark mark(this, stub_id);
address start = __ function_entry();
typedef struct {
@@ -3779,7 +3915,7 @@ class StubGenerator: public StubCodeGenerator {
// = sl >> block_size_shift. After the shift, if sl <= 0, there's too
// little data to be processed by this intrinsic.
__ srawi_(sl, sl, block_size_shift);
- __ ble(CCR0, return_zero);
+ __ ble(CR0, return_zero);
__ mtctr(sl);
// Clear the other two parameter registers upper 32 bits.
@@ -3818,8 +3954,8 @@ class StubGenerator: public StubCodeGenerator {
// The rest of the constants use different values depending on the
// setting of isURL
- __ cmpwi(CCR0, isURL, 0);
- __ beq(CCR0, not_URL);
+ __ cmpwi(CR0, isURL, 0);
+ __ beq(CR0, not_URL);
// isURL != 0 (true)
if (PowerArchitecturePPC64 >= 10) {
@@ -3909,11 +4045,11 @@ class StubGenerator: public StubCodeGenerator {
//
__ vcmpequb_(non_match, non_match, vec_0s);
}
- // vmcmpequb_ sets the EQ bit of CCR6 if no elements compare equal.
+ // vmcmpequb_ sets the EQ bit of CR6 if no elements compare equal.
// Any element comparing equal to zero means there is an error in
// that element. Note that the comparison result register
- // non_match is not referenced again. Only CCR6-EQ matters.
- __ bne_predict_not_taken(CCR6, loop_exit);
+ // non_match is not referenced again. Only CR6-EQ matters.
+ __ bne_predict_not_taken(CR6, loop_exit);
// The Base64 characters had no errors, so add the offsets, which in
// the case of Power10 is a constant vector of all 0x80's (see earlier
@@ -4156,7 +4292,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_base64_encodeBlock() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "base64_encodeBlock");
+ StubGenStubId stub_id = StubGenStubId::base64_encodeBlock_id;
+ StubCodeMark mark(this, stub_id);
address start = __ function_entry();
typedef struct {
@@ -4313,8 +4450,8 @@ class StubGenerator: public StubCodeGenerator {
// Use a different translation lookup table depending on the
// setting of isURL
- __ cmpdi(CCR0, isURL, 0);
- __ beq(CCR0, not_URL);
+ __ cmpdi(CR0, isURL, 0);
+ __ beq(CR0, not_URL);
__ lxv(vec_base64_48_63->to_vsr(), BLK_OFFSETOF(base64_48_63_URL_val), const_ptr);
__ b(calculate_size);
@@ -4331,8 +4468,8 @@ class StubGenerator: public StubCodeGenerator {
//
__ sub(size, sl, sp);
__ subi(size, size, 4);
- __ cmpdi(CCR7, size, block_size);
- __ bgt(CCR7, calculate_blocked_size);
+ __ cmpdi(CR7, size, block_size);
+ __ bgt(CR7, calculate_blocked_size);
__ mr(remaining, size);
// Add the 4 back into remaining again
__ addi(remaining, remaining, 4);
@@ -4390,8 +4527,8 @@ class StubGenerator: public StubCodeGenerator {
__ addi(bytes_to_write, bytes_to_write, 2);
__ divwu(bytes_to_write, bytes_to_write, three);
- __ cmpwi(CCR7, bytes_to_write, 16);
- __ ble_predict_taken(CCR7, le_16_to_write);
+ __ cmpwi(CR7, bytes_to_write, 16);
+ __ ble_predict_taken(CR7, le_16_to_write);
__ stxv(expanded->to_vsr(), 0, out);
// We've processed 12 of the 13-15 data bytes, so advance the pointers,
@@ -4412,7 +4549,7 @@ class StubGenerator: public StubCodeGenerator {
__ add(out, out, bytes_to_write);
__ li(pad_char, '=');
- __ rlwinm_(modulo_chars, bytes_to_write, 0, 30, 31); // bytes_to_write % 4, set CCR0
+ __ rlwinm_(modulo_chars, bytes_to_write, 0, 30, 31); // bytes_to_write % 4, set CR0
// Examples:
// remaining bytes_to_write modulo_chars num pad chars
// 0 0 0 0
@@ -4426,9 +4563,9 @@ class StubGenerator: public StubCodeGenerator {
// 13 18 2 2
// 14 19 3 1
// 15 20 0 0
- __ beq(CCR0, no_pad);
- __ cmpwi(CCR7, modulo_chars, 3);
- __ beq(CCR7, one_pad_char);
+ __ beq(CR0, no_pad);
+ __ cmpwi(CR7, modulo_chars, 3);
+ __ beq(CR7, one_pad_char);
// two pad chars
__ stb(pad_char, out);
@@ -4445,10 +4582,10 @@ class StubGenerator: public StubCodeGenerator {
#endif // VM_LITTLE_ENDIAN
-address generate_lookup_secondary_supers_table_stub(u1 super_klass_index) {
- StubCodeMark mark(this, "StubRoutines", "lookup_secondary_supers_table");
+void generate_lookup_secondary_supers_table_stub() {
+ StubGenStubId stub_id = StubGenStubId::lookup_secondary_supers_table_id;
+ StubCodeMark mark(this, stub_id);
- address start = __ pc();
const Register
r_super_klass = R4_ARG2,
r_array_base = R3_ARG1,
@@ -4458,17 +4595,19 @@ 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);
- __ blr();
-
- return start;
+ for (int slot = 0; slot < Klass::SECONDARY_SUPERS_TABLE_SIZE; slot++) {
+ StubRoutines::_lookup_secondary_supers_table_stubs[slot] = __ pc();
+ __ lookup_secondary_supers_table_const(r_sub_klass, r_super_klass,
+ r_array_base, r_array_length, r_array_index,
+ r_bitmap, result, slot);
+ __ blr();
+ }
}
// Slow path implementation for UseSecondarySupersTable.
address generate_lookup_secondary_supers_table_slow_path_stub() {
- StubCodeMark mark(this, "StubRoutines", "lookup_secondary_supers_table_slow_path");
+ StubGenStubId stub_id = StubGenStubId::lookup_secondary_supers_table_slow_path_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
const Register
@@ -4485,13 +4624,33 @@ address generate_lookup_secondary_supers_table_stub(u1 super_klass_index) {
return start;
}
- address generate_cont_thaw(const char* label, Continuation::thaw_kind kind) {
+ address generate_cont_thaw(StubGenStubId stub_id) {
if (!Continuations::enabled()) return nullptr;
- bool return_barrier = Continuation::is_thaw_return_barrier(kind);
- bool return_barrier_exception = Continuation::is_thaw_return_barrier_exception(kind);
+ Continuation::thaw_kind kind;
+ bool return_barrier;
+ bool return_barrier_exception;
- StubCodeMark mark(this, "StubRoutines", label);
+ switch (stub_id) {
+ case cont_thaw_id:
+ kind = Continuation::thaw_top;
+ return_barrier = false;
+ return_barrier_exception = false;
+ break;
+ case cont_returnBarrier_id:
+ kind = Continuation::thaw_return_barrier;
+ return_barrier = true;
+ return_barrier_exception = false;
+ break;
+ case cont_returnBarrierExc_id:
+ kind = Continuation::thaw_return_barrier_exception;
+ return_barrier = true;
+ return_barrier_exception = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+ StubCodeMark mark(this, stub_id);
Register tmp1 = R10_ARG8;
Register tmp2 = R9_ARG7;
@@ -4511,13 +4670,13 @@ address generate_lookup_secondary_supers_table_stub(u1 super_klass_index) {
__ ld_ptr(R1_SP, JavaThread::cont_entry_offset(), R16_thread);
#ifdef ASSERT
__ ld_ptr(tmp2, _abi0(callers_sp), R1_SP);
- __ cmpd(CCR0, tmp1, tmp2);
+ __ cmpd(CR0, tmp1, tmp2);
__ asm_assert_eq(FILE_AND_LINE ": callers sp is corrupt");
#endif
}
#ifdef ASSERT
__ ld_ptr(tmp1, JavaThread::cont_entry_offset(), R16_thread);
- __ cmpd(CCR0, R1_SP, tmp1);
+ __ cmpd(CR0, R1_SP, tmp1);
__ asm_assert_eq(FILE_AND_LINE ": incorrect R1_SP");
#endif
@@ -4526,14 +4685,14 @@ address generate_lookup_secondary_supers_table_stub(u1 super_klass_index) {
#ifdef ASSERT
DEBUG_ONLY(__ ld_ptr(tmp1, JavaThread::cont_entry_offset(), R16_thread));
- DEBUG_ONLY(__ cmpd(CCR0, R1_SP, tmp1));
+ DEBUG_ONLY(__ cmpd(CR0, R1_SP, tmp1));
__ asm_assert_eq(FILE_AND_LINE ": incorrect R1_SP");
#endif
// R3_RET contains the size of the frames to thaw, 0 if overflow or no more frames
Label thaw_success;
- __ cmpdi(CCR0, R3_RET, 0);
- __ bne(CCR0, thaw_success);
+ __ cmpdi(CR0, R3_RET, 0);
+ __ bne(CR0, thaw_success);
__ load_const_optimized(tmp1, (SharedRuntime::throw_StackOverflowError_entry()), R0);
__ mtctr(tmp1); __ bctr();
__ bind(thaw_success);
@@ -4580,22 +4739,23 @@ address generate_lookup_secondary_supers_table_stub(u1 super_klass_index) {
}
address generate_cont_thaw() {
- return generate_cont_thaw("Cont thaw", Continuation::thaw_top);
+ return generate_cont_thaw(StubGenStubId::cont_thaw_id);
}
// TODO: will probably need multiple return barriers depending on return type
address generate_cont_returnBarrier() {
- return generate_cont_thaw("Cont thaw return barrier", Continuation::thaw_return_barrier);
+ return generate_cont_thaw(StubGenStubId::cont_returnBarrier_id);
}
address generate_cont_returnBarrier_exception() {
- return generate_cont_thaw("Cont thaw return barrier exception", Continuation::thaw_return_barrier_exception);
+ return generate_cont_thaw(StubGenStubId::cont_returnBarrierExc_id);
}
address generate_cont_preempt_stub() {
if (!Continuations::enabled()) return nullptr;
- StubCodeMark mark(this, "StubRoutines","Continuation preempt stub");
+ StubGenStubId stub_id = StubGenStubId::cont_preempt_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ clobber_nonvolatile_registers(); // Except R16_thread and R29_TOC
@@ -4607,8 +4767,8 @@ address generate_lookup_secondary_supers_table_stub(u1 super_klass_index) {
Label preemption_cancelled;
__ lbz(R11_scratch1, in_bytes(JavaThread::preemption_cancelled_offset()), R16_thread);
- __ cmpwi(CCR0, R11_scratch1, 0);
- __ bne(CCR0, preemption_cancelled);
+ __ cmpwi(CR0, R11_scratch1, 0);
+ __ bne(CR0, preemption_cancelled);
// Remove enterSpecial frame from the stack and return to Continuation.run() to unmount.
SharedRuntime::continuation_enter_cleanup(_masm);
@@ -4630,7 +4790,8 @@ address generate_lookup_secondary_supers_table_stub(u1 super_klass_index) {
// exception handler for upcall stubs
address generate_upcall_stub_exception_handler() {
- StubCodeMark mark(this, "StubRoutines", "upcall stub exception handler");
+ StubGenStubId stub_id = StubGenStubId::upcall_stub_exception_handler_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
// Native caller has no idea how to handle exceptions,
@@ -4648,7 +4809,8 @@ address generate_lookup_secondary_supers_table_stub(u1 super_klass_index) {
// R19_method = result Method*
address generate_upcall_stub_load_target() {
- StubCodeMark mark(this, "StubRoutines", "upcall_stub_load_target");
+ StubGenStubId stub_id = StubGenStubId::upcall_stub_load_target_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ resolve_global_jobject(R3_ARG1, R22_tmp2, R23_tmp3, MacroAssembler::PRESERVATION_FRAME_LR_GP_FP_REGS);
@@ -4688,13 +4850,13 @@ address generate_lookup_secondary_supers_table_stub(u1 super_klass_index) {
// CRC32 Intrinsics.
if (UseCRC32Intrinsics) {
StubRoutines::_crc_table_adr = StubRoutines::ppc::generate_crc_constants(REVERSE_CRC32_POLY);
- StubRoutines::_updateBytesCRC32 = generate_CRC32_updateBytes(false);
+ StubRoutines::_updateBytesCRC32 = generate_CRC32_updateBytes(StubGenStubId::updateBytesCRC32_id);
}
// CRC32C Intrinsics.
if (UseCRC32CIntrinsics) {
StubRoutines::_crc32c_table_addr = StubRoutines::ppc::generate_crc_constants(REVERSE_CRC32C_POLY);
- StubRoutines::_updateBytesCRC32C = generate_CRC32_updateBytes(true);
+ StubRoutines::_updateBytesCRC32C = generate_CRC32_updateBytes(StubGenStubId::updateBytesCRC32C_id);
}
if (VM_Version::supports_float16()) {
@@ -4727,15 +4889,14 @@ address generate_lookup_secondary_supers_table_stub(u1 super_klass_index) {
// arraycopy stubs used by compilers
generate_arraycopy_stubs();
+#ifdef COMPILER2
if (UseSecondarySupersTable) {
StubRoutines::_lookup_secondary_supers_table_slow_path_stub = generate_lookup_secondary_supers_table_slow_path_stub();
if (!InlineSecondarySupersTest) {
- for (int slot = 0; slot < Klass::SECONDARY_SUPERS_TABLE_SIZE; slot++) {
- StubRoutines::_lookup_secondary_supers_table_stubs[slot]
- = generate_lookup_secondary_supers_table_stub(slot);
- }
+ generate_lookup_secondary_supers_table_stub();
}
}
+#endif // COMPILER2
StubRoutines::_upcall_stub_exception_handler = generate_upcall_stub_exception_handler();
StubRoutines::_upcall_stub_load_target = generate_upcall_stub_load_target();
@@ -4776,12 +4937,12 @@ address generate_lookup_secondary_supers_table_stub(u1 super_klass_index) {
}
if (UseSHA256Intrinsics) {
- StubRoutines::_sha256_implCompress = generate_sha256_implCompress(false, "sha256_implCompress");
- StubRoutines::_sha256_implCompressMB = generate_sha256_implCompress(true, "sha256_implCompressMB");
+ StubRoutines::_sha256_implCompress = generate_sha256_implCompress(StubGenStubId::sha256_implCompress_id);
+ StubRoutines::_sha256_implCompressMB = generate_sha256_implCompress(StubGenStubId::sha256_implCompressMB_id);
}
if (UseSHA512Intrinsics) {
- StubRoutines::_sha512_implCompress = generate_sha512_implCompress(false, "sha512_implCompress");
- StubRoutines::_sha512_implCompressMB = generate_sha512_implCompress(true, "sha512_implCompressMB");
+ StubRoutines::_sha512_implCompress = generate_sha512_implCompress(StubGenStubId::sha512_implCompress_id);
+ StubRoutines::_sha512_implCompressMB = generate_sha512_implCompress(StubGenStubId::sha512_implCompressMB_id);
}
#ifdef VM_LITTLE_ENDIAN
@@ -4795,27 +4956,28 @@ address generate_lookup_secondary_supers_table_stub(u1 super_klass_index) {
}
public:
- StubGenerator(CodeBuffer* code, StubsKind kind) : StubCodeGenerator(code) {
- switch(kind) {
- case Initial_stubs:
+ StubGenerator(CodeBuffer* code, StubGenBlobId blob_id) : StubCodeGenerator(code, blob_id) {
+ switch(blob_id) {
+ case initial_id:
generate_initial_stubs();
break;
- case Continuation_stubs:
+ case continuation_id:
generate_continuation_stubs();
break;
- case Compiler_stubs:
+ case compiler_id:
generate_compiler_stubs();
break;
- case Final_stubs:
+ case final_id:
generate_final_stubs();
break;
default:
- fatal("unexpected stubs kind: %d", kind);
+ fatal("unexpected blob id: %d", blob_id);
break;
};
}
};
-void StubGenerator_generate(CodeBuffer* code, StubCodeGenerator::StubsKind kind) {
- StubGenerator g(code, kind);
+void StubGenerator_generate(CodeBuffer* code, StubGenBlobId blob_id) {
+ StubGenerator g(code, blob_id);
}
+
diff --git a/src/hotspot/cpu/ppc/stubRoutines_ppc.hpp b/src/hotspot/cpu/ppc/stubRoutines_ppc.hpp
index 4db0227e81b4e..a542d7947f85f 100644
--- a/src/hotspot/cpu/ppc/stubRoutines_ppc.hpp
+++ b/src/hotspot/cpu/ppc/stubRoutines_ppc.hpp
@@ -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.
*
@@ -32,14 +32,17 @@
static bool returns_to_call_stub(address return_pc) { return return_pc == _call_stub_return_address; }
+// emit enum used to size per-blob code buffers
+
+#define DEFINE_BLOB_SIZE(blob_name, size) \
+ _ ## blob_name ## _code_size = size,
+
enum platform_dependent_constants {
- // simply increase sizes if too small (assembler will crash if too small)
- _initial_stubs_code_size = 20000,
- _continuation_stubs_code_size = 2000,
- _compiler_stubs_code_size = 24000,
- _final_stubs_code_size = 24000
+ STUBGEN_ARCH_BLOBS_DO(DEFINE_BLOB_SIZE)
};
+#undef DEFINE_BLOB_SIZE
+
// CRC32 Intrinsics.
#define CRC32_TABLE_SIZE (4 * 256)
#define REVERSE_CRC32_POLY 0xEDB88320
diff --git a/src/hotspot/cpu/ppc/stubRoutines_ppc_64.cpp b/src/hotspot/cpu/ppc/stubRoutines_ppc_64.cpp
index 7df905b90682c..60cca4efb5771 100644
--- a/src/hotspot/cpu/ppc/stubRoutines_ppc_64.cpp
+++ b/src/hotspot/cpu/ppc/stubRoutines_ppc_64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2019 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "runtime/os.hpp"
#include "runtime/stubRoutines.hpp"
diff --git a/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp b/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp
index 9147dfc1677ab..544de15d3f24a 100644
--- a/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp
+++ b/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2015, 2024 SAP SE. All rights reserved.
+ * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "classfile/javaClasses.hpp"
#include "compiler/disassembler.hpp"
@@ -144,12 +143,12 @@ address TemplateInterpreterGenerator::generate_slow_signature_handler() {
// TODO PPC port: requires change in shared code.
//assert(in_bytes(AccessFlags::flags_offset()) == 0,
// "MethodDesc._access_flags == MethodDesc._access_flags._flags");
- // _access_flags must be a 32 bit value.
- assert(sizeof(AccessFlags) == 4, "wrong size");
- __ lwa(R11_scratch1/*access_flags*/, method_(access_flags));
+ // _access_flags must be a 16 bit value.
+ assert(sizeof(AccessFlags) == 2, "wrong size");
+ __ lhz(R11_scratch1/*access_flags*/, method_(access_flags));
// testbit with condition register.
- __ testbitdi(CCR0, R0, R11_scratch1/*access_flags*/, JVM_ACC_STATIC_BIT);
- __ btrue(CCR0, L);
+ __ testbitdi(CR0, R0, R11_scratch1/*access_flags*/, JVM_ACC_STATIC_BIT);
+ __ btrue(CR0, L);
// For non-static functions, pass "this" in R4_ARG2 and copy it
// to 2nd C-arg slot.
// We need to box the Java object here, so we use arg_java
@@ -176,8 +175,8 @@ address TemplateInterpreterGenerator::generate_slow_signature_handler() {
// signature points to '(' at entry
#ifdef ASSERT
__ lbz(sig_byte, 0, signature);
- __ cmplwi(CCR0, sig_byte, '(');
- __ bne(CCR0, do_dontreachhere);
+ __ cmplwi(CR0, sig_byte, '(');
+ __ bne(CR0, do_dontreachhere);
#endif
__ bind(loop_start);
@@ -185,41 +184,41 @@ address TemplateInterpreterGenerator::generate_slow_signature_handler() {
__ addi(argcnt, argcnt, 1);
__ lbzu(sig_byte, 1, signature);
- __ cmplwi(CCR0, sig_byte, ')'); // end of signature
- __ beq(CCR0, loop_end);
+ __ cmplwi(CR0, sig_byte, ')'); // end of signature
+ __ beq(CR0, loop_end);
- __ cmplwi(CCR0, sig_byte, 'B'); // byte
- __ beq(CCR0, do_int);
+ __ cmplwi(CR0, sig_byte, 'B'); // byte
+ __ beq(CR0, do_int);
- __ cmplwi(CCR0, sig_byte, 'C'); // char
- __ beq(CCR0, do_int);
+ __ cmplwi(CR0, sig_byte, 'C'); // char
+ __ beq(CR0, do_int);
- __ cmplwi(CCR0, sig_byte, 'D'); // double
- __ beq(CCR0, do_double);
+ __ cmplwi(CR0, sig_byte, 'D'); // double
+ __ beq(CR0, do_double);
- __ cmplwi(CCR0, sig_byte, 'F'); // float
- __ beq(CCR0, do_float);
+ __ cmplwi(CR0, sig_byte, 'F'); // float
+ __ beq(CR0, do_float);
- __ cmplwi(CCR0, sig_byte, 'I'); // int
- __ beq(CCR0, do_int);
+ __ cmplwi(CR0, sig_byte, 'I'); // int
+ __ beq(CR0, do_int);
- __ cmplwi(CCR0, sig_byte, 'J'); // long
- __ beq(CCR0, do_long);
+ __ cmplwi(CR0, sig_byte, 'J'); // long
+ __ beq(CR0, do_long);
- __ cmplwi(CCR0, sig_byte, 'S'); // short
- __ beq(CCR0, do_int);
+ __ cmplwi(CR0, sig_byte, 'S'); // short
+ __ beq(CR0, do_int);
- __ cmplwi(CCR0, sig_byte, 'Z'); // boolean
- __ beq(CCR0, do_int);
+ __ cmplwi(CR0, sig_byte, 'Z'); // boolean
+ __ beq(CR0, do_int);
- __ cmplwi(CCR0, sig_byte, 'L'); // object
- __ beq(CCR0, do_object);
+ __ cmplwi(CR0, sig_byte, 'L'); // object
+ __ beq(CR0, do_object);
- __ cmplwi(CCR0, sig_byte, '['); // array
- __ beq(CCR0, do_array);
+ __ cmplwi(CR0, sig_byte, '['); // array
+ __ beq(CR0, do_array);
- // __ cmplwi(CCR0, sig_byte, 'V'); // void cannot appear since we do not parse the return type
- // __ beq(CCR0, do_void);
+ // __ cmplwi(CR0, sig_byte, 'V'); // void cannot appear since we do not parse the return type
+ // __ beq(CR0, do_void);
__ bind(do_dontreachhere);
@@ -232,16 +231,16 @@ address TemplateInterpreterGenerator::generate_slow_signature_handler() {
__ bind(start_skip);
__ lbzu(sig_byte, 1, signature);
- __ cmplwi(CCR0, sig_byte, '[');
- __ beq(CCR0, start_skip); // skip further brackets
- __ cmplwi(CCR0, sig_byte, '9');
- __ bgt(CCR0, end_skip); // no optional size
- __ cmplwi(CCR0, sig_byte, '0');
- __ bge(CCR0, start_skip); // skip optional size
+ __ cmplwi(CR0, sig_byte, '[');
+ __ beq(CR0, start_skip); // skip further brackets
+ __ cmplwi(CR0, sig_byte, '9');
+ __ bgt(CR0, end_skip); // no optional size
+ __ cmplwi(CR0, sig_byte, '0');
+ __ bge(CR0, start_skip); // skip optional size
__ bind(end_skip);
- __ cmplwi(CCR0, sig_byte, 'L');
- __ beq(CCR0, do_object); // for arrays of objects, the name of the object must be skipped
+ __ cmplwi(CR0, sig_byte, 'L');
+ __ beq(CR0, do_object); // for arrays of objects, the name of the object must be skipped
__ b(do_boxed); // otherwise, go directly to do_boxed
}
@@ -250,8 +249,8 @@ address TemplateInterpreterGenerator::generate_slow_signature_handler() {
Label L;
__ bind(L);
__ lbzu(sig_byte, 1, signature);
- __ cmplwi(CCR0, sig_byte, ';');
- __ bne(CCR0, L);
+ __ cmplwi(CR0, sig_byte, ';');
+ __ bne(CR0, L);
}
// Need to box the Java object here, so we use arg_java (address of
// current Java stack slot) as argument and don't dereference it as
@@ -259,16 +258,16 @@ address TemplateInterpreterGenerator::generate_slow_signature_handler() {
Label do_null;
__ bind(do_boxed);
__ ld(R0,0, arg_java);
- __ cmpdi(CCR0, R0, 0);
+ __ cmpdi(CR0, R0, 0);
__ li(intSlot,0);
- __ beq(CCR0, do_null);
+ __ beq(CR0, do_null);
__ mr(intSlot, arg_java);
__ bind(do_null);
__ std(intSlot, 0, arg_c);
__ addi(arg_java, arg_java, -BytesPerWord);
__ addi(arg_c, arg_c, BytesPerWord);
- __ cmplwi(CCR0, argcnt, max_int_register_arguments);
- __ blt(CCR0, move_intSlot_to_ARG);
+ __ cmplwi(CR0, argcnt, max_int_register_arguments);
+ __ blt(CR0, move_intSlot_to_ARG);
__ b(loop_start);
__ bind(do_int);
@@ -276,8 +275,8 @@ address TemplateInterpreterGenerator::generate_slow_signature_handler() {
__ std(intSlot, 0, arg_c);
__ addi(arg_java, arg_java, -BytesPerWord);
__ addi(arg_c, arg_c, BytesPerWord);
- __ cmplwi(CCR0, argcnt, max_int_register_arguments);
- __ blt(CCR0, move_intSlot_to_ARG);
+ __ cmplwi(CR0, argcnt, max_int_register_arguments);
+ __ blt(CR0, move_intSlot_to_ARG);
__ b(loop_start);
__ bind(do_long);
@@ -285,8 +284,8 @@ address TemplateInterpreterGenerator::generate_slow_signature_handler() {
__ std(intSlot, 0, arg_c);
__ addi(arg_java, arg_java, - 2 * BytesPerWord);
__ addi(arg_c, arg_c, BytesPerWord);
- __ cmplwi(CCR0, argcnt, max_int_register_arguments);
- __ blt(CCR0, move_intSlot_to_ARG);
+ __ cmplwi(CR0, argcnt, max_int_register_arguments);
+ __ blt(CR0, move_intSlot_to_ARG);
__ b(loop_start);
__ bind(do_float);
@@ -294,8 +293,8 @@ address TemplateInterpreterGenerator::generate_slow_signature_handler() {
__ stfs(floatSlot, Argument::float_on_stack_offset_in_bytes_c, arg_c);
__ addi(arg_java, arg_java, -BytesPerWord);
__ addi(arg_c, arg_c, BytesPerWord);
- __ cmplwi(CCR0, fpcnt, max_fp_register_arguments);
- __ blt(CCR0, move_floatSlot_to_FARG);
+ __ cmplwi(CR0, fpcnt, max_fp_register_arguments);
+ __ blt(CR0, move_floatSlot_to_FARG);
__ b(loop_start);
__ bind(do_double);
@@ -303,8 +302,8 @@ address TemplateInterpreterGenerator::generate_slow_signature_handler() {
__ stfd(floatSlot, 0, arg_c);
__ addi(arg_java, arg_java, - 2 * BytesPerWord);
__ addi(arg_c, arg_c, BytesPerWord);
- __ cmplwi(CCR0, fpcnt, max_fp_register_arguments);
- __ blt(CCR0, move_floatSlot_to_FARG);
+ __ cmplwi(CR0, fpcnt, max_fp_register_arguments);
+ __ blt(CR0, move_floatSlot_to_FARG);
__ b(loop_start);
__ bind(loop_end);
@@ -511,8 +510,8 @@ address TemplateInterpreterGenerator::generate_Reference_get_entry(void) {
__ ld(R3_RET, Interpreter::stackElementSize, R15_esp); // get receiver
// Check if receiver == nullptr and go the slow path.
- __ cmpdi(CCR0, R3_RET, 0);
- __ beq(CCR0, slow_path);
+ __ cmpdi(CR0, R3_RET, 0);
+ __ beq(CR0, slow_path);
__ load_heap_oop(R3_RET, referent_offset, R3_RET,
/* non-volatile temp */ R31, R11_scratch1,
@@ -726,8 +725,8 @@ void TemplateInterpreterGenerator::generate_counter_incr(Label* overflow) {
if (ProfileInterpreter) {
const Register Rmdo = R3_counters;
__ ld(Rmdo, in_bytes(Method::method_data_offset()), R19_method);
- __ cmpdi(CCR0, Rmdo, 0);
- __ beq(CCR0, no_mdo);
+ __ cmpdi(CR0, Rmdo, 0);
+ __ beq(CR0, no_mdo);
// Increment invocation counter in the MDO.
const int mdo_ic_offs = in_bytes(MethodData::invocation_counter_offset()) + in_bytes(InvocationCounter::counter_offset());
@@ -736,7 +735,7 @@ void TemplateInterpreterGenerator::generate_counter_incr(Label* overflow) {
__ addi(Rscratch2, Rscratch2, increment);
__ stw(Rscratch2, mdo_ic_offs, Rmdo);
__ and_(Rscratch1, Rscratch2, Rscratch1);
- __ bne(CCR0, done);
+ __ bne(CR0, done);
__ b(*overflow);
}
@@ -749,7 +748,7 @@ void TemplateInterpreterGenerator::generate_counter_incr(Label* overflow) {
__ addi(Rscratch2, Rscratch2, increment);
__ stw(Rscratch2, mo_ic_offs, R3_counters);
__ and_(Rscratch1, Rscratch2, Rscratch1);
- __ beq(CCR0, *overflow);
+ __ beq(CR0, *overflow);
__ bind(done);
}
@@ -790,8 +789,8 @@ void TemplateInterpreterGenerator::generate_stack_overflow_check(Register Rmem_f
BLOCK_COMMENT("stack_overflow_check_with_compare {");
__ sub(Rmem_frame_size, R1_SP, Rmem_frame_size);
__ ld(Rscratch1, thread_(stack_overflow_limit));
- __ cmpld(CCR0/*is_stack_overflow*/, Rmem_frame_size, Rscratch1);
- __ bgt(CCR0/*is_stack_overflow*/, done);
+ __ cmpld(CR0/*is_stack_overflow*/, Rmem_frame_size, Rscratch1);
+ __ bgt(CR0/*is_stack_overflow*/, done);
// The stack overflows. Load target address of the runtime stub and call it.
assert(SharedRuntime::throw_StackOverflowError_entry() != nullptr, "generated in wrong order");
@@ -800,13 +799,13 @@ void TemplateInterpreterGenerator::generate_stack_overflow_check(Register Rmem_f
// Restore caller_sp (c2i adapter may exist, but no shrinking of interpreted caller frame).
#ifdef ASSERT
Label frame_not_shrunk;
- __ cmpld(CCR0, R1_SP, R21_sender_SP);
- __ ble(CCR0, frame_not_shrunk);
+ __ cmpld(CR0, R1_SP, R21_sender_SP);
+ __ ble(CR0, frame_not_shrunk);
__ stop("frame shrunk");
__ bind(frame_not_shrunk);
__ ld(Rscratch1, 0, R1_SP);
__ ld(R0, 0, R21_sender_SP);
- __ cmpd(CCR0, R0, Rscratch1);
+ __ cmpd(CR0, R0, Rscratch1);
__ asm_assert_eq("backlink");
#endif // ASSERT
__ mr(R1_SP, R21_sender_SP);
@@ -823,15 +822,15 @@ void TemplateInterpreterGenerator::lock_method(Register Rflags, Register Rscratc
{
if (!flags_preloaded) {
- __ lwz(Rflags, method_(access_flags));
+ __ lhz(Rflags, method_(access_flags));
}
#ifdef ASSERT
// Check if methods needs synchronization.
{
Label Lok;
- __ testbitdi(CCR0, R0, Rflags, JVM_ACC_SYNCHRONIZED_BIT);
- __ btrue(CCR0,Lok);
+ __ testbitdi(CR0, R0, Rflags, JVM_ACC_SYNCHRONIZED_BIT);
+ __ btrue(CR0,Lok);
__ stop("method doesn't need synchronization");
__ bind(Lok);
}
@@ -843,8 +842,8 @@ void TemplateInterpreterGenerator::lock_method(Register Rflags, Register Rscratc
Label Lstatic;
Label Ldone;
- __ testbitdi(CCR0, R0, Rflags, JVM_ACC_STATIC_BIT);
- __ btrue(CCR0, Lstatic);
+ __ testbitdi(CR0, R0, Rflags, JVM_ACC_STATIC_BIT);
+ __ btrue(CR0, Lstatic);
// Non-static case: load receiver obj from stack and we're done.
__ ld(Robj_to_lock, R18_locals);
@@ -951,8 +950,8 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call, Regist
// environment and one for a possible native mirror.
Label skip_native_calculate_max_stack;
__ addi(Rtop_frame_size, Rsize_of_parameters, 2);
- __ cmpwi(CCR0, Rtop_frame_size, Argument::n_int_register_parameters_c);
- __ bge(CCR0, skip_native_calculate_max_stack);
+ __ cmpwi(CR0, Rtop_frame_size, Argument::n_int_register_parameters_c);
+ __ bge(CR0, skip_native_calculate_max_stack);
__ li(Rtop_frame_size, Argument::n_int_register_parameters_c);
__ bind(skip_native_calculate_max_stack);
__ sldi(Rsize_of_parameters, Rsize_of_parameters, Interpreter::logStackElementSize);
@@ -1000,8 +999,8 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call, Regist
if (ProfileInterpreter) {
Label zero_continue;
__ ld(R28_mdx, method_(method_data));
- __ cmpdi(CCR0, R28_mdx, 0);
- __ beq(CCR0, zero_continue);
+ __ cmpdi(CR0, R28_mdx, 0);
+ __ beq(CR0, zero_continue);
__ addi(R28_mdx, R28_mdx, in_bytes(MethodData::data_offset()));
__ bind(zero_continue);
}
@@ -1301,8 +1300,8 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
assert(__ nonvolatile_accross_vthread_preemtion(access_flags),
"access_flags not preserved");
// Type check.
- assert(4 == sizeof(AccessFlags), "unexpected field size");
- __ lwz(access_flags, method_(access_flags));
+ assert(2 == sizeof(AccessFlags), "unexpected field size");
+ __ lhz(access_flags, method_(access_flags));
// We don't want to reload R19_method and access_flags after calls
// to some helper functions.
@@ -1331,8 +1330,8 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
__ ld(signature_handler_fd, method_(signature_handler));
Label call_signature_handler;
- __ cmpdi(CCR0, signature_handler_fd, 0);
- __ bne(CCR0, call_signature_handler);
+ __ cmpdi(CR0, signature_handler_fd, 0);
+ __ bne(CR0, call_signature_handler);
// Method has never been called. Either generate a specialized
// handler or point to the slow one.
@@ -1343,8 +1342,8 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
// Check for an exception while looking up the target method. If we
// incurred one, bail.
__ ld(pending_exception, thread_(pending_exception));
- __ cmpdi(CCR0, pending_exception, 0);
- __ bne(CCR0, exception_return_sync_check); // Has pending exception.
+ __ cmpdi(CR0, pending_exception, 0);
+ __ bne(CR0, exception_return_sync_check); // Has pending exception.
// Reload signature handler, it may have been created/assigned in the meanwhile.
__ ld(signature_handler_fd, method_(signature_handler));
@@ -1399,8 +1398,8 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
// Access_flags is non-volatile and still, no need to restore it.
// Restore access flags.
- __ testbitdi(CCR0, R0, access_flags, JVM_ACC_STATIC_BIT);
- __ bfalse(CCR0, method_is_not_static);
+ __ testbitdi(CR0, R0, access_flags, JVM_ACC_STATIC_BIT);
+ __ bfalse(CR0, method_is_not_static);
// Load mirror from interpreter frame (FP in R11_scratch1)
__ ld(R21_tmp1, _ijava_state_neg(mirror), R11_scratch1);
@@ -1509,8 +1508,8 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
// Not suspended.
// TODO PPC port assert(4 == Thread::sz_suspend_flags(), "unexpected field size");
__ lwz(suspend_flags, thread_(suspend_flags));
- __ cmpwi(CCR1, suspend_flags, 0);
- __ beq(CCR1, sync_check_done);
+ __ cmpwi(CR1, suspend_flags, 0);
+ __ beq(CR1, sync_check_done);
__ bind(do_safepoint);
__ isync();
@@ -1553,8 +1552,8 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
// Check preemption for Object.wait()
Label not_preempted;
__ ld(R0, in_bytes(JavaThread::preempt_alternate_return_offset()), R16_thread);
- __ cmpdi(CCR0, R0, 0);
- __ beq(CCR0, not_preempted);
+ __ cmpdi(CR0, R0, 0);
+ __ beq(CR0, not_preempted);
__ mtlr(R0);
__ li(R0, 0);
__ std(R0, in_bytes(JavaThread::preempt_alternate_return_offset()), R16_thread);
@@ -1612,8 +1611,8 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
Label exception_return_sync_check_already_unlocked;
__ ld(R0/*pending_exception*/, thread_(pending_exception));
- __ cmpdi(CCR0, R0/*pending_exception*/, 0);
- __ bne(CCR0, exception_return_sync_check_already_unlocked);
+ __ cmpdi(CR0, R0/*pending_exception*/, 0);
+ __ bne(CR0, exception_return_sync_check_already_unlocked);
//-----------------------------------------------------------------------------
// No exception pending.
@@ -1707,7 +1706,7 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) {
__ subf(Rnum, Rsize_of_parameters, Rsize_of_locals);
__ subf(Rslot_addr, Rsize_of_parameters, R18_locals);
__ srdi_(Rnum, Rnum, Interpreter::logStackElementSize);
- __ beq(CCR0, Lno_locals);
+ __ beq(CR0, Lno_locals);
__ li(R0, 0);
__ mtctr(Rnum);
@@ -1769,7 +1768,7 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) {
#ifdef ASSERT
else {
Label Lok;
- __ lwz(R0, in_bytes(Method::access_flags_offset()), R19_method);
+ __ lhz(R0, in_bytes(Method::access_flags_offset()), R19_method);
__ andi_(R0, R0, JVM_ACC_SYNCHRONIZED);
__ asm_assert_eq("method needs synchronization");
__ bind(Lok);
@@ -2081,8 +2080,8 @@ void TemplateInterpreterGenerator::generate_throw_exception() {
__ ld(return_pc, 0, R1_SP);
__ ld(return_pc, _abi0(lr), return_pc);
__ call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::interpreter_contains), return_pc);
- __ cmpdi(CCR0, R3_RET, 0);
- __ bne(CCR0, Lcaller_not_deoptimized);
+ __ cmpdi(CR0, R3_RET, 0);
+ __ bne(CR0, Lcaller_not_deoptimized);
// The deoptimized case.
// In this case, we can't call dispatch_next() after the frame is
@@ -2128,16 +2127,16 @@ void TemplateInterpreterGenerator::generate_throw_exception() {
Label L_done;
__ lbz(R11_scratch1, 0, R14_bcp);
- __ cmpwi(CCR0, R11_scratch1, Bytecodes::_invokestatic);
- __ bne(CCR0, L_done);
+ __ cmpwi(CR0, R11_scratch1, Bytecodes::_invokestatic);
+ __ bne(CR0, L_done);
// The member name argument must be restored if _invokestatic is re-executed after a PopFrame call.
// Detect such a case in the InterpreterRuntime function and return the member name argument, or null.
__ ld(R4_ARG2, 0, R18_locals);
__ call_VM(R4_ARG2, CAST_FROM_FN_PTR(address, InterpreterRuntime::member_name_arg_or_null), R4_ARG2, R19_method, R14_bcp);
- __ cmpdi(CCR0, R4_ARG2, 0);
- __ beq(CCR0, L_done);
+ __ cmpdi(CR0, R4_ARG2, 0);
+ __ beq(CR0, L_done);
__ std(R4_ARG2, wordSize, R15_esp);
__ bind(L_done);
#endif // INCLUDE_JVMTI
@@ -2322,8 +2321,8 @@ address TemplateInterpreterGenerator::generate_trace_code(TosState state) {
int offs2 = __ load_const_optimized(R12_scratch2, (address) &BytecodeCounter::_counter_value, R0, true);
__ ld(R11_scratch1, offs1, R11_scratch1);
__ lwa(R12_scratch2, offs2, R12_scratch2);
- __ cmpd(CCR0, R12_scratch2, R11_scratch1);
- __ blt(CCR0, Lskip_vm_call);
+ __ cmpd(CR0, R12_scratch2, R11_scratch1);
+ __ blt(CR0, Lskip_vm_call);
}
__ push(state);
@@ -2397,8 +2396,8 @@ void TemplateInterpreterGenerator::stop_interpreter_at() {
int offs2 = __ load_const_optimized(R12_scratch2, (address) &BytecodeCounter::_counter_value, R0, true);
__ ld(R11_scratch1, offs1, R11_scratch1);
__ lwa(R12_scratch2, offs2, R12_scratch2);
- __ cmpd(CCR0, R12_scratch2, R11_scratch1);
- __ bne(CCR0, L);
+ __ cmpd(CR0, R12_scratch2, R11_scratch1);
+ __ bne(CR0, L);
__ illtrap();
__ bind(L);
}
diff --git a/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp b/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp
index 43e78dd9d1514..934bb1bd52918 100644
--- a/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp
+++ b/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2013, 2024 SAP SE. All rights reserved.
+ * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "cds/cdsConfig.hpp"
#include "compiler/disassembler.hpp"
@@ -124,9 +123,9 @@ void TemplateTable::patch_bytecode(Bytecodes::Code new_bc, Register Rnew_bc, Reg
int code_offset = (byte_no == f1_byte) ? in_bytes(ResolvedFieldEntry::get_code_offset())
: in_bytes(ResolvedFieldEntry::put_code_offset());
__ lbz(Rnew_bc, code_offset, Rtemp);
- __ cmpwi(CCR0, Rnew_bc, 0);
+ __ cmpwi(CR0, Rnew_bc, 0);
__ li(Rnew_bc, (unsigned int)(unsigned char)new_bc);
- __ beq(CCR0, L_patch_done);
+ __ beq(CR0, L_patch_done);
// __ isync(); // acquire not needed
break;
}
@@ -141,8 +140,8 @@ void TemplateTable::patch_bytecode(Bytecodes::Code new_bc, Register Rnew_bc, Reg
if (JvmtiExport::can_post_breakpoint()) {
Label L_fast_patch;
__ lbz(Rtemp, 0, R14_bcp);
- __ cmpwi(CCR0, Rtemp, (unsigned int)(unsigned char)Bytecodes::_breakpoint);
- __ bne(CCR0, L_fast_patch);
+ __ cmpwi(CR0, Rtemp, (unsigned int)(unsigned char)Bytecodes::_breakpoint);
+ __ bne(CR0, L_fast_patch);
// Perform the quickening, slowly, in the bowels of the breakpoint table.
__ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::set_original_bytecode_at), R19_method, R14_bcp, Rnew_bc);
__ b(L_patch_done);
@@ -262,14 +261,14 @@ void TemplateTable::ldc(LdcType type) {
__ addi(Rscratch2, Rscratch2, tags_offset);
__ lbzx(Rscratch2, Rscratch2, Rscratch1);
- __ cmpwi(CCR0, Rscratch2, JVM_CONSTANT_UnresolvedClass); // Unresolved class?
- __ cmpwi(CCR1, Rscratch2, JVM_CONSTANT_UnresolvedClassInError); // Unresolved class in error state?
- __ cror(CCR0, Assembler::equal, CCR1, Assembler::equal);
+ __ cmpwi(CR0, Rscratch2, JVM_CONSTANT_UnresolvedClass); // Unresolved class?
+ __ cmpwi(CR1, Rscratch2, JVM_CONSTANT_UnresolvedClassInError); // Unresolved class in error state?
+ __ cror(CR0, Assembler::equal, CR1, Assembler::equal);
// Resolved class - need to call vm to get java mirror of the class.
- __ cmpwi(CCR1, Rscratch2, JVM_CONSTANT_Class);
- __ crnor(CCR0, Assembler::equal, CCR1, Assembler::equal); // Neither resolved class nor unresolved case from above?
- __ beq(CCR0, notClass);
+ __ cmpwi(CR1, Rscratch2, JVM_CONSTANT_Class);
+ __ crnor(CR0, Assembler::equal, CR1, Assembler::equal); // Neither resolved class nor unresolved case from above?
+ __ beq(CR0, notClass);
__ li(R4, is_ldc_wide(type) ? 1 : 0);
call_VM(R17_tos, CAST_FROM_FN_PTR(address, InterpreterRuntime::ldc), R4);
@@ -280,16 +279,16 @@ void TemplateTable::ldc(LdcType type) {
__ bind(notClass);
__ addi(Rcpool, Rcpool, base_offset);
__ sldi(Rscratch1, Rscratch1, LogBytesPerWord);
- __ cmpdi(CCR0, Rscratch2, JVM_CONSTANT_Integer);
- __ bne(CCR0, notInt);
+ __ cmpdi(CR0, Rscratch2, JVM_CONSTANT_Integer);
+ __ bne(CR0, notInt);
__ lwax(R17_tos, Rcpool, Rscratch1);
__ push(itos);
__ b(exit);
__ align(32, 12);
__ bind(notInt);
- __ cmpdi(CCR0, Rscratch2, JVM_CONSTANT_Float);
- __ bne(CCR0, notFloat);
+ __ cmpdi(CR0, Rscratch2, JVM_CONSTANT_Float);
+ __ bne(CR0, notFloat);
__ lfsx(F15_ftos, Rcpool, Rscratch1);
__ push(ftos);
__ b(exit);
@@ -319,12 +318,12 @@ void TemplateTable::fast_aldc(LdcType type) {
int simm16_rest = __ load_const_optimized(R11_scratch1, Universe::the_null_sentinel_addr(), R0, true);
__ ld(R31, simm16_rest, R11_scratch1);
__ resolve_oop_handle(R31, R11_scratch1, R12_scratch2, MacroAssembler::PRESERVATION_NONE);
- __ cmpld(CCR0, R17_tos, R31);
+ __ cmpld(CR0, R17_tos, R31);
if (VM_Version::has_isel()) {
- __ isel_0(R17_tos, CCR0, Assembler::equal);
+ __ isel_0(R17_tos, CR0, Assembler::equal);
} else {
Label not_sentinel;
- __ bne(CCR0, not_sentinel);
+ __ bne(CR0, not_sentinel);
__ li(R17_tos, 0);
__ bind(not_sentinel);
}
@@ -360,15 +359,15 @@ void TemplateTable::ldc2_w() {
__ lbzx(Rtag, Rtag, Rindex);
__ sldi(Rindex, Rindex, LogBytesPerWord);
- __ cmpdi(CCR0, Rtag, JVM_CONSTANT_Double);
- __ bne(CCR0, not_double);
+ __ cmpdi(CR0, Rtag, JVM_CONSTANT_Double);
+ __ bne(CR0, not_double);
__ lfdx(F15_ftos, Rcpool, Rindex);
__ push(dtos);
__ b(exit);
__ bind(not_double);
- __ cmpdi(CCR0, Rtag, JVM_CONSTANT_Long);
- __ bne(CCR0, not_long);
+ __ cmpdi(CR0, Rtag, JVM_CONSTANT_Long);
+ __ bne(CR0, not_long);
__ ldx(R17_tos, Rcpool, Rindex);
__ push(ltos);
__ b(exit);
@@ -402,32 +401,32 @@ void TemplateTable::condy_helper(Label& Done) {
{
// tos in (itos, ftos, stos, btos, ctos, ztos)
Label notInt, notFloat, notShort, notByte, notChar, notBool;
- __ cmplwi(CCR0, flags, itos);
- __ bne(CCR0, notInt);
+ __ cmplwi(CR0, flags, itos);
+ __ bne(CR0, notInt);
// itos
__ lwax(R17_tos, obj, off);
__ push(itos);
__ b(Done);
__ bind(notInt);
- __ cmplwi(CCR0, flags, ftos);
- __ bne(CCR0, notFloat);
+ __ cmplwi(CR0, flags, ftos);
+ __ bne(CR0, notFloat);
// ftos
__ lfsx(F15_ftos, obj, off);
__ push(ftos);
__ b(Done);
__ bind(notFloat);
- __ cmplwi(CCR0, flags, stos);
- __ bne(CCR0, notShort);
+ __ cmplwi(CR0, flags, stos);
+ __ bne(CR0, notShort);
// stos
__ lhax(R17_tos, obj, off);
__ push(stos);
__ b(Done);
__ bind(notShort);
- __ cmplwi(CCR0, flags, btos);
- __ bne(CCR0, notByte);
+ __ cmplwi(CR0, flags, btos);
+ __ bne(CR0, notByte);
// btos
__ lbzx(R17_tos, obj, off);
__ extsb(R17_tos, R17_tos);
@@ -435,16 +434,16 @@ void TemplateTable::condy_helper(Label& Done) {
__ b(Done);
__ bind(notByte);
- __ cmplwi(CCR0, flags, ctos);
- __ bne(CCR0, notChar);
+ __ cmplwi(CR0, flags, ctos);
+ __ bne(CR0, notChar);
// ctos
__ lhzx(R17_tos, obj, off);
__ push(ctos);
__ b(Done);
__ bind(notChar);
- __ cmplwi(CCR0, flags, ztos);
- __ bne(CCR0, notBool);
+ __ cmplwi(CR0, flags, ztos);
+ __ bne(CR0, notBool);
// ztos
__ lbzx(R17_tos, obj, off);
__ push(ztos);
@@ -457,16 +456,16 @@ void TemplateTable::condy_helper(Label& Done) {
case Bytecodes::_ldc2_w:
{
Label notLong, notDouble;
- __ cmplwi(CCR0, flags, ltos);
- __ bne(CCR0, notLong);
+ __ cmplwi(CR0, flags, ltos);
+ __ bne(CR0, notLong);
// ltos
__ ldx(R17_tos, obj, off);
__ push(ltos);
__ b(Done);
__ bind(notLong);
- __ cmplwi(CCR0, flags, dtos);
- __ bne(CCR0, notDouble);
+ __ cmplwi(CR0, flags, dtos);
+ __ bne(CR0, notDouble);
// dtos
__ lfdx(F15_ftos, obj, off);
__ push(dtos);
@@ -518,16 +517,16 @@ void TemplateTable::iload_internal(RewriteControl rc) {
// last two iloads in a pair. Comparing against fast_iload means that
// the next bytecode is neither an iload or a caload, and therefore
// an iload pair.
- __ cmpwi(CCR0, Rnext_byte, (unsigned int)(unsigned char)Bytecodes::_iload);
- __ beq(CCR0, Ldone);
+ __ cmpwi(CR0, Rnext_byte, (unsigned int)(unsigned char)Bytecodes::_iload);
+ __ beq(CR0, Ldone);
- __ cmpwi(CCR1, Rnext_byte, (unsigned int)(unsigned char)Bytecodes::_fast_iload);
+ __ cmpwi(CR1, Rnext_byte, (unsigned int)(unsigned char)Bytecodes::_fast_iload);
__ li(Rrewrite_to, (unsigned int)(unsigned char)Bytecodes::_fast_iload2);
- __ beq(CCR1, Lrewrite);
+ __ beq(CR1, Lrewrite);
- __ cmpwi(CCR0, Rnext_byte, (unsigned int)(unsigned char)Bytecodes::_caload);
+ __ cmpwi(CR0, Rnext_byte, (unsigned int)(unsigned char)Bytecodes::_caload);
__ li(Rrewrite_to, (unsigned int)(unsigned char)Bytecodes::_fast_icaload);
- __ beq(CCR0, Lrewrite);
+ __ beq(CR0, Lrewrite);
__ li(Rrewrite_to, (unsigned int)(unsigned char)Bytecodes::_fast_iload);
@@ -813,20 +812,20 @@ void TemplateTable::aload_0_internal(RewriteControl rc) {
__ lbz(Rnext_byte, Bytecodes::length_for(Bytecodes::_aload_0), R14_bcp);
// If _getfield, wait to rewrite. We only want to rewrite the last two bytecodes in a pair.
- __ cmpwi(CCR0, Rnext_byte, (unsigned int)(unsigned char)Bytecodes::_getfield);
- __ beq(CCR0, Ldont_rewrite);
+ __ cmpwi(CR0, Rnext_byte, (unsigned int)(unsigned char)Bytecodes::_getfield);
+ __ beq(CR0, Ldont_rewrite);
- __ cmpwi(CCR1, Rnext_byte, (unsigned int)(unsigned char)Bytecodes::_fast_igetfield);
+ __ cmpwi(CR1, Rnext_byte, (unsigned int)(unsigned char)Bytecodes::_fast_igetfield);
__ li(Rrewrite_to, (unsigned int)(unsigned char)Bytecodes::_fast_iaccess_0);
- __ beq(CCR1, Lrewrite);
+ __ beq(CR1, Lrewrite);
- __ cmpwi(CCR0, Rnext_byte, (unsigned int)(unsigned char)Bytecodes::_fast_agetfield);
+ __ cmpwi(CR0, Rnext_byte, (unsigned int)(unsigned char)Bytecodes::_fast_agetfield);
__ li(Rrewrite_to, (unsigned int)(unsigned char)Bytecodes::_fast_aaccess_0);
- __ beq(CCR0, Lrewrite);
+ __ beq(CR0, Lrewrite);
- __ cmpwi(CCR1, Rnext_byte, (unsigned int)(unsigned char)Bytecodes::_fast_fgetfield);
+ __ cmpwi(CR1, Rnext_byte, (unsigned int)(unsigned char)Bytecodes::_fast_fgetfield);
__ li(Rrewrite_to, (unsigned int)(unsigned char)Bytecodes::_fast_faccess_0);
- __ beq(CCR1, Lrewrite);
+ __ beq(CR1, Lrewrite);
__ li(Rrewrite_to, (unsigned int)(unsigned char)Bytecodes::_fast_aload_0);
@@ -998,8 +997,8 @@ void TemplateTable::aastore() {
Register Rscratch3 = Rindex;
// Do array store check - check for null value first.
- __ cmpdi(CCR0, R17_tos, 0);
- __ beq(CCR0, Lis_null);
+ __ cmpdi(CR0, R17_tos, 0);
+ __ beq(CR0, Lis_null);
__ load_klass(Rarray_klass, Rarray);
__ load_klass(Rvalue_klass, R17_tos);
@@ -1046,9 +1045,9 @@ void TemplateTable::bastore() {
__ load_klass(Rscratch, Rarray);
__ lwz(Rscratch, in_bytes(Klass::layout_helper_offset()), Rscratch);
int diffbit = exact_log2(Klass::layout_helper_boolean_diffbit());
- __ testbitdi(CCR0, R0, Rscratch, diffbit);
+ __ testbitdi(CR0, R0, Rscratch, diffbit);
Label L_skip;
- __ bfalse(CCR0, L_skip);
+ __ bfalse(CR0, L_skip);
__ andi(R17_tos, R17_tos, 1); // if it is a T_BOOLEAN array, mask the stored value to 0/1
__ bind(L_skip);
@@ -1263,11 +1262,11 @@ void TemplateTable::idiv() {
Register Rdividend = R11_scratch1; // Used by irem.
__ addi(R0, R17_tos, 1);
- __ cmplwi(CCR0, R0, 2);
- __ bgt(CCR0, Lnormal); // divisor <-1 or >1
+ __ cmplwi(CR0, R0, 2);
+ __ bgt(CR0, Lnormal); // divisor <-1 or >1
- __ cmpwi(CCR1, R17_tos, 0);
- __ beq(CCR1, Lexception); // divisor == 0
+ __ cmpwi(CR1, R17_tos, 0);
+ __ beq(CR1, Lexception); // divisor == 0
__ pop_i(Rdividend);
__ mullw(R17_tos, Rdividend, R17_tos); // div by +/-1
@@ -1308,11 +1307,11 @@ void TemplateTable::ldiv() {
Register Rdividend = R11_scratch1; // Used by lrem.
__ addi(R0, R17_tos, 1);
- __ cmpldi(CCR0, R0, 2);
- __ bgt(CCR0, Lnormal); // divisor <-1 or >1
+ __ cmpldi(CR0, R0, 2);
+ __ bgt(CR0, Lnormal); // divisor <-1 or >1
- __ cmpdi(CCR1, R17_tos, 0);
- __ beq(CCR1, Lexception); // divisor == 0
+ __ cmpdi(CR1, R17_tos, 0);
+ __ beq(CR1, Lexception); // divisor == 0
__ pop_l(Rdividend);
__ mulld(R17_tos, Rdividend, R17_tos); // div by +/-1
@@ -1566,18 +1565,18 @@ void TemplateTable::convert() {
case Bytecodes::_d2i:
case Bytecodes::_f2i:
- __ fcmpu(CCR0, F15_ftos, F15_ftos);
+ __ fcmpu(CR0, F15_ftos, F15_ftos);
__ li(R17_tos, 0); // 0 in case of NAN
- __ bso(CCR0, done);
+ __ bso(CR0, done);
__ fctiwz(F15_ftos, F15_ftos);
__ move_d_to_l();
break;
case Bytecodes::_d2l:
case Bytecodes::_f2l:
- __ fcmpu(CCR0, F15_ftos, F15_ftos);
+ __ fcmpu(CR0, F15_ftos, F15_ftos);
__ li(R17_tos, 0); // 0 in case of NAN
- __ bso(CCR0, done);
+ __ bso(CR0, done);
__ fctidz(F15_ftos, F15_ftos);
__ move_d_to_l();
break;
@@ -1594,7 +1593,7 @@ void TemplateTable::lcmp() {
const Register Rscratch = R11_scratch1;
__ pop_l(Rscratch); // first operand, deeper in stack
- __ cmpd(CCR0, Rscratch, R17_tos); // compare
+ __ cmpd(CR0, Rscratch, R17_tos); // compare
__ set_cmp3(R17_tos); // set result as follows: <: -1, =: 0, >: 1
}
@@ -1612,7 +1611,7 @@ void TemplateTable::float_cmp(bool is_float, int unordered_result) {
__ pop_d(Rfirst);
}
- __ fcmpu(CCR0, Rfirst, Rsecond); // compare
+ __ fcmpu(CR0, Rfirst, Rsecond); // compare
// if unordered_result is 1, treat unordered_result like 'greater than'
assert(unordered_result == 1 || unordered_result == -1, "unordered_result can be either 1 or -1");
__ set_cmpu3(R17_tos, unordered_result != 1);
@@ -1684,8 +1683,8 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) {
Label Lforward;
// Check branch direction.
- __ cmpdi(CCR0, Rdisp, 0);
- __ bgt(CCR0, Lforward);
+ __ cmpdi(CR0, Rdisp, 0);
+ __ bgt(CR0, Lforward);
__ get_method_counters(R19_method, R4_counters, Lforward);
@@ -1696,8 +1695,8 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) {
// If no method data exists, go to profile_continue.
__ ld(Rmdo, in_bytes(Method::method_data_offset()), R19_method);
- __ cmpdi(CCR0, Rmdo, 0);
- __ beq(CCR0, Lno_mdo);
+ __ cmpdi(CR0, Rmdo, 0);
+ __ beq(CR0, Lno_mdo);
// Increment backedge counter in the MDO.
const int mdo_bc_offs = in_bytes(MethodData::backedge_counter_offset()) + in_bytes(InvocationCounter::counter_offset());
@@ -1707,7 +1706,7 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) {
__ stw(Rscratch2, mdo_bc_offs, Rmdo);
if (UseOnStackReplacement) {
__ and_(Rscratch3, Rscratch2, Rscratch3);
- __ bne(CCR0, Lforward);
+ __ bne(CR0, Lforward);
__ b(Loverflow);
} else {
__ b(Lforward);
@@ -1723,7 +1722,7 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) {
__ stw(Rscratch2, mo_bc_offs, R4_counters);
if (UseOnStackReplacement) {
__ and_(Rscratch3, Rscratch2, Rscratch3);
- __ bne(CCR0, Lforward);
+ __ bne(CR0, Lforward);
} else {
__ b(Lforward);
}
@@ -1734,13 +1733,13 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) {
__ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::frequency_counter_overflow), R4_ARG2, true);
// Was an OSR adapter generated?
- __ cmpdi(CCR0, R3_RET, 0);
- __ beq(CCR0, Lforward);
+ __ cmpdi(CR0, R3_RET, 0);
+ __ beq(CR0, Lforward);
// Has the nmethod been invalidated already?
__ lbz(R0, in_bytes(nmethod::state_offset()), R3_RET);
- __ cmpwi(CCR0, R0, nmethod::in_use);
- __ bne(CCR0, Lforward);
+ __ cmpwi(CR0, R0, nmethod::in_use);
+ __ bne(CR0, Lforward);
// Migrate the interpreter frame off of the stack.
// We can use all registers because we will not return to interpreter from this point.
@@ -1776,18 +1775,18 @@ void TemplateTable::if_cmp_common(Register Rfirst, Register Rsecond, Register Rs
if (is_jint) {
if (cmp0) {
- __ cmpwi(CCR0, Rfirst, 0);
+ __ cmpwi(CR0, Rfirst, 0);
} else {
- __ cmpw(CCR0, Rfirst, Rsecond);
+ __ cmpw(CR0, Rfirst, Rsecond);
}
} else {
if (cmp0) {
- __ cmpdi(CCR0, Rfirst, 0);
+ __ cmpdi(CR0, Rfirst, 0);
} else {
- __ cmpd(CCR0, Rfirst, Rsecond);
+ __ cmpd(CR0, Rfirst, Rsecond);
}
}
- branch_conditional(CCR0, cc, Lnot_taken, /*invert*/ true);
+ branch_conditional(CR0, cc, Lnot_taken, /*invert*/ true);
// Conition is false => Jump!
branch(false, false);
@@ -1886,10 +1885,10 @@ void TemplateTable::tableswitch() {
__ get_u4(Rhigh_byte, Rdef_offset_addr, 2 *BytesPerInt, InterpreterMacroAssembler::Unsigned);
// Check for default case (=index outside [low,high]).
- __ cmpw(CCR0, R17_tos, Rlow_byte);
- __ cmpw(CCR1, R17_tos, Rhigh_byte);
- __ blt(CCR0, Ldefault_case);
- __ bgt(CCR1, Ldefault_case);
+ __ cmpw(CR0, R17_tos, Rlow_byte);
+ __ cmpw(CR1, R17_tos, Rhigh_byte);
+ __ blt(CR0, Ldefault_case);
+ __ bgt(CR1, Ldefault_case);
// Lookup dispatch offset.
__ sub(Rindex, R17_tos, Rlow_byte);
@@ -1945,8 +1944,8 @@ void TemplateTable::fast_linearswitch() {
__ addi(Rcurrent_pair, Rdef_offset_addr, 2 * BytesPerInt); // Rcurrent_pair now points to first pair.
__ mtctr(Rcount);
- __ cmpwi(CCR0, Rcount, 0);
- __ bne(CCR0, Lloop_entry);
+ __ cmpwi(CR0, Rcount, 0);
+ __ bne(CR0, Lloop_entry);
// Default case
__ bind(Ldefault_case);
@@ -1962,8 +1961,8 @@ void TemplateTable::fast_linearswitch() {
__ addi(Rcurrent_pair, Rcurrent_pair, 2 * BytesPerInt);
__ bind(Lloop_entry);
__ get_u4(Rvalue, Rcurrent_pair, 0, InterpreterMacroAssembler::Unsigned);
- __ cmpw(CCR0, Rvalue, Rcmp_value);
- __ bne(CCR0, Lsearch_loop);
+ __ cmpw(CR0, Rvalue, Rcmp_value);
+ __ bne(CR0, Lsearch_loop);
// Found, load offset.
__ get_u4(Roffset, Rcurrent_pair, BytesPerInt, InterpreterMacroAssembler::Signed);
@@ -2058,8 +2057,8 @@ void TemplateTable::fast_binaryswitch() {
// else
// Rh = Ri
Label Lgreater;
- __ cmpw(CCR0, Rkey, Rscratch);
- __ bge(CCR0, Lgreater);
+ __ cmpw(CR0, Rkey, Rscratch);
+ __ bge(CR0, Lgreater);
__ mr(Rj, Rh);
__ b(entry);
__ bind(Lgreater);
@@ -2068,10 +2067,10 @@ void TemplateTable::fast_binaryswitch() {
// while (i+1 < j)
__ bind(entry);
__ addi(Rscratch, Ri, 1);
- __ cmpw(CCR0, Rscratch, Rj);
+ __ cmpw(CR0, Rscratch, Rj);
__ add(Rh, Ri, Rj); // start h = i + j >> 1;
- __ blt(CCR0, loop);
+ __ blt(CR0, loop);
}
// End of binary search, result index is i (must check again!).
@@ -2087,8 +2086,8 @@ void TemplateTable::fast_binaryswitch() {
Label not_found;
// Ri = offset offset
- __ cmpw(CCR0, Rkey, Rscratch);
- __ beq(CCR0, not_found);
+ __ cmpw(CR0, Rkey, Rscratch);
+ __ beq(CR0, not_found);
// entry not found -> j = default offset
__ get_u4(Rj, Rarray, -2 * BytesPerInt, InterpreterMacroAssembler::Unsigned);
__ b(default_case);
@@ -2131,8 +2130,8 @@ void TemplateTable::_return(TosState state) {
// Load klass of this obj.
__ load_klass(Rklass, R17_tos);
__ lbz(Rklass_flags, in_bytes(Klass::misc_flags_offset()), Rklass);
- __ testbitdi(CCR0, R0, Rklass_flags, exact_log2(KlassFlags::_misc_has_finalizer));
- __ bfalse(CCR0, Lskip_register_finalizer);
+ __ testbitdi(CR0, R0, Rklass_flags, exact_log2(KlassFlags::_misc_has_finalizer));
+ __ bfalse(CR0, Lskip_register_finalizer);
__ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::register_finalizer), R17_tos /* obj */);
@@ -2144,7 +2143,7 @@ void TemplateTable::_return(TosState state) {
Label no_safepoint;
__ ld(R11_scratch1, in_bytes(JavaThread::polling_word_offset()), R16_thread);
__ andi_(R11_scratch1, R11_scratch1, SafepointMechanism::poll_bit());
- __ beq(CCR0, no_safepoint);
+ __ beq(CR0, no_safepoint);
__ push(state);
__ push_cont_fastpath();
__ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::at_safepoint));
@@ -2215,8 +2214,8 @@ void TemplateTable::resolve_cache_and_index_for_method(int byte_no, Register Rca
// Load-acquire the bytecode to match store-release in InterpreterRuntime
__ lbz(Rscratch, bytecode_offset, Rcache);
// Acquire by cmp-br-isync (see below).
- __ cmpdi(CCR0, Rscratch, (int)code);
- __ beq(CCR0, Lresolved);
+ __ cmpdi(CR0, Rscratch, (int)code);
+ __ beq(CR0, Lresolved);
// Class initialization barrier slow path lands here as well.
__ bind(L_clinit_barrier_slow);
@@ -2264,8 +2263,8 @@ void TemplateTable::resolve_cache_and_index_for_field(int byte_no,
int code_offset = (byte_no == f1_byte) ? in_bytes(ResolvedFieldEntry::get_code_offset())
: in_bytes(ResolvedFieldEntry::put_code_offset());
__ lbz(R0, code_offset, Rcache);
- __ cmpwi(CCR0, R0, (int)code); // have we resolved this bytecode?
- __ beq(CCR0, resolved);
+ __ cmpwi(CR0, R0, (int)code); // have we resolved this bytecode?
+ __ beq(CR0, resolved);
// resolve first time through
address entry = CAST_FROM_FN_PTR(address, InterpreterRuntime::resolve_from_cache);
@@ -2333,8 +2332,8 @@ void TemplateTable::load_resolved_method_entry_handle(Register cache,
// maybe push appendix to arguments (just before return address)
Label L_no_push;
- __ testbitdi(CCR0, R0, flags, ResolvedMethodEntry::has_appendix_shift);
- __ bfalse(CCR0, L_no_push);
+ __ testbitdi(CR0, R0, flags, ResolvedMethodEntry::has_appendix_shift);
+ __ bfalse(CR0, L_no_push);
// invokehandle uses an index into the resolved references array
__ lhz(ref_index, in_bytes(ResolvedMethodEntry::resolved_references_index_offset()), cache);
// Push the appendix as a trailing parameter.
@@ -2396,8 +2395,8 @@ void TemplateTable::load_invokedynamic_entry(Register method) {
__ ld_ptr(method, in_bytes(ResolvedIndyEntry::method_offset()), cache);
// The invokedynamic is unresolved iff method is null
- __ cmpdi(CCR0, method, 0);
- __ bne(CCR0, resolved);
+ __ cmpdi(CR0, method, 0);
+ __ bne(CR0, resolved);
Bytecodes::Code code = bytecode();
@@ -2409,7 +2408,7 @@ void TemplateTable::load_invokedynamic_entry(Register method) {
__ load_resolved_indy_entry(cache, index);
__ ld_ptr(method, in_bytes(ResolvedIndyEntry::method_offset()), cache);
- DEBUG_ONLY(__ cmpdi(CCR0, method, 0));
+ DEBUG_ONLY(__ cmpdi(CR0, method, 0));
__ asm_assert_ne("Should be resolved by now");
__ bind(resolved);
__ isync(); // Order load wrt. succeeding loads.
@@ -2418,7 +2417,7 @@ void TemplateTable::load_invokedynamic_entry(Register method) {
// Check if there is an appendix
__ lbz(index, in_bytes(ResolvedIndyEntry::flags_offset()), cache);
__ rldicl_(R0, index, 64-ResolvedIndyEntry::has_appendix_shift, 63);
- __ beq(CCR0, L_no_push);
+ __ beq(CR0, L_no_push);
// Get appendix
__ lhz(index, in_bytes(ResolvedIndyEntry::resolved_references_index_offset()), cache);
@@ -2490,8 +2489,8 @@ void TemplateTable::jvmti_post_field_access(Register Rcache, Register Rscratch,
int offs = __ load_const_optimized(Rscratch, JvmtiExport::get_field_access_count_addr(), R0, true);
__ lwz(Rscratch, offs, Rscratch);
- __ cmpwi(CCR0, Rscratch, 0);
- __ beq(CCR0, Lno_field_access_post);
+ __ cmpwi(CR0, Rscratch, 0);
+ __ beq(CR0, Lno_field_access_post);
// Post access enabled - do it!
if (is_static) {
@@ -2575,13 +2574,13 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
#ifdef ASSERT
Label LFlagInvalid;
- __ cmpldi(CCR0, Rtos_state, number_of_states);
- __ bge(CCR0, LFlagInvalid);
+ __ cmpldi(CR0, Rtos_state, number_of_states);
+ __ bge(CR0, LFlagInvalid);
#endif
// Load from branch table and dispatch (volatile case: one instruction ahead).
__ sldi(Rtos_state, Rtos_state, LogBytesPerWord);
- __ cmpwi(CCR2, Rscratch, 1); // Volatile?
+ __ cmpwi(CR2, Rscratch, 1); // Volatile?
if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
__ sldi(Rscratch, Rscratch, exact_log2(BytesPerInstWord)); // Volatile ? size of 1 instruction : 0.
}
@@ -2632,12 +2631,12 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
}
{
Label acquire_double;
- __ beq(CCR2, acquire_double); // Volatile?
+ __ beq(CR2, acquire_double); // Volatile?
__ dispatch_epilog(vtos, Bytecodes::length_for(bytecode()));
__ bind(acquire_double);
- __ fcmpu(CCR0, F15_ftos, F15_ftos); // Acquire by cmp-br-isync.
- __ beq_predict_taken(CCR0, Lisync);
+ __ fcmpu(CR0, F15_ftos, F15_ftos); // Acquire by cmp-br-isync.
+ __ beq_predict_taken(CR0, Lisync);
__ b(Lisync); // In case of NAN.
}
@@ -2653,12 +2652,12 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
}
{
Label acquire_float;
- __ beq(CCR2, acquire_float); // Volatile?
+ __ beq(CR2, acquire_float); // Volatile?
__ dispatch_epilog(vtos, Bytecodes::length_for(bytecode()));
__ bind(acquire_float);
- __ fcmpu(CCR0, F15_ftos, F15_ftos); // Acquire by cmp-br-isync.
- __ beq_predict_taken(CCR0, Lisync);
+ __ fcmpu(CR0, F15_ftos, F15_ftos); // Acquire by cmp-br-isync.
+ __ beq_predict_taken(CR0, Lisync);
__ b(Lisync); // In case of NAN.
}
@@ -2672,7 +2671,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
if (!is_static && rc == may_rewrite) {
patch_bytecode(Bytecodes::_fast_igetfield, Rbc, Rscratch);
}
- __ beq(CCR2, Lacquire); // Volatile?
+ __ beq(CR2, Lacquire); // Volatile?
__ dispatch_epilog(vtos, Bytecodes::length_for(bytecode()));
__ align(32, 28, 28); // Align load.
@@ -2685,7 +2684,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
if (!is_static && rc == may_rewrite) {
patch_bytecode(Bytecodes::_fast_lgetfield, Rbc, Rscratch);
}
- __ beq(CCR2, Lacquire); // Volatile?
+ __ beq(CR2, Lacquire); // Volatile?
__ dispatch_epilog(vtos, Bytecodes::length_for(bytecode()));
__ align(32, 28, 28); // Align load.
@@ -2699,7 +2698,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
if (!is_static && rc == may_rewrite) {
patch_bytecode(Bytecodes::_fast_bgetfield, Rbc, Rscratch);
}
- __ beq(CCR2, Lacquire); // Volatile?
+ __ beq(CR2, Lacquire); // Volatile?
__ dispatch_epilog(vtos, Bytecodes::length_for(bytecode()));
__ align(32, 28, 28); // Align load.
@@ -2713,7 +2712,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
// use btos rewriting, no truncating to t/f bit is needed for getfield.
patch_bytecode(Bytecodes::_fast_bgetfield, Rbc, Rscratch);
}
- __ beq(CCR2, Lacquire); // Volatile?
+ __ beq(CR2, Lacquire); // Volatile?
__ dispatch_epilog(vtos, Bytecodes::length_for(bytecode()));
__ align(32, 28, 28); // Align load.
@@ -2726,7 +2725,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
if (!is_static && rc == may_rewrite) {
patch_bytecode(Bytecodes::_fast_cgetfield, Rbc, Rscratch);
}
- __ beq(CCR2, Lacquire); // Volatile?
+ __ beq(CR2, Lacquire); // Volatile?
__ dispatch_epilog(vtos, Bytecodes::length_for(bytecode()));
__ align(32, 28, 28); // Align load.
@@ -2739,7 +2738,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
if (!is_static && rc == may_rewrite) {
patch_bytecode(Bytecodes::_fast_sgetfield, Rbc, Rscratch);
}
- __ beq(CCR2, Lacquire); // Volatile?
+ __ beq(CR2, Lacquire); // Volatile?
__ dispatch_epilog(vtos, Bytecodes::length_for(bytecode()));
__ align(32, 28, 28); // Align load.
@@ -2754,7 +2753,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
if (!is_static && rc == may_rewrite) {
patch_bytecode(Bytecodes::_fast_agetfield, Rbc, Rscratch);
}
- __ beq(CCR2, Lacquire); // Volatile?
+ __ beq(CR2, Lacquire); // Volatile?
__ dispatch_epilog(vtos, Bytecodes::length_for(bytecode()));
__ align(32, 12);
@@ -2797,8 +2796,8 @@ void TemplateTable::jvmti_post_field_mod(Register Rcache, Register Rscratch, boo
int offs = __ load_const_optimized(Rscratch, JvmtiExport::get_field_modification_count_addr(), R0, true);
__ lwz(Rscratch, offs, Rscratch);
- __ cmpwi(CCR0, Rscratch, 0);
- __ beq(CCR0, Lno_field_mod_post);
+ __ cmpwi(CR0, Rscratch, 0);
+ __ beq(CR0, Lno_field_mod_post);
// Do the post
const Register Robj = Rscratch;
@@ -2831,11 +2830,11 @@ void TemplateTable::jvmti_post_field_mod(Register Rcache, Register Rscratch, boo
// the type to determine where the object is.
__ lbz(Rtos_state, in_bytes(ResolvedFieldEntry::type_offset()), Rcache);
- __ cmpwi(CCR0, Rtos_state, ltos);
- __ cmpwi(CCR1, Rtos_state, dtos);
+ __ cmpwi(CR0, Rtos_state, ltos);
+ __ cmpwi(CR1, Rtos_state, dtos);
__ addi(base, R15_esp, Interpreter::expr_offset_in_bytes(1));
- __ crnor(CCR0, Assembler::equal, CCR1, Assembler::equal);
- __ beq(CCR0, is_one_slot);
+ __ crnor(CR0, Assembler::equal, CR1, Assembler::equal);
+ __ beq(CR0, is_one_slot);
__ addi(base, R15_esp, Interpreter::expr_offset_in_bytes(2));
__ bind(is_one_slot);
break;
@@ -2882,7 +2881,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr
Rscratch2 = R12_scratch2, // used by load_field_cp_cache_entry
Rscratch3 = R6_ARG4,
Rbc = Rscratch3;
- const ConditionRegister CR_is_vol = CCR2; // Non-volatile condition register (survives runtime call in do_oop_store).
+ const ConditionRegister CR_is_vol = CR2; // Non-volatile condition register (survives runtime call in do_oop_store).
static address field_rw_branch_table[number_of_states],
field_norw_branch_table[number_of_states],
@@ -2908,8 +2907,8 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr
#ifdef ASSERT
Label LFlagInvalid;
- __ cmpldi(CCR0, Rtos_state, number_of_states);
- __ bge(CCR0, LFlagInvalid);
+ __ cmpldi(CR0, Rtos_state, number_of_states);
+ __ bge(CR0, LFlagInvalid);
#endif
// Load from branch table and dispatch (volatile case: one instruction ahead).
@@ -3125,7 +3124,7 @@ void TemplateTable::fast_storefield(TosState state) {
Rscratch = R11_scratch1, // used by load_field_cp_cache_entry
Rscratch2 = R12_scratch2, // used by load_field_cp_cache_entry
Rscratch3 = R4_ARG2;
- const ConditionRegister CR_is_vol = CCR2; // Non-volatile condition register (survives runtime call in do_oop_store).
+ const ConditionRegister CR_is_vol = CR2; // Non-volatile condition register (survives runtime call in do_oop_store).
// Constant pool already resolved => Load flags and offset of field.
__ load_field_entry(Rcache, Rscratch);
@@ -3140,7 +3139,7 @@ void TemplateTable::fast_storefield(TosState state) {
if (!support_IRIW_for_not_multiple_copy_atomic_cpu) { __ cmpdi(CR_is_vol, Rscratch, 1); }
{
Label LnotVolatile;
- __ beq(CCR0, LnotVolatile);
+ __ beq(CR0, LnotVolatile);
__ release();
__ align(32, 12);
__ bind(LnotVolatile);
@@ -3220,7 +3219,7 @@ void TemplateTable::fast_accessfield(TosState state) {
// Get volatile flag.
__ rldicl_(Rscratch, Rflags, 64-ResolvedFieldEntry::is_volatile_shift, 63); // Extract volatile bit.
- __ bne(CCR0, LisVolatile);
+ __ bne(CR0, LisVolatile);
switch(bytecode()) {
case Bytecodes::_fast_agetfield:
@@ -3308,8 +3307,8 @@ void TemplateTable::fast_accessfield(TosState state) {
Label Ldummy;
if (support_IRIW_for_not_multiple_copy_atomic_cpu) { __ fence(); }
__ lfsx(F15_ftos, Rclass_or_obj, Roffset);
- __ fcmpu(CCR0, F15_ftos, F15_ftos); // Acquire by cmp-br-isync.
- __ bne_predict_not_taken(CCR0, Ldummy);
+ __ fcmpu(CR0, F15_ftos, F15_ftos); // Acquire by cmp-br-isync.
+ __ bne_predict_not_taken(CR0, Ldummy);
__ bind(Ldummy);
__ isync();
break;
@@ -3323,8 +3322,8 @@ void TemplateTable::fast_accessfield(TosState state) {
Label Ldummy;
if (support_IRIW_for_not_multiple_copy_atomic_cpu) { __ fence(); }
__ lfdx(F15_ftos, Rclass_or_obj, Roffset);
- __ fcmpu(CCR0, F15_ftos, F15_ftos); // Acquire by cmp-br-isync.
- __ bne_predict_not_taken(CCR0, Ldummy);
+ __ fcmpu(CR0, F15_ftos, F15_ftos); // Acquire by cmp-br-isync.
+ __ bne_predict_not_taken(CR0, Ldummy);
__ bind(Ldummy);
__ isync();
break;
@@ -3361,7 +3360,7 @@ void TemplateTable::fast_xaccess(TosState state) {
// Get volatile flag.
__ rldicl_(Rscratch, Rflags, 64-ResolvedFieldEntry::is_volatile_shift, 63); // Extract volatile bit.
- __ bne(CCR0, LisVolatile);
+ __ bne(CR0, LisVolatile);
switch(state) {
case atos:
@@ -3399,8 +3398,8 @@ void TemplateTable::fast_xaccess(TosState state) {
Label Ldummy;
if (support_IRIW_for_not_multiple_copy_atomic_cpu) { __ fence(); }
__ lfsx(F15_ftos, Rclass_or_obj, Roffset);
- __ fcmpu(CCR0, F15_ftos, F15_ftos); // Acquire by cmp-br-isync.
- __ bne_predict_not_taken(CCR0, Ldummy);
+ __ fcmpu(CR0, F15_ftos, F15_ftos); // Acquire by cmp-br-isync.
+ __ bne_predict_not_taken(CR0, Ldummy);
__ bind(Ldummy);
__ isync();
break;
@@ -3481,8 +3480,8 @@ void TemplateTable::invokevirtual(int byte_no) {
load_resolved_method_entry_virtual(Rcache, noreg, Rflags);
// Handle final method separately.
- __ testbitdi(CCR0, R0, Rflags, ResolvedMethodEntry::is_vfinal_shift);
- __ bfalse(CCR0, LnotFinal);
+ __ testbitdi(CR0, R0, Rflags, ResolvedMethodEntry::is_vfinal_shift);
+ __ bfalse(CR0, LnotFinal);
if (RewriteBytecodes && !CDSConfig::is_using_archive() && !CDSConfig::is_dumping_static_archive()) {
patch_bytecode(Bytecodes::_fast_invokevfinal, Rnew_bc, R12_scratch2);
@@ -3588,8 +3587,8 @@ void TemplateTable::invokeinterface_object_method(Register Rrecv_klass,
Label LnotFinal;
// Check for vfinal.
- __ testbitdi(CCR0, R0, Rflags, ResolvedMethodEntry::is_vfinal_shift);
- __ bfalse(CCR0, LnotFinal);
+ __ testbitdi(CR0, R0, Rflags, ResolvedMethodEntry::is_vfinal_shift);
+ __ bfalse(CR0, LnotFinal);
Register Rscratch = Rflags, // Rflags is dead now.
Rmethod = Rtemp2,
@@ -3642,8 +3641,8 @@ void TemplateTable::invokeinterface(int byte_no) {
// to handle this corner case.
Label LnotObjectMethod, Lthrow_ame;
- __ testbitdi(CCR0, R0, Rflags, ResolvedMethodEntry::is_forced_virtual_shift);
- __ bfalse(CCR0, LnotObjectMethod);
+ __ testbitdi(CR0, R0, Rflags, ResolvedMethodEntry::is_forced_virtual_shift);
+ __ bfalse(CR0, LnotObjectMethod);
invokeinterface_object_method(Rrecv_klass, Rret_addr, Rflags, Rcache, Rscratch1, Rscratch2);
__ bind(LnotObjectMethod);
@@ -3653,8 +3652,8 @@ void TemplateTable::invokeinterface(int byte_no) {
// Check for private method invocation - indicated by vfinal
Label LnotVFinal, L_no_such_interface, L_subtype;
- __ testbitdi(CCR0, R0, Rflags, ResolvedMethodEntry::is_vfinal_shift);
- __ bfalse(CCR0, LnotVFinal);
+ __ testbitdi(CR0, R0, Rflags, ResolvedMethodEntry::is_vfinal_shift);
+ __ bfalse(CR0, LnotVFinal);
__ check_klass_subtype(Rrecv_klass, Rinterface_klass, Rscratch1, Rscratch2, L_subtype);
// If we get here the typecheck failed
@@ -3688,8 +3687,8 @@ void TemplateTable::invokeinterface(int byte_no) {
__ lookup_interface_method(Rrecv_klass, Rinterface_klass, Rindex, Rmethod2, Rscratch1, Rscratch2,
L_no_such_interface);
- __ cmpdi(CCR0, Rmethod2, 0);
- __ beq(CCR0, Lthrow_ame);
+ __ cmpdi(CR0, Rmethod2, 0);
+ __ beq(CR0, Lthrow_ame);
// Found entry. Jump off!
// Argument and return type profiling.
__ profile_arguments_type(Rmethod2, Rscratch1, Rscratch2, true);
@@ -3796,8 +3795,8 @@ void TemplateTable::_new() {
__ addi(Rtags, Rtags, Array::base_offset_in_bytes());
__ lbzx(Rtags, Rindex, Rtags);
- __ cmpdi(CCR0, Rtags, JVM_CONSTANT_Class);
- __ bne(CCR0, Lslow_case);
+ __ cmpdi(CR0, Rtags, JVM_CONSTANT_Class);
+ __ bne(CR0, Lslow_case);
// Get instanceKlass
__ sldi(Roffset, Rindex, LogBytesPerWord);
@@ -3811,7 +3810,7 @@ void TemplateTable::_new() {
// Make sure klass is not abstract, or interface or java/lang/Class.
__ andi_(R0, Rinstance_size, Klass::_lh_instance_slow_path_bit); // slow path bit equals 0?
- __ bne(CCR0, Lslow_case);
+ __ bne(CR0, Lslow_case);
// --------------------------------------------------------------------------
// Fast case:
@@ -3830,8 +3829,8 @@ void TemplateTable::_new() {
__ add(RnewTopValue, Rinstance_size, RoldTopValue);
// If there is enough space, we do not CAS and do not clear.
- __ cmpld(CCR0, RnewTopValue, RendValue);
- __ bgt(CCR0, Lslow_case);
+ __ cmpld(CR0, RnewTopValue, RendValue);
+ __ bgt(CR0, Lslow_case);
__ std(RnewTopValue, in_bytes(JavaThread::tlab_top_offset()), R16_thread);
@@ -3948,8 +3947,8 @@ void TemplateTable::checkcast() {
Rtags = R12_scratch2;
// Null does not pass.
- __ cmpdi(CCR0, R17_tos, 0);
- __ beq(CCR0, Lis_null);
+ __ cmpdi(CR0, R17_tos, 0);
+ __ beq(CR0, Lis_null);
// Get constant pool tag to find out if the bytecode has already been "quickened".
__ get_cpool_and_tags(Rcpool, Rtags);
@@ -3959,8 +3958,8 @@ void TemplateTable::checkcast() {
__ addi(Rtags, Rtags, Array::base_offset_in_bytes());
__ lbzx(Rtags, Rtags, Roffset);
- __ cmpdi(CCR0, Rtags, JVM_CONSTANT_Class);
- __ beq(CCR0, Lquicked);
+ __ cmpdi(CR0, Rtags, JVM_CONSTANT_Class);
+ __ beq(CR0, Lquicked);
// Call into the VM to "quicken" instanceof.
__ push_ptr(); // for GC
@@ -4010,8 +4009,8 @@ void TemplateTable::instanceof() {
Rtags = R12_scratch2;
// Null does not pass.
- __ cmpdi(CCR0, R17_tos, 0);
- __ beq(CCR0, Lis_null);
+ __ cmpdi(CR0, R17_tos, 0);
+ __ beq(CR0, Lis_null);
// Get constant pool tag to find out if the bytecode has already been "quickened".
__ get_cpool_and_tags(Rcpool, Rtags);
@@ -4021,8 +4020,8 @@ void TemplateTable::instanceof() {
__ addi(Rtags, Rtags, Array::base_offset_in_bytes());
__ lbzx(Rtags, Rtags, Roffset);
- __ cmpdi(CCR0, Rtags, JVM_CONSTANT_Class);
- __ beq(CCR0, Lquicked);
+ __ cmpdi(CR0, Rtags, JVM_CONSTANT_Class);
+ __ beq(CR0, Lquicked);
// Call into the VM to "quicken" instanceof.
__ push_ptr(); // for GC
@@ -4128,8 +4127,8 @@ void TemplateTable::monitorenter() {
__ null_check_throw(Robj_to_lock, -1, Rscratch1);
// Check if any slot is present => short cut to allocation if not.
- __ cmpld(CCR0, Rcurrent_monitor, Rbot);
- __ beq(CCR0, Lallocate_new);
+ __ cmpld(CR0, Rcurrent_monitor, Rbot);
+ __ beq(CR0, Lallocate_new);
// ------------------------------------------------------------------------------
// Find a free slot in the monitor block.
@@ -4142,24 +4141,24 @@ void TemplateTable::monitorenter() {
__ ld(Rcurrent_obj, in_bytes(BasicObjectLock::obj_offset()), Rcurrent_monitor);
// Exit if current entry is for same object; this guarantees, that new monitor
// used for recursive lock is above the older one.
- __ cmpd(CCR0, Rcurrent_obj, Robj_to_lock);
- __ beq(CCR0, Lexit); // recursive locking
+ __ cmpd(CR0, Rcurrent_obj, Robj_to_lock);
+ __ beq(CR0, Lexit); // recursive locking
- __ cmpdi(CCR0, Rcurrent_obj, 0);
- __ bne(CCR0, LnotFree);
+ __ cmpdi(CR0, Rcurrent_obj, 0);
+ __ bne(CR0, LnotFree);
__ mr(Rfree_slot, Rcurrent_monitor); // remember free slot closest to the bottom
__ bind(LnotFree);
__ addi(Rcurrent_monitor, Rcurrent_monitor, frame::interpreter_frame_monitor_size_in_bytes());
- __ cmpld(CCR0, Rcurrent_monitor, Rbot);
- __ bne(CCR0, Lloop);
+ __ cmpld(CR0, Rcurrent_monitor, Rbot);
+ __ bne(CR0, Lloop);
__ bind(Lexit);
}
// ------------------------------------------------------------------------------
// Check if we found a free slot.
- __ cmpdi(CCR0, Rfree_slot, 0);
- __ bne(CCR0, Lfound);
+ __ cmpdi(CR0, Rfree_slot, 0);
+ __ bne(CR0, Lfound);
// We didn't find a free BasicObjLock => allocate one.
__ bind(Lallocate_new);
@@ -4207,8 +4206,8 @@ void TemplateTable::monitorexit() {
__ null_check_throw(Robj_to_lock, -1, Rscratch);
// Check corner case: unbalanced monitorEnter / Exit.
- __ cmpld(CCR0, Rcurrent_monitor, Rbot);
- __ beq(CCR0, Lillegal_monitor_state);
+ __ cmpld(CR0, Rcurrent_monitor, Rbot);
+ __ beq(CR0, Lillegal_monitor_state);
// Find the corresponding slot in the monitors stack section.
{
@@ -4217,12 +4216,12 @@ void TemplateTable::monitorexit() {
__ bind(Lloop);
__ ld(Rcurrent_obj, in_bytes(BasicObjectLock::obj_offset()), Rcurrent_monitor);
// Is this entry for same obj?
- __ cmpd(CCR0, Rcurrent_obj, Robj_to_lock);
- __ beq(CCR0, Lfound);
+ __ cmpd(CR0, Rcurrent_obj, Robj_to_lock);
+ __ beq(CR0, Lfound);
__ addi(Rcurrent_monitor, Rcurrent_monitor, frame::interpreter_frame_monitor_size_in_bytes());
- __ cmpld(CCR0, Rcurrent_monitor, Rbot);
- __ bne(CCR0, Lloop);
+ __ cmpld(CR0, Rcurrent_monitor, Rbot);
+ __ bne(CR0, Lloop);
}
// Fell through without finding the basic obj lock => throw up!
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..8ec69bffe15ea 100644
--- a/src/hotspot/cpu/ppc/vm_version_ppc.cpp
+++ b/src/hotspot/cpu/ppc/vm_version_ppc.cpp
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2024 SAP SE. All rights reserved.
+ * Copyright (c) 1997, 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 @@
*
*/
-#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()) {
@@ -132,6 +131,9 @@ void VM_Version::initialize() {
}
}
MaxVectorSize = SuperwordUseVSX ? 16 : 8;
+ if (FLAG_IS_DEFAULT(AlignVector)) {
+ FLAG_SET_ERGO(AlignVector, false);
+ }
if (PowerArchitecturePPC64 >= 9) {
if (FLAG_IS_DEFAULT(UseCountTrailingZerosInstructionsPPC64)) {
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..e25a8baa9da61 100644
--- a/src/hotspot/cpu/ppc/vtableStubs_ppc_64.cpp
+++ b/src/hotspot/cpu/ppc/vtableStubs_ppc_64.cpp
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2024 SAP SE. All rights reserved.
+ * Copyright (c) 1997, 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 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "code/compiledIC.hpp"
#include "code/vtableStubs.hpp"
@@ -92,8 +91,8 @@ VtableStub* VtableStubs::create_vtable_stub(int vtable_index) {
// Check offset vs vtable length.
const Register vtable_len = R12_scratch2;
__ lwz(vtable_len, in_bytes(Klass::vtable_length_offset()), rcvr_klass);
- __ cmpwi(CCR0, vtable_len, vtable_index*vtableEntry::size());
- __ bge(CCR0, L);
+ __ cmpwi(CR0, vtable_len, vtable_index*vtableEntry::size());
+ __ bge(CR0, L);
__ li(R12_scratch2, vtable_index);
__ call_VM(noreg, CAST_FROM_FN_PTR(address, bad_compiled_vtable_index), R3_ARG1, R12_scratch2, false);
__ bind(L);
@@ -109,8 +108,8 @@ VtableStub* VtableStubs::create_vtable_stub(int vtable_index) {
#ifndef PRODUCT
if (DebugVtables) {
Label L;
- __ cmpdi(CCR0, R19_method, 0);
- __ bne(CCR0, L);
+ __ cmpdi(CR0, R19_method, 0);
+ __ bne(CR0, L);
__ stop("Vtable entry is ZERO");
__ bind(L);
}
@@ -195,8 +194,8 @@ VtableStub* VtableStubs::create_itable_stub(int itable_index) {
#ifndef PRODUCT
if (DebugVtables) {
Label ok;
- __ cmpdi(CCR0, R19_method, 0);
- __ bne(CCR0, ok);
+ __ cmpdi(CR0, R19_method, 0);
+ __ bne(CR0, ok);
__ stop("method is null");
__ bind(ok);
}
diff --git a/src/hotspot/cpu/riscv/abstractInterpreter_riscv.cpp b/src/hotspot/cpu/riscv/abstractInterpreter_riscv.cpp
index 7e7321501cbbc..843a58e28d712 100644
--- a/src/hotspot/cpu/riscv/abstractInterpreter_riscv.cpp
+++ b/src/hotspot/cpu/riscv/abstractInterpreter_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
* Copyright (c) 2020, 2022, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -24,7 +24,6 @@
*
*/
-#include "precompiled.hpp"
#include "interpreter/interpreter.hpp"
#include "oops/constMethod.hpp"
#include "oops/klass.inline.hpp"
diff --git a/src/hotspot/cpu/riscv/assembler_riscv.cpp b/src/hotspot/cpu/riscv/assembler_riscv.cpp
index 6a581a4d08193..4659afc09b57c 100644
--- a/src/hotspot/cpu/riscv/assembler_riscv.cpp
+++ b/src/hotspot/cpu/riscv/assembler_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
* Copyright (c) 2020, 2022, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -27,7 +27,6 @@
#include
#include
-#include "precompiled.hpp"
#include "asm/assembler.hpp"
#include "asm/assembler.inline.hpp"
#include "compiler/disassembler.hpp"
diff --git a/src/hotspot/cpu/riscv/assembler_riscv.hpp b/src/hotspot/cpu/riscv/assembler_riscv.hpp
index 31713d7362a18..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
@@ -2015,10 +2292,10 @@ enum Nf {
}
INSN(add_uw, 0b0111011, 0b000, 0b0000100);
- INSN(rol, 0b0110011, 0b001, 0b0110000);
- INSN(rolw, 0b0111011, 0b001, 0b0110000);
- INSN(ror, 0b0110011, 0b101, 0b0110000);
- INSN(rorw, 0b0111011, 0b101, 0b0110000);
+ INSN(rolr, 0b0110011, 0b001, 0b0110000);
+ INSN(rolrw, 0b0111011, 0b001, 0b0110000);
+ INSN(rorr, 0b0110011, 0b101, 0b0110000);
+ INSN(rorrw, 0b0111011, 0b101, 0b0110000);
INSN(sh1add, 0b0110011, 0b010, 0b0010000);
INSN(sh2add, 0b0110011, 0b100, 0b0010000);
INSN(sh3add, 0b0110011, 0b110, 0b0010000);
@@ -2230,7 +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 7d673383cad26..5aa213fba7a7b 100644
--- a/src/hotspot/cpu/riscv/c1_LIRAssembler_arraycopy_riscv.cpp
+++ b/src/hotspot/cpu/riscv/c1_LIRAssembler_arraycopy_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2022, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/assembler.hpp"
#include "c1/c1_LIRAssembler.hpp"
#include "c1/c1_MacroAssembler.hpp"
@@ -211,7 +210,7 @@ void LIR_Assembler::arraycopy_type_check(Register src, Register src_pos, Registe
Label cont, slow;
#define PUSH(r1, r2) \
- __ addi(sp, sp, -2 * wordSize); \
+ __ subi(sp, sp, 2 * wordSize); \
__ sd(r1, Address(sp, 1 * wordSize)); \
__ sd(r2, Address(sp, 0));
@@ -337,10 +336,10 @@ void LIR_Assembler::arraycopy_prepare_params(Register src, Register src_pos, Reg
Register dst, Register dst_pos, BasicType basic_type) {
int scale = array_element_size(basic_type);
__ shadd(c_rarg0, src_pos, src, t0, scale);
- __ add(c_rarg0, c_rarg0, arrayOopDesc::base_offset_in_bytes(basic_type));
+ __ addi(c_rarg0, c_rarg0, arrayOopDesc::base_offset_in_bytes(basic_type));
assert_different_registers(c_rarg0, dst, dst_pos, length);
__ shadd(c_rarg1, dst_pos, dst, t0, scale);
- __ add(c_rarg1, c_rarg1, arrayOopDesc::base_offset_in_bytes(basic_type));
+ __ addi(c_rarg1, c_rarg1, arrayOopDesc::base_offset_in_bytes(basic_type));
assert_different_registers(c_rarg1, dst, length);
__ mv(c_rarg2, length);
assert_different_registers(c_rarg2, dst);
diff --git a/src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.cpp b/src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.cpp
index d587a557a7312..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:
@@ -1084,7 +1095,7 @@ void LIR_Assembler::typecheck_helper_slowcheck(ciKlass *k, Register obj, Registe
// check for self
__ beq(klass_RInfo, k_RInfo, *success_target);
- __ addi(sp, sp, -2 * wordSize); // 2: store k_RInfo and klass_RInfo
+ __ subi(sp, sp, 2 * wordSize); // 2: store k_RInfo and klass_RInfo
__ sd(k_RInfo, Address(sp, 0)); // sub klass
__ sd(klass_RInfo, Address(sp, wordSize)); // super klass
__ far_call(RuntimeAddress(Runtime1::entry_for(C1StubId::slow_subtype_check_id)));
@@ -1099,7 +1110,7 @@ void LIR_Assembler::typecheck_helper_slowcheck(ciKlass *k, Register obj, Registe
// perform the fast part of the checking logic
__ check_klass_subtype_fast_path(klass_RInfo, k_RInfo, Rtmp1, success_target, failure_target, nullptr);
// call out-of-line instance of __ check_klass_subtytpe_slow_path(...)
- __ addi(sp, sp, -2 * wordSize); // 2: store k_RInfo and klass_RInfo
+ __ subi(sp, sp, 2 * wordSize); // 2: store k_RInfo and klass_RInfo
__ sd(klass_RInfo, Address(sp, wordSize)); // sub klass
__ sd(k_RInfo, Address(sp, 0)); // super klass
__ far_call(RuntimeAddress(Runtime1::entry_for(C1StubId::slow_subtype_check_id)));
@@ -2139,7 +2150,7 @@ void LIR_Assembler::lir_store_slowcheck(Register k_RInfo, Register klass_RInfo,
// perform the fast part of the checking logic
__ check_klass_subtype_fast_path(klass_RInfo, k_RInfo, Rtmp1, success_target, failure_target, nullptr);
// call out-of-line instance of __ check_klass_subtype_slow_path(...)
- __ addi(sp, sp, -2 * wordSize); // 2: store k_RInfo and klass_RInfo
+ __ subi(sp, sp, 2 * wordSize); // 2: store k_RInfo and klass_RInfo
__ sd(klass_RInfo, Address(sp, wordSize)); // sub klass
__ sd(k_RInfo, Address(sp, 0)); // super klass
__ far_call(RuntimeAddress(Runtime1::entry_for(C1StubId::slow_subtype_check_id)));
diff --git a/src/hotspot/cpu/riscv/c1_LIRGenerator_riscv.cpp b/src/hotspot/cpu/riscv/c1_LIRGenerator_riscv.cpp
index b328d457192ba..3868c5ea8293c 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"
@@ -1103,6 +1102,11 @@ void LIRGenerator::do_InstanceOf(InstanceOf* x) {
x->direct_compare(), patching_info, x->profiled_method(), x->profiled_bci());
}
+// Intrinsic for Class::isInstance
+address LIRGenerator::isInstance_entry() {
+ return Runtime1::entry_for(C1StubId::is_instance_of_id);
+}
+
void LIRGenerator::do_If(If* x) {
// If should have two successors
assert(x->number_of_sux() == 2, "inconsistency");
diff --git a/src/hotspot/cpu/riscv/c1_LIR_riscv.cpp b/src/hotspot/cpu/riscv/c1_LIR_riscv.cpp
index 5f1c394ab3d46..6ce70f48cb459 100644
--- a/src/hotspot/cpu/riscv/c1_LIR_riscv.cpp
+++ b/src/hotspot/cpu/riscv/c1_LIR_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2021, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/register.hpp"
#include "c1/c1_LIR.hpp"
diff --git a/src/hotspot/cpu/riscv/c1_LinearScan_riscv.cpp b/src/hotspot/cpu/riscv/c1_LinearScan_riscv.cpp
index 78a61128bdd5d..8a6dfbbdf1eb4 100644
--- a/src/hotspot/cpu/riscv/c1_LinearScan_riscv.cpp
+++ b/src/hotspot/cpu/riscv/c1_LinearScan_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2022, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "c1/c1_Instruction.hpp"
#include "c1/c1_LinearScan.hpp"
#include "utilities/bitMap.inline.hpp"
diff --git a/src/hotspot/cpu/riscv/c1_MacroAssembler_riscv.cpp b/src/hotspot/cpu/riscv/c1_MacroAssembler_riscv.cpp
index ed932dddcd8d8..76089e8dd4536 100644
--- a/src/hotspot/cpu/riscv/c1_MacroAssembler_riscv.cpp
+++ b/src/hotspot/cpu/riscv/c1_MacroAssembler_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
* Copyright (c) 2020, 2022, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -24,7 +24,6 @@
*
*/
-#include "precompiled.hpp"
#include "c1/c1_LIR.hpp"
#include "c1/c1_MacroAssembler.hpp"
#include "c1/c1_Runtime1.hpp"
@@ -199,16 +198,16 @@ void C1_MacroAssembler::initialize_body(Register obj, Register len_in_bytes, int
Label done;
// len_in_bytes is positive and ptr sized
- sub(len_in_bytes, len_in_bytes, hdr_size_in_bytes);
+ subi(len_in_bytes, len_in_bytes, hdr_size_in_bytes);
beqz(len_in_bytes, done);
// Preserve obj
if (hdr_size_in_bytes) {
- add(obj, obj, hdr_size_in_bytes);
+ addi(obj, obj, hdr_size_in_bytes);
}
zero_memory(obj, len_in_bytes, tmp);
if (hdr_size_in_bytes) {
- sub(obj, obj, hdr_size_in_bytes);
+ subi(obj, obj, hdr_size_in_bytes);
}
bind(done);
@@ -262,7 +261,7 @@ void C1_MacroAssembler::initialize_object(Register obj, Register klass, Register
j(entry_point);
bind(loop);
- sub(index, index, 1);
+ subi(index, index, 1);
for (int i = -unroll; i < 0; i++) {
if (-i == remainder) {
bind(entry_point);
@@ -272,7 +271,7 @@ void C1_MacroAssembler::initialize_object(Register obj, Register klass, Register
if (remainder == 0) {
bind(entry_point);
}
- add(t0, t0, unroll * wordSize);
+ addi(t0, t0, unroll * wordSize);
bnez(index, loop);
}
}
@@ -301,7 +300,7 @@ void C1_MacroAssembler::allocate_array(Register obj, Register len, Register tmp1
// align object end
mv(arr_size, (int32_t)base_offset_in_bytes + MinObjAlignmentInBytesMask);
shadd(arr_size, len, arr_size, t0, f);
- andi(arr_size, arr_size, ~(uint)MinObjAlignmentInBytesMask);
+ andi(arr_size, arr_size, ~MinObjAlignmentInBytesMask);
try_allocate(obj, arr_size, 0, tmp1, tmp2, slow_case);
diff --git a/src/hotspot/cpu/riscv/c1_Runtime1_riscv.cpp b/src/hotspot/cpu/riscv/c1_Runtime1_riscv.cpp
index 6f59f5c2b9559..0f1f1dd891c51 100644
--- a/src/hotspot/cpu/riscv/c1_Runtime1_riscv.cpp
+++ b/src/hotspot/cpu/riscv/c1_Runtime1_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
* Copyright (c) 2020, 2023, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -24,7 +24,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/assembler.hpp"
#include "c1/c1_CodeStubs.hpp"
#include "c1/c1_Defs.hpp"
@@ -147,7 +146,7 @@ int StubAssembler::call_RT(Register oop_result, Register metadata_result, addres
const int arg1_sp_offset = 0;
const int arg2_sp_offset = 1;
const int arg3_sp_offset = 2;
- addi(sp, sp, -(arg_num + 1) * wordSize);
+ subi(sp, sp, (arg_num + 1) * wordSize);
sd(arg1, Address(sp, arg1_sp_offset * wordSize));
sd(arg2, Address(sp, arg2_sp_offset * wordSize));
sd(arg3, Address(sp, arg3_sp_offset * wordSize));
@@ -301,14 +300,14 @@ static OopMap* save_live_registers(StubAssembler* sasm,
if (save_fpu_registers) {
// float registers
- __ addi(sp, sp, -(FrameMap::nof_fpu_regs * wordSize));
+ __ subi(sp, sp, FrameMap::nof_fpu_regs * wordSize);
for (int i = 0; i < FrameMap::nof_fpu_regs; i++) {
__ fsd(as_FloatRegister(i), Address(sp, i * wordSize));
}
} else {
// we define reg_save_layout = 62 as the fixed frame size,
// we should also sub 32 * wordSize to sp when save_fpu_registers == false
- __ addi(sp, sp, -32 * wordSize);
+ __ subi(sp, sp, 32 * wordSize);
}
return generate_oop_map(sasm, save_fpu_registers);
@@ -543,7 +542,7 @@ void Runtime1::generate_unwind_exception(StubAssembler *sasm) {
// Save our return address because
// exception_handler_for_return_address will destroy it. We also
// save exception_oop
- __ addi(sp, sp, -2 * wordSize);
+ __ subi(sp, sp, 2 * wordSize);
__ sd(exception_oop, Address(sp, wordSize));
__ sd(ra, Address(sp));
@@ -883,7 +882,13 @@ OopMapSet* Runtime1::generate_code_for(C1StubId id, StubAssembler* sasm) {
__ ld(x10, Address(sp, (sup_k_off) * VMRegImpl::stack_slot_size)); // super klass
Label miss;
- __ check_klass_subtype_slow_path(x14, x10, x12, x15, nullptr, &miss);
+ __ check_klass_subtype_slow_path(x14, /*sub_klass*/
+ x10, /*super_klass*/
+ x12, /*tmp1_reg*/
+ x15, /*tmp2_reg*/
+ nullptr, /*L_success*/
+ &miss /*L_failure*/);
+ // Need extras for table lookup: x7, x11, x13
// fallthrough on success:
__ mv(t0, 1);
@@ -920,6 +925,52 @@ OopMapSet* Runtime1::generate_code_for(C1StubId id, StubAssembler* sasm) {
}
break;
+ case C1StubId::is_instance_of_id:
+ {
+ // Mirror: x10
+ // Object: x11
+ // Temps: x13, x14, x15, x16, x17
+ // Result: x10
+
+ // Get the Klass* into x16
+ Register klass = x16, obj = x11, result = x10;
+ __ ld(klass, Address(x10, java_lang_Class::klass_offset()));
+
+ Label fail, is_secondary, success;
+
+ __ beqz(klass, fail); // Klass is null
+ __ beqz(obj, fail); // obj is null
+
+ __ lwu(x13, Address(klass, in_bytes(Klass::super_check_offset_offset())));
+ __ mv(x17, in_bytes(Klass::secondary_super_cache_offset()));
+ __ beq(x13, x17, is_secondary); // Klass is a secondary superclass
+
+ // Klass is a concrete class
+ __ load_klass(x15, obj);
+ __ add(x17, x15, x13);
+ __ ld(x17, Address(x17));
+ __ beq(klass, x17, success);
+ __ mv(result, 0);
+ __ ret();
+
+ __ bind(is_secondary);
+ __ load_klass(obj, obj);
+
+ // This is necessary because I am never in my own secondary_super list.
+ __ beq(obj, klass, success);
+
+ __ lookup_secondary_supers_table_var(obj, klass, result, x13, x14, x15, x17, &success);
+
+ __ bind(fail);
+ __ mv(result, 0);
+ __ ret();
+
+ __ bind(success);
+ __ mv(result, 1);
+ __ ret();
+ }
+ break;
+
case C1StubId::monitorexit_nofpu_id:
save_fpu_registers = false;
// fall through
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 a075895cd6c95..e52cf7565beb0 100644
--- a/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp
+++ b/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2022, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/assembler.hpp"
#include "asm/assembler.inline.hpp"
#include "opto/c2_MacroAssembler.hpp"
@@ -211,16 +210,14 @@ void C2_MacroAssembler::fast_unlock(Register objectReg, Register boxReg,
// Handle existing monitor.
bind(object_has_monitor);
- STATIC_ASSERT(markWord::monitor_value <= INT_MAX);
- add(tmp, tmp, -(int)markWord::monitor_value); // monitor
-
+ subi(tmp, tmp, (int)markWord::monitor_value); // monitor
ld(disp_hdr, Address(tmp, ObjectMonitor::recursions_offset()));
Label notRecursive;
beqz(disp_hdr, notRecursive); // Will be 0 if not recursive.
// Recursive lock
- addi(disp_hdr, disp_hdr, -1);
+ subi(disp_hdr, disp_hdr, 1);
sd(disp_hdr, Address(tmp, ObjectMonitor::recursions_offset()));
j(unlocked);
@@ -537,7 +534,7 @@ void C2_MacroAssembler::fast_unlock_lightweight(Register obj, Register box,
if (!UseObjectMonitorTable) {
assert(tmp1_monitor == tmp1_mark, "should be the same here");
// Untag the monitor.
- add(tmp1_monitor, tmp1_mark, -(int)markWord::monitor_value);
+ subi(tmp1_monitor, tmp1_mark, (int)markWord::monitor_value);
} else {
ld(tmp1_monitor, Address(box, BasicLock::object_monitor_cache_offset_in_bytes()));
// No valid pointer below alignof(ObjectMonitor*). Take the slow path.
@@ -553,7 +550,7 @@ void C2_MacroAssembler::fast_unlock_lightweight(Register obj, Register box,
beqz(tmp2_recursions, not_recursive);
// Recursive unlock.
- addi(tmp2_recursions, tmp2_recursions, -1);
+ subi(tmp2_recursions, tmp2_recursions, 1);
sd(tmp2_recursions, Address(tmp1_monitor, ObjectMonitor::recursions_offset()));
j(unlocked);
@@ -732,7 +729,7 @@ void C2_MacroAssembler::string_indexof_char(Register str1, Register cnt1,
BLOCK_COMMENT("string_indexof_char {");
beqz(cnt1, NOMATCH);
- addi(t0, cnt1, isL ? -32 : -16);
+ subi(t0, cnt1, isL ? 32 : 16);
bgtz(t0, DO_LONG);
string_indexof_char_short(str1, cnt1, ch, result, isL);
j(DONE);
@@ -780,14 +777,15 @@ void C2_MacroAssembler::string_indexof_char(Register str1, Register cnt1,
bind(CH1_LOOP);
ld(ch1, Address(str1));
addi(str1, str1, 8);
- addi(cnt1, cnt1, -8);
+ subi(cnt1, cnt1, 8);
compute_match_mask(ch1, ch, match_mask, mask1, mask2);
bnez(match_mask, HIT);
bgtz(cnt1, CH1_LOOP);
j(NOMATCH);
bind(HIT);
- ctzc_bit(trailing_char, match_mask, isL, ch1, result);
+ // count bits of trailing zero chars
+ ctzc_bits(trailing_char, match_mask, isL, ch1, result);
srli(trailing_char, trailing_char, 3);
addi(cnt1, cnt1, 8);
ble(cnt1, trailing_char, NOMATCH);
@@ -956,7 +954,7 @@ void C2_MacroAssembler::string_indexof(Register haystack, Register needle,
const int ASIZE = 256;
const int STORE_BYTES = 8; // 8 bytes stored per instruction(sd)
- sub(sp, sp, ASIZE);
+ subi(sp, sp, ASIZE);
// init BC offset table with default value: needle_len
slli(t0, needle_len, 8);
@@ -975,16 +973,16 @@ void C2_MacroAssembler::string_indexof(Register haystack, Register needle,
for (int i = 0; i < 4; i++) {
sd(tmp5, Address(ch1, i * wordSize));
}
- add(ch1, ch1, 32);
- sub(tmp6, tmp6, 4);
+ addi(ch1, ch1, 32);
+ subi(tmp6, tmp6, 4);
bgtz(tmp6, BM_INIT_LOOP);
- sub(nlen_tmp, needle_len, 1); // m - 1, index of the last element in pattern
+ subi(nlen_tmp, needle_len, 1); // m - 1, index of the last element in pattern
Register orig_haystack = tmp5;
mv(orig_haystack, haystack);
// result_tmp = tmp4
shadd(haystack_end, result_tmp, haystack, haystack_end, haystack_chr_shift);
- sub(ch2, needle_len, 1); // bc offset init value, ch2 is t1
+ subi(ch2, needle_len, 1); // bc offset init value, ch2 is t1
mv(tmp3, needle);
// for (i = 0; i < m - 1; ) {
@@ -999,7 +997,7 @@ void C2_MacroAssembler::string_indexof(Register haystack, Register needle,
// }
bind(BCLOOP);
(this->*needle_load_1chr)(ch1, Address(tmp3), noreg);
- add(tmp3, tmp3, needle_chr_size);
+ addi(tmp3, tmp3, needle_chr_size);
if (!needle_isL) {
// ae == StrIntrinsicNode::UU
mv(tmp6, ASIZE);
@@ -1009,7 +1007,7 @@ void C2_MacroAssembler::string_indexof(Register haystack, Register needle,
sb(ch2, Address(tmp4)); // store skip offset to BC offset table
bind(BCSKIP);
- sub(ch2, ch2, 1); // for next pattern element, skip distance -1
+ subi(ch2, ch2, 1); // for next pattern element, skip distance -1
bgtz(ch2, BCLOOP);
// tmp6: pattern end, address after needle
@@ -1046,7 +1044,7 @@ void C2_MacroAssembler::string_indexof(Register haystack, Register needle,
// compare pattern to source string backward
shadd(result, nlen_tmp, haystack, result, haystack_chr_shift);
(this->*haystack_load_1chr)(skipch, Address(result), noreg);
- sub(nlen_tmp, nlen_tmp, firstStep); // nlen_tmp is positive here, because needle_len >= 8
+ subi(nlen_tmp, nlen_tmp, firstStep); // nlen_tmp is positive here, because needle_len >= 8
if (needle_isL == haystack_isL) {
// re-init tmp3. It's for free because it's executed in parallel with
// load above. Alternative is to initialize it before loop, but it'll
@@ -1065,7 +1063,7 @@ void C2_MacroAssembler::string_indexof(Register haystack, Register needle,
if (isLL) {
j(BMLOOPSTR1_AFTER_LOAD);
} else {
- sub(nlen_tmp, nlen_tmp, 1); // no need to branch for UU/UL case. cnt1 >= 8
+ subi(nlen_tmp, nlen_tmp, 1); // no need to branch for UU/UL case. cnt1 >= 8
j(BMLOOPSTR1_CMP);
}
@@ -1076,7 +1074,7 @@ void C2_MacroAssembler::string_indexof(Register haystack, Register needle,
(this->*haystack_load_1chr)(ch2, Address(ch2), noreg);
bind(BMLOOPSTR1_AFTER_LOAD);
- sub(nlen_tmp, nlen_tmp, 1);
+ subi(nlen_tmp, nlen_tmp, 1);
bltz(nlen_tmp, BMLOOPSTR1_LASTCMP);
bind(BMLOOPSTR1_CMP);
@@ -1098,11 +1096,11 @@ void C2_MacroAssembler::string_indexof(Register haystack, Register needle,
lbu(result_tmp, Address(result_tmp)); // load skip offset
bind(BMADV);
- sub(nlen_tmp, needle_len, 1);
+ subi(nlen_tmp, needle_len, 1);
// move haystack after bad char skip offset
shadd(haystack, result_tmp, haystack, result, haystack_chr_shift);
ble(haystack, haystack_end, BMLOOPSTR2);
- add(sp, sp, ASIZE);
+ addi(sp, sp, ASIZE);
j(NOMATCH);
bind(BMLOOPSTR1_LASTCMP);
@@ -1113,11 +1111,11 @@ void C2_MacroAssembler::string_indexof(Register haystack, Register needle,
if (!haystack_isL) {
srli(result, result, 1);
}
- add(sp, sp, ASIZE);
+ addi(sp, sp, ASIZE);
j(DONE);
bind(LINEARSTUB);
- sub(t0, needle_len, 16); // small patterns still should be handled by simple algorithm
+ subi(t0, needle_len, 16); // small patterns still should be handled by simple algorithm
bltz(t0, LINEARSEARCH);
mv(result, zr);
RuntimeAddress stub = nullptr;
@@ -1196,7 +1194,7 @@ void C2_MacroAssembler::string_indexof_linearscan(Register haystack, Register ne
if (needle_con_cnt == -1) {
Label DOSHORT, FIRST_LOOP, STR2_NEXT, STR1_LOOP, STR1_NEXT;
- sub(t0, needle_len, needle_isL == haystack_isL ? 4 : 2);
+ subi(t0, needle_len, needle_isL == haystack_isL ? 4 : 2);
bltz(t0, DOSHORT);
(this->*needle_load_1chr)(first, Address(needle), noreg);
@@ -1213,13 +1211,13 @@ void C2_MacroAssembler::string_indexof_linearscan(Register haystack, Register ne
beq(first, ch2, STR1_LOOP);
bind(STR2_NEXT);
- add(hlen_neg, hlen_neg, haystack_chr_size);
+ addi(hlen_neg, hlen_neg, haystack_chr_size);
blez(hlen_neg, FIRST_LOOP);
j(NOMATCH);
bind(STR1_LOOP);
- add(nlen_tmp, nlen_neg, needle_chr_size);
- add(hlen_tmp, hlen_neg, haystack_chr_size);
+ addi(nlen_tmp, nlen_neg, needle_chr_size);
+ addi(hlen_tmp, hlen_neg, haystack_chr_size);
bgez(nlen_tmp, MATCH);
bind(STR1_NEXT);
@@ -1228,14 +1226,14 @@ void C2_MacroAssembler::string_indexof_linearscan(Register haystack, Register ne
add(ch2, haystack, hlen_tmp);
(this->*haystack_load_1chr)(ch2, Address(ch2), noreg);
bne(ch1, ch2, STR2_NEXT);
- add(nlen_tmp, nlen_tmp, needle_chr_size);
- add(hlen_tmp, hlen_tmp, haystack_chr_size);
+ addi(nlen_tmp, nlen_tmp, needle_chr_size);
+ addi(hlen_tmp, hlen_tmp, haystack_chr_size);
bltz(nlen_tmp, STR1_NEXT);
j(MATCH);
bind(DOSHORT);
if (needle_isL == haystack_isL) {
- sub(t0, needle_len, 2);
+ subi(t0, needle_len, 2);
bltz(t0, DO1);
bgtz(t0, DO3);
}
@@ -1244,7 +1242,7 @@ void C2_MacroAssembler::string_indexof_linearscan(Register haystack, Register ne
if (needle_con_cnt == 4) {
Label CH1_LOOP;
(this->*load_4chr)(ch1, Address(needle), noreg);
- sub(result_tmp, haystack_len, 4);
+ subi(result_tmp, haystack_len, 4);
slli(tmp3, result_tmp, haystack_chr_shift); // result as tmp
add(haystack, haystack, tmp3);
neg(hlen_neg, tmp3);
@@ -1273,7 +1271,7 @@ void C2_MacroAssembler::string_indexof_linearscan(Register haystack, Register ne
(this->*load_4chr)(ch2, Address(tmp3), noreg);
}
beq(ch1, ch2, MATCH);
- add(hlen_neg, hlen_neg, haystack_chr_size);
+ addi(hlen_neg, hlen_neg, haystack_chr_size);
blez(hlen_neg, CH1_LOOP);
j(NOMATCH);
}
@@ -1284,7 +1282,7 @@ void C2_MacroAssembler::string_indexof_linearscan(Register haystack, Register ne
bind(DO2);
(this->*load_2chr)(ch1, Address(needle), noreg);
if (needle_con_cnt == 2) {
- sub(result_tmp, haystack_len, 2);
+ subi(result_tmp, haystack_len, 2);
}
slli(tmp3, result_tmp, haystack_chr_shift);
add(haystack, haystack, tmp3);
@@ -1307,7 +1305,7 @@ void C2_MacroAssembler::string_indexof_linearscan(Register haystack, Register ne
(this->*load_2chr)(ch2, Address(tmp3), noreg);
}
beq(ch1, ch2, MATCH);
- add(hlen_neg, hlen_neg, haystack_chr_size);
+ addi(hlen_neg, hlen_neg, haystack_chr_size);
blez(hlen_neg, CH1_LOOP);
j(NOMATCH);
BLOCK_COMMENT("} string_indexof DO2");
@@ -1321,7 +1319,7 @@ void C2_MacroAssembler::string_indexof_linearscan(Register haystack, Register ne
(this->*load_2chr)(first, Address(needle), noreg);
(this->*needle_load_1chr)(ch1, Address(needle, 2 * needle_chr_size), noreg);
if (needle_con_cnt == 3) {
- sub(result_tmp, haystack_len, 3);
+ subi(result_tmp, haystack_len, 3);
}
slli(hlen_tmp, result_tmp, haystack_chr_shift);
add(haystack, haystack, hlen_tmp);
@@ -1340,12 +1338,12 @@ void C2_MacroAssembler::string_indexof_linearscan(Register haystack, Register ne
beq(first, ch2, STR1_LOOP);
bind(STR2_NEXT);
- add(hlen_neg, hlen_neg, haystack_chr_size);
+ addi(hlen_neg, hlen_neg, haystack_chr_size);
blez(hlen_neg, FIRST_LOOP);
j(NOMATCH);
bind(STR1_LOOP);
- add(hlen_tmp, hlen_neg, 2 * haystack_chr_size);
+ addi(hlen_tmp, hlen_neg, 2 * haystack_chr_size);
add(ch2, haystack, hlen_tmp);
(this->*haystack_load_1chr)(ch2, Address(ch2), noreg);
bne(ch1, ch2, STR2_NEXT);
@@ -1359,7 +1357,7 @@ void C2_MacroAssembler::string_indexof_linearscan(Register haystack, Register ne
BLOCK_COMMENT("string_indexof DO1 {");
bind(DO1);
(this->*needle_load_1chr)(ch1, Address(needle), noreg);
- sub(result_tmp, haystack_len, 1);
+ subi(result_tmp, haystack_len, 1);
slli(tmp3, result_tmp, haystack_chr_shift);
add(haystack, haystack, tmp3);
neg(hlen_neg, tmp3);
@@ -1368,7 +1366,7 @@ void C2_MacroAssembler::string_indexof_linearscan(Register haystack, Register ne
add(tmp3, haystack, hlen_neg);
(this->*haystack_load_1chr)(ch2, Address(tmp3), noreg);
beq(ch1, ch2, MATCH);
- add(hlen_neg, hlen_neg, haystack_chr_size);
+ addi(hlen_neg, hlen_neg, haystack_chr_size);
blez(hlen_neg, DO1_LOOP);
BLOCK_COMMENT("} string_indexof DO1");
}
@@ -1411,6 +1409,14 @@ void C2_MacroAssembler::string_compare(Register str1, Register str2,
load_chr_insn str1_load_chr = str1_isL ? (load_chr_insn)&MacroAssembler::lbu : (load_chr_insn)&MacroAssembler::lhu;
load_chr_insn str2_load_chr = str2_isL ? (load_chr_insn)&MacroAssembler::lbu : (load_chr_insn)&MacroAssembler::lhu;
+ int base_offset1 = arrayOopDesc::base_offset_in_bytes(T_BYTE);
+ int base_offset2 = arrayOopDesc::base_offset_in_bytes(T_CHAR);
+
+ assert((base_offset1 % (UseCompactObjectHeaders ? 4 :
+ (UseCompressedClassPointers ? 8 : 4))) == 0, "Must be");
+ assert((base_offset2 % (UseCompactObjectHeaders ? 4 :
+ (UseCompressedClassPointers ? 8 : 4))) == 0, "Must be");
+
BLOCK_COMMENT("string_compare {");
// Bizarrely, the counts are passed in bytes, regardless of whether they
@@ -1428,6 +1434,24 @@ void C2_MacroAssembler::string_compare(Register str1, Register str2,
mv(cnt2, cnt1);
bind(L);
+ // Load 4 bytes once to compare for alignment before main loop. Note that this
+ // is only possible for LL/UU case. We need to resort to load_long_misaligned
+ // for both LU and UL cases.
+ if (str1_isL == str2_isL) { // LL or UU
+ beq(str1, str2, DONE);
+ int base_offset = isLL ? base_offset1 : base_offset2;
+ if (AvoidUnalignedAccesses && (base_offset % 8) != 0) {
+ mv(t0, minCharsInWord / 2);
+ ble(cnt2, t0, SHORT_STRING);
+ lwu(tmp1, Address(str1));
+ lwu(tmp2, Address(str2));
+ bne(tmp1, tmp2, DIFFERENCE);
+ addi(str1, str1, 4);
+ addi(str2, str2, 4);
+ subi(cnt2, cnt2, minCharsInWord / 2);
+ }
+ }
+
// A very short string
mv(t0, minCharsInWord);
ble(cnt2, t0, SHORT_STRING);
@@ -1436,14 +1460,22 @@ void C2_MacroAssembler::string_compare(Register str1, Register str2,
// load first parts of strings and finish initialization while loading
{
if (str1_isL == str2_isL) { // LL or UU
- // check if str1 and str2 is same pointer
- beq(str1, str2, DONE);
+#ifdef ASSERT
+ if (AvoidUnalignedAccesses) {
+ Label align_ok;
+ orr(t0, str1, str2);
+ andi(t0, t0, 0x7);
+ beqz(t0, align_ok);
+ stop("bad alignment");
+ bind(align_ok);
+ }
+#endif
// load 8 bytes once to compare
ld(tmp1, Address(str1));
ld(tmp2, Address(str2));
mv(t0, STUB_THRESHOLD);
bge(cnt2, t0, STUB);
- sub(cnt2, cnt2, minCharsInWord);
+ subi(cnt2, cnt2, minCharsInWord);
beqz(cnt2, TAIL_CHECK);
// convert cnt2 from characters to bytes
if (!str1_isL) {
@@ -1453,11 +1485,11 @@ void C2_MacroAssembler::string_compare(Register str1, Register str2,
add(str1, str1, cnt2);
sub(cnt2, zr, cnt2);
} else if (isLU) { // LU case
- lwu(tmp1, Address(str1));
- ld(tmp2, Address(str2));
mv(t0, STUB_THRESHOLD);
bge(cnt2, t0, STUB);
- addi(cnt2, cnt2, -4);
+ lwu(tmp1, Address(str1));
+ load_long_misaligned(tmp2, Address(str2), tmp3, (base_offset2 % 8) != 0 ? 4 : 8);
+ subi(cnt2, cnt2, 4);
add(str1, str1, cnt2);
sub(cnt1, zr, cnt2);
slli(cnt2, cnt2, 1);
@@ -1467,11 +1499,11 @@ void C2_MacroAssembler::string_compare(Register str1, Register str2,
sub(cnt2, zr, cnt2);
addi(cnt1, cnt1, 4);
} else { // UL case
- ld(tmp1, Address(str1));
- lwu(tmp2, Address(str2));
mv(t0, STUB_THRESHOLD);
bge(cnt2, t0, STUB);
- addi(cnt2, cnt2, -4);
+ load_long_misaligned(tmp1, Address(str1), tmp3, (base_offset2 % 8) != 0 ? 4 : 8);
+ lwu(tmp2, Address(str2));
+ subi(cnt2, cnt2, 4);
slli(t0, cnt2, 1);
sub(cnt1, zr, t0);
add(str1, str1, t0);
@@ -1488,6 +1520,7 @@ void C2_MacroAssembler::string_compare(Register str1, Register str2,
// main loop
bind(NEXT_WORD);
if (str1_isL == str2_isL) { // LL or UU
+ // 8-byte aligned loads when AvoidUnalignedAccesses is enabled
add(t0, str1, cnt2);
ld(tmp1, Address(t0));
add(t0, str2, cnt2);
@@ -1497,7 +1530,7 @@ void C2_MacroAssembler::string_compare(Register str1, Register str2,
add(t0, str1, cnt1);
lwu(tmp1, Address(t0));
add(t0, str2, cnt2);
- ld(tmp2, Address(t0));
+ load_long_misaligned(tmp2, Address(t0), tmp3, (base_offset2 % 8) != 0 ? 4 : 8);
addi(cnt1, cnt1, 4);
inflate_lo32(tmp3, tmp1);
mv(tmp1, tmp3);
@@ -1506,7 +1539,7 @@ void C2_MacroAssembler::string_compare(Register str1, Register str2,
add(t0, str2, cnt2);
lwu(tmp2, Address(t0));
add(t0, str1, cnt1);
- ld(tmp1, Address(t0));
+ load_long_misaligned(tmp1, Address(t0), tmp3, (base_offset2 % 8) != 0 ? 4 : 8);
inflate_lo32(tmp3, tmp2);
mv(tmp2, tmp3);
addi(cnt1, cnt1, 8);
@@ -1536,7 +1569,8 @@ void C2_MacroAssembler::string_compare(Register str1, Register str2,
// compute their difference.
bind(DIFFERENCE);
xorr(tmp3, tmp1, tmp2);
- ctzc_bit(result, tmp3, isLL); // count zero from lsb to msb
+ // count bits of trailing zero chars
+ ctzc_bits(result, tmp3, isLL);
srl(tmp1, tmp1, result);
srl(tmp2, tmp2, result);
if (isLL) {
@@ -1584,13 +1618,13 @@ void C2_MacroAssembler::string_compare(Register str1, Register str2,
// while comparing previous
(this->*str1_load_chr)(tmp1, Address(str1), t0);
addi(str1, str1, str1_chr_size);
- addi(cnt2, cnt2, -1);
+ subi(cnt2, cnt2, 1);
beqz(cnt2, SHORT_LAST_INIT);
(this->*str2_load_chr)(cnt1, Address(str2), t0);
addi(str2, str2, str2_chr_size);
j(SHORT_LOOP_START);
bind(SHORT_LOOP);
- addi(cnt2, cnt2, -1);
+ subi(cnt2, cnt2, 1);
beqz(cnt2, SHORT_LAST);
bind(SHORT_LOOP_START);
(this->*str1_load_chr)(tmp2, Address(str1), t0);
@@ -1598,7 +1632,7 @@ void C2_MacroAssembler::string_compare(Register str1, Register str2,
(this->*str2_load_chr)(t0, Address(str2), t0);
addi(str2, str2, str2_chr_size);
bne(tmp1, cnt1, SHORT_LOOP_TAIL);
- addi(cnt2, cnt2, -1);
+ subi(cnt2, cnt2, 1);
beqz(cnt2, SHORT_LAST2);
(this->*str1_load_chr)(tmp1, Address(str1), t0);
addi(str1, str1, str1_chr_size);
@@ -1633,11 +1667,14 @@ void C2_MacroAssembler::arrays_equals(Register a1, Register a2,
assert(elem_size == 1 || elem_size == 2, "must be char or byte");
assert_different_registers(a1, a2, result, tmp1, tmp2, tmp3, t0);
- int elem_per_word = wordSize/elem_size;
+ int elem_per_word = wordSize / elem_size;
int log_elem_size = exact_log2(elem_size);
int length_offset = arrayOopDesc::length_offset_in_bytes();
int base_offset = arrayOopDesc::base_offset_in_bytes(elem_size == 2 ? T_CHAR : T_BYTE);
+ assert((base_offset % (UseCompactObjectHeaders ? 4 :
+ (UseCompressedClassPointers ? 8 : 4))) == 0, "Must be");
+
Register cnt1 = tmp3;
Register cnt2 = tmp1; // cnt2 only used in array length compare
Label DONE, SAME, NEXT_WORD, SHORT, TAIL03, TAIL01;
@@ -1661,15 +1698,38 @@ void C2_MacroAssembler::arrays_equals(Register a1, Register a2,
la(a1, Address(a1, base_offset));
la(a2, Address(a2, base_offset));
+
+ // Load 4 bytes once to compare for alignment before main loop.
+ if (AvoidUnalignedAccesses && (base_offset % 8) != 0) {
+ subi(cnt1, cnt1, elem_per_word / 2);
+ bltz(cnt1, TAIL03);
+ lwu(tmp1, Address(a1));
+ lwu(tmp2, Address(a2));
+ addi(a1, a1, 4);
+ addi(a2, a2, 4);
+ bne(tmp1, tmp2, DONE);
+ }
+
// Check for short strings, i.e. smaller than wordSize.
- addi(cnt1, cnt1, -elem_per_word);
+ subi(cnt1, cnt1, elem_per_word);
bltz(cnt1, SHORT);
+#ifdef ASSERT
+ if (AvoidUnalignedAccesses) {
+ Label align_ok;
+ orr(t0, a1, a2);
+ andi(t0, t0, 0x7);
+ beqz(t0, align_ok);
+ stop("bad alignment");
+ bind(align_ok);
+ }
+#endif
+
// Main 8 byte comparison loop.
bind(NEXT_WORD); {
ld(tmp1, Address(a1));
ld(tmp2, Address(a2));
- addi(cnt1, cnt1, -elem_per_word);
+ subi(cnt1, cnt1, elem_per_word);
addi(a1, a1, wordSize);
addi(a2, a2, wordSize);
bne(tmp1, tmp2, DONE);
@@ -1730,25 +1790,52 @@ void C2_MacroAssembler::arrays_equals(Register a1, Register a2,
void C2_MacroAssembler::string_equals(Register a1, Register a2,
Register result, Register cnt1)
{
- Label SAME, DONE, SHORT, NEXT_WORD;
+ Label SAME, DONE, SHORT, NEXT_WORD, TAIL03, TAIL01;
Register tmp1 = t0;
Register tmp2 = t1;
assert_different_registers(a1, a2, result, cnt1, tmp1, tmp2);
+ int base_offset = arrayOopDesc::base_offset_in_bytes(T_BYTE);
+
+ assert((base_offset % (UseCompactObjectHeaders ? 4 :
+ (UseCompressedClassPointers ? 8 : 4))) == 0, "Must be");
+
BLOCK_COMMENT("string_equals {");
mv(result, false);
+ // Load 4 bytes once to compare for alignment before main loop.
+ if (AvoidUnalignedAccesses && (base_offset % 8) != 0) {
+ subi(cnt1, cnt1, 4);
+ bltz(cnt1, TAIL03);
+ lwu(tmp1, Address(a1));
+ lwu(tmp2, Address(a2));
+ addi(a1, a1, 4);
+ addi(a2, a2, 4);
+ bne(tmp1, tmp2, DONE);
+ }
+
// Check for short strings, i.e. smaller than wordSize.
- addi(cnt1, cnt1, -wordSize);
+ subi(cnt1, cnt1, wordSize);
bltz(cnt1, SHORT);
+#ifdef ASSERT
+ if (AvoidUnalignedAccesses) {
+ Label align_ok;
+ orr(t0, a1, a2);
+ andi(t0, t0, 0x7);
+ beqz(t0, align_ok);
+ stop("bad alignment");
+ bind(align_ok);
+ }
+#endif
+
// Main 8 byte comparison loop.
bind(NEXT_WORD); {
ld(tmp1, Address(a1));
ld(tmp2, Address(a2));
- addi(cnt1, cnt1, -wordSize);
+ subi(cnt1, cnt1, wordSize);
addi(a1, a1, wordSize);
addi(a2, a2, wordSize);
bne(tmp1, tmp2, DONE);
@@ -1758,8 +1845,6 @@ void C2_MacroAssembler::string_equals(Register a1, Register a2,
beqz(tmp1, SAME);
bind(SHORT);
- Label TAIL03, TAIL01;
-
// 0-7 bytes left.
test_bit(tmp1, cnt1, 2);
beqz(tmp1, TAIL03);
@@ -1836,7 +1921,7 @@ void C2_MacroAssembler::arrays_hashcode(Register ary, Register cnt, Register res
beqz(cnt, DONE);
- andi(chunks, cnt, ~(stride-1));
+ andi(chunks, cnt, ~(stride - 1));
beqz(chunks, TAIL);
mv(pow31_4, 923521); // [31^^4]
@@ -1845,7 +1930,7 @@ void C2_MacroAssembler::arrays_hashcode(Register ary, Register cnt, Register res
slli(chunks_end, chunks, chunks_end_shift);
add(chunks_end, ary, chunks_end);
- andi(cnt, cnt, stride-1); // don't forget about tail!
+ andi(cnt, cnt, stride - 1); // don't forget about tail!
bind(WIDE_LOOP);
mulw(result, result, pow31_4); // 31^^4 * h
@@ -2050,7 +2135,8 @@ void C2_MacroAssembler::enc_cmove(int cmpFlag, Register op1, Register op2, Regis
// Set dst to NaN if any NaN input.
void C2_MacroAssembler::minmax_fp(FloatRegister dst, FloatRegister src1, FloatRegister src2,
bool is_double, bool is_min) {
- assert_different_registers(dst, src1, src2);
+ assert_different_registers(dst, src1);
+ assert_different_registers(dst, src2);
Label Done, Compare;
@@ -2059,7 +2145,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 +2239,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 +2455,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);
@@ -2513,6 +2599,9 @@ void C2_MacroAssembler::arrays_equals_v(Register a1, Register a2, Register resul
int length_offset = arrayOopDesc::length_offset_in_bytes();
int base_offset = arrayOopDesc::base_offset_in_bytes(elem_size == 2 ? T_CHAR : T_BYTE);
+ assert((base_offset % (UseCompactObjectHeaders ? 4 :
+ (UseCompressedClassPointers ? 8 : 4))) == 0, "Must be");
+
BLOCK_COMMENT("arrays_equals_v {");
// if (a1 == a2), return true
@@ -2866,6 +2955,45 @@ void C2_MacroAssembler::reduce_integral_v(Register dst, Register src1,
vmv_x_s(dst, tmp);
}
+void C2_MacroAssembler::reduce_mul_integral_v(Register dst, Register src1, VectorRegister src2,
+ VectorRegister vtmp1, VectorRegister vtmp2,
+ BasicType bt, uint vector_length, VectorMask vm) {
+ assert(bt == T_BYTE || bt == T_SHORT || bt == T_INT || bt == T_LONG, "unsupported element type");
+ vsetvli_helper(bt, vector_length);
+
+ vector_length /= 2;
+ if (vm != Assembler::unmasked) {
+ // This behaviour is consistent with spec requirements of vector API, for `reduceLanes`:
+ // If no elements are selected, an operation-specific identity value is returned.
+ // If the operation is MUL, then the identity value is one.
+ vmv_v_i(vtmp1, 1);
+ vmerge_vvm(vtmp2, vtmp1, src2); // vm == v0
+ vslidedown_vi(vtmp1, vtmp2, vector_length);
+
+ vsetvli_helper(bt, vector_length);
+ vmul_vv(vtmp1, vtmp1, vtmp2);
+ } else {
+ vslidedown_vi(vtmp1, src2, vector_length);
+
+ vsetvli_helper(bt, vector_length);
+ vmul_vv(vtmp1, vtmp1, src2);
+ }
+
+ while (vector_length > 1) {
+ vector_length /= 2;
+ vslidedown_vi(vtmp2, vtmp1, vector_length);
+ vsetvli_helper(bt, vector_length);
+ vmul_vv(vtmp1, vtmp1, vtmp2);
+ }
+
+ vmv_x_s(dst, vtmp1);
+ if (bt == T_INT) {
+ mulw(dst, dst, src1);
+ } else {
+ mul(dst, dst, src1);
+ }
+}
+
// Set vl and vtype for full and partial vector operations.
// (vma = mu, vta = tu, vill = false)
void C2_MacroAssembler::vsetvli_helper(BasicType bt, uint vector_length, LMUL vlmul, Register tmp) {
diff --git a/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.hpp b/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.hpp
index 114ad0a101c23..c79c360d2eb67 100644
--- a/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.hpp
+++ b/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.hpp
@@ -239,6 +239,10 @@
int opc, BasicType bt, uint vector_length,
VectorMask vm = Assembler::unmasked);
+ void reduce_mul_integral_v(Register dst, Register src1, VectorRegister src2,
+ VectorRegister vtmp1, VectorRegister vtmp2, BasicType bt,
+ uint vector_length, VectorMask vm = Assembler::unmasked);
+
void vsetvli_helper(BasicType bt, uint vector_length, LMUL vlmul = Assembler::m1, Register tmp = t0);
void compare_integral_v(VectorRegister dst, VectorRegister src1, VectorRegister src2, int cond,
diff --git a/src/hotspot/cpu/riscv/c2_init_riscv.cpp b/src/hotspot/cpu/riscv/c2_init_riscv.cpp
index cdbd69807bee1..70a024f7f8afc 100644
--- a/src/hotspot/cpu/riscv/c2_init_riscv.cpp
+++ b/src/hotspot/cpu/riscv/c2_init_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2019, Red Hat Inc. All rights reserved.
* Copyright (c) 2020, 2022, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -24,7 +24,6 @@
*
*/
-#include "precompiled.hpp"
#include "opto/compile.hpp"
#include "opto/node.hpp"
diff --git a/src/hotspot/cpu/riscv/codeBuffer_riscv.cpp b/src/hotspot/cpu/riscv/codeBuffer_riscv.cpp
index e99183a5b5d91..280b3bd54e5ce 100644
--- a/src/hotspot/cpu/riscv/codeBuffer_riscv.cpp
+++ b/src/hotspot/cpu/riscv/codeBuffer_riscv.cpp
@@ -24,7 +24,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/codeBuffer.inline.hpp"
#include "asm/macroAssembler.hpp"
diff --git a/src/hotspot/cpu/riscv/codeBuffer_riscv.hpp b/src/hotspot/cpu/riscv/codeBuffer_riscv.hpp
index a864d7073dcfb..f541ac117eba0 100644
--- a/src/hotspot/cpu/riscv/codeBuffer_riscv.hpp
+++ b/src/hotspot/cpu/riscv/codeBuffer_riscv.hpp
@@ -33,6 +33,6 @@
public:
void flush_bundle(bool start_new_bundle) {}
- static bool supports_shared_stubs() { return false; }
+ static bool supports_shared_stubs() { return true; }
#endif // CPU_RISCV_CODEBUFFER_RISCV_HPP
diff --git a/src/hotspot/cpu/riscv/compiledIC_riscv.cpp b/src/hotspot/cpu/riscv/compiledIC_riscv.cpp
index 65f3aa263aa02..a86e65ab58086 100644
--- a/src/hotspot/cpu/riscv/compiledIC_riscv.cpp
+++ b/src/hotspot/cpu/riscv/compiledIC_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2018, Red Hat Inc. All rights reserved.
* Copyright (c) 2020, 2021, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -24,7 +24,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "code/compiledIC.hpp"
#include "code/nmethod.hpp"
diff --git a/src/hotspot/cpu/riscv/compressedKlass_riscv.cpp b/src/hotspot/cpu/riscv/compressedKlass_riscv.cpp
index 7e596e0a7e99a..a2e732025d539 100644
--- a/src/hotspot/cpu/riscv/compressedKlass_riscv.cpp
+++ b/src/hotspot/cpu/riscv/compressedKlass_riscv.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2023, Red Hat, Inc. All rights reserved.
- * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "oops/compressedKlass.hpp"
#include "utilities/globalDefinitions.hpp"
@@ -31,7 +30,7 @@ char* CompressedKlassPointers::reserve_address_space_for_compressed_classes(size
char* result = nullptr;
- // RiscV loads a 64-bit immediate in up to four separate steps, splitting it into four different sections
+ // RISC-V loads a 64-bit immediate in up to four separate steps, splitting it into four different sections
// (two 32-bit sections, each split into two subsections of 20/12 bits).
//
// 63 ....... 44 43 ... 32 31 ....... 12 11 ... 0
@@ -51,11 +50,6 @@ char* CompressedKlassPointers::reserve_address_space_for_compressed_classes(size
// with one instruction (2)
result = reserve_address_space_for_unscaled_encoding(size, aslr);
- // Failing that, attempt to reserve for base=zero shift>0
- if (result == nullptr && optimize_for_zero_base) {
- result = reserve_address_space_for_zerobased_encoding(size, aslr);
- }
-
// Failing that, optimize for case (3) - a base with only bits set between [32-44)
if (result == nullptr) {
const uintptr_t from = nth_bit(32);
diff --git a/src/hotspot/cpu/riscv/downcallLinker_riscv.cpp b/src/hotspot/cpu/riscv/downcallLinker_riscv.cpp
index 97b168a98119e..1edb30a36ea78 100644
--- a/src/hotspot/cpu/riscv/downcallLinker_riscv.cpp
+++ b/src/hotspot/cpu/riscv/downcallLinker_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2023, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.hpp"
#include "code/codeBlob.hpp"
#include "code/codeCache.hpp"
diff --git a/src/hotspot/cpu/riscv/foreignGlobals_riscv.cpp b/src/hotspot/cpu/riscv/foreignGlobals_riscv.cpp
index 2975b088b0c19..339e205c48afe 100644
--- a/src/hotspot/cpu/riscv/foreignGlobals_riscv.cpp
+++ b/src/hotspot/cpu/riscv/foreignGlobals_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2023, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "code/vmreg.inline.hpp"
#include "runtime/jniHandles.hpp"
#include "runtime/jniHandles.inline.hpp"
diff --git a/src/hotspot/cpu/riscv/frame_riscv.cpp b/src/hotspot/cpu/riscv/frame_riscv.cpp
index ecc450bd6b254..8ee6d11dcaf39 100644
--- a/src/hotspot/cpu/riscv/frame_riscv.cpp
+++ b/src/hotspot/cpu/riscv/frame_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved.
* Copyright (c) 2020, 2023, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -24,7 +24,6 @@
*
*/
-#include "precompiled.hpp"
#include "compiler/oopMap.hpp"
#include "interpreter/interpreter.hpp"
#include "memory/resourceArea.hpp"
@@ -158,6 +157,11 @@ bool frame::safe_for_sender(JavaThread *thread) {
}
if (Continuation::is_return_barrier_entry(sender_pc)) {
+ // sender_pc might be invalid so check that the frame
+ // actually belongs to a Continuation.
+ if (!Continuation::is_frame_in_continuation(thread, *this)) {
+ return false;
+ }
// If our sender_pc is the return barrier, then our "real" sender is the continuation entry
frame s = Continuation::continuation_bottom_sender(thread, *this, sender_sp);
sender_sp = s.sp();
diff --git a/src/hotspot/cpu/riscv/gc/g1/g1BarrierSetAssembler_riscv.cpp b/src/hotspot/cpu/riscv/gc/g1/g1BarrierSetAssembler_riscv.cpp
index 6a3e4f95b9848..ef5dcdd8074a3 100644
--- a/src/hotspot/cpu/riscv/gc/g1/g1BarrierSetAssembler_riscv.cpp
+++ b/src/hotspot/cpu/riscv/gc/g1/g1BarrierSetAssembler_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2024, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "gc/g1/g1BarrierSet.hpp"
#include "gc/g1/g1BarrierSetAssembler.hpp"
@@ -106,7 +105,7 @@ static void generate_queue_test_and_insertion(MacroAssembler* masm, ByteSize ind
__ ld(tmp1, Address(thread, in_bytes(index_offset))); // tmp1 := *(index address)
__ beqz(tmp1, runtime); // jump to runtime if index == 0 (full buffer)
// The buffer is not full, store value into it.
- __ sub(tmp1, tmp1, wordSize); // tmp1 := next index
+ __ subi(tmp1, tmp1, wordSize); // tmp1 := next index
__ sd(tmp1, Address(thread, in_bytes(index_offset))); // *(index address) := next index
__ ld(tmp2, Address(thread, in_bytes(buffer_offset))); // tmp2 := buffer address
__ add(tmp2, tmp2, tmp1);
@@ -490,7 +489,7 @@ void G1BarrierSetAssembler::generate_c1_pre_barrier_runtime_stub(StubAssembler*
__ ld(tmp, queue_index);
__ beqz(tmp, runtime);
- __ sub(tmp, tmp, wordSize);
+ __ subi(tmp, tmp, wordSize);
__ sd(tmp, queue_index);
__ ld(t1, buffer);
__ add(tmp, tmp, t1);
@@ -557,7 +556,7 @@ void G1BarrierSetAssembler::generate_c1_post_barrier_runtime_stub(StubAssembler*
__ ld(t0, queue_index);
__ beqz(t0, runtime);
- __ sub(t0, t0, wordSize);
+ __ subi(t0, t0, wordSize);
__ sd(t0, queue_index);
// Reuse RA to hold buffer_addr
diff --git a/src/hotspot/cpu/riscv/gc/shared/barrierSetAssembler_riscv.cpp b/src/hotspot/cpu/riscv/gc/shared/barrierSetAssembler_riscv.cpp
index d96d405aa2282..c49c8406befec 100644
--- a/src/hotspot/cpu/riscv/gc/shared/barrierSetAssembler_riscv.cpp
+++ b/src/hotspot/cpu/riscv/gc/shared/barrierSetAssembler_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2023, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "classfile/classLoaderData.hpp"
#include "gc/shared/barrierSet.hpp"
#include "gc/shared/barrierSetAssembler.hpp"
diff --git a/src/hotspot/cpu/riscv/gc/shared/barrierSetNMethod_riscv.cpp b/src/hotspot/cpu/riscv/gc/shared/barrierSetNMethod_riscv.cpp
index 5373704c078a8..39da77181c674 100644
--- a/src/hotspot/cpu/riscv/gc/shared/barrierSetNMethod_riscv.cpp
+++ b/src/hotspot/cpu/riscv/gc/shared/barrierSetNMethod_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2022, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "code/codeCache.hpp"
#include "code/nativeInst.hpp"
#include "gc/shared/barrierSetAssembler.hpp"
diff --git a/src/hotspot/cpu/riscv/gc/shared/cardTableBarrierSetAssembler_riscv.cpp b/src/hotspot/cpu/riscv/gc/shared/cardTableBarrierSetAssembler_riscv.cpp
index 2ad44400687f2..df7ff65442ef9 100644
--- a/src/hotspot/cpu/riscv/gc/shared/cardTableBarrierSetAssembler_riscv.cpp
+++ b/src/hotspot/cpu/riscv/gc/shared/cardTableBarrierSetAssembler_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2022, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "gc/shared/barrierSet.hpp"
#include "gc/shared/cardTable.hpp"
@@ -69,7 +68,7 @@ void CardTableBarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembl
__ beqz(count, L_done); // zero count - nothing to do
// end = start + count << LogBytesPerHeapOop
__ shadd(end, count, start, count, LogBytesPerHeapOop);
- __ sub(end, end, BytesPerHeapOop); // last element address to make inclusive
+ __ subi(end, end, BytesPerHeapOop); // last element address to make inclusive
__ srli(start, start, CardTable::card_shift());
__ srli(end, end, CardTable::card_shift());
@@ -81,7 +80,7 @@ void CardTableBarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembl
__ bind(L_loop);
__ add(tmp, start, count);
__ sb(zr, Address(tmp));
- __ sub(count, count, 1);
+ __ subi(count, count, 1);
__ bgez(count, L_loop);
__ bind(L_done);
}
diff --git a/src/hotspot/cpu/riscv/gc/shared/modRefBarrierSetAssembler_riscv.cpp b/src/hotspot/cpu/riscv/gc/shared/modRefBarrierSetAssembler_riscv.cpp
index f2b0face0a9d3..6b0871007f488 100644
--- a/src/hotspot/cpu/riscv/gc/shared/modRefBarrierSetAssembler_riscv.cpp
+++ b/src/hotspot/cpu/riscv/gc/shared/modRefBarrierSetAssembler_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2022, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "gc/shared/modRefBarrierSetAssembler.hpp"
diff --git a/src/hotspot/cpu/riscv/gc/shenandoah/c1/shenandoahBarrierSetC1_riscv.cpp b/src/hotspot/cpu/riscv/gc/shenandoah/c1/shenandoahBarrierSetC1_riscv.cpp
index d15b3aa31f905..2a96bd32cf8d7 100644
--- a/src/hotspot/cpu/riscv/gc/shenandoah/c1/shenandoahBarrierSetC1_riscv.cpp
+++ b/src/hotspot/cpu/riscv/gc/shenandoah/c1/shenandoahBarrierSetC1_riscv.cpp
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "c1/c1_LIRAssembler.hpp"
#include "c1/c1_MacroAssembler.hpp"
#include "gc/shared/gc_globals.hpp"
diff --git a/src/hotspot/cpu/riscv/gc/shenandoah/shenandoahBarrierSetAssembler_riscv.cpp b/src/hotspot/cpu/riscv/gc/shenandoah/shenandoahBarrierSetAssembler_riscv.cpp
index 257d445f01187..97b83d78811a8 100644
--- a/src/hotspot/cpu/riscv/gc/shenandoah/shenandoahBarrierSetAssembler_riscv.cpp
+++ b/src/hotspot/cpu/riscv/gc/shenandoah/shenandoahBarrierSetAssembler_riscv.cpp
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "gc/shenandoah/shenandoahBarrierSet.hpp"
#include "gc/shenandoah/shenandoahBarrierSetAssembler.hpp"
#include "gc/shenandoah/shenandoahForwarding.hpp"
@@ -143,7 +142,7 @@ void ShenandoahBarrierSetAssembler::satb_write_barrier_pre(MacroAssembler* masm,
__ ld(tmp1, index); // tmp := *index_adr
__ beqz(tmp1, runtime); // tmp == 0? If yes, goto runtime
- __ sub(tmp1, tmp1, wordSize); // tmp := tmp - wordSize
+ __ subi(tmp1, tmp1, wordSize); // tmp := tmp - wordSize
__ sd(tmp1, index); // *index_adr := tmp
__ ld(tmp2, buffer);
__ add(tmp1, tmp1, tmp2); // tmp := tmp + *buffer_adr
@@ -562,7 +561,7 @@ void ShenandoahBarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssemb
// end = start + count << LogBytesPerHeapOop
// last element address to make inclusive
__ shadd(end, count, start, tmp, LogBytesPerHeapOop);
- __ sub(end, end, BytesPerHeapOop);
+ __ subi(end, end, BytesPerHeapOop);
__ srli(start, start, CardTable::card_shift());
__ srli(end, end, CardTable::card_shift());
@@ -575,7 +574,7 @@ void ShenandoahBarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssemb
__ bind(L_loop);
__ add(tmp, start, count);
__ sb(zr, Address(tmp));
- __ sub(count, count, 1);
+ __ subi(count, count, 1);
__ bgez(count, L_loop);
__ bind(L_done);
}
@@ -690,7 +689,7 @@ void ShenandoahBarrierSetAssembler::generate_c1_pre_barrier_runtime_stub(StubAss
__ ld(tmp, queue_index);
__ beqz(tmp, runtime);
- __ sub(tmp, tmp, wordSize);
+ __ subi(tmp, tmp, wordSize);
__ sd(tmp, queue_index);
__ ld(t1, buffer);
__ add(tmp, tmp, t1);
diff --git a/src/hotspot/cpu/riscv/gc/z/zAddress_riscv.cpp b/src/hotspot/cpu/riscv/gc/z/zAddress_riscv.cpp
index 715f0d8aff7cb..683d892915f50 100644
--- a/src/hotspot/cpu/riscv/gc/z/zAddress_riscv.cpp
+++ b/src/hotspot/cpu/riscv/gc/z/zAddress_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -22,7 +22,6 @@
* questions.
*/
-#include "precompiled.hpp"
#include "gc/shared/gcLogPrecious.hpp"
#include "gc/shared/gc_globals.hpp"
#include "gc/z/zAddress.hpp"
@@ -84,7 +83,7 @@ static size_t probe_valid_max_address_bit() {
munmap(result_addr, page_size);
}
}
- log_info_p(gc, init)("Probing address space for the highest valid bit: " SIZE_FORMAT, max_address_bit);
+ log_info_p(gc, init)("Probing address space for the highest valid bit: %zu", max_address_bit);
return MAX2(max_address_bit, MINIMUM_MAX_ADDRESS_BIT);
#else // LINUX
return DEFAULT_MAX_ADDRESS_BIT;
diff --git a/src/hotspot/cpu/riscv/gc/z/zBarrierSetAssembler_riscv.cpp b/src/hotspot/cpu/riscv/gc/z/zBarrierSetAssembler_riscv.cpp
index 0b093838b8b68..09dea62b6d18f 100644
--- a/src/hotspot/cpu/riscv/gc/z/zBarrierSetAssembler_riscv.cpp
+++ b/src/hotspot/cpu/riscv/gc/z/zBarrierSetAssembler_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2023, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "code/codeBlob.hpp"
#include "code/vmreg.inline.hpp"
@@ -241,7 +240,7 @@ static void store_barrier_buffer_add(MacroAssembler* masm,
__ beqz(tmp2, slow_path);
// Bump the pointer
- __ sub(tmp2, tmp2, sizeof(ZStoreBarrierEntry));
+ __ subi(tmp2, tmp2, sizeof(ZStoreBarrierEntry));
__ sd(tmp2, Address(tmp1, ZStoreBarrierBuffer::current_offset()));
// Compute the buffer entry address
@@ -848,10 +847,10 @@ void ZBarrierSetAssembler::generate_c1_load_barrier_stub(LIR_Assembler* ce,
// Save x10 unless it is the result or tmp register
// Set up SP to accommdate parameters and maybe x10.
if (ref != x10 && tmp != x10) {
- __ sub(sp, sp, 32);
+ __ subi(sp, sp, 32);
__ sd(x10, Address(sp, 16));
} else {
- __ sub(sp, sp, 16);
+ __ subi(sp, sp, 16);
}
// Setup arguments and call runtime stub
@@ -963,7 +962,7 @@ void ZBarrierSetAssembler::generate_c1_store_barrier_stub(LIR_Assembler* ce,
__ la(stub->new_zpointer()->as_register(), ce->as_Address(stub->ref_addr()->as_address_ptr()));
- __ sub(sp, sp, 16);
+ __ subi(sp, sp, 16);
//Setup arguments and call runtime stub
assert(stub->new_zpointer()->is_valid(), "invariant");
ce->store_parameter(stub->new_zpointer()->as_register(), 0);
diff --git a/src/hotspot/cpu/riscv/globals_riscv.hpp b/src/hotspot/cpu/riscv/globals_riscv.hpp
index 806cca16269ea..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 e17a3765b50ec..c132f9cda7a08 100644
--- a/src/hotspot/cpu/riscv/interp_masm_riscv.cpp
+++ b/src/hotspot/cpu/riscv/interp_masm_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved.
* Copyright (c) 2020, 2023, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -24,7 +24,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "gc/shared/barrierSet.hpp"
#include "gc/shared/barrierSetAssembler.hpp"
@@ -270,18 +269,18 @@ void InterpreterMacroAssembler::pop_l(Register r) {
}
void InterpreterMacroAssembler::push_ptr(Register r) {
- addi(esp, esp, -wordSize);
+ subi(esp, esp, wordSize);
sd(r, Address(esp, 0));
}
void InterpreterMacroAssembler::push_i(Register r) {
- addi(esp, esp, -wordSize);
+ subi(esp, esp, wordSize);
sext(r, r, 32);
sd(r, Address(esp, 0));
}
void InterpreterMacroAssembler::push_l(Register r) {
- addi(esp, esp, -2 * wordSize);
+ subi(esp, esp, 2 * wordSize);
sd(zr, Address(esp, wordSize));
sd(r, Address(esp));
}
@@ -297,12 +296,12 @@ void InterpreterMacroAssembler::pop_d(FloatRegister r) {
}
void InterpreterMacroAssembler::push_f(FloatRegister r) {
- addi(esp, esp, -wordSize);
+ subi(esp, esp, wordSize);
fsw(r, Address(esp, 0));
}
void InterpreterMacroAssembler::push_d(FloatRegister r) {
- addi(esp, esp, -2 * wordSize);
+ subi(esp, esp, 2 * wordSize);
fsd(r, Address(esp, 0));
}
@@ -544,7 +543,7 @@ void InterpreterMacroAssembler::remove_activation(
// get method access flags
ld(x11, Address(fp, frame::interpreter_frame_method_offset * wordSize));
- ld(x12, Address(x11, Method::access_flags_offset()));
+ load_unsigned_short(x12, Address(x11, Method::access_flags_offset()));
test_bit(t0, x12, exact_log2(JVM_ACC_SYNCHRONIZED));
beqz(t0, unlocked);
@@ -895,7 +894,7 @@ void InterpreterMacroAssembler::verify_method_data_pointer() {
assert(ProfileInterpreter, "must be profiling interpreter");
#ifdef ASSERT
Label verify_continue;
- add(sp, sp, -4 * wordSize);
+ subi(sp, sp, 4 * wordSize);
sd(x10, Address(sp, 0));
sd(x11, Address(sp, wordSize));
sd(x12, Address(sp, 2 * wordSize));
@@ -920,7 +919,7 @@ void InterpreterMacroAssembler::verify_method_data_pointer() {
ld(x11, Address(sp, wordSize));
ld(x12, Address(sp, 2 * wordSize));
ld(x13, Address(sp, 3 * wordSize));
- add(sp, sp, 4 * wordSize);
+ addi(sp, sp, 4 * wordSize);
#endif // ASSERT
}
@@ -961,7 +960,7 @@ void InterpreterMacroAssembler::increment_mdp_data_at(Register mdp_in,
if (decrement) {
ld(t0, addr);
- addi(t0, t0, -DataLayout::counter_increment);
+ subi(t0, t0, DataLayout::counter_increment);
Label L;
bltz(t0, L); // skip store if counter underflow
sd(t0, addr);
@@ -1028,7 +1027,7 @@ void InterpreterMacroAssembler::update_mdp_by_offset(Register mdp_in,
void InterpreterMacroAssembler::update_mdp_by_constant(Register mdp_in,
int constant) {
assert(ProfileInterpreter, "must be profiling interpreter");
- addi(mdp_in, mdp_in, (unsigned)constant);
+ add(mdp_in, mdp_in, (unsigned)constant);
sd(mdp_in, Address(fp, frame::interpreter_frame_mdp_offset * wordSize));
}
@@ -1037,7 +1036,7 @@ void InterpreterMacroAssembler::update_mdp_for_ret(Register return_bci) {
assert(ProfileInterpreter, "must be profiling interpreter");
// save/restore across call_VM
- addi(sp, sp, -2 * wordSize);
+ subi(sp, sp, 2 * wordSize);
sd(zr, Address(sp, 0));
sd(return_bci, Address(sp, wordSize));
call_VM(noreg,
@@ -1739,7 +1738,7 @@ void InterpreterMacroAssembler::profile_arguments_type(Register mdp, Register ca
add(t0, mdp, t0);
ld(t0, Address(t0));
sub(tmp, tmp, t0);
- addi(tmp, tmp, -1);
+ subi(tmp, tmp, 1);
Address arg_addr = argument_address(tmp);
ld(tmp, arg_addr);
@@ -1762,7 +1761,7 @@ void InterpreterMacroAssembler::profile_arguments_type(Register mdp, Register ca
if (MethodData::profile_return()) {
ld(tmp, Address(mdp, in_bytes(TypeEntriesAtCall::cell_count_offset())));
- addi(tmp, tmp, -TypeProfileArgsLimit*TypeStackSlotEntries::per_arg_count());
+ sub(tmp, tmp, TypeProfileArgsLimit * TypeStackSlotEntries::per_arg_count());
}
add(t0, mdp, off_to_args);
@@ -1849,7 +1848,7 @@ void InterpreterMacroAssembler::profile_parameters_type(Register mdp, Register t
// mdo start + parameters offset + array length - 1
add(mdp, mdp, tmp1);
ld(tmp1, Address(mdp, ArrayData::array_len_offset()));
- add(tmp1, tmp1, - TypeStackSlotEntries::per_arg_count());
+ subi(tmp1, tmp1, TypeStackSlotEntries::per_arg_count());
Label loop;
bind(loop);
@@ -1875,7 +1874,7 @@ void InterpreterMacroAssembler::profile_parameters_type(Register mdp, Register t
profile_obj_type(tmp2, arg_type, tmp3);
// go to next parameter
- add(tmp1, tmp1, - TypeStackSlotEntries::per_arg_count());
+ subi(tmp1, tmp1, TypeStackSlotEntries::per_arg_count());
bgez(tmp1, loop);
bind(profile_continue);
@@ -1890,7 +1889,7 @@ void InterpreterMacroAssembler::load_resolved_indy_entry(Register cache, Registe
ld(cache, Address(xcpool, in_bytes(ConstantPoolCache::invokedynamic_entries_offset())));
// Scale the index to be the entry index * sizeof(ResolvedIndyEntry)
slli(index, index, log2i_exact(sizeof(ResolvedIndyEntry)));
- add(cache, cache, Array::base_offset_in_bytes());
+ addi(cache, cache, Array::base_offset_in_bytes());
add(cache, cache, index);
}
@@ -1906,7 +1905,7 @@ void InterpreterMacroAssembler::load_field_entry(Register cache, Register index,
}
// Get address of field entries array
ld(cache, Address(xcpool, ConstantPoolCache::field_entries_offset()));
- add(cache, cache, Array::base_offset_in_bytes());
+ addi(cache, cache, Array::base_offset_in_bytes());
add(cache, cache, index);
// Prevents stale data from being read after the bytecode is patched to the fast bytecode
membar(MacroAssembler::LoadLoad);
@@ -1932,7 +1931,7 @@ void InterpreterMacroAssembler::load_method_entry(Register cache, Register index
// Get address of field entries array
ld(cache, Address(xcpool, ConstantPoolCache::method_entries_offset()));
- add(cache, cache, Array::base_offset_in_bytes());
+ addi(cache, cache, Array::base_offset_in_bytes());
add(cache, cache, index);
}
diff --git a/src/hotspot/cpu/riscv/interpreterRT_riscv.cpp b/src/hotspot/cpu/riscv/interpreterRT_riscv.cpp
index de34d84fecb00..c8e488d9d6919 100644
--- a/src/hotspot/cpu/riscv/interpreterRT_riscv.cpp
+++ b/src/hotspot/cpu/riscv/interpreterRT_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved.
* Copyright (c) 2020, 2022, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -24,7 +24,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "interpreter/interp_masm.hpp"
#include "interpreter/interpreter.hpp"
@@ -138,10 +137,10 @@ void InterpreterRuntime::SignatureHandlerGenerator::pass_object() {
Register reg = next_gpr();
if (reg == c_rarg1) {
assert(offset() == 0, "argument register 1 can only be (non-null) receiver");
- __ addi(c_rarg1, from(), Interpreter::local_offset_in_bytes(offset()));
+ __ add(c_rarg1, from(), Interpreter::local_offset_in_bytes(offset()));
} else if (reg != noreg) {
// c_rarg2-c_rarg7
- __ addi(x10, from(), Interpreter::local_offset_in_bytes(offset()));
+ __ add(x10, from(), Interpreter::local_offset_in_bytes(offset()));
__ mv(reg, zr); //_num_reg_int_args:c_rarg -> 1:c_rarg2, 2:c_rarg3...
__ ld(temp(), x10);
Label L;
@@ -150,7 +149,7 @@ void InterpreterRuntime::SignatureHandlerGenerator::pass_object() {
__ bind(L);
} else {
//to stack
- __ addi(x10, from(), Interpreter::local_offset_in_bytes(offset()));
+ __ add(x10, from(), Interpreter::local_offset_in_bytes(offset()));
__ ld(temp(), x10);
Label L;
__ bnez(temp(), L);
diff --git a/src/hotspot/cpu/riscv/jniFastGetField_riscv.cpp b/src/hotspot/cpu/riscv/jniFastGetField_riscv.cpp
index 648a665fef5aa..b08e520393ab8 100644
--- a/src/hotspot/cpu/riscv/jniFastGetField_riscv.cpp
+++ b/src/hotspot/cpu/riscv/jniFastGetField_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved.
* Copyright (c) 2020, 2023, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -24,7 +24,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.hpp"
#include "gc/shared/barrierSet.hpp"
#include "gc/shared/barrierSetAssembler.hpp"
diff --git a/src/hotspot/cpu/riscv/jvmciCodeInstaller_riscv.cpp b/src/hotspot/cpu/riscv/jvmciCodeInstaller_riscv.cpp
index 1c06d0b29aa6d..cbe387eed148c 100644
--- a/src/hotspot/cpu/riscv/jvmciCodeInstaller_riscv.cpp
+++ b/src/hotspot/cpu/riscv/jvmciCodeInstaller_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.hpp"
#include "jvmci/jvmci.hpp"
#include "jvmci/jvmciCodeInstaller.hpp"
diff --git a/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp b/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp
index 27452e7a6842c..4276595ffccd2 100644
--- a/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp
+++ b/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved.
* Copyright (c) 2020, 2024, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -24,7 +24,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/assembler.hpp"
#include "asm/assembler.inline.hpp"
#include "code/compiledIC.hpp"
@@ -245,7 +244,7 @@ void MacroAssembler::inc_held_monitor_count(Register tmp) {
void MacroAssembler::dec_held_monitor_count(Register tmp) {
Address dst(xthread, JavaThread::held_monitor_count_offset());
ld(tmp, dst);
- addi(tmp, tmp, -1);
+ subi(tmp, tmp, 1);
sd(tmp, dst);
#ifdef ASSERT
Label ok;
@@ -794,7 +793,7 @@ void MacroAssembler::call_VM_leaf_base(address entry_point,
Label *retaddr) {
int32_t offset = 0;
push_reg(RegSet::of(t1, xmethod), sp); // push << t1 & xmethod >> to sp
- mv(t1, entry_point, offset);
+ movptr(t1, entry_point, offset, t0);
jalr(t1, offset);
if (retaddr != nullptr) {
bind(*retaddr);
@@ -1333,22 +1332,11 @@ void MacroAssembler::cmov_gtu(Register cmp1, Register cmp2, Register dst, Regist
#undef INSN
-
-#define INSN(NAME, CSR) \
- void MacroAssembler::NAME(Register Rd) { \
- csrr(Rd, CSR); \
- }
-
- INSN(rdinstret, CSR_INSTRET);
- INSN(rdcycle, CSR_CYCLE);
- INSN(rdtime, CSR_TIME);
- INSN(frcsr, CSR_FCSR);
- INSN(frrm, CSR_FRM);
- INSN(frflags, CSR_FFLAGS);
-
-#undef INSN
-
void MacroAssembler::csrr(Register Rd, unsigned csr) {
+ // These three are specified in zicntr and are unused.
+ // Before adding use-cases add the appropriate hwprobe and flag.
+ assert(csr != CSR_INSTRET && csr != CSR_CYCLE && csr != CSR_TIME,
+ "Not intended for use without enabling zicntr.");
csrrs(Rd, csr, x0);
}
@@ -1430,7 +1418,7 @@ void MacroAssembler::restore_cpu_control_state_after_jni(Register tmp) {
void MacroAssembler::push_reg(Register Rs)
{
- addi(esp, esp, 0 - wordSize);
+ subi(esp, esp, wordSize);
sd(Rs, Address(esp, 0));
}
@@ -1462,7 +1450,7 @@ int MacroAssembler::push_reg(unsigned int bitset, Register stack) {
int offset = is_even(count) ? 0 : wordSize;
if (count) {
- addi(stack, stack, -count * wordSize - offset);
+ sub(stack, stack, count * wordSize + offset);
}
for (int i = count - 1; i >= 0; i--) {
sd(as_Register(regs[i]), Address(stack, (count - 1 - i) * wordSize + offset));
@@ -1487,7 +1475,7 @@ int MacroAssembler::pop_reg(unsigned int bitset, Register stack) {
}
if (count) {
- addi(stack, stack, count * wordSize + offset);
+ add(stack, stack, count * wordSize + offset);
}
assert(words_popped == count, "oops, popped != count");
@@ -1503,7 +1491,7 @@ int MacroAssembler::push_fp(unsigned int bitset, Register stack) {
int push_slots = count + (count & 1);
if (count) {
- addi(stack, stack, -push_slots * wordSize);
+ subi(stack, stack, push_slots * wordSize);
}
for (int i = count - 1; i >= 0; i--) {
@@ -1632,7 +1620,7 @@ void MacroAssembler::vector_update_crc32(Register crc, Register buf, Register le
Label VectorLoop;
Label LastBlock;
- add(tableN16, table3, 1*single_table_size*sizeof(juint), tmp1);
+ add(tableN16, table3, 1 * single_table_size * sizeof(juint), tmp1);
mv(tmp5, 0xff);
if (MaxVectorSize == 16) {
@@ -1651,7 +1639,7 @@ void MacroAssembler::vector_update_crc32(Register crc, Register buf, Register le
srli(blks, len, 6);
slli(t1, blks, 6);
sub(len, len, t1);
- sub(blks, blks, 1);
+ subi(blks, blks, 1);
blez(blks, LastBlock);
bind(VectorLoop);
@@ -1683,7 +1671,7 @@ void MacroAssembler::vector_update_crc32(Register crc, Register buf, Register le
addi(tmp1, tmp1, 1);
}
- sub(blks, blks, 1);
+ subi(blks, blks, 1);
bgtz(blks, VectorLoop);
}
@@ -2046,7 +2034,7 @@ void MacroAssembler::kernel_crc32_vclmul_fold(Register crc, Register buf, Regist
Register vclmul_table = tmp3;
la(vclmul_table, table_addr);
- add(vclmul_table, vclmul_table, table_num*single_table_size*sizeof(juint), tmp1);
+ add(vclmul_table, vclmul_table, table_num * single_table_size * sizeof(juint), tmp1);
la(table0, table_addr);
if (MaxVectorSize == 16) {
@@ -2092,25 +2080,25 @@ void MacroAssembler::kernel_crc32(Register crc, Register buf, Register len,
const ExternalAddress table_addr = StubRoutines::crc_table_addr();
la(table0, table_addr);
- add(table1, table0, 1*single_table_size*sizeof(juint), tmp1);
- add(table2, table0, 2*single_table_size*sizeof(juint), tmp1);
- add(table3, table2, 1*single_table_size*sizeof(juint), tmp1);
+ add(table1, table0, 1 * single_table_size * sizeof(juint), tmp1);
+ add(table2, table0, 2 * single_table_size * sizeof(juint), tmp1);
+ add(table3, table2, 1 * single_table_size * sizeof(juint), tmp1);
// Ensure basic 4-byte alignment of input byte buffer
mv(tmp1, 4);
blt(len, tmp1, L_by1_loop);
test_bit(tmp1, buf, 0);
beqz(tmp1, L_skip1);
- subw(len, len, 1);
+ subiw(len, len, 1);
lbu(tmp1, Address(buf));
- add(buf, buf, 1);
+ addi(buf, buf, 1);
update_byte_crc32(crc, tmp1, table0);
bind(L_skip1);
test_bit(tmp1, buf, 1);
beqz(tmp1, L_skip2);
- subw(len, len, 2);
+ subiw(len, len, 2);
lhu(tmp1, Address(buf));
- add(buf, buf, 2);
+ addi(buf, buf, 2);
zext(tmp2, tmp1, 8);
update_byte_crc32(crc, tmp2, table0);
srli(tmp2, tmp1, 8);
@@ -2134,8 +2122,8 @@ void MacroAssembler::kernel_crc32(Register crc, Register buf, Register len,
align(CodeEntryAlignment);
// Entry for L_unroll_loop
- add(loop_buf_end, buf, len); // loop_buf_end will be used as endpoint for loop below
- andi(len, len, unroll_words-1); // len = (len % unroll_words)
+ add(loop_buf_end, buf, len); // loop_buf_end will be used as endpoint for loop below
+ andi(len, len, unroll_words - 1); // len = (len % unroll_words)
sub(loop_buf_end, loop_buf_end, len);
bind(L_unroll_loop);
for (int i = 0; i < unroll; i++) {
@@ -2162,17 +2150,17 @@ void MacroAssembler::kernel_crc32(Register crc, Register buf, Register len,
bind(L_by1_loop);
beqz(len, L_exit);
- subw(len, len, 1);
+ subiw(len, len, 1);
lbu(tmp1, Address(buf));
update_byte_crc32(crc, tmp1, table0);
beqz(len, L_exit);
- subw(len, len, 1);
+ subiw(len, len, 1);
lbu(tmp1, Address(buf, 1));
update_byte_crc32(crc, tmp1, table0);
beqz(len, L_exit);
- subw(len, len, 1);
+ subiw(len, len, 1);
lbu(tmp1, Address(buf, 2));
update_byte_crc32(crc, tmp1, table0);
@@ -2238,7 +2226,7 @@ void MacroAssembler::push_call_clobbered_registers_except(RegSet exclude) {
push_reg(RegSet::of(x7) + RegSet::range(x10, x17) + RegSet::range(x28, x31) - exclude, sp);
// Push float registers f0-f7, f10-f17, f28-f31.
- addi(sp, sp, - wordSize * 20);
+ subi(sp, sp, wordSize * 20);
int offset = 0;
for (int i = 0; i < 32; i++) {
if (i <= f7->encoding() || i >= f28->encoding() || (i >= f10->encoding() && i <= f17->encoding())) {
@@ -2264,7 +2252,7 @@ void MacroAssembler::push_CPU_state(bool save_vectors, int vector_size_in_bytes)
push_reg(RegSet::range(x5, x31), sp);
// float registers
- addi(sp, sp, - 32 * wordSize);
+ subi(sp, sp, 32 * wordSize);
for (int i = 0; i < 32; i++) {
fsd(as_FloatRegister(i), Address(sp, i * wordSize));
}
@@ -2605,32 +2593,71 @@ void MacroAssembler::movptr2(Register Rd, uint64_t addr, int32_t &offset, Regist
offset = lower12;
}
-void MacroAssembler::add(Register Rd, Register Rn, int64_t increment, Register temp) {
+// 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);
} else {
- assert_different_registers(Rn, temp);
- li(temp, increment);
- add(Rd, Rn, temp);
+ assert_different_registers(Rn, tmp);
+ mv(tmp, increment);
+ add(Rd, Rn, tmp);
}
}
-void MacroAssembler::addw(Register Rd, Register Rn, int32_t increment, Register temp) {
+void MacroAssembler::sub(Register Rd, Register Rn, int64_t decrement, Register tmp) {
+ add(Rd, Rn, -decrement, tmp);
+}
+
+void MacroAssembler::addw(Register Rd, Register Rn, int64_t increment, Register tmp) {
if (is_simm12(increment)) {
addiw(Rd, Rn, increment);
} else {
- assert_different_registers(Rn, temp);
- li(temp, increment);
- addw(Rd, Rn, temp);
+ assert_different_registers(Rn, tmp);
+ mv(tmp, increment);
+ addw(Rd, Rn, tmp);
}
}
-void MacroAssembler::sub(Register Rd, Register Rn, int64_t decrement, Register temp) {
- add(Rd, Rn, -decrement, temp);
-}
-
-void MacroAssembler::subw(Register Rd, Register Rn, int32_t decrement, Register temp) {
- addw(Rd, Rn, -decrement, temp);
+void MacroAssembler::subw(Register Rd, Register Rn, int64_t decrement, Register tmp) {
+ addw(Rd, Rn, -decrement, tmp);
}
void MacroAssembler::andrw(Register Rd, Register Rs1, Register Rs2) {
@@ -2870,7 +2897,25 @@ void MacroAssembler::revb(Register Rd, Register Rs, Register tmp1, Register tmp2
}
// rotate right with shift bits
-void MacroAssembler::ror_imm(Register dst, Register src, uint32_t shift, Register tmp)
+void MacroAssembler::ror(Register dst, Register src, Register shift, Register tmp)
+{
+ if (UseZbb) {
+ rorr(dst, src, shift);
+ return;
+ }
+
+ assert_different_registers(dst, tmp);
+ assert_different_registers(src, tmp);
+
+ mv(tmp, 64);
+ sub(tmp, tmp, shift);
+ sll(tmp, src, tmp);
+ srl(dst, src, shift);
+ orr(dst, dst, tmp);
+}
+
+// rotate right with shift bits
+void MacroAssembler::ror(Register dst, Register src, uint32_t shift, Register tmp)
{
if (UseZbb) {
rori(dst, src, shift);
@@ -2886,7 +2931,7 @@ void MacroAssembler::ror_imm(Register dst, Register src, uint32_t shift, Registe
}
// rotate left with shift bits, 32-bit version
-void MacroAssembler::rolw_imm(Register dst, Register src, uint32_t shift, Register tmp) {
+void MacroAssembler::rolw(Register dst, Register src, uint32_t shift, Register tmp) {
if (UseZbb) {
// no roliw available
roriw(dst, src, 32 - shift);
@@ -2901,16 +2946,6 @@ void MacroAssembler::rolw_imm(Register dst, Register src, uint32_t shift, Regist
orr(dst, dst, tmp);
}
-void MacroAssembler::andi(Register Rd, Register Rn, int64_t imm, Register tmp) {
- if (is_simm12(imm)) {
- and_imm12(Rd, Rn, imm);
- } else {
- assert_different_registers(Rn, tmp);
- mv(tmp, imm);
- andr(Rd, Rn, tmp);
- }
-}
-
void MacroAssembler::orptr(Address adr, RegisterOrConstant src, Register tmp1, Register tmp2) {
ld(tmp1, adr);
if (src.is_register()) {
@@ -4077,12 +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);
@@ -4153,18 +4186,19 @@ void MacroAssembler::repne_scan(Register addr, Register value, Register count,
bind(Lloop);
ld(tmp, addr);
beq(value, tmp, Lexit);
- add(addr, addr, wordSize);
- sub(count, count, 1);
+ addi(addr, addr, wordSize);
+ subi(count, count, 1);
bnez(count, Lloop);
bind(Lexit);
}
-void MacroAssembler::check_klass_subtype_slow_path(Register sub_klass,
- Register super_klass,
- Register tmp1_reg,
- Register tmp2_reg,
- Label* L_success,
- Label* L_failure) {
+void MacroAssembler::check_klass_subtype_slow_path_linear(Register sub_klass,
+ Register super_klass,
+ Register tmp1_reg,
+ Register tmp2_reg,
+ Label* L_success,
+ Label* L_failure,
+ bool set_cond_codes) {
assert_different_registers(sub_klass, super_klass, tmp1_reg);
if (tmp2_reg != noreg) {
assert_different_registers(sub_klass, super_klass, tmp1_reg, tmp2_reg, t0);
@@ -4222,7 +4256,7 @@ void MacroAssembler::check_klass_subtype_slow_path(Register sub_klass,
// Load the array length.
lwu(x12, Address(x15, Array::length_offset_in_bytes()));
// Skip to start of data.
- add(x15, x15, Array::base_offset_in_bytes());
+ addi(x15, x15, Array::base_offset_in_bytes());
// Set t0 to an obvious invalid value, falling through by default
mv(t0, -1);
@@ -4238,7 +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);
@@ -4271,7 +4307,7 @@ void MacroAssembler::population_count(Register dst, Register src,
{
bind(loop);
addi(dst, dst, 1);
- addi(tmp2, tmp1, -1);
+ subi(tmp2, tmp1, 1);
andr(tmp1, tmp1, tmp2);
bnez(tmp1, loop);
}
@@ -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;
@@ -4359,7 +4491,7 @@ bool MacroAssembler::lookup_secondary_supers_table(Register r_sub_klass,
// Linear probe.
if (bit != 0) {
- ror_imm(r_bitmap, r_bitmap, bit);
+ ror(r_bitmap, r_bitmap, bit);
}
// The slot we just inspected is at secondary_supers[r_array_index - 1].
@@ -4379,6 +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);
@@ -4440,7 +4669,7 @@ void MacroAssembler::lookup_secondary_supers_table_slow_path(Register r_super_kl
test_bit(t0, r_bitmap, 2); // look-ahead check (Bit 2); result is non-zero
beqz(t0, L_fallthrough);
- ror_imm(r_bitmap, r_bitmap, 1);
+ ror(r_bitmap, r_bitmap, 1);
addi(r_array_index, r_array_index, 1);
j(L_loop);
}
@@ -4475,9 +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.
@@ -4914,11 +5140,11 @@ void MacroAssembler::mul_add(Register out, Register in, Register offset,
blt(len, tmp, L_tail_loop);
bind(L_unroll);
for (int i = 0; i < unroll; i++) {
- sub(in, in, BytesPerInt);
+ subi(in, in, BytesPerInt);
lwu(t0, Address(in, 0));
mul(t1, t0, k);
add(t0, t1, out);
- sub(offset, offset, BytesPerInt);
+ subi(offset, offset, BytesPerInt);
lwu(t1, Address(offset, 0));
add(t0, t0, t1);
sw(t0, Address(offset, 0));
@@ -4929,16 +5155,16 @@ void MacroAssembler::mul_add(Register out, Register in, Register offset,
bind(L_tail_loop);
blez(len, L_end);
- sub(in, in, BytesPerInt);
+ subi(in, in, BytesPerInt);
lwu(t0, Address(in, 0));
mul(t1, t0, k);
add(t0, t1, out);
- sub(offset, offset, BytesPerInt);
+ subi(offset, offset, BytesPerInt);
lwu(t1, Address(offset, 0));
add(t0, t0, t1);
sw(t0, Address(offset, 0));
srli(out, t0, 32);
- subw(len, len, 1);
+ subiw(len, len, 1);
j(L_tail_loop);
bind(L_end);
@@ -5015,13 +5241,13 @@ void MacroAssembler::multiply_32_x_32_loop(Register x, Register xstart, Register
lwu(x_xstart, Address(t0, 0));
bind(L_first_loop);
- subw(idx, idx, 1);
+ subiw(idx, idx, 1);
shadd(t0, idx, y, t0, LogBytesPerInt);
lwu(y_idx, Address(t0, 0));
mul(product, x_xstart, y_idx);
add(product, product, carry);
srli(carry, product, 32);
- subw(kdx, kdx, 1);
+ subiw(kdx, kdx, 1);
shadd(t0, kdx, z, t0, LogBytesPerInt);
sw(product, Address(t0, 0));
bgtz(idx, L_first_loop);
@@ -5049,22 +5275,22 @@ void MacroAssembler::multiply_64_x_64_loop(Register x, Register xstart, Register
Label L_first_loop, L_first_loop_exit;
Label L_one_x, L_one_y, L_multiply;
- subw(xstart, xstart, 1);
+ subiw(xstart, xstart, 1);
bltz(xstart, L_one_x);
shadd(t0, xstart, x, t0, LogBytesPerInt);
ld(x_xstart, Address(t0, 0));
- ror_imm(x_xstart, x_xstart, 32); // convert big-endian to little-endian
+ ror(x_xstart, x_xstart, 32); // convert big-endian to little-endian
bind(L_first_loop);
- subw(idx, idx, 1);
+ subiw(idx, idx, 1);
bltz(idx, L_first_loop_exit);
- subw(idx, idx, 1);
+ subiw(idx, idx, 1);
bltz(idx, L_one_y);
shadd(t0, idx, y, t0, LogBytesPerInt);
ld(y_idx, Address(t0, 0));
- ror_imm(y_idx, y_idx, 32); // convert big-endian to little-endian
+ ror(y_idx, y_idx, 32); // convert big-endian to little-endian
bind(L_multiply);
mulhu(t0, x_xstart, y_idx);
@@ -5072,8 +5298,8 @@ void MacroAssembler::multiply_64_x_64_loop(Register x, Register xstart, Register
cad(product, product, carry, t1);
adc(carry, t0, zr, t1);
- subw(kdx, kdx, 2);
- ror_imm(product, product, 32); // back to big-endian
+ subiw(kdx, kdx, 2);
+ ror(product, product, 32); // back to big-endian
shadd(t0, kdx, z, t0, LogBytesPerInt);
sd(product, Address(t0, 0));
@@ -5134,8 +5360,8 @@ void MacroAssembler::multiply_128_x_128_loop(Register y, Register z,
shadd(tmp6, idx, z, t0, LogBytesPerInt);
- ror_imm(yz_idx1, yz_idx1, 32); // convert big-endian to little-endian
- ror_imm(yz_idx2, yz_idx2, 32);
+ ror(yz_idx1, yz_idx1, 32); // convert big-endian to little-endian
+ ror(yz_idx2, yz_idx2, 32);
ld(t1, Address(tmp6, 0));
ld(t0, Address(tmp6, wordSize));
@@ -5143,8 +5369,8 @@ void MacroAssembler::multiply_128_x_128_loop(Register y, Register z,
mul(tmp3, product_hi, yz_idx1); // yz_idx1 * product_hi -> tmp4:tmp3
mulhu(tmp4, product_hi, yz_idx1);
- ror_imm(t0, t0, 32, tmp); // convert big-endian to little-endian
- ror_imm(t1, t1, 32, tmp);
+ ror(t0, t0, 32, tmp); // convert big-endian to little-endian
+ ror(t1, t1, 32, tmp);
mul(tmp, product_hi, yz_idx2); // yz_idx2 * product_hi -> carry2:tmp
mulhu(carry2, product_hi, yz_idx2);
@@ -5157,8 +5383,8 @@ void MacroAssembler::multiply_128_x_128_loop(Register y, Register z,
cad(tmp4, tmp4, t1, carry2);
adc(carry, carry, zr, carry2);
- ror_imm(tmp3, tmp3, 32); // convert little-endian to big-endian
- ror_imm(tmp4, tmp4, 32);
+ ror(tmp3, tmp3, 32); // convert little-endian to big-endian
+ ror(tmp4, tmp4, 32);
sd(tmp4, Address(tmp6, 0));
sd(tmp3, Address(tmp6, wordSize));
@@ -5170,29 +5396,29 @@ void MacroAssembler::multiply_128_x_128_loop(Register y, Register z,
beqz(idx, L_post_third_loop_done);
Label L_check_1;
- subw(idx, idx, 2);
+ subiw(idx, idx, 2);
bltz(idx, L_check_1);
shadd(t0, idx, y, t0, LogBytesPerInt);
ld(yz_idx1, Address(t0, 0));
- ror_imm(yz_idx1, yz_idx1, 32);
+ ror(yz_idx1, yz_idx1, 32);
mul(tmp3, product_hi, yz_idx1); // yz_idx1 * product_hi -> tmp4:tmp3
mulhu(tmp4, product_hi, yz_idx1);
shadd(t0, idx, z, t0, LogBytesPerInt);
ld(yz_idx2, Address(t0, 0));
- ror_imm(yz_idx2, yz_idx2, 32, tmp);
+ ror(yz_idx2, yz_idx2, 32, tmp);
add2_with_carry(carry, tmp4, tmp3, carry, yz_idx2, tmp);
- ror_imm(tmp3, tmp3, 32, tmp);
+ ror(tmp3, tmp3, 32, tmp);
sd(tmp3, Address(t0, 0));
bind(L_check_1);
andi(idx, idx, 0x1);
- subw(idx, idx, 1);
+ subiw(idx, idx, 1);
bltz(idx, L_post_third_loop_done);
shadd(t0, idx, y, t0, LogBytesPerInt);
lwu(tmp4, Address(t0, 0));
@@ -5252,40 +5478,49 @@ void MacroAssembler::multiply_to_len(Register x, Register xlen, Register y, Regi
Label L_multiply_64_x_64_loop, L_done;
- subw(xstart, xlen, 1);
+ subiw(xstart, xlen, 1);
bltz(xstart, L_done);
const Register jdx = tmp1;
if (AvoidUnalignedAccesses) {
- // Check if x and y are both 8-byte aligned.
- orr(t0, xlen, ylen);
- test_bit(t0, t0, 0);
- beqz(t0, L_multiply_64_x_64_loop);
+ int base_offset = arrayOopDesc::base_offset_in_bytes(T_INT);
+ assert((base_offset % (UseCompactObjectHeaders ? 4 :
+ (UseCompressedClassPointers ? 8 : 4))) == 0, "Must be");
+
+ if ((base_offset % 8) == 0) {
+ // multiply_64_x_64_loop emits 8-byte load/store to access two elements
+ // at a time from int arrays x and y. When base_offset is 8 bytes, these
+ // accesses are naturally aligned if both xlen and ylen are even numbers.
+ orr(t0, xlen, ylen);
+ test_bit(t0, t0, 0);
+ beqz(t0, L_multiply_64_x_64_loop);
+ }
+
+ Label L_second_loop_unaligned, L_third_loop, L_third_loop_exit;
multiply_32_x_32_loop(x, xstart, x_xstart, y, y_idx, z, carry, product, idx, kdx);
shadd(t0, xstart, z, t0, LogBytesPerInt);
sw(carry, Address(t0, 0));
- Label L_second_loop_unaligned;
bind(L_second_loop_unaligned);
mv(carry, zr);
mv(jdx, ylen);
- subw(xstart, xstart, 1);
+ subiw(xstart, xstart, 1);
bltz(xstart, L_done);
- sub(sp, sp, 2 * wordSize);
+
+ subi(sp, sp, 2 * wordSize);
sd(z, Address(sp, 0));
sd(zr, Address(sp, wordSize));
shadd(t0, xstart, z, t0, LogBytesPerInt);
addi(z, t0, 4);
shadd(t0, xstart, x, t0, LogBytesPerInt);
lwu(product, Address(t0, 0));
- Label L_third_loop, L_third_loop_exit;
blez(jdx, L_third_loop_exit);
bind(L_third_loop);
- subw(jdx, jdx, 1);
+ subiw(jdx, jdx, 1);
shadd(t0, jdx, y, t0, LogBytesPerInt);
lwu(t0, Address(t0, 0));
mul(t1, t0, product);
@@ -5313,13 +5548,13 @@ void MacroAssembler::multiply_to_len(Register x, Register xlen, Register y, Regi
beqz(kdx, L_second_loop_aligned);
Label L_carry;
- subw(kdx, kdx, 1);
+ subiw(kdx, kdx, 1);
beqz(kdx, L_carry);
shadd(t0, kdx, z, t0, LogBytesPerInt);
sw(carry, Address(t0, 0));
srli(carry, carry, 32);
- subw(kdx, kdx, 1);
+ subiw(kdx, kdx, 1);
bind(L_carry);
shadd(t0, kdx, z, t0, LogBytesPerInt);
@@ -5344,21 +5579,21 @@ void MacroAssembler::multiply_to_len(Register x, Register xlen, Register y, Regi
mv(carry, zr); // carry = 0;
mv(jdx, ylen); // j = ystart+1
- subw(xstart, xstart, 1); // i = xstart-1;
+ subiw(xstart, xstart, 1); // i = xstart-1;
bltz(xstart, L_done);
- sub(sp, sp, 4 * wordSize);
+ subi(sp, sp, 4 * wordSize);
sd(z, Address(sp, 0));
Label L_last_x;
shadd(t0, xstart, z, t0, LogBytesPerInt);
addi(z, t0, 4);
- subw(xstart, xstart, 1); // i = xstart-1;
+ subiw(xstart, xstart, 1); // i = xstart-1;
bltz(xstart, L_last_x);
shadd(t0, xstart, x, t0, LogBytesPerInt);
ld(product_hi, Address(t0, 0));
- ror_imm(product_hi, product_hi, 32); // convert big-endian to little-endian
+ ror(product_hi, product_hi, 32); // convert big-endian to little-endian
Label L_third_loop_prologue;
bind(L_third_loop_prologue);
@@ -5378,7 +5613,7 @@ void MacroAssembler::multiply_to_len(Register x, Register xlen, Register y, Regi
shadd(t0, tmp3, z, t0, LogBytesPerInt);
sw(carry, Address(t0, 0));
- subw(tmp3, tmp3, 1);
+ subiw(tmp3, tmp3, 1);
bltz(tmp3, L_done);
srli(carry, carry, 32);
@@ -5395,28 +5630,26 @@ void MacroAssembler::multiply_to_len(Register x, Register xlen, Register y, Regi
}
#endif
-// Count bits of trailing zero chars from lsb to msb until first non-zero element.
-// For LL case, one byte for one element, so shift 8 bits once, and for other case,
-// shift 16 bits once.
-void MacroAssembler::ctzc_bit(Register Rd, Register Rs, bool isLL, Register tmp1, Register tmp2) {
+// Count bits of trailing zero chars from lsb to msb until first non-zero
+// char seen. For the LL case, shift 8 bits once as there is only one byte
+// per each char. For other cases, shift 16 bits once.
+void MacroAssembler::ctzc_bits(Register Rd, Register Rs, bool isLL,
+ Register tmp1, Register tmp2) {
+ int step = isLL ? 8 : 16;
if (UseZbb) {
- assert_different_registers(Rd, Rs, tmp1);
- int step = isLL ? 8 : 16;
ctz(Rd, Rs);
- andi(tmp1, Rd, step - 1);
- sub(Rd, Rd, tmp1);
+ andi(Rd, Rd, -step);
return;
}
- assert_different_registers(Rd, Rs, tmp1, tmp2);
+ assert_different_registers(Rd, tmp1, tmp2);
Label Loop;
- int step = isLL ? 8 : 16;
- mv(Rd, -step);
mv(tmp2, Rs);
+ mv(Rd, -step);
bind(Loop);
addi(Rd, Rd, step);
- andi(tmp1, tmp2, ((1 << step) - 1));
+ zext(tmp1, tmp2, step);
srli(tmp2, tmp2, step);
beqz(tmp1, Loop);
}
@@ -5538,13 +5771,13 @@ void MacroAssembler::zero_words(Register base, uint64_t cnt) {
Register loop_base = t1;
cnt = cnt - remainder;
mv(cnt_reg, cnt);
- add(loop_base, base, remainder * wordSize);
+ addi(loop_base, base, remainder * wordSize);
bind(loop);
sub(cnt_reg, cnt_reg, unroll);
for (int i = 0; i < unroll; i++) {
sd(zr, Address(loop_base, i * wordSize));
}
- add(loop_base, loop_base, unroll * wordSize);
+ addi(loop_base, loop_base, unroll * wordSize);
bnez(cnt_reg, loop);
}
@@ -5595,12 +5828,12 @@ void MacroAssembler::fill_words(Register base, Register cnt, Register value) {
jr(t1);
bind(loop);
- add(base, base, unroll * 8);
+ addi(base, base, unroll * wordSize);
for (int i = -unroll; i < 0; i++) {
sd(value, Address(base, i * 8));
}
bind(entry);
- sub(cnt, cnt, unroll);
+ subi(cnt, cnt, unroll);
bgez(cnt, loop);
bind(fini);
@@ -5639,7 +5872,7 @@ void MacroAssembler::zero_dcache_blocks(Register base, Register cnt, Register tm
bind(loop);
cbo_zero(base);
sub(cnt, cnt, tmp1);
- add(base, base, CacheLineSize);
+ addi(base, base, CacheLineSize);
bge(cnt, tmp1, loop);
}
@@ -5701,7 +5934,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); \
@@ -5725,7 +5958,7 @@ void MacroAssembler::FLOATTYPE##_compare(Register result, FloatRegister Rs1,
/* Rs1 > Rs2, install 1 */ \
bgtz(result, Ldone); \
feq_##FLOATSIG(result, Rs1, Rs2); \
- addi(result, result, -1); \
+ subi(result, result, 1); \
/* Rs1 = Rs2, install 0 */ \
/* NaN or Rs1 < Rs2, install -1 */ \
bind(Ldone); \
@@ -5736,7 +5969,7 @@ void MacroAssembler::FLOATTYPE##_compare(Register result, FloatRegister Rs1,
/* Rs1 < Rs2, install -1 */ \
bgtz(result, Ldone); \
feq_##FLOATSIG(result, Rs1, Rs2); \
- addi(result, result, -1); \
+ subi(result, result, 1); \
/* Rs1 = Rs2, install 0 */ \
/* NaN or Rs1 > Rs2, install 1 */ \
bind(Ldone); \
@@ -6144,10 +6377,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);
}
}
@@ -6200,7 +6433,7 @@ void MacroAssembler::lightweight_lock(Register basic_lock, Register obj, Registe
// After successful lock, push object on lock-stack.
add(t, xthread, top);
sd(obj, Address(t));
- addw(top, top, oopSize);
+ addiw(top, top, oopSize);
sw(top, Address(xthread, JavaThread::lock_stack_top_offset()));
}
@@ -6232,7 +6465,7 @@ void MacroAssembler::lightweight_unlock(Register obj, Register tmp1, Register tm
// Check if obj is top of lock-stack.
lwu(top, Address(xthread, JavaThread::lock_stack_top_offset()));
- subw(top, top, oopSize);
+ subiw(top, top, oopSize);
add(t, xthread, top);
ld(t, Address(t));
bne(obj, t, slow, /* is_far */ true);
@@ -6272,7 +6505,7 @@ void MacroAssembler::lightweight_unlock(Register obj, Register tmp1, Register tm
// Restore lock-stack and handle the unlock in runtime.
DEBUG_ONLY(add(t, xthread, top);)
DEBUG_ONLY(sd(obj, Address(t));)
- addw(top, top, oopSize);
+ addiw(top, top, oopSize);
sw(top, Address(xthread, JavaThread::lock_stack_top_offset()));
j(slow);
diff --git a/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp b/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp
index 1f5a47bf65acb..41ccd0c4b2f74 100644
--- a/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp
+++ b/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp
@@ -60,14 +60,14 @@ class MacroAssembler: public Assembler {
// Note that SP must be updated to the right place before saving/restoring RA and FP
// because signal based thread suspend/resume could happen asynchronously.
void enter() {
- addi(sp, sp, - 2 * wordSize);
+ subi(sp, sp, 2 * wordSize);
sd(ra, Address(sp, wordSize));
sd(fp, Address(sp));
addi(fp, sp, 2 * wordSize);
}
void leave() {
- addi(sp, fp, - 2 * wordSize);
+ subi(sp, fp, 2 * wordSize);
ld(fp, Address(sp));
ld(ra, Address(sp, wordSize));
addi(sp, sp, 2 * wordSize);
@@ -323,21 +323,55 @@ class MacroAssembler: public Assembler {
Register tmp1_reg,
Register tmp2_reg,
Label* L_success,
- Label* L_failure);
+ Label* L_failure,
+ bool set_cond_codes = false);
+
+ void check_klass_subtype_slow_path_linear(Register sub_klass,
+ Register super_klass,
+ Register tmp1_reg,
+ Register tmp2_reg,
+ Label* L_success,
+ Label* L_failure,
+ bool set_cond_codes = false);
+
+ void check_klass_subtype_slow_path_table(Register sub_klass,
+ Register super_klass,
+ Register tmp1_reg,
+ Register tmp2_reg,
+ Label* L_success,
+ Label* L_failure,
+ bool set_cond_codes = false);
+
+ // If r is valid, return r.
+ // If r is invalid, remove a register r2 from available_regs, add r2
+ // to regs_to_push, then return r2.
+ Register allocate_if_noreg(const Register r,
+ RegSetIterator &available_regs,
+ RegSet ®s_to_push);
+
+ // Secondary subtype checking
+ void lookup_secondary_supers_table_var(Register sub_klass,
+ Register r_super_klass,
+ Register result,
+ Register tmp1,
+ Register tmp2,
+ Register tmp3,
+ Register tmp4,
+ Label *L_success);
void population_count(Register dst, Register src, Register tmp1, Register tmp2);
// As above, but with a constant super_klass.
// The result is in Register result, not the condition codes.
- bool lookup_secondary_supers_table(Register r_sub_klass,
- Register r_super_klass,
- Register result,
- Register tmp1,
- Register tmp2,
- Register tmp3,
- Register tmp4,
- u1 super_klass_slot,
- bool stub_is_near = false);
+ bool lookup_secondary_supers_table_const(Register r_sub_klass,
+ Register r_super_klass,
+ Register result,
+ Register tmp1,
+ Register tmp2,
+ Register tmp3,
+ Register tmp4,
+ u1 super_klass_slot,
+ bool stub_is_near = false);
void verify_secondary_supers_table(Register r_sub_klass,
Register r_super_klass,
@@ -351,7 +385,8 @@ class MacroAssembler: public Assembler {
Register r_array_index,
Register r_bitmap,
Register result,
- Register tmp1);
+ Register tmp,
+ bool is_stub = true);
void check_klass_subtype(Register sub_klass,
Register super_klass,
@@ -591,9 +626,6 @@ class MacroAssembler: public Assembler {
}
// Control and status pseudo instructions
- void rdinstret(Register Rd); // read instruction-retired counter
- void rdcycle(Register Rd); // read cycle counter
- void rdtime(Register Rd); // read time
void csrr(Register Rd, unsigned csr); // read csr
void csrw(unsigned csr, Register Rs); // write csr
void csrs(unsigned csr, Register Rs); // set bits in csr
@@ -601,19 +633,23 @@ class MacroAssembler: public Assembler {
void csrwi(unsigned csr, unsigned imm);
void csrsi(unsigned csr, unsigned imm);
void csrci(unsigned csr, unsigned imm);
- void frcsr(Register Rd); // read float-point csr
- void fscsr(Register Rd, Register Rs); // swap float-point csr
- void fscsr(Register Rs); // write float-point csr
- void frrm(Register Rd); // read float-point rounding mode
- void fsrm(Register Rd, Register Rs); // swap float-point rounding mode
- void fsrm(Register Rs); // write float-point rounding mode
+ void frcsr(Register Rd) { csrr(Rd, CSR_FCSR); }; // read float-point csr
+ void fscsr(Register Rd, Register Rs); // swap float-point csr
+ void fscsr(Register Rs); // write float-point csr
+ void frrm(Register Rd) { csrr(Rd, CSR_FRM); }; // read float-point rounding mode
+ void fsrm(Register Rd, Register Rs); // swap float-point rounding mode
+ void fsrm(Register Rs); // write float-point rounding mode
void fsrmi(Register Rd, unsigned imm);
void fsrmi(unsigned imm);
- void frflags(Register Rd); // read float-point exception flags
- void fsflags(Register Rd, Register Rs); // swap float-point exception flags
- void fsflags(Register Rs); // write float-point exception flags
+ void frflags(Register Rd) { csrr(Rd, CSR_FFLAGS); }; // read float-point exception flags
+ void fsflags(Register Rd, Register Rs); // swap float-point exception flags
+ void fsflags(Register Rs); // write float-point exception flags
void fsflagsi(Register Rd, unsigned imm);
void fsflagsi(unsigned imm);
+ // Requires Zicntr
+ void rdinstret(Register Rd) { csrr(Rd, CSR_INSTRET); }; // read instruction-retired counter
+ void rdcycle(Register Rd) { csrr(Rd, CSR_CYCLE); }; // read cycle counter
+ void rdtime(Register Rd) { csrr(Rd, CSR_TIME); }; // read time
// Restore cpu control state after JNI call
void restore_cpu_control_state_after_jni(Register tmp);
@@ -884,12 +920,27 @@ 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 temp = t0);
- void addw(Register Rd, Register Rn, int32_t increment, Register temp = t0);
- void sub (Register Rd, Register Rn, int64_t decrement, Register temp = t0);
- void subw(Register Rd, Register Rn, int32_t decrement, Register temp = t0);
+ void add (Register Rd, Register Rn, int64_t increment, Register tmp = t0);
+ void sub (Register Rd, Register Rn, int64_t decrement, Register tmp = t0);
+ void addw(Register Rd, Register Rn, int64_t increment, Register tmp = t0);
+ void subw(Register Rd, Register Rn, int64_t decrement, Register tmp = t0);
+
+ void subi(Register Rd, Register Rn, int64_t decrement) {
+ assert(is_simm12(-decrement), "Must be");
+ addi(Rd, Rn, -decrement);
+ }
+
+ void subiw(Register Rd, Register Rn, int64_t decrement) {
+ assert(is_simm12(-decrement), "Must be");
+ addiw(Rd, Rn, -decrement);
+ }
#define INSN(NAME) \
inline void NAME(Register Rd, Register Rs1, Register Rs2) { \
@@ -916,9 +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_imm(Register dst, Register src, uint32_t shift, Register tmp = t0);
- void rolw_imm(Register dst, Register src, uint32_t, Register tmp = t0);
- void andi(Register Rd, Register Rn, int64_t imm, Register tmp = t0);
+ void ror(Register dst, Register src, Register shift, Register tmp = t0);
+ void ror(Register dst, Register src, uint32_t shift, Register tmp = t0);
+ void rolw(Register dst, Register src, uint32_t shift, Register tmp = t0);
+
void orptr(Address adr, RegisterOrConstant src, Register tmp1 = t0, Register tmp2 = t1);
// Load and Store Instructions
@@ -1362,7 +1414,8 @@ class MacroAssembler: public Assembler {
void inflate_lo32(Register Rd, Register Rs, Register tmp1 = t0, Register tmp2 = t1);
void inflate_hi32(Register Rd, Register Rs, Register tmp1 = t0, Register tmp2 = t1);
- void ctzc_bit(Register Rd, Register Rs, bool isLL = false, Register tmp1 = t0, Register tmp2 = t1);
+ void ctzc_bits(Register Rd, Register Rs, bool isLL = false,
+ Register tmp1 = t0, Register tmp2 = t1);
void zero_words(Register base, uint64_t cnt);
address zero_words(Register ptr, Register cnt);
diff --git a/src/hotspot/cpu/riscv/methodHandles_riscv.cpp b/src/hotspot/cpu/riscv/methodHandles_riscv.cpp
index 8ed4b93ad4de9..39b6737631dc5 100644
--- a/src/hotspot/cpu/riscv/methodHandles_riscv.cpp
+++ b/src/hotspot/cpu/riscv/methodHandles_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
* Copyright (c) 2020, 2023, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -24,7 +24,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.hpp"
#include "classfile/javaClasses.inline.hpp"
#include "classfile/vmClasses.hpp"
diff --git a/src/hotspot/cpu/riscv/nativeInst_riscv.cpp b/src/hotspot/cpu/riscv/nativeInst_riscv.cpp
index 48a9a84e481bf..6f20d54b222f2 100644
--- a/src/hotspot/cpu/riscv/nativeInst_riscv.cpp
+++ b/src/hotspot/cpu/riscv/nativeInst_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved.
* Copyright (c) 2020, 2023, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -24,7 +24,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.hpp"
#include "code/compiledIC.hpp"
#include "nativeInst_riscv.hpp"
diff --git a/src/hotspot/cpu/riscv/registerMap_riscv.cpp b/src/hotspot/cpu/riscv/registerMap_riscv.cpp
index e59fca777c1de..fa7b108c6ff12 100644
--- a/src/hotspot/cpu/riscv/registerMap_riscv.cpp
+++ b/src/hotspot/cpu/riscv/registerMap_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2022, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "runtime/registerMap.hpp"
#include "vmreg_riscv.inline.hpp"
diff --git a/src/hotspot/cpu/riscv/register_riscv.cpp b/src/hotspot/cpu/riscv/register_riscv.cpp
index 98aeafbfe9cbe..56a4483a989e6 100644
--- a/src/hotspot/cpu/riscv/register_riscv.cpp
+++ b/src/hotspot/cpu/riscv/register_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2022, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "register_riscv.hpp"
Register::RegisterImpl all_RegisterImpls [Register::number_of_registers + 1];
diff --git a/src/hotspot/cpu/riscv/relocInfo_riscv.cpp b/src/hotspot/cpu/riscv/relocInfo_riscv.cpp
index 18b4302c7e68e..7bee372b0ef80 100644
--- a/src/hotspot/cpu/riscv/relocInfo_riscv.cpp
+++ b/src/hotspot/cpu/riscv/relocInfo_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
* Copyright (c) 2020, 2022, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -24,7 +24,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.hpp"
#include "code/relocInfo.hpp"
#include "nativeInst_riscv.hpp"
diff --git a/src/hotspot/cpu/riscv/riscv.ad b/src/hotspot/cpu/riscv/riscv.ad
index 7cb42a6b30c3c..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);
@@ -6482,9 +6490,9 @@ instruct addP_reg_imm(iRegPNoSp dst, iRegP src1, immLAdd src2) %{
ins_encode %{
// src2 is imm, so actually call the addi
- __ add(as_Register($dst$$reg),
- as_Register($src1$$reg),
- $src2$$constant);
+ __ addi(as_Register($dst$$reg),
+ as_Register($src1$$reg),
+ $src2$$constant);
%}
ins_pipe(ialu_reg_imm);
@@ -6513,9 +6521,9 @@ instruct addL_reg_imm(iRegLNoSp dst, iRegL src1, immLAdd src2) %{
ins_encode %{
// src2 is imm, so actually call the addi
- __ add(as_Register($dst$$reg),
- as_Register($src1$$reg),
- $src2$$constant);
+ __ addi(as_Register($dst$$reg),
+ as_Register($src1$$reg),
+ $src2$$constant);
%}
ins_pipe(ialu_reg_imm);
@@ -6546,9 +6554,9 @@ instruct subI_reg_imm(iRegINoSp dst, iRegIorL2I src1, immISub src2) %{
ins_encode %{
// src2 is imm, so actually call the addiw
- __ subw(as_Register($dst$$reg),
- as_Register($src1$$reg),
- $src2$$constant);
+ __ subiw(as_Register($dst$$reg),
+ as_Register($src1$$reg),
+ $src2$$constant);
%}
ins_pipe(ialu_reg_imm);
@@ -6577,9 +6585,9 @@ instruct subL_reg_imm(iRegLNoSp dst, iRegL src1, immLSub src2) %{
ins_encode %{
// src2 is imm, so actually call the addi
- __ sub(as_Register($dst$$reg),
- as_Register($src1$$reg),
- $src2$$constant);
+ __ subi(as_Register($dst$$reg),
+ as_Register($src1$$reg),
+ $src2$$constant);
%}
ins_pipe(ialu_reg_imm);
@@ -7348,7 +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/riscv_b.ad b/src/hotspot/cpu/riscv/riscv_b.ad
index 535c0fd534ddf..990d9eab87c7b 100644
--- a/src/hotspot/cpu/riscv/riscv_b.ad
+++ b/src/hotspot/cpu/riscv/riscv_b.ad
@@ -60,7 +60,7 @@ instruct rorI_reg_b(iRegINoSp dst, iRegI src, iRegI shift) %{
format %{ "rorw $dst, $src, $shift\t#@rorI_reg_b" %}
ins_cost(ALU_COST);
ins_encode %{
- __ rorw(as_Register($dst$$reg), as_Register($src$$reg), as_Register($shift$$reg));
+ __ rorrw(as_Register($dst$$reg), as_Register($src$$reg), as_Register($shift$$reg));
%}
ins_pipe(ialu_reg_reg);
%}
@@ -72,7 +72,7 @@ instruct rorL_reg_b(iRegLNoSp dst, iRegL src, iRegI shift) %{
format %{ "ror $dst, $src, $shift\t#@rorL_reg_b" %}
ins_cost(ALU_COST);
ins_encode %{
- __ ror(as_Register($dst$$reg), as_Register($src$$reg), as_Register($shift$$reg));
+ __ rorr(as_Register($dst$$reg), as_Register($src$$reg), as_Register($shift$$reg));
%}
ins_pipe(ialu_reg_reg);
%}
@@ -84,7 +84,7 @@ instruct rolI_reg_b(iRegINoSp dst, iRegI src, iRegI shift) %{
format %{ "rolw $dst, $src, $shift\t#@rolI_reg_b" %}
ins_cost(ALU_COST);
ins_encode %{
- __ rolw(as_Register($dst$$reg), as_Register($src$$reg), as_Register($shift$$reg));
+ __ rolrw(as_Register($dst$$reg), as_Register($src$$reg), as_Register($shift$$reg));
%}
ins_pipe(ialu_reg_reg);
%}
@@ -96,7 +96,7 @@ instruct rolL_reg_b(iRegLNoSp dst, iRegL src, iRegI shift) %{
format %{ "rol $dst, $src, $shift\t#@rolL_reg_b" %}
ins_cost(ALU_COST);
ins_encode %{
- __ rol(as_Register($dst$$reg), as_Register($src$$reg), as_Register($shift$$reg));
+ __ rolr(as_Register($dst$$reg), as_Register($src$$reg), as_Register($shift$$reg));
%}
ins_pipe(ialu_reg_reg);
%}
diff --git a/src/hotspot/cpu/riscv/riscv_v.ad b/src/hotspot/cpu/riscv/riscv_v.ad
index 4b30a91115221..9892d2b9c0392 100644
--- a/src/hotspot/cpu/riscv/riscv_v.ad
+++ b/src/hotspot/cpu/riscv/riscv_v.ad
@@ -1,7 +1,8 @@
//
-// 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, Arm Limited. All rights reserved.
// Copyright (c) 2020, 2022, Huawei Technologies Co., Ltd. All rights reserved.
+// Copyright (c) 2023, 2025, Rivos Inc. All rights reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
//
// This code is free software; you can redistribute it and/or modify it
@@ -99,6 +100,12 @@ source %{
return false;
}
break;
+ case Op_MulReductionVI:
+ case Op_MulReductionVL:
+ // When vlen < 4, our log2(vlen) implementation does not help to gain performance improvement.
+ if (vlen < 4) {
+ return false;
+ }
default:
break;
}
@@ -109,6 +116,13 @@ source %{
if (!UseRVV) {
return false;
}
+ switch (opcode) {
+ case Op_SelectFromTwoVector:
+ // There is no masked version of selectFrom two vector, i.e. selectFrom(av, bv, mask) in vector API.
+ return false;
+ default:
+ break;
+ }
return match_rule_supported_vector(opcode, vlen, bt);
}
@@ -2420,6 +2434,67 @@ instruct vreduce_minD_masked(fRegD dst, fRegD src1, vReg src2, vRegMask_V0 v0, v
ins_pipe(pipe_slow);
%}
+
+// ------------------------------ Vector reduction mul -------------------------
+
+instruct reduce_mulI(iRegINoSp dst, iRegIorL2I isrc, vReg vsrc,
+ vReg tmp1, vReg tmp2) %{
+ match(Set dst (MulReductionVI isrc vsrc));
+ effect(TEMP_DEF dst, TEMP tmp1, TEMP tmp2);
+ format %{ "reduce_mulI $dst, $isrc, $vsrc\t" %}
+
+ ins_encode %{
+ __ reduce_mul_integral_v($dst$$Register, $isrc$$Register, as_VectorRegister($vsrc$$reg),
+ as_VectorRegister($tmp1$$reg), as_VectorRegister($tmp2$$reg),
+ Matcher::vector_element_basic_type(this, $vsrc), Matcher::vector_length(this, $vsrc));
+ %}
+ ins_pipe(pipe_slow);
+%}
+
+instruct reduce_mulI_masked(iRegINoSp dst, iRegIorL2I isrc, vReg vsrc,
+ vRegMask_V0 v0, vReg tmp1, vReg tmp2) %{
+ match(Set dst (MulReductionVI (Binary isrc vsrc) v0));
+ effect(TEMP_DEF dst, TEMP tmp1, TEMP tmp2);
+ format %{ "reduce_mulI_masked $dst, $isrc, $vsrc, $v0\t" %}
+
+ ins_encode %{
+ __ reduce_mul_integral_v($dst$$Register, $isrc$$Register, as_VectorRegister($vsrc$$reg),
+ as_VectorRegister($tmp1$$reg), as_VectorRegister($tmp2$$reg),
+ Matcher::vector_element_basic_type(this, $vsrc), Matcher::vector_length(this, $vsrc),
+ Assembler::v0_t);
+ %}
+ ins_pipe(pipe_slow);
+%}
+
+instruct reduce_mulL(iRegLNoSp dst, iRegL isrc, vReg vsrc,
+ vReg tmp1, vReg tmp2) %{
+ match(Set dst (MulReductionVL isrc vsrc));
+ effect(TEMP_DEF dst, TEMP tmp1, TEMP tmp2);
+ format %{ "reduce_mulL $dst, $isrc, $vsrc\t" %}
+
+ ins_encode %{
+ __ reduce_mul_integral_v($dst$$Register, $isrc$$Register, as_VectorRegister($vsrc$$reg),
+ as_VectorRegister($tmp1$$reg), as_VectorRegister($tmp2$$reg),
+ Matcher::vector_element_basic_type(this, $vsrc), Matcher::vector_length(this, $vsrc));
+ %}
+ ins_pipe(pipe_slow);
+%}
+
+instruct reduce_mulL_masked(iRegLNoSp dst, iRegL isrc, vReg vsrc,
+ vRegMask_V0 v0, vReg tmp1, vReg tmp2) %{
+ match(Set dst (MulReductionVL (Binary isrc vsrc) v0));
+ effect(TEMP_DEF dst, TEMP tmp1, TEMP tmp2);
+ format %{ "reduce_mulL_masked $dst, $isrc, $vsrc, $v0\t" %}
+
+ ins_encode %{
+ __ reduce_mul_integral_v($dst$$Register, $isrc$$Register, as_VectorRegister($vsrc$$reg),
+ as_VectorRegister($tmp1$$reg), as_VectorRegister($tmp2$$reg),
+ Matcher::vector_element_basic_type(this, $vsrc), Matcher::vector_length(this, $vsrc),
+ Assembler::v0_t);
+ %}
+ ins_pipe(pipe_slow);
+%}
+
// vector replicate
instruct replicate(vReg dst, iRegIorL2I src) %{
@@ -4425,6 +4500,34 @@ instruct vmask_reinterpret_diff_esize(vRegMask dst, vRegMask_V0 src, vReg tmp) %
ins_pipe(pipe_slow);
%}
+// ------------------------------ Vector selectFrom -----------------------------
+
+instruct select_from_two_vectors(vReg dst, vReg src1, vReg src2, vReg index, vRegMask_V0 v0, vReg tmp) %{
+ match(Set dst (SelectFromTwoVector (Binary index src1) src2));
+ effect(TEMP_DEF dst, TEMP v0, TEMP tmp);
+ format %{ "select_from_two_vectors $dst, $src1, $src2, $index" %}
+ ins_encode %{
+ BasicType bt = Matcher::vector_element_basic_type(this);
+ __ vsetvli_helper(bt, Matcher::vector_length(this));
+ __ vrgather_vv(as_VectorRegister($dst$$reg), as_VectorRegister($src1$$reg),
+ as_VectorRegister($index$$reg));
+ bool use_imm = __ is_simm5(Matcher::vector_length(this) - 1);
+ if (use_imm) {
+ __ vmsgtu_vi(v0, as_VectorRegister($index$$reg), Matcher::vector_length(this) - 1);
+ __ vadd_vi(as_VectorRegister($tmp$$reg), as_VectorRegister($index$$reg),
+ -Matcher::vector_length(this), Assembler::v0_t);
+ } else {
+ __ mv(t0, Matcher::vector_length(this) - 1);
+ __ vmsgtu_vx(v0, as_VectorRegister($index$$reg), t0);
+ __ mv(t0, -Matcher::vector_length(this));
+ __ vadd_vx(as_VectorRegister($tmp$$reg), as_VectorRegister($index$$reg), t0, Assembler::v0_t);
+ }
+ __ vrgather_vv(as_VectorRegister($dst$$reg), as_VectorRegister($src2$$reg),
+ as_VectorRegister($tmp$$reg), Assembler::v0_t);
+ %}
+ ins_pipe(pipe_slow);
+%}
+
// ------------------------------ Vector rearrange -----------------------------
instruct rearrange(vReg dst, vReg src, vReg shuffle) %{
diff --git a/src/hotspot/cpu/riscv/runtime_riscv.cpp b/src/hotspot/cpu/riscv/runtime_riscv.cpp
index 441bd1f241f28..a0879b68053d6 100644
--- a/src/hotspot/cpu/riscv/runtime_riscv.cpp
+++ b/src/hotspot/cpu/riscv/runtime_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2024, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#ifdef COMPILER2
#include "asm/macroAssembler.hpp"
#include "asm/macroAssembler.inline.hpp"
@@ -73,7 +72,7 @@ void OptoRuntime::generate_uncommon_trap_blob() {
// Push self-frame. We get here with a return address in RA
// and sp should be 16 byte aligned
// push fp and retaddr by hand
- __ addi(sp, sp, -2 * wordSize);
+ __ subi(sp, sp, 2 * wordSize);
__ sd(ra, Address(sp, wordSize));
__ sd(fp, Address(sp, 0));
// we don't expect an arg reg save area
@@ -140,7 +139,7 @@ void OptoRuntime::generate_uncommon_trap_blob() {
__ lwu(x12, Address(x14,
Deoptimization::UnrollBlock::
size_of_deoptimized_frame_offset()));
- __ sub(x12, x12, 2 * wordSize);
+ __ subi(x12, x12, 2 * wordSize);
__ add(sp, sp, x12);
__ ld(fp, Address(sp, 0));
__ ld(ra, Address(sp, wordSize));
@@ -188,7 +187,7 @@ void OptoRuntime::generate_uncommon_trap_blob() {
Label loop;
__ bind(loop);
__ ld(x11, Address(x15, 0)); // Load frame size
- __ sub(x11, x11, 2 * wordSize); // We'll push pc and fp by hand
+ __ subi(x11, x11, 2 * wordSize); // We'll push pc and fp by hand
__ ld(ra, Address(x12, 0)); // Save return address
__ enter(); // and old fp & set new fp
__ sub(sp, sp, x11); // Prolog
@@ -196,9 +195,9 @@ void OptoRuntime::generate_uncommon_trap_blob() {
// This value is corrected by layout_activation_impl
__ sd(zr, Address(fp, frame::interpreter_frame_last_sp_offset * wordSize));
__ mv(sender_sp, sp); // Pass sender_sp to next frame
- __ add(x15, x15, wordSize); // Bump array pointer (sizes)
- __ add(x12, x12, wordSize); // Bump array pointer (pcs)
- __ subw(x13, x13, 1); // Decrement counter
+ __ addi(x15, x15, wordSize); // Bump array pointer (sizes)
+ __ addi(x12, x12, wordSize); // Bump array pointer (pcs)
+ __ subiw(x13, x13, 1); // Decrement counter
__ bgtz(x13, loop);
__ ld(ra, Address(x12, 0)); // save final return address
// Re-push self-frame
@@ -292,7 +291,7 @@ void OptoRuntime::generate_exception_blob() {
// push fp and retaddr by hand
// Exception pc is 'return address' for stack walker
- __ addi(sp, sp, -2 * wordSize);
+ __ subi(sp, sp, 2 * wordSize);
__ sd(ra, Address(sp, wordSize));
__ sd(fp, Address(sp));
// there are no callee save registers and we don't expect an
@@ -346,7 +345,7 @@ void OptoRuntime::generate_exception_blob() {
// and we dont' expect an arg reg save area
__ ld(fp, Address(sp));
__ ld(x13, Address(sp, wordSize));
- __ addi(sp, sp , 2 * wordSize);
+ __ addi(sp, sp, 2 * wordSize);
// x10: exception handler
@@ -378,5 +377,3 @@ void OptoRuntime::generate_exception_blob() {
_exception_blob = ExceptionBlob::create(&buffer, oop_maps, SimpleRuntimeFrame::framesize >> 1);
}
#endif // COMPILER2
-
-
diff --git a/src/hotspot/cpu/riscv/sharedRuntime_riscv.cpp b/src/hotspot/cpu/riscv/sharedRuntime_riscv.cpp
index 9af1b6a9bb128..49e630bbfdf91 100644
--- a/src/hotspot/cpu/riscv/sharedRuntime_riscv.cpp
+++ b/src/hotspot/cpu/riscv/sharedRuntime_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved.
* Copyright (c) 2020, 2023, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -24,7 +24,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "code/compiledIC.hpp"
@@ -641,7 +640,7 @@ AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm
Label L_skip_barrier;
{ // Bypass the barrier for non-static methods
- __ lwu(t0, Address(xmethod, Method::access_flags_offset()));
+ __ load_unsigned_short(t0, Address(xmethod, Method::access_flags_offset()));
__ test_bit(t1, t0, exact_log2(JVM_ACC_STATIC));
__ beqz(t1, L_skip_barrier); // non-static
}
@@ -802,7 +801,7 @@ static void save_args(MacroAssembler *masm, int arg_count, int first_arg, VMRegP
if (args[i].first()->is_Register()) {
x = x + args[i].first()->as_Register();
} else if (args[i].first()->is_FloatRegister()) {
- __ addi(sp, sp, -2 * wordSize);
+ __ subi(sp, sp, 2 * wordSize);
__ fsd(args[i].first()->as_FloatRegister(), Address(sp, 0));
}
}
@@ -824,7 +823,7 @@ static void restore_args(MacroAssembler *masm, int arg_count, int first_arg, VMR
;
} else if (args[i].first()->is_FloatRegister()) {
__ fld(args[i].first()->as_FloatRegister(), Address(sp, 0));
- __ add(sp, sp, 2 * wordSize);
+ __ addi(sp, sp, 2 * wordSize);
}
}
}
@@ -1715,7 +1714,8 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm,
// NOTE: the oopMark is in swap_reg % 10 as the result of cmpxchg
__ sub(swap_reg, swap_reg, sp);
- __ andi(swap_reg, swap_reg, 3 - (int)os::vm_page_size());
+ __ mv(t0, 3 - (int)os::vm_page_size());
+ __ andr(swap_reg, swap_reg, t0);
// Save the test result, for recursive case, the result is zero
__ sd(swap_reg, Address(lock_reg, mark_word_offset));
@@ -2336,7 +2336,7 @@ void SharedRuntime::generate_deopt_blob() {
// Pop deoptimized frame
__ lwu(x12, Address(x15, Deoptimization::UnrollBlock::size_of_deoptimized_frame_offset()));
- __ sub(x12, x12, 2 * wordSize);
+ __ subi(x12, x12, 2 * wordSize);
__ add(sp, sp, x12);
__ ld(fp, Address(sp, 0));
__ ld(ra, Address(sp, wordSize));
@@ -2379,7 +2379,7 @@ void SharedRuntime::generate_deopt_blob() {
__ bind(loop);
__ ld(x9, Address(x14, 0)); // Load frame size
__ addi(x14, x14, wordSize);
- __ sub(x9, x9, 2 * wordSize); // We'll push pc and fp by hand
+ __ subi(x9, x9, 2 * wordSize); // We'll push pc and fp by hand
__ ld(ra, Address(x12, 0)); // Load pc
__ addi(x12, x12, wordSize);
__ enter(); // Save old & set new fp
@@ -2388,7 +2388,7 @@ void SharedRuntime::generate_deopt_blob() {
__ sd(zr, Address(fp, frame::interpreter_frame_last_sp_offset * wordSize));
__ sd(sender_sp, Address(fp, frame::interpreter_frame_sender_sp_offset * wordSize)); // Make it walkable
__ mv(sender_sp, sp); // Pass sender_sp to next frame
- __ addi(x13, x13, -1); // Decrement counter
+ __ subi(x13, x13, 1); // Decrement counter
__ bnez(x13, loop);
// Re-push self-frame
@@ -2566,7 +2566,7 @@ SafepointBlob* SharedRuntime::generate_handler_blob(SharedStubId id, address cal
#endif
// Adjust return pc forward to step over the safepoint poll instruction
- __ add(x18, x18, NativeInstruction::instruction_size);
+ __ addi(x18, x18, NativeInstruction::instruction_size);
__ sd(x18, Address(fp, frame::return_addr_offset * wordSize));
}
@@ -2736,7 +2736,7 @@ RuntimeStub* SharedRuntime::generate_throw_exception(SharedStubId id, address ru
assert(is_even(framesize / 2), "sp not 16-byte aligned");
// ra and fp are already in place
- __ addi(sp, fp, 0 - ((unsigned)framesize << LogBytesPerInt)); // prolog
+ __ subi(sp, fp, (unsigned)framesize << LogBytesPerInt); // prolog
int frame_complete = __ pc() - start;
diff --git a/src/hotspot/cpu/riscv/stubDeclarations_riscv.hpp b/src/hotspot/cpu/riscv/stubDeclarations_riscv.hpp
new file mode 100644
index 0000000000000..4905566c233a3
--- /dev/null
+++ b/src/hotspot/cpu/riscv/stubDeclarations_riscv.hpp
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2025, Red Hat, Inc. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef CPU_RISCV_STUBDECLARATIONS_HPP
+#define CPU_RISCV_STUBDECLARATIONS_HPP
+
+#define STUBGEN_INITIAL_BLOBS_ARCH_DO(do_stub, \
+ do_arch_blob, \
+ do_arch_entry, \
+ do_arch_entry_init) \
+ do_arch_blob(initial, 10000) \
+
+
+#define STUBGEN_CONTINUATION_BLOBS_ARCH_DO(do_stub, \
+ do_arch_blob, \
+ do_arch_entry, \
+ do_arch_entry_init) \
+ do_arch_blob(continuation, 2000) \
+
+
+#define STUBGEN_COMPILER_BLOBS_ARCH_DO(do_stub, \
+ do_arch_blob, \
+ do_arch_entry, \
+ do_arch_entry_init) \
+ do_arch_blob(compiler, 45000) \
+ do_stub(compiler, compare_long_string_LL) \
+ do_arch_entry(riscv, compiler, compare_long_string_LL, \
+ compare_long_string_LL, compare_long_string_LL) \
+ do_stub(compiler, compare_long_string_UU) \
+ do_arch_entry(riscv, compiler, compare_long_string_UU, \
+ compare_long_string_UU, compare_long_string_UU) \
+ do_stub(compiler, compare_long_string_LU) \
+ do_arch_entry(riscv, compiler, compare_long_string_LU, \
+ compare_long_string_LU, compare_long_string_LU) \
+ do_stub(compiler, compare_long_string_UL) \
+ do_arch_entry(riscv, compiler, compare_long_string_UL, \
+ compare_long_string_UL, compare_long_string_UL) \
+ do_stub(compiler, string_indexof_linear_ll) \
+ do_arch_entry(riscv, compiler, string_indexof_linear_ll, \
+ string_indexof_linear_ll, string_indexof_linear_ll) \
+ do_stub(compiler, string_indexof_linear_uu) \
+ do_arch_entry(riscv, compiler, string_indexof_linear_uu, \
+ string_indexof_linear_uu, string_indexof_linear_uu) \
+ do_stub(compiler, string_indexof_linear_ul) \
+ do_arch_entry(riscv, compiler, string_indexof_linear_ul, \
+ string_indexof_linear_ul, string_indexof_linear_ul) \
+
+
+#define STUBGEN_FINAL_BLOBS_ARCH_DO(do_stub, \
+ do_arch_blob, \
+ do_arch_entry, \
+ do_arch_entry_init) \
+ do_arch_blob(final, 20000 ZGC_ONLY(+10000)) \
+ do_stub(final, copy_byte_f) \
+ do_arch_entry(riscv, final, copy_byte_f, copy_byte_f, \
+ copy_byte_f) \
+ do_stub(final, copy_byte_b) \
+ do_arch_entry(riscv, final, copy_byte_b, copy_byte_b, \
+ copy_byte_b) \
+ do_stub(final, zero_blocks) \
+ do_arch_entry(riscv, final, zero_blocks, zero_blocks, \
+ zero_blocks) \
+
+
+#endif // CPU_RISCV_STUBDECLARATIONS_HPP
diff --git a/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp b/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp
index 1afa3545afcf9..01ed7fcac9f87 100644
--- a/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp
+++ b/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved.
+ * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2025, 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"
@@ -208,7 +207,8 @@ class StubGenerator: public StubCodeGenerator {
(int)frame::entry_frame_call_wrapper_offset == (int)call_wrapper_off,
"adjust this code");
- StubCodeMark mark(this, "StubRoutines", "call_stub");
+ StubGenStubId stub_id = StubGenStubId::call_stub_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
const Address sp_after_call (fp, sp_after_call_off * wordSize);
@@ -341,7 +341,7 @@ class StubGenerator: public StubCodeGenerator {
address loop = __ pc();
__ ld(t0, Address(c_rarg5, 0));
__ addi(c_rarg5, c_rarg5, wordSize);
- __ addi(c_rarg6, c_rarg6, -1);
+ __ subi(c_rarg6, c_rarg6, 1);
__ push_reg(t0);
__ bgtz(c_rarg6, loop);
@@ -476,7 +476,8 @@ class StubGenerator: public StubCodeGenerator {
// x10: exception oop
address generate_catch_exception() {
- StubCodeMark mark(this, "StubRoutines", "catch_exception");
+ StubGenStubId stub_id = StubGenStubId::catch_exception_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
// same as in generate_call_stub():
@@ -528,7 +529,8 @@ class StubGenerator: public StubCodeGenerator {
// so it just needs to be generated code with no x86 prolog
address generate_forward_exception() {
- StubCodeMark mark(this, "StubRoutines", "forward exception");
+ StubGenStubId stub_id = StubGenStubId::forward_exception_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
// Upon entry, RA points to the return address returning into
@@ -614,7 +616,8 @@ class StubGenerator: public StubCodeGenerator {
// [tos + 5]: saved t0
address generate_verify_oop() {
- StubCodeMark mark(this, "StubRoutines", "verify_oop");
+ StubGenStubId stub_id = StubGenStubId::verify_oop_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Label exit, error;
@@ -623,7 +626,7 @@ class StubGenerator: public StubCodeGenerator {
__ la(c_rarg2, ExternalAddress((address) StubRoutines::verify_oop_count_addr()));
__ ld(c_rarg3, Address(c_rarg2));
- __ add(c_rarg3, c_rarg3, 1);
+ __ addi(c_rarg3, c_rarg3, 1);
__ sd(c_rarg3, Address(c_rarg2));
// object is in x10
@@ -675,7 +678,8 @@ class StubGenerator: public StubCodeGenerator {
const Register base = x28, cnt = x29, tmp1 = x30, tmp2 = x31;
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "zero_blocks");
+ StubGenStubId stub_id = StubGenStubId::zero_blocks_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
if (UseBlockZeroing) {
@@ -698,8 +702,8 @@ class StubGenerator: public StubCodeGenerator {
for (int i = 0; i < MacroAssembler::zero_words_block_size; i++) {
__ sd(zr, Address(base, i * wordSize));
}
- __ add(base, base, MacroAssembler::zero_words_block_size * wordSize);
- __ sub(cnt, cnt, MacroAssembler::zero_words_block_size);
+ __ addi(base, base, MacroAssembler::zero_words_block_size * wordSize);
+ __ subi(cnt, cnt, MacroAssembler::zero_words_block_size);
__ bge(cnt, tmp1, loop);
__ bind(done);
}
@@ -727,8 +731,22 @@ class StubGenerator: public StubCodeGenerator {
//
// s and d are adjusted to point to the remaining words to copy
//
- void generate_copy_longs(Label &start, Register s, Register d, Register count,
- copy_direction direction) {
+ void generate_copy_longs(StubGenStubId stub_id, Label &start,
+ Register s, Register d, Register count) {
+ BasicType type;
+ copy_direction direction;
+ switch (stub_id) {
+ case copy_byte_f_id:
+ direction = copy_forwards;
+ type = T_BYTE;
+ break;
+ case copy_byte_b_id:
+ direction = copy_backwards;
+ type = T_BYTE;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
int unit = wordSize * direction;
int bias = wordSize;
@@ -742,13 +760,7 @@ class StubGenerator: public StubCodeGenerator {
assert_different_registers(s, d, count, t0);
Label again, drain;
- const char* stub_name = nullptr;
- if (direction == copy_forwards) {
- stub_name = "forward_copy_longs";
- } else {
- stub_name = "backward_copy_longs";
- }
- StubCodeMark mark(this, "StubRoutines", stub_name);
+ StubCodeMark mark(this, stub_id);
__ align(CodeEntryAlignment);
__ bind(start);
@@ -779,7 +791,7 @@ class StubGenerator: public StubCodeGenerator {
__ ld(tmp_reg7, Address(s, 8 * unit));
__ addi(s, s, 8 * unit);
- __ sub(count, count, 16);
+ __ subi(count, count, 16);
__ bltz(count, drain);
__ bind(again);
@@ -805,7 +817,7 @@ class StubGenerator: public StubCodeGenerator {
__ addi(s, s, 8 * unit);
__ addi(d, d, 8 * unit);
- __ sub(count, count, 8);
+ __ subi(count, count, 8);
__ bgez(count, again);
// Drain
@@ -959,9 +971,9 @@ class StubGenerator: public StubCodeGenerator {
}
if (is_aligned) {
- __ addi(t0, cnt, -32);
+ __ subi(t0, cnt, 32);
__ bgez(t0, copy32_loop);
- __ addi(t0, cnt, -8);
+ __ subi(t0, cnt, 8);
__ bgez(t0, copy8_loop, is_far);
__ j(copy_small);
} else {
@@ -985,7 +997,7 @@ class StubGenerator: public StubCodeGenerator {
__ addi(src, src, step);
__ addi(dst, dst, step);
}
- __ addi(cnt, cnt, -granularity);
+ __ subi(cnt, cnt, granularity);
__ beqz(cnt, done, is_far);
__ j(same_aligned);
@@ -996,8 +1008,8 @@ class StubGenerator: public StubCodeGenerator {
__ bind(copy32_loop);
if (is_backwards) {
- __ addi(src, src, -wordSize * 4);
- __ addi(dst, dst, -wordSize * 4);
+ __ subi(src, src, wordSize * 4);
+ __ subi(dst, dst, wordSize * 4);
}
// we first load 32 bytes, then write it, so the direction here doesn't matter
bs_asm->copy_load_at(_masm, decorators, type, 8, tmp3, Address(src), gct1);
@@ -1014,19 +1026,19 @@ class StubGenerator: public StubCodeGenerator {
__ addi(src, src, wordSize * 4);
__ addi(dst, dst, wordSize * 4);
}
- __ addi(t0, cnt, -(32 + wordSize * 4));
- __ addi(cnt, cnt, -wordSize * 4);
+ __ subi(t0, cnt, 32 + wordSize * 4);
+ __ subi(cnt, cnt, wordSize * 4);
__ bgez(t0, copy32_loop); // cnt >= 32, do next loop
__ beqz(cnt, done); // if that's all - done
- __ addi(t0, cnt, -8); // if not - copy the reminder
+ __ subi(t0, cnt, 8); // if not - copy the reminder
__ bltz(t0, copy_small); // cnt < 8, go to copy_small, else fall through to copy8_loop
__ bind(copy8_loop);
if (is_backwards) {
- __ addi(src, src, -wordSize);
- __ addi(dst, dst, -wordSize);
+ __ subi(src, src, wordSize);
+ __ subi(dst, dst, wordSize);
}
bs_asm->copy_load_at(_masm, decorators, type, 8, tmp3, Address(src), gct1);
bs_asm->copy_store_at(_masm, decorators, type, 8, Address(dst), tmp3, gct1, gct2, gct3);
@@ -1035,8 +1047,8 @@ class StubGenerator: public StubCodeGenerator {
__ addi(src, src, wordSize);
__ addi(dst, dst, wordSize);
}
- __ addi(t0, cnt, -(8 + wordSize));
- __ addi(cnt, cnt, -wordSize);
+ __ subi(t0, cnt, 8 + wordSize);
+ __ subi(cnt, cnt, wordSize);
__ bgez(t0, copy8_loop); // cnt >= 8, do next loop
__ beqz(cnt, done); // if that's all - done
@@ -1054,7 +1066,7 @@ class StubGenerator: public StubCodeGenerator {
__ addi(src, src, step);
__ addi(dst, dst, step);
}
- __ addi(cnt, cnt, -granularity);
+ __ subi(cnt, cnt, granularity);
__ bgtz(cnt, copy_small);
__ bind(done);
@@ -1083,10 +1095,11 @@ class StubGenerator: public StubCodeGenerator {
}
// Arguments:
- // aligned - true => Input and output aligned on a HeapWord == 8-byte boundary
- // ignored
- // is_oop - true => oop array, so generate store check code
- // name - stub name string
+ // stub_id - is used to name the stub and identify all details of
+ // how to perform the copy.
+ //
+ // entry - is assigned to the stub's post push entry point unless
+ // it is null
//
// Inputs:
// c_rarg0 - source array address
@@ -1097,16 +1110,96 @@ class StubGenerator: public StubCodeGenerator {
// the hardware handle it. The two dwords within qwords that span
// cache line boundaries will still be loaded and stored atomically.
//
- // Side Effects:
- // disjoint_int_copy_entry is set to the no-overlap entry point
- // used by generate_conjoint_int_oop_copy().
+ // Side Effects: entry is set to the (post push) entry point so it
+ // can be used by the corresponding conjoint copy
+ // method
//
- address generate_disjoint_copy(size_t size, bool aligned, bool is_oop, address* entry,
- const char* name, bool dest_uninitialized = false) {
+ address generate_disjoint_copy(StubGenStubId stub_id, address* entry) {
+ size_t size;
+ bool aligned;
+ bool is_oop;
+ bool dest_uninitialized;
+ switch (stub_id) {
+ case jbyte_disjoint_arraycopy_id:
+ size = sizeof(jbyte);
+ aligned = false;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case arrayof_jbyte_disjoint_arraycopy_id:
+ size = sizeof(jbyte);
+ aligned = true;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case jshort_disjoint_arraycopy_id:
+ size = sizeof(jshort);
+ aligned = false;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case arrayof_jshort_disjoint_arraycopy_id:
+ size = sizeof(jshort);
+ aligned = true;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case jint_disjoint_arraycopy_id:
+ size = sizeof(jint);
+ aligned = false;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case arrayof_jint_disjoint_arraycopy_id:
+ size = sizeof(jint);
+ aligned = true;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case jlong_disjoint_arraycopy_id:
+ // since this is always aligned we can (should!) use the same
+ // stub as for case arrayof_jlong_disjoint_arraycopy
+ ShouldNotReachHere();
+ break;
+ case arrayof_jlong_disjoint_arraycopy_id:
+ size = sizeof(jlong);
+ aligned = true;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case oop_disjoint_arraycopy_id:
+ size = UseCompressedOops ? sizeof (jint) : sizeof (jlong);
+ aligned = !UseCompressedOops;
+ is_oop = true;
+ dest_uninitialized = false;
+ break;
+ case arrayof_oop_disjoint_arraycopy_id:
+ size = UseCompressedOops ? sizeof (jint) : sizeof (jlong);
+ aligned = !UseCompressedOops;
+ is_oop = true;
+ dest_uninitialized = false;
+ break;
+ case oop_disjoint_arraycopy_uninit_id:
+ size = UseCompressedOops ? sizeof (jint) : sizeof (jlong);
+ aligned = !UseCompressedOops;
+ is_oop = true;
+ dest_uninitialized = true;
+ break;
+ case arrayof_oop_disjoint_arraycopy_uninit_id:
+ size = UseCompressedOops ? sizeof (jint) : sizeof (jlong);
+ aligned = !UseCompressedOops;
+ is_oop = true;
+ dest_uninitialized = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ break;
+ }
+
const Register s = c_rarg0, d = c_rarg1, count = c_rarg2;
RegSet saved_reg = RegSet::of(s, d, count);
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ enter();
@@ -1155,10 +1248,15 @@ class StubGenerator: public StubCodeGenerator {
}
// Arguments:
- // aligned - true => Input and output aligned on a HeapWord == 8-byte boundary
- // ignored
- // is_oop - true => oop array, so generate store check code
- // name - stub name string
+ // stub_id - is used to name the stub and identify all details of
+ // how to perform the copy.
+ //
+ // nooverlap_target - identifes the (post push) entry for the
+ // corresponding disjoint copy routine which can be
+ // jumped to if the ranges do not actually overlap
+ //
+ // entry - is assigned to the stub's post push entry point unless
+ // it is null
//
// Inputs:
// c_rarg0 - source array address
@@ -1169,12 +1267,94 @@ class StubGenerator: public StubCodeGenerator {
// the hardware handle it. The two dwords within qwords that span
// cache line boundaries will still be loaded and stored atomically.
//
- address generate_conjoint_copy(size_t size, bool aligned, bool is_oop, address nooverlap_target,
- address* entry, const char* name,
- bool dest_uninitialized = false) {
+ // Side Effects:
+ // entry is set to the no-overlap entry point so it can be used by
+ // some other conjoint copy method
+ //
+ address generate_conjoint_copy(StubGenStubId stub_id, address nooverlap_target, address *entry) {
const Register s = c_rarg0, d = c_rarg1, count = c_rarg2;
RegSet saved_regs = RegSet::of(s, d, count);
- StubCodeMark mark(this, "StubRoutines", name);
+ int size;
+ bool aligned;
+ bool is_oop;
+ bool dest_uninitialized;
+ switch (stub_id) {
+ case jbyte_arraycopy_id:
+ size = sizeof(jbyte);
+ aligned = false;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case arrayof_jbyte_arraycopy_id:
+ size = sizeof(jbyte);
+ aligned = true;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case jshort_arraycopy_id:
+ size = sizeof(jshort);
+ aligned = false;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case arrayof_jshort_arraycopy_id:
+ size = sizeof(jshort);
+ aligned = true;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case jint_arraycopy_id:
+ size = sizeof(jint);
+ aligned = false;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case arrayof_jint_arraycopy_id:
+ size = sizeof(jint);
+ aligned = true;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case jlong_arraycopy_id:
+ // since this is always aligned we can (should!) use the same
+ // stub as for case arrayof_jlong_disjoint_arraycopy
+ ShouldNotReachHere();
+ break;
+ case arrayof_jlong_arraycopy_id:
+ size = sizeof(jlong);
+ aligned = true;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case oop_arraycopy_id:
+ size = UseCompressedOops ? sizeof (jint) : sizeof (jlong);
+ aligned = !UseCompressedOops;
+ is_oop = true;
+ dest_uninitialized = false;
+ break;
+ case arrayof_oop_arraycopy_id:
+ size = UseCompressedOops ? sizeof (jint) : sizeof (jlong);
+ aligned = !UseCompressedOops;
+ is_oop = true;
+ dest_uninitialized = false;
+ break;
+ case oop_arraycopy_uninit_id:
+ size = UseCompressedOops ? sizeof (jint) : sizeof (jlong);
+ aligned = !UseCompressedOops;
+ is_oop = true;
+ dest_uninitialized = true;
+ break;
+ case arrayof_oop_arraycopy_uninit_id:
+ size = UseCompressedOops ? sizeof (jint) : sizeof (jlong);
+ aligned = !UseCompressedOops;
+ is_oop = true;
+ dest_uninitialized = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ enter();
@@ -1228,232 +1408,14 @@ class StubGenerator: public StubCodeGenerator {
return start;
}
- // Arguments:
- // aligned - true => Input and output aligned on a HeapWord == 8-byte boundary
- // ignored
- // name - stub name string
- //
- // Inputs:
- // c_rarg0 - source array address
- // c_rarg1 - destination array address
- // c_rarg2 - element count, treated as ssize_t, can be zero
- //
- // If 'from' and/or 'to' are aligned on 4-, 2-, or 1-byte boundaries,
- // we let the hardware handle it. The one to eight bytes within words,
- // dwords or qwords that span cache line boundaries will still be loaded
- // and stored atomically.
- //
- // Side Effects:
- // disjoint_byte_copy_entry is set to the no-overlap entry point //
- // If 'from' and/or 'to' are aligned on 4-, 2-, or 1-byte boundaries,
- // we let the hardware handle it. The one to eight bytes within words,
- // dwords or qwords that span cache line boundaries will still be loaded
- // and stored atomically.
- //
- // Side Effects:
- // disjoint_byte_copy_entry is set to the no-overlap entry point
- // used by generate_conjoint_byte_copy().
- //
- address generate_disjoint_byte_copy(bool aligned, address* entry, const char* name) {
- const bool not_oop = false;
- return generate_disjoint_copy(sizeof (jbyte), aligned, not_oop, entry, name);
- }
-
- // Arguments:
- // aligned - true => Input and output aligned on a HeapWord == 8-byte boundary
- // ignored
- // name - stub name string
- //
- // Inputs:
- // c_rarg0 - source array address
- // c_rarg1 - destination array address
- // c_rarg2 - element count, treated as ssize_t, can be zero
- //
- // If 'from' and/or 'to' are aligned on 4-, 2-, or 1-byte boundaries,
- // we let the hardware handle it. The one to eight bytes within words,
- // dwords or qwords that span cache line boundaries will still be loaded
- // and stored atomically.
- //
- address generate_conjoint_byte_copy(bool aligned, address nooverlap_target,
- address* entry, const char* name) {
- const bool not_oop = false;
- return generate_conjoint_copy(sizeof (jbyte), aligned, not_oop, nooverlap_target, entry, name);
- }
-
- // Arguments:
- // aligned - true => Input and output aligned on a HeapWord == 8-byte boundary
- // ignored
- // name - stub name string
- //
- // Inputs:
- // c_rarg0 - source array address
- // c_rarg1 - destination array address
- // c_rarg2 - element count, treated as ssize_t, can be zero
- //
- // If 'from' and/or 'to' are aligned on 4- or 2-byte boundaries, we
- // let the hardware handle it. The two or four words within dwords
- // or qwords that span cache line boundaries will still be loaded
- // and stored atomically.
- //
- // Side Effects:
- // disjoint_short_copy_entry is set to the no-overlap entry point
- // used by generate_conjoint_short_copy().
- //
- address generate_disjoint_short_copy(bool aligned,
- address* entry, const char* name) {
- const bool not_oop = false;
- return generate_disjoint_copy(sizeof (jshort), aligned, not_oop, entry, name);
- }
-
- // Arguments:
- // aligned - true => Input and output aligned on a HeapWord == 8-byte boundary
- // ignored
- // name - stub name string
- //
- // Inputs:
- // c_rarg0 - source array address
- // c_rarg1 - destination array address
- // c_rarg2 - element count, treated as ssize_t, can be zero
- //
- // If 'from' and/or 'to' are aligned on 4- or 2-byte boundaries, we
- // let the hardware handle it. The two or four words within dwords
- // or qwords that span cache line boundaries will still be loaded
- // and stored atomically.
- //
- address generate_conjoint_short_copy(bool aligned, address nooverlap_target,
- address* entry, const char* name) {
- const bool not_oop = false;
- return generate_conjoint_copy(sizeof (jshort), aligned, not_oop, nooverlap_target, entry, name);
- }
-
- // Arguments:
- // aligned - true => Input and output aligned on a HeapWord == 8-byte boundary
- // ignored
- // name - stub name string
- //
- // Inputs:
- // c_rarg0 - source array address
- // c_rarg1 - destination array address
- // c_rarg2 - element count, treated as ssize_t, can be zero
- //
- // If 'from' and/or 'to' are aligned on 4-byte boundaries, we let
- // the hardware handle it. The two dwords within qwords that span
- // cache line boundaries will still be loaded and stored atomically.
- //
- // Side Effects:
- // disjoint_int_copy_entry is set to the no-overlap entry point
- // used by generate_conjoint_int_oop_copy().
- //
- address generate_disjoint_int_copy(bool aligned, address* entry,
- const char* name, bool dest_uninitialized = false) {
- const bool not_oop = false;
- return generate_disjoint_copy(sizeof (jint), aligned, not_oop, entry, name);
- }
-
- // Arguments:
- // aligned - true => Input and output aligned on a HeapWord == 8-byte boundary
- // ignored
- // name - stub name string
- //
- // Inputs:
- // c_rarg0 - source array address
- // c_rarg1 - destination array address
- // c_rarg2 - element count, treated as ssize_t, can be zero
- //
- // If 'from' and/or 'to' are aligned on 4-byte boundaries, we let
- // the hardware handle it. The two dwords within qwords that span
- // cache line boundaries will still be loaded and stored atomically.
- //
- address generate_conjoint_int_copy(bool aligned, address nooverlap_target,
- address* entry, const char* name,
- bool dest_uninitialized = false) {
- const bool not_oop = false;
- return generate_conjoint_copy(sizeof (jint), aligned, not_oop, nooverlap_target, entry, name);
- }
-
-
- // Arguments:
- // aligned - true => Input and output aligned on a HeapWord boundary == 8 bytes
- // ignored
- // name - stub name string
- //
- // Inputs:
- // c_rarg0 - source array address
- // c_rarg1 - destination array address
- // c_rarg2 - element count, treated as size_t, can be zero
- //
- // Side Effects:
- // disjoint_oop_copy_entry or disjoint_long_copy_entry is set to the
- // no-overlap entry point used by generate_conjoint_long_oop_copy().
- //
- address generate_disjoint_long_copy(bool aligned, address* entry,
- const char* name, bool dest_uninitialized = false) {
- const bool not_oop = false;
- return generate_disjoint_copy(sizeof (jlong), aligned, not_oop, entry, name);
- }
-
- // Arguments:
- // aligned - true => Input and output aligned on a HeapWord boundary == 8 bytes
- // ignored
- // name - stub name string
- //
- // Inputs:
- // c_rarg0 - source array address
- // c_rarg1 - destination array address
- // c_rarg2 - element count, treated as size_t, can be zero
- //
- address generate_conjoint_long_copy(bool aligned,
- address nooverlap_target, address* entry,
- const char* name, bool dest_uninitialized = false) {
- const bool not_oop = false;
- return generate_conjoint_copy(sizeof (jlong), aligned, not_oop, nooverlap_target, entry, name);
- }
-
- // Arguments:
- // aligned - true => Input and output aligned on a HeapWord boundary == 8 bytes
- // ignored
- // name - stub name string
- //
- // Inputs:
- // c_rarg0 - source array address
- // c_rarg1 - destination array address
- // c_rarg2 - element count, treated as size_t, can be zero
- //
- // Side Effects:
- // disjoint_oop_copy_entry or disjoint_long_copy_entry is set to the
- // no-overlap entry point used by generate_conjoint_long_oop_copy().
- //
- address generate_disjoint_oop_copy(bool aligned, address* entry,
- const char* name, bool dest_uninitialized) {
- const bool is_oop = true;
- const size_t size = UseCompressedOops ? sizeof (jint) : sizeof (jlong);
- return generate_disjoint_copy(size, aligned, is_oop, entry, name, dest_uninitialized);
- }
-
- // Arguments:
- // aligned - true => Input and output aligned on a HeapWord boundary == 8 bytes
- // ignored
- // name - stub name string
- //
- // Inputs:
- // c_rarg0 - source array address
- // c_rarg1 - destination array address
- // c_rarg2 - element count, treated as size_t, can be zero
- //
- address generate_conjoint_oop_copy(bool aligned,
- address nooverlap_target, address* entry,
- const char* name, bool dest_uninitialized) {
- const bool is_oop = true;
- const size_t size = UseCompressedOops ? sizeof (jint) : sizeof (jlong);
- return generate_conjoint_copy(size, aligned, is_oop, nooverlap_target, entry,
- name, dest_uninitialized);
- }
-
// Helper for generating a dynamic type check.
// Smashes t0, t1.
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 +1424,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);
@@ -1482,8 +1444,19 @@ class StubGenerator: public StubCodeGenerator {
// x10 == 0 - success
// x10 == -1^K - failure, where K is partial transfer count
//
- address generate_checkcast_copy(const char* name, address* entry,
- bool dest_uninitialized = false) {
+ address generate_checkcast_copy(StubGenStubId stub_id, address* entry) {
+ bool dest_uninitialized;
+ switch (stub_id) {
+ case checkcast_arraycopy_id:
+ dest_uninitialized = false;
+ break;
+ case checkcast_arraycopy_uninit_id:
+ dest_uninitialized = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+
Label L_load_element, L_store_element, L_do_card_marks, L_done, L_done_pop;
// Input registers (after setup_arg_regs)
@@ -1516,7 +1489,7 @@ class StubGenerator: public StubCodeGenerator {
copied_oop, r9_klass, count_save);
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ enter(); // required for proper stackwalking of RuntimeStub frame
@@ -1578,8 +1551,8 @@ class StubGenerator: public StubCodeGenerator {
bs->copy_store_at(_masm, decorators, T_OBJECT, element_size,
Address(to, 0), copied_oop,
gct1, gct2, gct3);
- __ add(to, to, UseCompressedOops ? 4 : 8);
- __ sub(count, count, 1);
+ __ addi(to, to, UseCompressedOops ? 4 : 8);
+ __ subi(count, count, 1);
__ beqz(count, L_do_card_marks);
// ======== loop entry is here ========
@@ -1587,11 +1560,22 @@ class StubGenerator: public StubCodeGenerator {
bs->copy_load_at(_masm, decorators, T_OBJECT, element_size,
copied_oop, Address(from, 0),
gct1);
- __ add(from, from, UseCompressedOops ? 4 : 8);
+ __ addi(from, from, UseCompressedOops ? 4 : 8);
__ beqz(copied_oop, L_store_element);
__ load_klass(r9_klass, copied_oop);// query the object klass
- generate_type_check(r9_klass, ckoff, ckval, L_store_element);
+
+ BLOCK_COMMENT("type_check:");
+ generate_type_check(r9_klass, /*sub_klass*/
+ ckoff, /*super_check_offset*/
+ ckval, /*super_klass*/
+ x10, /*result*/
+ gct1, /*tmp1*/
+ gct2, /*tmp2*/
+ L_store_element);
+
+ // Fall through on failure!
+
// ======== end loop ========
// It was a real error; we must depend on the caller to finish the job.
@@ -1600,7 +1584,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);
@@ -1662,8 +1646,7 @@ class StubGenerator: public StubCodeGenerator {
// Examines the alignment of the operands and dispatches
// to a long, int, short, or byte copy loop.
//
- address generate_unsafe_copy(const char* name,
- address byte_copy_entry,
+ address generate_unsafe_copy(address byte_copy_entry,
address short_copy_entry,
address int_copy_entry,
address long_copy_entry) {
@@ -1673,7 +1656,8 @@ class StubGenerator: public StubCodeGenerator {
const Register s = c_rarg0, d = c_rarg1, count = c_rarg2;
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubGenStubId stub_id = StubGenStubId::unsafe_arraycopy_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ enter(); // required for proper stackwalking of RuntimeStub frame
@@ -1718,8 +1702,7 @@ class StubGenerator: public StubCodeGenerator {
// x10 == 0 - success
// x10 == -1^K - failure, where K is partial transfer count
//
- address generate_generic_copy(const char* name,
- address byte_copy_entry, address short_copy_entry,
+ address generate_generic_copy(address byte_copy_entry, address short_copy_entry,
address int_copy_entry, address oop_copy_entry,
address long_copy_entry, address checkcast_copy_entry) {
assert_cond(byte_copy_entry != nullptr && short_copy_entry != nullptr &&
@@ -1740,7 +1723,8 @@ class StubGenerator: public StubCodeGenerator {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubGenStubId stub_id = StubGenStubId::generic_arraycopy_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
@@ -1929,9 +1913,9 @@ class StubGenerator: public StubCodeGenerator {
t1, L_failed);
__ shadd(from, src_pos, src, t0, LogBytesPerHeapOop);
- __ add(from, from, arrayOopDesc::base_offset_in_bytes(T_OBJECT));
+ __ addi(from, from, arrayOopDesc::base_offset_in_bytes(T_OBJECT));
__ shadd(to, dst_pos, dst, t0, LogBytesPerHeapOop);
- __ add(to, to, arrayOopDesc::base_offset_in_bytes(T_OBJECT));
+ __ addi(to, to, arrayOopDesc::base_offset_in_bytes(T_OBJECT));
__ sext(count, scratch_length, 32); // length
__ BIND(L_plain_copy);
__ j(RuntimeAddress(oop_copy_entry));
@@ -1952,9 +1936,9 @@ class StubGenerator: public StubCodeGenerator {
// Marshal the base address arguments now, freeing registers.
__ shadd(from, src_pos, src, t0, LogBytesPerHeapOop);
- __ add(from, from, arrayOopDesc::base_offset_in_bytes(T_OBJECT));
+ __ addi(from, from, arrayOopDesc::base_offset_in_bytes(T_OBJECT));
__ shadd(to, dst_pos, dst, t0, LogBytesPerHeapOop);
- __ add(to, to, arrayOopDesc::base_offset_in_bytes(T_OBJECT));
+ __ addi(to, to, arrayOopDesc::base_offset_in_bytes(T_OBJECT));
__ sext(count, length, 32); // length (reloaded)
const Register sco_temp = c_rarg3; // this register is free now
assert_different_registers(from, to, count, sco_temp,
@@ -1965,7 +1949,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());
@@ -1996,9 +1980,41 @@ class StubGenerator: public StubCodeGenerator {
// value: c_rarg1
// count: c_rarg2 treated as signed
//
- address generate_fill(BasicType t, bool aligned, const char* name) {
+ address generate_fill(StubGenStubId stub_id) {
+ BasicType t;
+ bool aligned;
+
+ switch (stub_id) {
+ case jbyte_fill_id:
+ t = T_BYTE;
+ aligned = false;
+ break;
+ case jshort_fill_id:
+ t = T_SHORT;
+ aligned = false;
+ break;
+ case jint_fill_id:
+ t = T_INT;
+ aligned = false;
+ break;
+ case arrayof_jbyte_fill_id:
+ t = T_BYTE;
+ aligned = true;
+ break;
+ case arrayof_jshort_fill_id:
+ t = T_SHORT;
+ aligned = true;
+ break;
+ case arrayof_jint_fill_id:
+ t = T_INT;
+ aligned = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ };
+
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
BLOCK_COMMENT("Entry:");
@@ -2068,7 +2084,7 @@ class StubGenerator: public StubCodeGenerator {
__ beqz(t0, L_skip_align1);
__ sb(value, Address(to, 0));
__ addi(to, to, 1);
- __ addiw(count, count, -1);
+ __ subiw(count, count, 1);
__ bind(L_skip_align1);
// Fallthrough
case T_SHORT:
@@ -2077,7 +2093,7 @@ class StubGenerator: public StubCodeGenerator {
__ beqz(t0, L_skip_align2);
__ sh(value, Address(to, 0));
__ addi(to, to, 2);
- __ addiw(count, count, -(2 >> shift));
+ __ subiw(count, count, 2 >> shift);
__ bind(L_skip_align2);
// Fallthrough
case T_INT:
@@ -2086,7 +2102,7 @@ class StubGenerator: public StubCodeGenerator {
__ beqz(t0, L_skip_align4);
__ sw(value, Address(to, 0));
__ addi(to, to, 4);
- __ addiw(count, count, -(4 >> shift));
+ __ subiw(count, count, 4 >> shift);
__ bind(L_skip_align4);
break;
default: ShouldNotReachHere();
@@ -2170,109 +2186,79 @@ class StubGenerator: public StubCodeGenerator {
address entry_jlong_arraycopy = nullptr;
address entry_checkcast_arraycopy = nullptr;
- generate_copy_longs(copy_f, c_rarg0, c_rarg1, t1, copy_forwards);
- generate_copy_longs(copy_b, c_rarg0, c_rarg1, t1, copy_backwards);
+ generate_copy_longs(StubGenStubId::copy_byte_f_id, copy_f, c_rarg0, c_rarg1, t1);
+ generate_copy_longs(StubGenStubId::copy_byte_b_id, copy_b, c_rarg0, c_rarg1, t1);
StubRoutines::riscv::_zero_blocks = generate_zero_blocks();
//*** jbyte
// Always need aligned and unaligned versions
- StubRoutines::_jbyte_disjoint_arraycopy = generate_disjoint_byte_copy(false, &entry,
- "jbyte_disjoint_arraycopy");
- StubRoutines::_jbyte_arraycopy = generate_conjoint_byte_copy(false, entry,
- &entry_jbyte_arraycopy,
- "jbyte_arraycopy");
- StubRoutines::_arrayof_jbyte_disjoint_arraycopy = generate_disjoint_byte_copy(true, &entry,
- "arrayof_jbyte_disjoint_arraycopy");
- StubRoutines::_arrayof_jbyte_arraycopy = generate_conjoint_byte_copy(true, entry, nullptr,
- "arrayof_jbyte_arraycopy");
+ StubRoutines::_jbyte_disjoint_arraycopy = generate_disjoint_copy(StubGenStubId::jbyte_disjoint_arraycopy_id, &entry);
+ StubRoutines::_jbyte_arraycopy = generate_conjoint_copy(StubGenStubId::jbyte_arraycopy_id, entry, &entry_jbyte_arraycopy);
+ StubRoutines::_arrayof_jbyte_disjoint_arraycopy = generate_disjoint_copy(StubGenStubId::arrayof_jbyte_disjoint_arraycopy_id, &entry);
+ StubRoutines::_arrayof_jbyte_arraycopy = generate_conjoint_copy(StubGenStubId::arrayof_jbyte_arraycopy_id, entry, nullptr);
//*** jshort
// Always need aligned and unaligned versions
- StubRoutines::_jshort_disjoint_arraycopy = generate_disjoint_short_copy(false, &entry,
- "jshort_disjoint_arraycopy");
- StubRoutines::_jshort_arraycopy = generate_conjoint_short_copy(false, entry,
- &entry_jshort_arraycopy,
- "jshort_arraycopy");
- StubRoutines::_arrayof_jshort_disjoint_arraycopy = generate_disjoint_short_copy(true, &entry,
- "arrayof_jshort_disjoint_arraycopy");
- StubRoutines::_arrayof_jshort_arraycopy = generate_conjoint_short_copy(true, entry, nullptr,
- "arrayof_jshort_arraycopy");
+ StubRoutines::_jshort_disjoint_arraycopy = generate_disjoint_copy(StubGenStubId::jshort_disjoint_arraycopy_id, &entry);
+ StubRoutines::_jshort_arraycopy = generate_conjoint_copy(StubGenStubId::jshort_arraycopy_id, entry, &entry_jshort_arraycopy);
+ StubRoutines::_arrayof_jshort_disjoint_arraycopy = generate_disjoint_copy(StubGenStubId::arrayof_jshort_disjoint_arraycopy_id, &entry);
+ StubRoutines::_arrayof_jshort_arraycopy = generate_conjoint_copy(StubGenStubId::arrayof_jshort_arraycopy_id, entry, nullptr);
//*** jint
// Aligned versions
- StubRoutines::_arrayof_jint_disjoint_arraycopy = generate_disjoint_int_copy(true, &entry,
- "arrayof_jint_disjoint_arraycopy");
- StubRoutines::_arrayof_jint_arraycopy = generate_conjoint_int_copy(true, entry, &entry_jint_arraycopy,
- "arrayof_jint_arraycopy");
+ StubRoutines::_arrayof_jint_disjoint_arraycopy = generate_disjoint_copy(StubGenStubId::arrayof_jint_disjoint_arraycopy_id, &entry);
+ StubRoutines::_arrayof_jint_arraycopy = generate_conjoint_copy(StubGenStubId::arrayof_jint_arraycopy_id, entry, &entry_jint_arraycopy);
// In 64 bit we need both aligned and unaligned versions of jint arraycopy.
// entry_jint_arraycopy always points to the unaligned version
- StubRoutines::_jint_disjoint_arraycopy = generate_disjoint_int_copy(false, &entry,
- "jint_disjoint_arraycopy");
- StubRoutines::_jint_arraycopy = generate_conjoint_int_copy(false, entry,
- &entry_jint_arraycopy,
- "jint_arraycopy");
+ StubRoutines::_jint_disjoint_arraycopy = generate_disjoint_copy(StubGenStubId::jint_disjoint_arraycopy_id, &entry);
+ StubRoutines::_jint_arraycopy = generate_conjoint_copy(StubGenStubId::jint_arraycopy_id, entry, &entry_jint_arraycopy);
//*** jlong
// It is always aligned
- StubRoutines::_arrayof_jlong_disjoint_arraycopy = generate_disjoint_long_copy(true, &entry,
- "arrayof_jlong_disjoint_arraycopy");
- StubRoutines::_arrayof_jlong_arraycopy = generate_conjoint_long_copy(true, entry, &entry_jlong_arraycopy,
- "arrayof_jlong_arraycopy");
- StubRoutines::_jlong_disjoint_arraycopy = StubRoutines::_arrayof_jlong_disjoint_arraycopy;
- StubRoutines::_jlong_arraycopy = StubRoutines::_arrayof_jlong_arraycopy;
+ StubRoutines::_arrayof_jlong_disjoint_arraycopy = generate_disjoint_copy(StubGenStubId::arrayof_jlong_disjoint_arraycopy_id, &entry);
+ StubRoutines::_arrayof_jlong_arraycopy = generate_conjoint_copy(StubGenStubId::arrayof_jlong_arraycopy_id, entry, &entry_jlong_arraycopy);
+ StubRoutines::_jlong_disjoint_arraycopy = StubRoutines::_arrayof_jlong_disjoint_arraycopy;
+ StubRoutines::_jlong_arraycopy = StubRoutines::_arrayof_jlong_arraycopy;
//*** oops
- {
- // With compressed oops we need unaligned versions; notice that
- // we overwrite entry_oop_arraycopy.
- bool aligned = !UseCompressedOops;
-
- StubRoutines::_arrayof_oop_disjoint_arraycopy
- = generate_disjoint_oop_copy(aligned, &entry, "arrayof_oop_disjoint_arraycopy",
- /*dest_uninitialized*/false);
- StubRoutines::_arrayof_oop_arraycopy
- = generate_conjoint_oop_copy(aligned, entry, &entry_oop_arraycopy, "arrayof_oop_arraycopy",
- /*dest_uninitialized*/false);
- // Aligned versions without pre-barriers
- StubRoutines::_arrayof_oop_disjoint_arraycopy_uninit
- = generate_disjoint_oop_copy(aligned, &entry, "arrayof_oop_disjoint_arraycopy_uninit",
- /*dest_uninitialized*/true);
- StubRoutines::_arrayof_oop_arraycopy_uninit
- = generate_conjoint_oop_copy(aligned, entry, nullptr, "arrayof_oop_arraycopy_uninit",
- /*dest_uninitialized*/true);
- }
+ StubRoutines::_arrayof_oop_disjoint_arraycopy
+ = generate_disjoint_copy(StubGenStubId::arrayof_oop_disjoint_arraycopy_id, &entry);
+ StubRoutines::_arrayof_oop_arraycopy
+ = generate_conjoint_copy(StubGenStubId::arrayof_oop_arraycopy_id, entry, &entry_oop_arraycopy);
+ // Aligned versions without pre-barriers
+ StubRoutines::_arrayof_oop_disjoint_arraycopy_uninit
+ = generate_disjoint_copy(StubGenStubId::arrayof_oop_disjoint_arraycopy_uninit_id, &entry);
+ StubRoutines::_arrayof_oop_arraycopy_uninit
+ = generate_conjoint_copy(StubGenStubId::arrayof_oop_arraycopy_uninit_id, entry, nullptr);
StubRoutines::_oop_disjoint_arraycopy = StubRoutines::_arrayof_oop_disjoint_arraycopy;
StubRoutines::_oop_arraycopy = StubRoutines::_arrayof_oop_arraycopy;
StubRoutines::_oop_disjoint_arraycopy_uninit = StubRoutines::_arrayof_oop_disjoint_arraycopy_uninit;
StubRoutines::_oop_arraycopy_uninit = StubRoutines::_arrayof_oop_arraycopy_uninit;
- StubRoutines::_checkcast_arraycopy = generate_checkcast_copy("checkcast_arraycopy", &entry_checkcast_arraycopy);
- StubRoutines::_checkcast_arraycopy_uninit = generate_checkcast_copy("checkcast_arraycopy_uninit", nullptr,
- /*dest_uninitialized*/true);
+ StubRoutines::_checkcast_arraycopy = generate_checkcast_copy(StubGenStubId::checkcast_arraycopy_id, &entry_checkcast_arraycopy);
+ StubRoutines::_checkcast_arraycopy_uninit = generate_checkcast_copy(StubGenStubId::checkcast_arraycopy_uninit_id, nullptr);
- StubRoutines::_unsafe_arraycopy = generate_unsafe_copy("unsafe_arraycopy",
- entry_jbyte_arraycopy,
+ StubRoutines::_unsafe_arraycopy = generate_unsafe_copy(entry_jbyte_arraycopy,
entry_jshort_arraycopy,
entry_jint_arraycopy,
entry_jlong_arraycopy);
- StubRoutines::_generic_arraycopy = generate_generic_copy("generic_arraycopy",
- entry_jbyte_arraycopy,
+ StubRoutines::_generic_arraycopy = generate_generic_copy(entry_jbyte_arraycopy,
entry_jshort_arraycopy,
entry_jint_arraycopy,
entry_oop_arraycopy,
entry_jlong_arraycopy,
entry_checkcast_arraycopy);
- StubRoutines::_jbyte_fill = generate_fill(T_BYTE, false, "jbyte_fill");
- StubRoutines::_jshort_fill = generate_fill(T_SHORT, false, "jshort_fill");
- StubRoutines::_jint_fill = generate_fill(T_INT, false, "jint_fill");
- StubRoutines::_arrayof_jbyte_fill = generate_fill(T_BYTE, true, "arrayof_jbyte_fill");
- StubRoutines::_arrayof_jshort_fill = generate_fill(T_SHORT, true, "arrayof_jshort_fill");
- StubRoutines::_arrayof_jint_fill = generate_fill(T_INT, true, "arrayof_jint_fill");
+ StubRoutines::_jbyte_fill = generate_fill(StubGenStubId::jbyte_fill_id);
+ StubRoutines::_jshort_fill = generate_fill(StubGenStubId::jshort_fill_id);
+ StubRoutines::_jint_fill = generate_fill(StubGenStubId::jint_fill_id);
+ StubRoutines::_arrayof_jbyte_fill = generate_fill(StubGenStubId::arrayof_jbyte_fill_id);
+ StubRoutines::_arrayof_jshort_fill = generate_fill(StubGenStubId::arrayof_jshort_fill_id);
+ StubRoutines::_arrayof_jint_fill = generate_fill(StubGenStubId::arrayof_jint_fill_id);
}
void generate_aes_loadkeys(const Register &key, VectorRegister *working_vregs, int rounds) {
@@ -2308,7 +2294,8 @@ class StubGenerator: public StubCodeGenerator {
assert(UseAESIntrinsics, "need AES instructions (Zvkned extension) support");
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "aescrypt_encryptBlock");
+ StubGenStubId stub_id = StubGenStubId::aescrypt_encryptBlock_id;
+ StubCodeMark mark(this, stub_id);
Label L_aes128, L_aes192;
@@ -2386,7 +2373,8 @@ class StubGenerator: public StubCodeGenerator {
assert(UseAESIntrinsics, "need AES instructions (Zvkned extension) support");
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "aescrypt_decryptBlock");
+ StubGenStubId stub_id = StubGenStubId::aescrypt_decryptBlock_id;
+ StubCodeMark mark(this, stub_id);
Label L_aes128, L_aes192;
@@ -2461,17 +2449,36 @@ class StubGenerator: public StubCodeGenerator {
}
// code for comparing 8 characters of strings with Latin1 and Utf16 encoding
- void compare_string_8_x_LU(Register tmpL, Register tmpU, Register strL, Register strU, Label& DIFF) {
+ void compare_string_8_x_LU(Register tmpL, Register tmpU,
+ Register strL, Register strU, Label& DIFF) {
const Register tmp = x30, tmpLval = x12;
+
+ int base_offset = arrayOopDesc::base_offset_in_bytes(T_CHAR);
+
+ assert((base_offset % (UseCompactObjectHeaders ? 4 :
+ (UseCompressedClassPointers ? 8 : 4))) == 0, "Must be");
+
+#ifdef ASSERT
+ if (AvoidUnalignedAccesses) {
+ Label align_ok;
+ __ andi(t0, strL, 0x7);
+ __ beqz(t0, align_ok);
+ __ stop("bad alignment");
+ __ bind(align_ok);
+ }
+#endif
__ ld(tmpLval, Address(strL));
__ addi(strL, strL, wordSize);
- __ ld(tmpU, Address(strU));
+
+ // compare first 4 characters
+ __ load_long_misaligned(tmpU, Address(strU), tmp, (base_offset % 8) != 0 ? 4 : 8);
__ addi(strU, strU, wordSize);
__ inflate_lo32(tmpL, tmpLval);
__ xorr(tmp, tmpU, tmpL);
__ bnez(tmp, DIFF);
- __ ld(tmpU, Address(strU));
+ // compare second 4 characters
+ __ load_long_misaligned(tmpU, Address(strU), tmp, (base_offset % 8) != 0 ? 4 : 8);
__ addi(strU, strU, wordSize);
__ inflate_hi32(tmpL, tmpLval);
__ xorr(tmp, tmpU, tmpL);
@@ -2486,47 +2493,57 @@ class StubGenerator: public StubCodeGenerator {
// x28 = tmp1
// x29 = tmp2
// x30 = tmp3
- address generate_compare_long_string_different_encoding(bool isLU) {
+ address generate_compare_long_string_different_encoding(StubGenStubId stub_id) {
+ bool isLU;
+ switch (stub_id) {
+ case compare_long_string_LU_id:
+ isLU = true;
+ break;
+ case compare_long_string_UL_id:
+ isLU = false;
+ break;
+ default:
+ ShouldNotReachHere();
+ };
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", isLU ? "compare_long_string_different_encoding LU" : "compare_long_string_different_encoding UL");
+ StubCodeMark mark(this, stub_id);
address entry = __ pc();
Label SMALL_LOOP, TAIL, LOAD_LAST, DONE, CALCULATE_DIFFERENCE;
const Register result = x10, str1 = x11, str2 = x13, cnt2 = x14,
tmp1 = x28, tmp2 = x29, tmp3 = x30, tmp4 = x12;
- // cnt2 == amount of characters left to compare
- // Check already loaded first 4 symbols
- __ inflate_lo32(tmp3, isLU ? tmp1 : tmp2);
- __ mv(isLU ? tmp1 : tmp2, tmp3);
- __ addi(str1, str1, isLU ? wordSize / 2 : wordSize);
- __ addi(str2, str2, isLU ? wordSize : wordSize / 2);
- __ sub(cnt2, cnt2, wordSize / 2); // Already loaded 4 symbols
+ int base_offset1 = arrayOopDesc::base_offset_in_bytes(T_BYTE);
+ int base_offset2 = arrayOopDesc::base_offset_in_bytes(T_CHAR);
- __ xorr(tmp3, tmp1, tmp2);
- __ bnez(tmp3, CALCULATE_DIFFERENCE);
+ assert((base_offset1 % (UseCompactObjectHeaders ? 4 :
+ (UseCompressedClassPointers ? 8 : 4))) == 0, "Must be");
+ assert((base_offset2 % (UseCompactObjectHeaders ? 4 :
+ (UseCompressedClassPointers ? 8 : 4))) == 0, "Must be");
Register strU = isLU ? str2 : str1,
strL = isLU ? str1 : str2,
tmpU = isLU ? tmp2 : tmp1, // where to keep U for comparison
tmpL = isLU ? tmp1 : tmp2; // where to keep L for comparison
- // make sure main loop is 8 byte-aligned, we should load another 4 bytes from strL
- // cnt2 is >= 68 here, no need to check it for >= 0
- __ lwu(tmpL, Address(strL));
- __ addi(strL, strL, wordSize / 2);
- __ ld(tmpU, Address(strU));
- __ addi(strU, strU, wordSize);
- __ inflate_lo32(tmp3, tmpL);
- __ mv(tmpL, tmp3);
- __ xorr(tmp3, tmpU, tmpL);
- __ bnez(tmp3, CALCULATE_DIFFERENCE);
- __ addi(cnt2, cnt2, -wordSize / 2);
-
- // we are now 8-bytes aligned on strL
- __ sub(cnt2, cnt2, wordSize * 2);
+ if (AvoidUnalignedAccesses && (base_offset1 % 8) != 0) {
+ // Load 4 bytes from strL to make sure main loop is 8-byte aligned
+ // cnt2 is >= 68 here, no need to check it for >= 0
+ __ lwu(tmpL, Address(strL));
+ __ addi(strL, strL, wordSize / 2);
+ __ load_long_misaligned(tmpU, Address(strU), tmp4, (base_offset2 % 8) != 0 ? 4 : 8);
+ __ addi(strU, strU, wordSize);
+ __ inflate_lo32(tmp3, tmpL);
+ __ mv(tmpL, tmp3);
+ __ xorr(tmp3, tmpU, tmpL);
+ __ bnez(tmp3, CALCULATE_DIFFERENCE);
+ __ subi(cnt2, cnt2, wordSize / 2);
+ }
+
+ // we are now 8-bytes aligned on strL when AvoidUnalignedAccesses is true
+ __ subi(cnt2, cnt2, wordSize * 2);
__ bltz(cnt2, TAIL);
__ bind(SMALL_LOOP); // smaller loop
- __ sub(cnt2, cnt2, wordSize * 2);
+ __ subi(cnt2, cnt2, wordSize * 2);
compare_string_8_x_LU(tmpL, tmpU, strL, strU, CALCULATE_DIFFERENCE);
compare_string_8_x_LU(tmpL, tmpU, strL, strU, CALCULATE_DIFFERENCE);
__ bgez(cnt2, SMALL_LOOP);
@@ -2540,11 +2557,11 @@ class StubGenerator: public StubCodeGenerator {
__ bltz(t0, LOAD_LAST);
// remaining characters are greater than or equals to 8, we can do one compare_string_8_x_LU
compare_string_8_x_LU(tmpL, tmpU, strL, strU, CALCULATE_DIFFERENCE);
- __ addi(cnt2, cnt2, -wordSize);
+ __ subi(cnt2, cnt2, wordSize);
__ beqz(cnt2, DONE); // no character left
__ bind(LOAD_LAST); // cnt2 = 1..7 characters left
- __ addi(cnt2, cnt2, -wordSize); // cnt2 is now an offset in strL which points to last 8 bytes
+ __ subi(cnt2, cnt2, wordSize); // cnt2 is now an offset in strL which points to last 8 bytes
__ slli(t0, cnt2, 1); // t0 is now an offset in strU which points to last 16 bytes
__ add(strL, strL, cnt2); // Address of last 8 bytes in Latin1 string
__ add(strU, strU, t0); // Address of last 16 bytes in UTF-16 string
@@ -2568,7 +2585,8 @@ class StubGenerator: public StubCodeGenerator {
// Find the first different characters in the longwords and
// compute their difference.
__ bind(CALCULATE_DIFFERENCE);
- __ ctzc_bit(tmp4, tmp3);
+ // count bits of trailing zero chars
+ __ ctzc_bits(tmp4, tmp3);
__ srl(tmp1, tmp1, tmp4);
__ srl(tmp2, tmp2, tmp4);
__ zext(tmp1, tmp1, 16);
@@ -2581,7 +2599,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_method_entry_barrier() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "nmethod_entry_barrier");
+ StubGenStubId stub_id = StubGenStubId::method_entry_barrier_id;
+ StubCodeMark mark(this, stub_id);
Label deoptimize_label;
@@ -2609,9 +2628,9 @@ class StubGenerator: public StubCodeGenerator {
__ set_last_Java_frame(sp, fp, ra);
__ enter();
- __ add(t1, sp, wordSize);
+ __ addi(t1, sp, wordSize);
- __ sub(sp, sp, 4 * wordSize);
+ __ subi(sp, sp, 4 * wordSize);
__ push_call_clobbered_registers();
@@ -2651,10 +2670,20 @@ class StubGenerator: public StubCodeGenerator {
// x29 = tmp2
// x30 = tmp3
// x31 = tmp4
- address generate_compare_long_string_same_encoding(bool isLL) {
+ address generate_compare_long_string_same_encoding(StubGenStubId stub_id) {
+ bool isLL;
+ switch (stub_id) {
+ case compare_long_string_LL_id:
+ isLL = true;
+ break;
+ case compare_long_string_UU_id:
+ isLL = false;
+ break;
+ default:
+ ShouldNotReachHere();
+ };
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", isLL ?
- "compare_long_string_same_encoding LL" : "compare_long_string_same_encoding UU");
+ StubCodeMark mark(this, stub_id);
address entry = __ pc();
Label SMALL_LOOP, CHECK_LAST, DIFF2, TAIL,
LENGTH_DIFF, DIFF, LAST_CHECK_AND_LENGTH_DIFF;
@@ -2664,22 +2693,22 @@ class StubGenerator: public StubCodeGenerator {
// cnt1/cnt2 contains amount of characters to compare. cnt1 can be re-used
// update cnt2 counter with already loaded 8 bytes
- __ sub(cnt2, cnt2, wordSize / (isLL ? 1 : 2));
+ __ subi(cnt2, cnt2, wordSize / (isLL ? 1 : 2));
// update pointers, because of previous read
- __ add(str1, str1, wordSize);
- __ add(str2, str2, wordSize);
+ __ addi(str1, str1, wordSize);
+ __ addi(str2, str2, wordSize);
// less than 16 bytes left?
- __ sub(cnt2, cnt2, isLL ? 16 : 8);
+ __ subi(cnt2, cnt2, isLL ? 16 : 8);
__ push_reg(spilled_regs, sp);
__ bltz(cnt2, TAIL);
__ bind(SMALL_LOOP);
compare_string_16_bytes_same(DIFF, DIFF2);
- __ sub(cnt2, cnt2, isLL ? 16 : 8);
+ __ subi(cnt2, cnt2, isLL ? 16 : 8);
__ bgez(cnt2, SMALL_LOOP);
__ bind(TAIL);
__ addi(cnt2, cnt2, isLL ? 16 : 8);
__ beqz(cnt2, LAST_CHECK_AND_LENGTH_DIFF);
- __ sub(cnt2, cnt2, isLL ? 8 : 4);
+ __ subi(cnt2, cnt2, isLL ? 8 : 4);
__ blez(cnt2, CHECK_LAST);
__ xorr(tmp4, tmp1, tmp2);
__ bnez(tmp4, DIFF);
@@ -2687,7 +2716,7 @@ class StubGenerator: public StubCodeGenerator {
__ addi(str1, str1, 8);
__ ld(tmp2, Address(str2));
__ addi(str2, str2, 8);
- __ sub(cnt2, cnt2, isLL ? 8 : 4);
+ __ subi(cnt2, cnt2, isLL ? 8 : 4);
__ bind(CHECK_LAST);
if (!isLL) {
__ add(cnt2, cnt2, cnt2); // now in bytes
@@ -2703,7 +2732,8 @@ class StubGenerator: public StubCodeGenerator {
// Find the first different characters in the longwords and
// compute their difference.
__ bind(DIFF2);
- __ ctzc_bit(tmp3, tmp4, isLL); // count zero from lsb to msb
+ // count bits of trailing zero chars
+ __ ctzc_bits(tmp3, tmp4, isLL);
__ srl(tmp5, tmp5, tmp3);
__ srl(cnt1, cnt1, tmp3);
if (isLL) {
@@ -2716,7 +2746,8 @@ class StubGenerator: public StubCodeGenerator {
__ sub(result, tmp5, cnt1);
__ j(LENGTH_DIFF);
__ bind(DIFF);
- __ ctzc_bit(tmp3, tmp4, isLL); // count zero from lsb to msb
+ // count bits of trailing zero chars
+ __ ctzc_bits(tmp3, tmp4, isLL);
__ srl(tmp1, tmp1, tmp3);
__ srl(tmp2, tmp2, tmp3);
if (isLL) {
@@ -2738,10 +2769,10 @@ class StubGenerator: public StubCodeGenerator {
}
void generate_compare_long_strings() {
- StubRoutines::riscv::_compare_long_string_LL = generate_compare_long_string_same_encoding(true);
- StubRoutines::riscv::_compare_long_string_UU = generate_compare_long_string_same_encoding(false);
- StubRoutines::riscv::_compare_long_string_LU = generate_compare_long_string_different_encoding(true);
- StubRoutines::riscv::_compare_long_string_UL = generate_compare_long_string_different_encoding(false);
+ StubRoutines::riscv::_compare_long_string_LL = generate_compare_long_string_same_encoding(StubGenStubId::compare_long_string_LL_id);
+ StubRoutines::riscv::_compare_long_string_UU = generate_compare_long_string_same_encoding(StubGenStubId::compare_long_string_UU_id);
+ StubRoutines::riscv::_compare_long_string_LU = generate_compare_long_string_different_encoding(StubGenStubId::compare_long_string_LU_id);
+ StubRoutines::riscv::_compare_long_string_UL = generate_compare_long_string_different_encoding(StubGenStubId::compare_long_string_UL_id);
}
// x10 result
@@ -2749,13 +2780,29 @@ class StubGenerator: public StubCodeGenerator {
// x12 src count
// x13 pattern
// x14 pattern count
- address generate_string_indexof_linear(bool needle_isL, bool haystack_isL)
+ address generate_string_indexof_linear(StubGenStubId stub_id)
{
- const char* stubName = needle_isL
- ? (haystack_isL ? "indexof_linear_ll" : "indexof_linear_ul")
- : "indexof_linear_uu";
+ bool needle_isL;
+ bool haystack_isL;
+ switch (stub_id) {
+ case string_indexof_linear_ll_id:
+ needle_isL = true;
+ haystack_isL = true;
+ break;
+ case string_indexof_linear_ul_id:
+ needle_isL = true;
+ haystack_isL = false;
+ break;
+ case string_indexof_linear_uu_id:
+ needle_isL = false;
+ haystack_isL = false;
+ break;
+ default:
+ ShouldNotReachHere();
+ };
+
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", stubName);
+ StubCodeMark mark(this, stub_id);
address entry = __ pc();
int needle_chr_size = needle_isL ? 1 : 2;
@@ -2798,7 +2845,7 @@ class StubGenerator: public StubCodeGenerator {
if (needle_isL != haystack_isL) {
__ mv(tmp, ch1);
}
- __ sub(haystack_len, haystack_len, wordSize / haystack_chr_size - 1);
+ __ subi(haystack_len, haystack_len, wordSize / haystack_chr_size - 1);
__ blez(haystack_len, L_SMALL);
if (needle_isL != haystack_isL) {
@@ -2814,9 +2861,9 @@ class StubGenerator: public StubCodeGenerator {
// search first char of needle, if success, goto L_HAS_ZERO;
__ bnez(match_mask, L_HAS_ZERO);
- __ sub(haystack_len, haystack_len, wordSize / haystack_chr_size);
- __ add(result, result, wordSize / haystack_chr_size);
- __ add(haystack, haystack, wordSize);
+ __ subi(haystack_len, haystack_len, wordSize / haystack_chr_size);
+ __ addi(result, result, wordSize / haystack_chr_size);
+ __ addi(haystack, haystack, wordSize);
__ bltz(haystack_len, L_POST_LOOP);
__ bind(L_LOOP);
@@ -2825,9 +2872,9 @@ class StubGenerator: public StubCodeGenerator {
__ bnez(match_mask, L_HAS_ZERO);
__ bind(L_LOOP_PROCEED);
- __ sub(haystack_len, haystack_len, wordSize / haystack_chr_size);
- __ add(haystack, haystack, wordSize);
- __ add(result, result, wordSize / haystack_chr_size);
+ __ subi(haystack_len, haystack_len, wordSize / haystack_chr_size);
+ __ addi(haystack, haystack, wordSize);
+ __ addi(result, result, wordSize / haystack_chr_size);
__ bgez(haystack_len, L_LOOP);
__ bind(L_POST_LOOP);
@@ -2862,7 +2909,8 @@ class StubGenerator: public StubCodeGenerator {
__ beqz(match_mask, NOMATCH);
__ bind(L_SMALL_HAS_ZERO_LOOP);
- __ ctzc_bit(trailing_zeros, match_mask, haystack_isL, ch2, tmp); // count trailing zeros
+ // count bits of trailing zero chars
+ __ ctzc_bits(trailing_zeros, match_mask, haystack_isL, ch2, tmp);
__ addi(trailing_zeros, trailing_zeros, haystack_isL ? 7 : 15);
__ mv(ch2, wordSize / haystack_chr_size);
__ ble(needle_len, ch2, L_SMALL_CMP_LOOP_LAST_CMP2);
@@ -2875,16 +2923,17 @@ class StubGenerator: public StubCodeGenerator {
__ shadd(ch2, trailing_zeros, haystack, ch2, haystack_chr_shift);
needle_isL ? __ lbu(first, Address(first)) : __ lhu(first, Address(first));
haystack_isL ? __ lbu(ch2, Address(ch2)) : __ lhu(ch2, Address(ch2));
- __ add(trailing_zeros, trailing_zeros, 1);
+ __ addi(trailing_zeros, trailing_zeros, 1);
__ bge(trailing_zeros, needle_len, L_SMALL_CMP_LOOP_LAST_CMP);
__ beq(first, ch2, L_SMALL_CMP_LOOP);
__ bind(L_SMALL_CMP_LOOP_NOMATCH);
__ beqz(match_mask, NOMATCH);
- __ ctzc_bit(trailing_zeros, match_mask, haystack_isL, tmp, ch2);
+ // count bits of trailing zero chars
+ __ ctzc_bits(trailing_zeros, match_mask, haystack_isL, tmp, ch2);
__ addi(trailing_zeros, trailing_zeros, haystack_isL ? 7 : 15);
- __ add(result, result, 1);
- __ add(haystack, haystack, haystack_chr_size);
+ __ addi(result, result, 1);
+ __ addi(haystack, haystack, haystack_chr_size);
__ j(L_SMALL_HAS_ZERO_LOOP);
__ align(OptoLoopAlignment);
@@ -2900,11 +2949,12 @@ class StubGenerator: public StubCodeGenerator {
__ align(OptoLoopAlignment);
__ bind(L_HAS_ZERO);
- __ ctzc_bit(trailing_zeros, match_mask, haystack_isL, tmp, ch2);
+ // count bits of trailing zero chars
+ __ ctzc_bits(trailing_zeros, match_mask, haystack_isL, tmp, ch2);
__ addi(trailing_zeros, trailing_zeros, haystack_isL ? 7 : 15);
__ slli(needle_len, needle_len, BitsPerByte * wordSize / 2);
__ orr(haystack_len, haystack_len, needle_len); // restore needle_len(32bits)
- __ sub(result, result, 1); // array index from 0, so result -= 1
+ __ subi(result, result, 1); // array index from 0, so result -= 1
__ bind(L_HAS_ZERO_LOOP);
__ mv(needle_len, wordSize / haystack_chr_size);
@@ -2912,7 +2962,7 @@ class StubGenerator: public StubCodeGenerator {
__ bge(needle_len, ch2, L_CMP_LOOP_LAST_CMP2);
// load next 8 bytes from haystack, and increase result index
__ compute_index(haystack, trailing_zeros, match_mask, result, ch2, tmp, haystack_isL);
- __ add(result, result, 1);
+ __ addi(result, result, 1);
__ mv(trailing_zeros, wordSize / haystack_chr_size);
__ bne(ch1, ch2, L_CMP_LOOP_NOMATCH);
@@ -2922,16 +2972,17 @@ class StubGenerator: public StubCodeGenerator {
needle_isL ? __ lbu(needle_len, Address(needle_len)) : __ lhu(needle_len, Address(needle_len));
__ shadd(ch2, trailing_zeros, haystack, ch2, haystack_chr_shift);
haystack_isL ? __ lbu(ch2, Address(ch2)) : __ lhu(ch2, Address(ch2));
- __ add(trailing_zeros, trailing_zeros, 1); // next char index
+ __ addi(trailing_zeros, trailing_zeros, 1); // next char index
__ srli(tmp, haystack_len, BitsPerByte * wordSize / 2);
__ bge(trailing_zeros, tmp, L_CMP_LOOP_LAST_CMP);
__ beq(needle_len, ch2, L_CMP_LOOP);
__ bind(L_CMP_LOOP_NOMATCH);
__ beqz(match_mask, L_HAS_ZERO_LOOP_NOMATCH);
- __ ctzc_bit(trailing_zeros, match_mask, haystack_isL, needle_len, ch2); // find next "first" char index
+ // count bits of trailing zero chars
+ __ ctzc_bits(trailing_zeros, match_mask, haystack_isL, needle_len, ch2);
__ addi(trailing_zeros, trailing_zeros, haystack_isL ? 7 : 15);
- __ add(haystack, haystack, haystack_chr_size);
+ __ addi(haystack, haystack, haystack_chr_size);
__ j(L_HAS_ZERO_LOOP);
__ align(OptoLoopAlignment);
@@ -2942,7 +2993,7 @@ class StubGenerator: public StubCodeGenerator {
__ align(OptoLoopAlignment);
__ bind(L_CMP_LOOP_LAST_CMP2);
__ compute_index(haystack, trailing_zeros, match_mask, result, ch2, tmp, haystack_isL);
- __ add(result, result, 1);
+ __ addi(result, result, 1);
__ bne(ch1, ch2, L_CMP_LOOP_NOMATCH);
__ j(DONE);
@@ -2978,16 +3029,16 @@ class StubGenerator: public StubCodeGenerator {
void generate_string_indexof_stubs()
{
- StubRoutines::riscv::_string_indexof_linear_ll = generate_string_indexof_linear(true, true);
- StubRoutines::riscv::_string_indexof_linear_uu = generate_string_indexof_linear(false, false);
- StubRoutines::riscv::_string_indexof_linear_ul = generate_string_indexof_linear(true, false);
+ StubRoutines::riscv::_string_indexof_linear_ll = generate_string_indexof_linear(StubGenStubId::string_indexof_linear_ll_id);
+ StubRoutines::riscv::_string_indexof_linear_uu = generate_string_indexof_linear(StubGenStubId::string_indexof_linear_uu_id);
+ StubRoutines::riscv::_string_indexof_linear_ul = generate_string_indexof_linear(StubGenStubId::string_indexof_linear_ul_id);
}
#ifdef COMPILER2
- address generate_lookup_secondary_supers_table_stub(u1 super_klass_index) {
- StubCodeMark mark(this, "StubRoutines", "lookup_secondary_supers_table");
+ void generate_lookup_secondary_supers_table_stub() {
+ StubGenStubId stub_id = StubGenStubId::lookup_secondary_supers_table_id;
+ StubCodeMark mark(this, stub_id);
- address start = __ pc();
const Register
r_super_klass = x10,
r_array_base = x11,
@@ -2997,20 +3048,22 @@ class StubGenerator: public StubCodeGenerator {
result = x15,
r_bitmap = x16;
- 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);
- __ leave();
- __ ret();
-
- return start;
+ for (int slot = 0; slot < Klass::SECONDARY_SUPERS_TABLE_SIZE; slot++) {
+ StubRoutines::_lookup_secondary_supers_table_stubs[slot] = __ pc();
+ Label L_success;
+ __ enter();
+ __ lookup_secondary_supers_table_const(r_sub_klass, r_super_klass, result,
+ r_array_base, r_array_length, r_array_index,
+ r_bitmap, slot, /*stub_is_near*/true);
+ __ leave();
+ __ ret();
+ }
}
// Slow path implementation for UseSecondarySupersTable.
address generate_lookup_secondary_supers_table_slow_path_stub() {
- StubCodeMark mark(this, "StubRoutines", "lookup_secondary_supers_table_slow_path");
+ StubGenStubId stub_id = StubGenStubId::lookup_secondary_supers_table_slow_path_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
const Register
@@ -3031,7 +3084,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_mulAdd()
{
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "mulAdd");
+ StubGenStubId stub_id = StubGenStubId::mulAdd_id;
+ StubCodeMark mark(this, stub_id);
address entry = __ pc();
@@ -3064,7 +3118,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_multiplyToLen()
{
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "multiplyToLen");
+ StubGenStubId stub_id = StubGenStubId::multiplyToLen_id;
+ StubCodeMark mark(this, stub_id);
address entry = __ pc();
const Register x = x10;
@@ -3094,7 +3149,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_squareToLen()
{
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "squareToLen");
+ StubGenStubId stub_id = StubGenStubId::squareToLen_id;
+ StubCodeMark mark(this, stub_id);
address entry = __ pc();
const Register x = x10;
@@ -3134,7 +3190,8 @@ class StubGenerator: public StubCodeGenerator {
//
address generate_bigIntegerLeftShift() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "bigIntegerLeftShiftWorker");
+ StubGenStubId stub_id = StubGenStubId::bigIntegerLeftShiftWorker_id;
+ StubCodeMark mark(this, stub_id);
address entry = __ pc();
Label loop, exit;
@@ -3185,7 +3242,8 @@ class StubGenerator: public StubCodeGenerator {
//
address generate_bigIntegerRightShift() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "bigIntegerRightShiftWorker");
+ StubGenStubId stub_id = StubGenStubId::bigIntegerRightShiftWorker_id;
+ StubCodeMark mark(this, stub_id);
address entry = __ pc();
Label loop, exit;
@@ -3303,7 +3361,7 @@ class StubGenerator: public StubCodeGenerator {
(this->*block)();
bind(odd);
(this->*block)();
- addi(count, count, -2);
+ subi(count, count, 2);
bgtz(count, loop);
bind(end);
}
@@ -3319,7 +3377,7 @@ class StubGenerator: public StubCodeGenerator {
(this->*block)(d, s, tmp);
bind(odd);
(this->*block)(d, s, tmp);
- addi(count, count, -2);
+ subi(count, count, 2);
bgtz(count, loop);
bind(end);
}
@@ -3371,7 +3429,7 @@ class StubGenerator: public StubCodeGenerator {
mul(Rlo_ab, Ra, Rb);
addi(Pa, Pa, wordSize);
ld(Ra, Address(Pa));
- addi(Pb, Pb, -wordSize);
+ subi(Pb, Pb, wordSize);
ld(Rb, Address(Pb));
acc(Rhi_mn, Rlo_mn, tmp0, tmp1, tmp2); // The pending m*n from the
// previous iteration.
@@ -3382,7 +3440,7 @@ class StubGenerator: public StubCodeGenerator {
mul(Rlo_mn, Rm, Rn);
addi(Pm, Pm, wordSize);
ld(Rm, Address(Pm));
- addi(Pn, Pn, -wordSize);
+ subi(Pn, Pn, wordSize);
ld(Rn, Address(Pn));
acc(Rhi_ab, Rlo_ab, tmp0, tmp1, tmp2);
}
@@ -3426,7 +3484,7 @@ class StubGenerator: public StubCodeGenerator {
//
// mul(Rlo_mn, Rm, Rn);
// cad(zr, tmp0, Rlo_mn);
- addi(t0, tmp0, -1);
+ subi(t0, tmp0, 1);
sltu(t0, t0, tmp0); // Set carry iff tmp0 is nonzero
cadc(tmp0, tmp1, Rhi_mn, t0);
adc(tmp1, tmp2, zr, t0);
@@ -3455,13 +3513,13 @@ class StubGenerator: public StubCodeGenerator {
// Rb = *--Pb;
// Rm = *++Pm;
// Rn = *--Pn;
- add(Pa, Pa, wordSize);
+ addi(Pa, Pa, wordSize);
ld(Ra, Address(Pa));
- add(Pb, Pb, -wordSize);
+ subi(Pb, Pb, wordSize);
ld(Rb, Address(Pb));
- add(Pm, Pm, wordSize);
+ addi(Pm, Pm, wordSize);
ld(Rm, Address(Pm));
- add(Pn, Pn, -wordSize);
+ subi(Pn, Pn, wordSize);
ld(Rn, Address(Pn));
mv(Rhi_mn, zr);
@@ -3516,15 +3574,15 @@ class StubGenerator: public StubCodeGenerator {
slli(Rn, i, LogBytesPerWord); // Rn as temp register
add(Rn, Pm_base, Rn);
sd(Rm, Address(Rn));
- add(i, i, 1);
+ addi(i, i, 1);
slli(Rn, i, LogBytesPerWord);
add(Rm, Pm_base, Rn);
ld(Rm, Address(Rm));
add(Rn, Pn_base, Rn);
ld(Rn, Address(Rn));
- sub(cnt, cnt, 1);
+ subi(cnt, cnt, 1);
} bnez(cnt, loop);
- addi(tmp0, tmp0, -1);
+ subi(tmp0, tmp0, 1);
add(tmp0, tmp0, t0);
} bnez(tmp0, again);
} bind(post);
@@ -3547,9 +3605,9 @@ class StubGenerator: public StubCodeGenerator {
}
// [63...0] -> [31...0][63...32]
void reverse1(Register d, Register s, Register tmp) {
- addi(s, s, -wordSize);
+ subi(s, s, wordSize);
ld(tmp, Address(s));
- ror_imm(tmp, tmp, 32, t0);
+ ror(tmp, tmp, 32, t0);
sd(tmp, Address(d));
addi(d, d, wordSize);
}
@@ -3584,7 +3642,7 @@ class StubGenerator: public StubCodeGenerator {
mul(Rlo_mn, Rm, Rn);
addi(Pm, Pm, wordSize);
ld(Rm, Address(Pm));
- addi(Pn, Pn, -wordSize);
+ subi(Pn, Pn, wordSize);
ld(Rn, Address(Pn));
}
@@ -3619,7 +3677,7 @@ class StubGenerator: public StubCodeGenerator {
//
// mul(Rlo_mn, Rm, Rn);
// cad(zr, tmp, Rlo_mn);
- addi(t0, tmp0, -1);
+ subi(t0, tmp0, 1);
sltu(t0, t0, tmp0); // Set carry iff tmp0 is nonzero
cadc(tmp0, tmp1, Rhi_mn, t0);
adc(tmp1, tmp2, zr, t0);
@@ -3725,7 +3783,7 @@ class StubGenerator: public StubCodeGenerator {
} block_comment(" } // j");
post1();
- addw(Ri, Ri, 1);
+ addiw(Ri, Ri, 1);
blt(Ri, Rlen, loop);
bind(end);
block_comment("} // i");
@@ -3743,12 +3801,12 @@ class StubGenerator: public StubCodeGenerator {
block_comment(" for (j = len*2-i-1; j; j--) {"); {
slliw(Rj, Rlen, 1);
subw(Rj, Rj, Ri);
- subw(Rj, Rj, 1);
+ subiw(Rj, Rj, 1);
unroll_2(Rj, &MontgomeryMultiplyGenerator::step);
} block_comment(" } // j");
post2(Ri, Rlen);
- addw(Ri, Ri, 1);
+ addiw(Ri, Ri, 1);
slli(t0, Rlen, 1);
blt(Ri, t0, loop);
bind(end);
@@ -3859,7 +3917,7 @@ class StubGenerator: public StubCodeGenerator {
block_comment(" for (j = (2*len-i-1)/2; j; j--) {"); {
slli(Rj, Rlen, 1);
sub(Rj, Rj, Ri);
- sub(Rj, Rj, 1);
+ subi(Rj, Rj, 1);
srliw(Rj, Rj, 1);
unroll_2(Rj, &MontgomeryMultiplyGenerator::step_squaring);
} block_comment(" } // j");
@@ -3921,7 +3979,7 @@ class StubGenerator: public StubCodeGenerator {
if (return_barrier) {
// preserve possible return value from a method returning to the return barrier
- __ sub(sp, sp, 2 * wordSize);
+ __ subi(sp, sp, 2 * wordSize);
__ fsd(f10, Address(sp, 0 * wordSize));
__ sd(x10, Address(sp, 1 * wordSize));
}
@@ -3934,7 +3992,7 @@ class StubGenerator: public StubCodeGenerator {
// restore return value (no safepoint in the call to thaw, so even an oop return value should be OK)
__ ld(x10, Address(sp, 1 * wordSize));
__ fld(f10, Address(sp, 0 * wordSize));
- __ add(sp, sp, 2 * wordSize);
+ __ addi(sp, sp, 2 * wordSize);
}
#ifndef PRODUCT
@@ -3959,7 +4017,7 @@ class StubGenerator: public StubCodeGenerator {
if (return_barrier) {
// save original return value -- again
- __ sub(sp, sp, 2 * wordSize);
+ __ subi(sp, sp, 2 * wordSize);
__ fsd(f10, Address(sp, 0 * wordSize));
__ sd(x10, Address(sp, 1 * wordSize));
}
@@ -3974,14 +4032,14 @@ class StubGenerator: public StubCodeGenerator {
// restore return value (no safepoint in the call to thaw, so even an oop return value should be OK)
__ ld(x10, Address(sp, 1 * wordSize));
__ fld(f10, Address(sp, 0 * wordSize));
- __ add(sp, sp, 2 * wordSize);
+ __ addi(sp, sp, 2 * wordSize);
} else {
__ mv(x10, zr); // return 0 (success) from doYield
}
// we're now on the yield frame (which is in an address above us b/c sp has been pushed down)
__ mv(fp, t1);
- __ sub(sp, t1, 2 * wordSize); // now pointing to fp spill
+ __ subi(sp, t1, 2 * wordSize); // now pointing to fp spill
if (return_barrier_exception) {
__ ld(c_rarg1, Address(fp, -1 * wordSize)); // return address
@@ -4011,7 +4069,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_cont_thaw() {
if (!Continuations::enabled()) return nullptr;
- StubCodeMark mark(this, "StubRoutines", "Cont thaw");
+ StubGenStubId stub_id = StubGenStubId::cont_thaw_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
generate_cont_thaw(Continuation::thaw_top);
return start;
@@ -4021,7 +4080,8 @@ class StubGenerator: public StubCodeGenerator {
if (!Continuations::enabled()) return nullptr;
// TODO: will probably need multiple return barriers depending on return type
- StubCodeMark mark(this, "StubRoutines", "cont return barrier");
+ StubGenStubId stub_id = StubGenStubId::cont_returnBarrier_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
generate_cont_thaw(Continuation::thaw_return_barrier);
@@ -4032,7 +4092,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_cont_returnBarrier_exception() {
if (!Continuations::enabled()) return nullptr;
- StubCodeMark mark(this, "StubRoutines", "cont return barrier exception handler");
+ StubGenStubId stub_id = StubGenStubId::cont_returnBarrierExc_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
generate_cont_thaw(Continuation::thaw_return_barrier_exception);
@@ -4042,7 +4103,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_cont_preempt_stub() {
if (!Continuations::enabled()) return nullptr;
- StubCodeMark mark(this, "StubRoutines","Continuation preempt stub");
+ StubGenStubId stub_id = StubGenStubId::cont_preempt_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ reset_last_Java_frame(true);
@@ -4079,11 +4141,11 @@ class StubGenerator: public StubCodeGenerator {
StubCodeGenerator* _cgen;
public:
Sha2Generator(MacroAssembler* masm, StubCodeGenerator* cgen) : MacroAssembler(masm->code()), _cgen(cgen) {}
- address generate_sha256_implCompress(bool multi_block) {
- return generate_sha2_implCompress(Assembler::e32, multi_block);
+ address generate_sha256_implCompress(StubGenStubId stub_id) {
+ return generate_sha2_implCompress(Assembler::e32, stub_id);
}
- address generate_sha512_implCompress(bool multi_block) {
- return generate_sha2_implCompress(Assembler::e64, multi_block);
+ address generate_sha512_implCompress(StubGenStubId stub_id) {
+ return generate_sha2_implCompress(Assembler::e64, stub_id);
}
private:
@@ -4208,15 +4270,6 @@ class StubGenerator: public StubCodeGenerator {
}
}
- const char* stub_name(Assembler::SEW vset_sew, bool multi_block) {
- if (vset_sew == Assembler::e32 && !multi_block) return "sha256_implCompress";
- if (vset_sew == Assembler::e32 && multi_block) return "sha256_implCompressMB";
- if (vset_sew == Assembler::e64 && !multi_block) return "sha512_implCompress";
- if (vset_sew == Assembler::e64 && multi_block) return "sha512_implCompressMB";
- ShouldNotReachHere();
- return "bad name lookup";
- }
-
// Arguments:
//
// Inputs:
@@ -4225,7 +4278,7 @@ class StubGenerator: public StubCodeGenerator {
// c_rarg2 - int offset
// c_rarg3 - int limit
//
- address generate_sha2_implCompress(Assembler::SEW vset_sew, bool multi_block) {
+ address generate_sha2_implCompress(Assembler::SEW vset_sew, StubGenStubId stub_id) {
alignas(64) static const uint32_t round_consts_256[64] = {
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
@@ -4275,8 +4328,29 @@ class StubGenerator: public StubCodeGenerator {
};
const int const_add = vset_sew == Assembler::e32 ? 16 : 32;
+ bool multi_block;
+ switch (stub_id) {
+ case sha256_implCompress_id:
+ assert (vset_sew == Assembler::e32, "wrong macroassembler for stub");
+ multi_block = false;
+ break;
+ case sha256_implCompressMB_id:
+ assert (vset_sew == Assembler::e32, "wrong macroassembler for stub");
+ multi_block = true;
+ break;
+ case sha512_implCompress_id:
+ assert (vset_sew == Assembler::e64, "wrong macroassembler for stub");
+ multi_block = false;
+ break;
+ case sha512_implCompressMB_id:
+ assert (vset_sew == Assembler::e64, "wrong macroassembler for stub");
+ multi_block = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ };
__ align(CodeEntryAlignment);
- StubCodeMark mark(_cgen, "StubRoutines", stub_name(vset_sew, multi_block));
+ StubCodeMark mark(_cgen, stub_id);
address start = __ pc();
Register buf = c_rarg0;
@@ -4437,8 +4511,8 @@ class StubGenerator: public StubCodeGenerator {
if (multi_block) {
int total_adds = vset_sew == Assembler::e32 ? 240 : 608;
- __ addi(consts, consts, -total_adds);
- __ add(ofs, ofs, vset_sew == Assembler::e32 ? 64 : 128);
+ __ subi(consts, consts, total_adds);
+ __ addi(ofs, ofs, vset_sew == Assembler::e32 ? 64 : 128);
__ ble(ofs, limit, multi_block_loop);
__ mv(c_rarg0, ofs); // return ofs
}
@@ -4516,7 +4590,7 @@ class StubGenerator: public StubCodeGenerator {
__ addw(a, a, value);
// a = Integer.rotateLeft(a, s) + b;
- __ rolw_imm(a, a, s);
+ __ rolw(a, a, s);
__ addw(a, a, b);
}
@@ -4623,9 +4697,20 @@ class StubGenerator: public StubCodeGenerator {
// x29 t4 buf5
// x30 t5 buf6
// x31 t6 buf7
- address generate_md5_implCompress(bool multi_block, const char *name) {
+ address generate_md5_implCompress(StubGenStubId stub_id) {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ bool multi_block;
+ switch (stub_id) {
+ case md5_implCompress_id:
+ multi_block = false;
+ break;
+ case md5_implCompressMB_id:
+ multi_block = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ };
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
// rotation constants
@@ -4879,7 +4964,8 @@ class StubGenerator: public StubCodeGenerator {
Label L_Rounds;
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "chacha20Block");
+ StubGenStubId stub_id = StubGenStubId::chacha20Block_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ enter();
@@ -4932,7 +5018,7 @@ class StubGenerator: public StubCodeGenerator {
chacha20_quarter_round(work_vrs[2], work_vrs[7], work_vrs[8], work_vrs[13], tmp_vr);
chacha20_quarter_round(work_vrs[3], work_vrs[4], work_vrs[9], work_vrs[14], tmp_vr);
- __ sub(loop, loop, 1);
+ __ subi(loop, loop, 1);
__ bnez(loop, L_Rounds);
}
@@ -5021,7 +5107,7 @@ class StubGenerator: public StubCodeGenerator {
__ xorr(cur_w, cur_w, t1);
__ xorr(cur_w, cur_w, t0);
- __ rolw_imm(cur_w, cur_w, 1, t0);
+ __ rolw(cur_w, cur_w, 1, t0);
// copy the cur_w value to ws[8].
// now, valid w't values are at:
@@ -5041,7 +5127,7 @@ class StubGenerator: public StubCodeGenerator {
__ xorr(cur_w, ws[(idx-16)/2], ws[(idx-14)/2]);
__ xorr(cur_w, cur_w, t0);
- __ rolw_imm(cur_w, cur_w, 1, t0);
+ __ rolw(cur_w, cur_w, 1, t0);
// copy the cur_w value to ws[8]
__ zext(cur_w, cur_w, 32);
@@ -5106,7 +5192,7 @@ class StubGenerator: public StubCodeGenerator {
Register tmp3 = e;
__ add(tmp2, cur_k, tmp2);
__ add(tmp3, tmp3, tmp2);
- __ rolw_imm(tmp2, a, 5, t0);
+ __ rolw(tmp2, a, 5, t0);
sha1_f(tmp, b, c, d, round);
@@ -5121,7 +5207,7 @@ class StubGenerator: public StubCodeGenerator {
__ mv(e, d);
__ mv(d, c);
- __ rolw_imm(c, b, 30);
+ __ rolw(c, b, 30);
__ mv(b, a);
__ mv(a, tmp2);
}
@@ -5178,9 +5264,20 @@ class StubGenerator: public StubCodeGenerator {
// - - - - - - below are only for implCompressMultiBlock0 - - - - - -
// c_rarg0: int offset, when (multi_block == true)
//
- address generate_sha1_implCompress(bool multi_block, const char *name) {
+ address generate_sha1_implCompress(StubGenStubId stub_id) {
+ bool multi_block;
+ switch (stub_id) {
+ case sha1_implCompress_id:
+ multi_block = false;
+ break;
+ case sha1_implCompressMB_id:
+ multi_block = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ };
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ enter();
@@ -5390,7 +5487,8 @@ class StubGenerator: public StubCodeGenerator {
};
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "encodeBlock");
+ StubGenStubId stub_id = StubGenStubId::base64_encodeBlock_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ enter();
@@ -5512,7 +5610,7 @@ class StubGenerator: public StubCodeGenerator {
__ sb(byte2, Address(dst, 2));
__ sb(combined24Bits, Address(dst, 3));
- __ sub(length, length, 3);
+ __ subi(length, length, 3);
__ addi(dst, dst, 4);
// loop back
__ bnez(length, ScalarLoop);
@@ -5646,7 +5744,8 @@ class StubGenerator: public StubCodeGenerator {
};
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "decodeBlock");
+ StubGenStubId stub_id = StubGenStubId::base64_decodeBlock_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ enter();
@@ -5789,7 +5888,7 @@ class StubGenerator: public StubCodeGenerator {
__ sb(byte1, Address(dst, 1));
__ sb(combined32Bits, Address(dst, 2));
- __ sub(length, length, 4);
+ __ subi(length, length, 4);
__ addi(dst, dst, 3);
// loop back
__ bnez(length, ScalarLoop);
@@ -5890,7 +5989,8 @@ class StubGenerator: public StubCodeGenerator {
*/
address generate_updateBytesAdler32() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "updateBytesAdler32");
+ StubGenStubId stub_id = StubGenStubId::updateBytesAdler32_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Label L_nmax, L_nmax_loop, L_nmax_loop_entry, L_by16, L_by16_loop,
@@ -5972,23 +6072,23 @@ class StubGenerator: public StubCodeGenerator {
__ beqz(len, L_combine);
// Jumping to L_by1_loop
- __ sub(len, len, step_1);
+ __ subi(len, len, step_1);
__ j(L_by1_loop);
__ bind(L_nmax);
__ sub(len, len, nmax);
- __ sub(count, nmax, 16);
+ __ subi(count, nmax, 16);
__ bltz(len, L_by16);
// Align L_nmax loop by 64
__ bind(L_nmax_loop_entry);
- __ sub(count, count, 32);
+ __ subi(count, count, 32);
__ bind(L_nmax_loop);
adler32_process_bytes(buff, s1, s2, vtable_64, vzero,
vbytes, vs1acc, vs2acc, temp0, temp1, temp2, temp3,
vtemp1, vtemp2, step_64, Assembler::m4);
- __ sub(count, count, step_64);
+ __ subi(count, count, step_64);
__ bgtz(count, L_nmax_loop);
// There are three iterations left to do
@@ -6005,7 +6105,7 @@ class StubGenerator: public StubCodeGenerator {
__ remuw(s2, s2, base);
__ sub(len, len, nmax);
- __ sub(count, nmax, 16);
+ __ subi(count, nmax, 16);
__ bgez(len, L_nmax_loop_entry);
__ bind(L_by16);
@@ -6019,7 +6119,7 @@ class StubGenerator: public StubCodeGenerator {
adler32_process_bytes(buff, s1, s2, vtable_64, vzero,
vbytes, vs1acc, vs2acc, temp0, temp1, temp2, temp3,
vtemp1, vtemp2, step_64, Assembler::m4);
- __ sub(len, len, step_64);
+ __ subi(len, len, step_64);
// By now the temp3 should still be 64
__ bge(len, temp3, L_by16_loop_unroll);
@@ -6027,11 +6127,11 @@ class StubGenerator: public StubCodeGenerator {
adler32_process_bytes(buff, s1, s2, vtable_16, vzero,
vbytes, vs1acc, vs2acc, temp0, temp1, temp2, temp3,
vtemp1, vtemp2, step_16, Assembler::m1);
- __ sub(len, len, step_16);
+ __ subi(len, len, step_16);
__ bgez(len, L_by16_loop);
__ bind(L_by1);
- __ add(len, len, 15);
+ __ addi(len, len, 15);
__ bltz(len, L_do_mod);
__ bind(L_by1_loop);
@@ -6039,7 +6139,7 @@ class StubGenerator: public StubCodeGenerator {
__ addi(buff, buff, step_1);
__ add(s1, temp0, s1);
__ add(s2, s2, s1);
- __ sub(len, len, step_1);
+ __ subi(len, len, step_1);
__ bgez(len, L_by1_loop);
__ bind(L_do_mod);
@@ -6148,7 +6248,8 @@ static const int64_t right_3_bits = right_n_bits(3);
address generate_poly1305_processBlocks() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "poly1305_processBlocks");
+ StubGenStubId stub_id = StubGenStubId::poly1305_processBlocks_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ enter();
Label here;
@@ -6221,7 +6322,7 @@ static const int64_t right_3_bits = right_n_bits(3);
// U_2:U_1:U_0: += (U_2 >> 2) * 5
poly1305_reduce(U_2, U_1, U_0, t1, t2);
- __ sub(length, length, BLOCK_LENGTH);
+ __ subi(length, length, BLOCK_LENGTH);
__ addi(input_start, input_start, BLOCK_LENGTH);
__ mv(t1, BLOCK_LENGTH);
__ bge(length, t1, LOOP);
@@ -6337,7 +6438,8 @@ static const int64_t right_3_bits = right_n_bits(3);
assert(UseCRC32Intrinsics, "what are we doing here?");
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "updateBytesCRC32");
+ StubGenStubId stub_id = StubGenStubId::updateBytesCRC32_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
@@ -6361,7 +6463,8 @@ static const int64_t right_3_bits = right_n_bits(3);
// exception handler for upcall stubs
address generate_upcall_stub_exception_handler() {
- StubCodeMark mark(this, "StubRoutines", "upcall stub exception handler");
+ StubGenStubId stub_id = StubGenStubId::upcall_stub_exception_handler_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
// Native caller has no idea how to handle exceptions,
@@ -6378,7 +6481,8 @@ static const int64_t right_3_bits = right_n_bits(3);
// xmethod = Method* result
address generate_upcall_stub_load_target() {
- StubCodeMark mark(this, "StubRoutines", "upcall_stub_load_target");
+ StubGenStubId stub_id = StubGenStubId::upcall_stub_load_target_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ resolve_global_jobject(j_rarg0, t0, t1);
@@ -6453,10 +6557,7 @@ static const int64_t right_3_bits = right_n_bits(3);
if (UseSecondarySupersTable) {
StubRoutines::_lookup_secondary_supers_table_slow_path_stub = generate_lookup_secondary_supers_table_slow_path_stub();
if (!InlineSecondarySupersTest) {
- for (int slot = 0; slot < Klass::SECONDARY_SUPERS_TABLE_SIZE; slot++) {
- StubRoutines::_lookup_secondary_supers_table_stubs[slot]
- = generate_lookup_secondary_supers_table_stub(slot);
- }
+ generate_lookup_secondary_supers_table_stub();
}
}
#endif // COMPILER2
@@ -6482,13 +6583,15 @@ static const int64_t right_3_bits = right_n_bits(3);
}
if (UseMontgomeryMultiplyIntrinsic) {
- StubCodeMark mark(this, "StubRoutines", "montgomeryMultiply");
+ StubGenStubId stub_id = StubGenStubId::montgomeryMultiply_id;
+ StubCodeMark mark(this, stub_id);
MontgomeryMultiplyGenerator g(_masm, /*squaring*/false);
StubRoutines::_montgomeryMultiply = g.generate_multiply();
}
if (UseMontgomerySquareIntrinsic) {
- StubCodeMark mark(this, "StubRoutines", "montgomerySquare");
+ StubGenStubId stub_id = StubGenStubId::montgomerySquare_id;
+ StubCodeMark mark(this, stub_id);
MontgomeryMultiplyGenerator g(_masm, /*squaring*/true);
StubRoutines::_montgomerySquare = g.generate_square();
}
@@ -6509,19 +6612,19 @@ static const int64_t right_3_bits = right_n_bits(3);
if (UseSHA256Intrinsics) {
Sha2Generator sha2(_masm, this);
- StubRoutines::_sha256_implCompress = sha2.generate_sha256_implCompress(false);
- StubRoutines::_sha256_implCompressMB = sha2.generate_sha256_implCompress(true);
+ StubRoutines::_sha256_implCompress = sha2.generate_sha256_implCompress(StubGenStubId::sha256_implCompress_id);
+ StubRoutines::_sha256_implCompressMB = sha2.generate_sha256_implCompress(StubGenStubId::sha256_implCompressMB_id);
}
if (UseSHA512Intrinsics) {
Sha2Generator sha2(_masm, this);
- StubRoutines::_sha512_implCompress = sha2.generate_sha512_implCompress(false);
- StubRoutines::_sha512_implCompressMB = sha2.generate_sha512_implCompress(true);
+ StubRoutines::_sha512_implCompress = sha2.generate_sha512_implCompress(StubGenStubId::sha512_implCompress_id);
+ StubRoutines::_sha512_implCompressMB = sha2.generate_sha512_implCompress(StubGenStubId::sha512_implCompressMB_id);
}
if (UseMD5Intrinsics) {
- StubRoutines::_md5_implCompress = generate_md5_implCompress(false, "md5_implCompress");
- StubRoutines::_md5_implCompressMB = generate_md5_implCompress(true, "md5_implCompressMB");
+ StubRoutines::_md5_implCompress = generate_md5_implCompress(StubGenStubId::md5_implCompress_id);
+ StubRoutines::_md5_implCompressMB = generate_md5_implCompress(StubGenStubId::md5_implCompressMB_id);
}
if (UseChaCha20Intrinsics) {
@@ -6529,8 +6632,8 @@ static const int64_t right_3_bits = right_n_bits(3);
}
if (UseSHA1Intrinsics) {
- StubRoutines::_sha1_implCompress = generate_sha1_implCompress(false, "sha1_implCompress");
- StubRoutines::_sha1_implCompressMB = generate_sha1_implCompress(true, "sha1_implCompressMB");
+ StubRoutines::_sha1_implCompress = generate_sha1_implCompress(StubGenStubId::sha1_implCompress_id);
+ StubRoutines::_sha1_implCompressMB = generate_sha1_implCompress(StubGenStubId::sha1_implCompressMB_id);
}
if (UseBASE64Intrinsics) {
@@ -6552,27 +6655,27 @@ static const int64_t right_3_bits = right_n_bits(3);
}
public:
- StubGenerator(CodeBuffer* code, StubsKind kind) : StubCodeGenerator(code) {
- switch(kind) {
- case Initial_stubs:
+ StubGenerator(CodeBuffer* code, StubGenBlobId blob_id) : StubCodeGenerator(code, blob_id) {
+ switch(blob_id) {
+ case initial_id:
generate_initial_stubs();
break;
- case Continuation_stubs:
+ case continuation_id:
generate_continuation_stubs();
break;
- case Compiler_stubs:
+ case compiler_id:
generate_compiler_stubs();
break;
- case Final_stubs:
+ case final_id:
generate_final_stubs();
break;
default:
- fatal("unexpected stubs kind: %d", kind);
+ fatal("unexpected blob id: %d", blob_id);
break;
};
}
}; // end class declaration
-void StubGenerator_generate(CodeBuffer* code, StubCodeGenerator::StubsKind kind) {
- StubGenerator g(code, kind);
+void StubGenerator_generate(CodeBuffer* code, StubGenBlobId blob_id) {
+ StubGenerator g(code, blob_id);
}
diff --git a/src/hotspot/cpu/riscv/stubRoutines_riscv.cpp b/src/hotspot/cpu/riscv/stubRoutines_riscv.cpp
index 66a3ac3a994d5..2a1150276c1be 100644
--- a/src/hotspot/cpu/riscv/stubRoutines_riscv.cpp
+++ b/src/hotspot/cpu/riscv/stubRoutines_riscv.cpp
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2014, Red Hat Inc. All rights reserved.
+ * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2025, 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"
@@ -34,14 +33,19 @@
// Implementation of the platform-specific part of StubRoutines - for
// a description of how to extend it, see the stubRoutines.hpp file.
-address StubRoutines::riscv::_zero_blocks = nullptr;
-address StubRoutines::riscv::_compare_long_string_LL = nullptr;
-address StubRoutines::riscv::_compare_long_string_UU = nullptr;
-address StubRoutines::riscv::_compare_long_string_LU = nullptr;
-address StubRoutines::riscv::_compare_long_string_UL = nullptr;
-address StubRoutines::riscv::_string_indexof_linear_ll = nullptr;
-address StubRoutines::riscv::_string_indexof_linear_uu = nullptr;
-address StubRoutines::riscv::_string_indexof_linear_ul = nullptr;
+
+// define fields for arch-specific entries
+
+#define DEFINE_ARCH_ENTRY(arch, blob_name, stub_name, field_name, getter_name) \
+ address StubRoutines:: arch :: STUB_FIELD_NAME(field_name) = nullptr;
+
+#define DEFINE_ARCH_ENTRY_INIT(arch, blob_name, stub_name, field_name, getter_name, init_function) \
+ address StubRoutines:: arch :: STUB_FIELD_NAME(field_name) = CAST_FROM_FN_PTR(address, init_function);
+
+STUBGEN_ARCH_ENTRIES_DO(DEFINE_ARCH_ENTRY, DEFINE_ARCH_ENTRY_INIT)
+
+#undef DEFINE_ARCH_ENTRY_INIT
+#undef DEFINE_ARCH_ENTRY
bool StubRoutines::riscv::_completed = false;
diff --git a/src/hotspot/cpu/riscv/stubRoutines_riscv.hpp b/src/hotspot/cpu/riscv/stubRoutines_riscv.hpp
index 3bc5aeaa26826..1cd10b996dbcf 100644
--- a/src/hotspot/cpu/riscv/stubRoutines_riscv.hpp
+++ b/src/hotspot/cpu/riscv/stubRoutines_riscv.hpp
@@ -35,63 +35,53 @@ static bool returns_to_call_stub(address return_pc) {
return return_pc == _call_stub_return_address;
}
+// emit enum used to size per-blob code buffers
+
+#define DEFINE_BLOB_SIZE(blob_name, size) \
+ _ ## blob_name ## _code_size = size,
+
enum platform_dependent_constants {
- // simply increase sizes if too small (assembler will crash if too small)
- _initial_stubs_code_size = 10000,
- _continuation_stubs_code_size = 2000,
- _compiler_stubs_code_size = 45000,
- _final_stubs_code_size = 20000 ZGC_ONLY(+10000)
+ STUBGEN_ARCH_BLOBS_DO(DEFINE_BLOB_SIZE)
};
+#undef DEFINE_BLOB_SIZE
+
class riscv {
friend class StubGenerator;
+#if INCLUDE_JVMCI
+ friend class JVMCIVMStructs;
+#endif
- private:
- static address _zero_blocks;
+ // declare fields for arch-specific entries
- static address _compare_long_string_LL;
- static address _compare_long_string_LU;
- static address _compare_long_string_UL;
- static address _compare_long_string_UU;
- static address _string_indexof_linear_ll;
- static address _string_indexof_linear_uu;
- static address _string_indexof_linear_ul;
+#define DECLARE_ARCH_ENTRY(arch, blob_name, stub_name, field_name, getter_name) \
+ static address STUB_FIELD_NAME(field_name) ;
- static bool _completed;
+#define DECLARE_ARCH_ENTRY_INIT(arch, blob_name, stub_name, field_name, getter_name, init_function) \
+ DECLARE_ARCH_ENTRY(arch, blob_name, stub_name, field_name, getter_name)
- public:
+private:
+ STUBGEN_ARCH_ENTRIES_DO(DECLARE_ARCH_ENTRY, DECLARE_ARCH_ENTRY_INIT)
- static address zero_blocks() {
- return _zero_blocks;
- }
+#undef DECLARE_ARCH_ENTRY_INIT
+#undef DECLARE_ARCH_ENTRY
- static address compare_long_string_LL() {
- return _compare_long_string_LL;
- }
+ static bool _completed;
- static address compare_long_string_LU() {
- return _compare_long_string_LU;
- }
+ public:
- static address compare_long_string_UL() {
- return _compare_long_string_UL;
- }
+ // declare getters for arch-specific entries
- static address compare_long_string_UU() {
- return _compare_long_string_UU;
- }
+#define DEFINE_ARCH_ENTRY_GETTER(arch, blob_name, stub_name, field_name, getter_name) \
+ static address getter_name() { return STUB_FIELD_NAME(field_name) ; }
- static address string_indexof_linear_ul() {
- return _string_indexof_linear_ul;
- }
+#define DEFINE_ARCH_ENTRY_GETTER_INIT(arch, blob_name, stub_name, field_name, getter_name, init_function) \
+ DEFINE_ARCH_ENTRY_GETTER(arch, blob_name, stub_name, field_name, getter_name)
- static address string_indexof_linear_ll() {
- return _string_indexof_linear_ll;
- }
+ STUBGEN_ARCH_ENTRIES_DO(DEFINE_ARCH_ENTRY_GETTER, DEFINE_ARCH_ENTRY_GETTER_INIT)
- static address string_indexof_linear_uu() {
- return _string_indexof_linear_uu;
- }
+#undef DEFINE_ARCH_ENTRY_GETTER_INIT
+#undef DEFINE_ARCH_ENTRY_GETTER
static bool complete() {
return _completed;
diff --git a/src/hotspot/cpu/riscv/templateInterpreterGenerator_riscv.cpp b/src/hotspot/cpu/riscv/templateInterpreterGenerator_riscv.cpp
index bc67de54c4bc6..79de9becbaedc 100644
--- a/src/hotspot/cpu/riscv/templateInterpreterGenerator_riscv.cpp
+++ b/src/hotspot/cpu/riscv/templateInterpreterGenerator_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved.
* Copyright (c) 2020, 2022, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -24,7 +24,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "classfile/javaClasses.hpp"
#include "compiler/disassembler.hpp"
@@ -85,8 +84,8 @@ address TemplateInterpreterGenerator::generate_slow_signature_handler() {
// c_rarg3: first stack arg - wordSize
// adjust sp
- __ addi(sp, c_rarg3, -18 * wordSize);
- __ addi(sp, sp, -2 * wordSize);
+ __ subi(sp, c_rarg3, 18 * wordSize);
+ __ subi(sp, sp, 2 * wordSize);
__ sd(ra, Address(sp, 0));
__ call_VM(noreg,
@@ -189,7 +188,7 @@ address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::M
} else {
fn = CAST_FROM_FN_PTR(address, StubRoutines::dsin());
}
- __ call(fn);
+ __ rt_call(fn);
__ mv(ra, x9);
break;
case Interpreter::java_lang_math_cos :
@@ -202,7 +201,7 @@ address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::M
} else {
fn = CAST_FROM_FN_PTR(address, StubRoutines::dcos());
}
- __ call(fn);
+ __ rt_call(fn);
__ mv(ra, x9);
break;
case Interpreter::java_lang_math_tan :
@@ -215,7 +214,7 @@ address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::M
} else {
fn = CAST_FROM_FN_PTR(address, StubRoutines::dtan());
}
- __ call(fn);
+ __ rt_call(fn);
__ mv(ra, x9);
break;
case Interpreter::java_lang_math_log :
@@ -228,7 +227,7 @@ address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::M
} else {
fn = CAST_FROM_FN_PTR(address, StubRoutines::dlog());
}
- __ call(fn);
+ __ rt_call(fn);
__ mv(ra, x9);
break;
case Interpreter::java_lang_math_log10 :
@@ -241,7 +240,7 @@ address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::M
} else {
fn = CAST_FROM_FN_PTR(address, StubRoutines::dlog10());
}
- __ call(fn);
+ __ rt_call(fn);
__ mv(ra, x9);
break;
case Interpreter::java_lang_math_exp :
@@ -254,7 +253,7 @@ address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::M
} else {
fn = CAST_FROM_FN_PTR(address, StubRoutines::dexp());
}
- __ call(fn);
+ __ rt_call(fn);
__ mv(ra, x9);
break;
case Interpreter::java_lang_math_pow :
@@ -268,7 +267,7 @@ address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::M
} else {
fn = CAST_FROM_FN_PTR(address, StubRoutines::dpow());
}
- __ call(fn);
+ __ rt_call(fn);
__ mv(ra, x9);
break;
case Interpreter::java_lang_math_fmaD :
@@ -714,14 +713,14 @@ void TemplateInterpreterGenerator::lock_method() {
const int entry_size = frame::interpreter_frame_monitor_size_in_bytes();
#ifdef ASSERT
- __ lwu(x10, access_flags);
+ __ load_unsigned_short(x10, access_flags);
__ verify_access_flags(x10, JVM_ACC_SYNCHRONIZED, "method doesn't need synchronization", false);
#endif // ASSERT
// get synchronization object
{
Label done;
- __ lwu(x10, access_flags);
+ __ load_unsigned_short(x10, access_flags);
__ andi(t0, x10, JVM_ACC_STATIC);
// get receiver (assume this is frequent case)
__ ld(x10, Address(xlocals, Interpreter::local_offset_in_bytes(0)));
@@ -742,8 +741,8 @@ void TemplateInterpreterGenerator::lock_method() {
// add space for monitor & lock
__ check_extended_sp();
- __ add(sp, sp, - entry_size); // add space for a monitor entry
- __ add(esp, esp, - entry_size);
+ __ sub(sp, sp, entry_size); // add space for a monitor entry
+ __ sub(esp, esp, entry_size);
__ sub(t0, sp, fp);
__ srai(t0, t0, Interpreter::logStackElementSize);
__ sd(t0, Address(fp, frame::interpreter_frame_extended_sp_offset * wordSize));
@@ -768,17 +767,17 @@ void TemplateInterpreterGenerator::lock_method() {
void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) {
// initialize fixed part of activation frame
if (native_call) {
- __ add(esp, sp, - 14 * wordSize);
+ __ subi(esp, sp, 14 * wordSize);
__ mv(xbcp, zr);
- __ add(sp, sp, - 14 * wordSize);
+ __ subi(sp, sp, 14 * wordSize);
// add 2 zero-initialized slots for native calls
__ sd(zr, Address(sp, 13 * wordSize));
__ sd(zr, Address(sp, 12 * wordSize));
} else {
- __ add(esp, sp, - 12 * wordSize);
+ __ subi(esp, sp, 12 * wordSize);
__ ld(t0, Address(xmethod, Method::const_offset())); // get ConstMethod
__ add(xbcp, t0, in_bytes(ConstMethod::codes_offset())); // get codebase
- __ add(sp, sp, - 12 * wordSize);
+ __ subi(sp, sp, 12 * wordSize);
}
__ sd(xbcp, Address(sp, wordSize));
__ mv(t0, frame::interpreter_frame_initial_sp_offset);
@@ -833,7 +832,7 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) {
} else {
// Make sure there is room for the exception oop pushed in case method throws
// an exception (see TemplateInterpreterGenerator::generate_throw_exception())
- __ sub(t0, sp, 2 * wordSize);
+ __ subi(t0, sp, 2 * wordSize);
__ sub(t1, t0, fp);
__ srai(t1, t1, Interpreter::logStackElementSize);
__ sd(t1, Address(sp, 5 * wordSize));
@@ -1018,7 +1017,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
// compute beginning of parameters (xlocals)
__ shadd(xlocals, x12, esp, xlocals, 3);
- __ addi(xlocals, xlocals, -wordSize);
+ __ subi(xlocals, xlocals, wordSize);
// Pull SP back to minimum size: this avoids holes in the stack
__ andi(sp, esp, -16);
@@ -1028,7 +1027,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
// make sure method is native & not abstract
#ifdef ASSERT
- __ lwu(x10, access_flags);
+ __ load_unsigned_short(x10, access_flags);
__ verify_access_flags(x10, JVM_ACC_NATIVE, "tried to execute non-native method as native", false);
__ verify_access_flags(x10, JVM_ACC_ABSTRACT, "tried to execute abstract method in interpreter");
#endif
@@ -1066,7 +1065,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
} else {
// no synchronization necessary
#ifdef ASSERT
- __ lwu(x10, access_flags);
+ __ load_unsigned_short(x10, access_flags);
__ verify_access_flags(x10, JVM_ACC_SYNCHRONIZED, "method needs synchronization");
#endif
}
@@ -1130,7 +1129,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
// pass mirror handle if static call
{
Label L;
- __ lwu(t, Address(xmethod, Method::access_flags_offset()));
+ __ load_unsigned_short(t, Address(xmethod, Method::access_flags_offset()));
__ test_bit(t0, t, exact_log2(JVM_ACC_STATIC));
__ beqz(t0, L);
// get mirror
@@ -1175,7 +1174,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
{
Label L;
__ lwu(t, Address(xthread, JavaThread::thread_state_offset()));
- __ addi(t0, zr, (u1)_thread_in_Java);
+ __ mv(t0, (u1)_thread_in_Java);
__ beq(t, t0, L);
__ stop("Wrong thread state in native stub");
__ bind(L);
@@ -1202,7 +1201,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
__ restore_cpu_control_state_after_jni(t0);
// make room for the pushes we're about to do
- __ sub(t0, esp, 4 * wordSize);
+ __ subi(t0, esp, 4 * wordSize);
__ andi(sp, t0, -16);
// NOTE: The order of these pushes is known to frame::interpreter_frame_result
@@ -1308,7 +1307,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
{
Label no_reguard;
__ lwu(t0, Address(xthread, in_bytes(JavaThread::stack_guard_state_offset())));
- __ addi(t1, zr, (u1)StackOverflow::stack_guard_yellow_reserved_disabled);
+ __ mv(t1, (u1)StackOverflow::stack_guard_yellow_reserved_disabled);
__ bne(t0, t1, no_reguard);
__ push_call_clobbered_registers();
@@ -1346,7 +1345,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
// do unlocking if necessary
{
Label L;
- __ lwu(t, Address(xmethod, Method::access_flags_offset()));
+ __ load_unsigned_short(t, Address(xmethod, Method::access_flags_offset()));
__ test_bit(t0, t, exact_log2(JVM_ACC_SYNCHRONIZED));
__ beqz(t0, L);
// the code below should be shared with interpreter macro
@@ -1440,7 +1439,7 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) {
// compute beginning of parameters (xlocals)
__ shadd(xlocals, x12, esp, t1, 3);
- __ add(xlocals, xlocals, -wordSize);
+ __ subi(xlocals, xlocals, wordSize);
// Make room for additional locals
__ slli(t1, x13, 3);
@@ -1458,8 +1457,8 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) {
__ blez(x13, exit); // do nothing if x13 <= 0
__ bind(loop);
__ sd(zr, Address(t0));
- __ add(t0, t0, wordSize);
- __ add(x13, x13, -1); // until everything initialized
+ __ addi(t0, t0, wordSize);
+ __ subi(x13, x13, 1); // until everything initialized
__ bnez(x13, loop);
__ bind(exit);
}
@@ -1472,7 +1471,7 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) {
// make sure method is not native & not abstract
#ifdef ASSERT
- __ lwu(x10, access_flags);
+ __ load_unsigned_short(x10, access_flags);
__ verify_access_flags(x10, JVM_ACC_NATIVE, "tried to execute native method as non-native");
__ verify_access_flags(x10, JVM_ACC_ABSTRACT, "tried to execute abstract method in interpreter");
#endif
@@ -1519,7 +1518,7 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) {
} else {
// no synchronization necessary
#ifdef ASSERT
- __ lwu(x10, access_flags);
+ __ load_unsigned_short(x10, access_flags);
__ verify_access_flags(x10, JVM_ACC_SYNCHRONIZED, "method needs synchronization");
#endif
}
@@ -1650,7 +1649,7 @@ void TemplateInterpreterGenerator::generate_throw_exception() {
__ slli(x10, x10, Interpreter::logStackElementSize);
__ restore_locals();
__ sub(xlocals, xlocals, x10);
- __ add(xlocals, xlocals, wordSize);
+ __ addi(xlocals, xlocals, wordSize);
// Save these arguments
__ super_call_VM_leaf(CAST_FROM_FN_PTR(address,
Deoptimization::
@@ -1745,7 +1744,7 @@ void TemplateInterpreterGenerator::generate_throw_exception() {
// sp: expression stack of caller
// fp: fp of caller
// FIXME: There's no point saving ra here because VM calls don't trash it
- __ sub(sp, sp, 2 * wordSize);
+ __ subi(sp, sp, 2 * wordSize);
__ sd(x10, Address(sp, 0)); // save exception
__ sd(ra, Address(sp, wordSize)); // save return address
__ super_call_VM_leaf(CAST_FROM_FN_PTR(address,
@@ -1754,7 +1753,7 @@ void TemplateInterpreterGenerator::generate_throw_exception() {
__ mv(x11, x10); // save exception handler
__ ld(x10, Address(sp, 0)); // restore exception
__ ld(ra, Address(sp, wordSize)); // restore return address
- __ add(sp, sp, 2 * wordSize);
+ __ addi(sp, sp, 2 * wordSize);
// We might be returning to a deopt handler that expects x13 to
// contain the exception pc
__ mv(x13, ra);
diff --git a/src/hotspot/cpu/riscv/templateTable_riscv.cpp b/src/hotspot/cpu/riscv/templateTable_riscv.cpp
index e51604569f688..cb4ded3c330b6 100644
--- a/src/hotspot/cpu/riscv/templateTable_riscv.cpp
+++ b/src/hotspot/cpu/riscv/templateTable_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
* Copyright (c) 2020, 2023, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -24,7 +24,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "compiler/disassembler.hpp"
#include "gc/shared/barrierSetAssembler.hpp"
@@ -197,7 +196,7 @@ void TemplateTable::patch_bytecode(Bytecodes::Code bc, Register bc_reg,
Label L_fast_patch;
// if a breakpoint is present we can't rewrite the stream directly
__ load_unsigned_byte(temp_reg, at_bcp(0));
- __ addi(temp_reg, temp_reg, -Bytecodes::_breakpoint); // temp_reg is temporary register.
+ __ subi(temp_reg, temp_reg, Bytecodes::_breakpoint); // temp_reg is temporary register.
__ bnez(temp_reg, L_fast_patch);
// Let breakpoint table handling rewrite to quicker bytecode
__ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::set_original_bytecode_at), xmethod, xbcp, bc_reg);
@@ -209,7 +208,7 @@ void TemplateTable::patch_bytecode(Bytecodes::Code bc, Register bc_reg,
Label L_okay;
__ load_unsigned_byte(temp_reg, at_bcp(0));
__ beq(temp_reg, bc_reg, L_okay);
- __ addi(temp_reg, temp_reg, -(int) Bytecodes::java_code(bc));
+ __ subi(temp_reg, temp_reg, (int)Bytecodes::java_code(bc));
__ beqz(temp_reg, L_okay);
__ stop("patching the wrong bytecode");
__ bind(L_okay);
@@ -737,7 +736,7 @@ void TemplateTable::iaload() {
// x10: array
// x11: index
index_check(x10, x11); // leaves index in x11
- __ add(x11, x11, arrayOopDesc::base_offset_in_bytes(T_INT) >> 2);
+ __ addi(x11, x11, arrayOopDesc::base_offset_in_bytes(T_INT) >> 2);
__ shadd(x10, x11, x10, t0, 2);
__ access_load_at(T_INT, IN_HEAP | IS_ARRAY, x10, Address(x10), noreg, noreg);
__ sext(x10, x10, 32);
@@ -750,7 +749,7 @@ void TemplateTable::laload() {
// x10: array
// x11: index
index_check(x10, x11); // leaves index in x11
- __ add(x11, x11, arrayOopDesc::base_offset_in_bytes(T_LONG) >> 3);
+ __ addi(x11, x11, arrayOopDesc::base_offset_in_bytes(T_LONG) >> 3);
__ shadd(x10, x11, x10, t0, 3);
__ access_load_at(T_LONG, IN_HEAP | IS_ARRAY, x10, Address(x10), noreg, noreg);
}
@@ -762,7 +761,7 @@ void TemplateTable::faload() {
// x10: array
// x11: index
index_check(x10, x11); // leaves index in x11
- __ add(x11, x11, arrayOopDesc::base_offset_in_bytes(T_FLOAT) >> 2);
+ __ addi(x11, x11, arrayOopDesc::base_offset_in_bytes(T_FLOAT) >> 2);
__ shadd(x10, x11, x10, t0, 2);
__ access_load_at(T_FLOAT, IN_HEAP | IS_ARRAY, x10, Address(x10), noreg, noreg);
}
@@ -774,7 +773,7 @@ void TemplateTable::daload() {
// x10: array
// x11: index
index_check(x10, x11); // leaves index in x11
- __ add(x11, x11, arrayOopDesc::base_offset_in_bytes(T_DOUBLE) >> 3);
+ __ addi(x11, x11, arrayOopDesc::base_offset_in_bytes(T_DOUBLE) >> 3);
__ shadd(x10, x11, x10, t0, 3);
__ access_load_at(T_DOUBLE, IN_HEAP | IS_ARRAY, x10, Address(x10), noreg, noreg);
}
@@ -786,7 +785,7 @@ void TemplateTable::aaload() {
// x10: array
// x11: index
index_check(x10, x11); // leaves index in x11
- __ add(x11, x11, arrayOopDesc::base_offset_in_bytes(T_OBJECT) >> LogBytesPerHeapOop);
+ __ addi(x11, x11, arrayOopDesc::base_offset_in_bytes(T_OBJECT) >> LogBytesPerHeapOop);
__ shadd(x10, x11, x10, t0, LogBytesPerHeapOop);
do_oop_load(_masm, Address(x10), x10, IS_ARRAY);
}
@@ -798,7 +797,7 @@ void TemplateTable::baload() {
// x10: array
// x11: index
index_check(x10, x11); // leaves index in x11
- __ add(x11, x11, arrayOopDesc::base_offset_in_bytes(T_BYTE) >> 0);
+ __ addi(x11, x11, arrayOopDesc::base_offset_in_bytes(T_BYTE) >> 0);
__ shadd(x10, x11, x10, t0, 0);
__ access_load_at(T_BYTE, IN_HEAP | IS_ARRAY, x10, Address(x10), noreg, noreg);
}
@@ -810,7 +809,7 @@ void TemplateTable::caload() {
// x10: array
// x11: index
index_check(x10, x11); // leaves index in x11
- __ add(x11, x11, arrayOopDesc::base_offset_in_bytes(T_CHAR) >> 1);
+ __ addi(x11, x11, arrayOopDesc::base_offset_in_bytes(T_CHAR) >> 1);
__ shadd(x10, x11, x10, t0, 1);
__ access_load_at(T_CHAR, IN_HEAP | IS_ARRAY, x10, Address(x10), noreg, noreg);
}
@@ -826,7 +825,7 @@ void TemplateTable::fast_icaload() {
// x10: array
// x11: index
index_check(x10, x11); // leaves index in x11, kills t0
- __ add(x11, x11, arrayOopDesc::base_offset_in_bytes(T_CHAR) >> 1); // addi, max imm is 2^11
+ __ addi(x11, x11, arrayOopDesc::base_offset_in_bytes(T_CHAR) >> 1); // addi, max imm is 2^11
__ shadd(x10, x11, x10, t0, 1);
__ access_load_at(T_CHAR, IN_HEAP | IS_ARRAY, x10, Address(x10), noreg, noreg);
}
@@ -838,7 +837,7 @@ void TemplateTable::saload() {
// x10: array
// x11: index
index_check(x10, x11); // leaves index in x11, kills t0
- __ add(x11, x11, arrayOopDesc::base_offset_in_bytes(T_SHORT) >> 1);
+ __ addi(x11, x11, arrayOopDesc::base_offset_in_bytes(T_SHORT) >> 1);
__ shadd(x10, x11, x10, t0, 1);
__ access_load_at(T_SHORT, IN_HEAP | IS_ARRAY, x10, Address(x10), noreg, noreg);
}
@@ -1017,7 +1016,7 @@ void TemplateTable::iastore() {
// x11: index
// x13: array
index_check(x13, x11); // prefer index in x11
- __ add(x11, x11, arrayOopDesc::base_offset_in_bytes(T_INT) >> 2);
+ __ addi(x11, x11, arrayOopDesc::base_offset_in_bytes(T_INT) >> 2);
__ shadd(t0, x11, x13, t0, 2);
__ access_store_at(T_INT, IN_HEAP | IS_ARRAY, Address(t0, 0), x10, noreg, noreg, noreg);
}
@@ -1030,7 +1029,7 @@ void TemplateTable::lastore() {
// x11: index
// x13: array
index_check(x13, x11); // prefer index in x11
- __ add(x11, x11, arrayOopDesc::base_offset_in_bytes(T_LONG) >> 3);
+ __ addi(x11, x11, arrayOopDesc::base_offset_in_bytes(T_LONG) >> 3);
__ shadd(t0, x11, x13, t0, 3);
__ access_store_at(T_LONG, IN_HEAP | IS_ARRAY, Address(t0, 0), x10, noreg, noreg, noreg);
}
@@ -1043,7 +1042,7 @@ void TemplateTable::fastore() {
// x11: index
// x13: array
index_check(x13, x11); // prefer index in x11
- __ add(x11, x11, arrayOopDesc::base_offset_in_bytes(T_FLOAT) >> 2);
+ __ addi(x11, x11, arrayOopDesc::base_offset_in_bytes(T_FLOAT) >> 2);
__ shadd(t0, x11, x13, t0, 2);
__ access_store_at(T_FLOAT, IN_HEAP | IS_ARRAY, Address(t0, 0), noreg /* ftos */, noreg, noreg, noreg);
}
@@ -1056,7 +1055,7 @@ void TemplateTable::dastore() {
// x11: index
// x13: array
index_check(x13, x11); // prefer index in x11
- __ add(x11, x11, arrayOopDesc::base_offset_in_bytes(T_DOUBLE) >> 3);
+ __ addi(x11, x11, arrayOopDesc::base_offset_in_bytes(T_DOUBLE) >> 3);
__ shadd(t0, x11, x13, t0, 3);
__ access_store_at(T_DOUBLE, IN_HEAP | IS_ARRAY, Address(t0, 0), noreg /* dtos */, noreg, noreg, noreg);
}
@@ -1070,7 +1069,7 @@ void TemplateTable::aastore() {
__ ld(x13, at_tos_p2()); // array
index_check(x13, x12); // kills x11
- __ add(x14, x12, arrayOopDesc::base_offset_in_bytes(T_OBJECT) >> LogBytesPerHeapOop);
+ __ addi(x14, x12, arrayOopDesc::base_offset_in_bytes(T_OBJECT) >> LogBytesPerHeapOop);
__ shadd(x14, x14, x13, x14, LogBytesPerHeapOop);
Address element_address(x14, 0);
@@ -1112,7 +1111,7 @@ void TemplateTable::aastore() {
// Pop stack arguments
__ bind(done);
- __ add(esp, esp, 3 * Interpreter::stackElementSize);
+ __ addi(esp, esp, 3 * Interpreter::stackElementSize);
}
void TemplateTable::bastore() {
@@ -1134,7 +1133,7 @@ void TemplateTable::bastore() {
__ andi(x10, x10, 1); // if it is a T_BOOLEAN array, mask the stored value to 0/1
__ bind(L_skip);
- __ add(x11, x11, arrayOopDesc::base_offset_in_bytes(T_BYTE) >> 0);
+ __ addi(x11, x11, arrayOopDesc::base_offset_in_bytes(T_BYTE) >> 0);
__ add(x11, x13, x11);
__ access_store_at(T_BYTE, IN_HEAP | IS_ARRAY, Address(x11, 0), x10, noreg, noreg, noreg);
@@ -1148,7 +1147,7 @@ void TemplateTable::castore() {
// x11: index
// x13: array
index_check(x13, x11); // prefer index in x11
- __ add(x11, x11, arrayOopDesc::base_offset_in_bytes(T_CHAR) >> 1);
+ __ addi(x11, x11, arrayOopDesc::base_offset_in_bytes(T_CHAR) >> 1);
__ shadd(t0, x11, x13, t0, 1);
__ access_store_at(T_CHAR, IN_HEAP | IS_ARRAY, Address(t0, 0), x10, noreg, noreg, noreg);
}
@@ -1883,7 +1882,7 @@ void TemplateTable::ret() {
__ profile_ret(x11, x12);
__ ld(xbcp, Address(xmethod, Method::const_offset()));
__ add(xbcp, xbcp, x11);
- __ addi(xbcp, xbcp, in_bytes(ConstMethod::codes_offset()));
+ __ add(xbcp, xbcp, in_bytes(ConstMethod::codes_offset()));
__ dispatch_next(vtos, 0, /*generate_poll*/true);
}
@@ -1958,7 +1957,7 @@ void TemplateTable::fast_linearswitch() {
__ lw(t0, Address(t0, 2 * BytesPerInt));
__ beq(x10, t0, found);
__ bind(loop_entry);
- __ addi(x11, x11, -1);
+ __ subi(x11, x11, 1);
__ bgez(x11, loop);
// default case
__ profile_switch_default(x10);
@@ -2544,7 +2543,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
__ j(Done);
__ bind(notByte);
- __ sub(t0, tos_state, (u1)ztos);
+ __ subi(t0, tos_state, (u1)ztos);
__ bnez(t0, notBool);
// ztos (same code as btos)
@@ -2558,7 +2557,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
__ j(Done);
__ bind(notBool);
- __ sub(t0, tos_state, (u1)atos);
+ __ subi(t0, tos_state, (u1)atos);
__ bnez(t0, notObj);
// atos
do_oop_load(_masm, field, x10, IN_HEAP);
@@ -2569,7 +2568,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
__ j(Done);
__ bind(notObj);
- __ sub(t0, tos_state, (u1)itos);
+ __ subi(t0, tos_state, (u1)itos);
__ bnez(t0, notInt);
// itos
__ access_load_at(T_INT, IN_HEAP, x10, field, noreg, noreg);
@@ -2582,7 +2581,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
__ j(Done);
__ bind(notInt);
- __ sub(t0, tos_state, (u1)ctos);
+ __ subi(t0, tos_state, (u1)ctos);
__ bnez(t0, notChar);
// ctos
__ access_load_at(T_CHAR, IN_HEAP, x10, field, noreg, noreg);
@@ -2594,7 +2593,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
__ j(Done);
__ bind(notChar);
- __ sub(t0, tos_state, (u1)stos);
+ __ subi(t0, tos_state, (u1)stos);
__ bnez(t0, notShort);
// stos
__ access_load_at(T_SHORT, IN_HEAP, x10, field, noreg, noreg);
@@ -2606,7 +2605,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
__ j(Done);
__ bind(notShort);
- __ sub(t0, tos_state, (u1)ltos);
+ __ subi(t0, tos_state, (u1)ltos);
__ bnez(t0, notLong);
// ltos
__ access_load_at(T_LONG, IN_HEAP, x10, field, noreg, noreg);
@@ -2618,7 +2617,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
__ j(Done);
__ bind(notLong);
- __ sub(t0, tos_state, (u1)ftos);
+ __ subi(t0, tos_state, (u1)ftos);
__ bnez(t0, notFloat);
// ftos
__ access_load_at(T_FLOAT, IN_HEAP, noreg /* ftos */, field, noreg, noreg);
@@ -2631,7 +2630,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
__ bind(notFloat);
#ifdef ASSERT
- __ sub(t0, tos_state, (u1)dtos);
+ __ subi(t0, tos_state, (u1)dtos);
__ bnez(t0, notDouble);
#endif
// dtos
@@ -2696,9 +2695,9 @@ void TemplateTable::jvmti_post_field_mod(Register cache, Register index, bool is
__ load_unsigned_byte(c_rarg3, Address(c_rarg2, in_bytes(ResolvedFieldEntry::type_offset())));
Label nope2, done, ok;
__ ld(c_rarg1, at_tos_p1()); // initially assume a one word jvalue
- __ sub(t0, c_rarg3, ltos);
+ __ subi(t0, c_rarg3, (u1)ltos);
__ beqz(t0, ok);
- __ sub(t0, c_rarg3, dtos);
+ __ subi(t0, c_rarg3, (u1)dtos);
__ bnez(t0, nope2);
__ bind(ok);
__ ld(c_rarg1, at_tos_p2()); // ltos (two word jvalue);
@@ -2772,7 +2771,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr
}
__ bind(notByte);
- __ sub(t0, tos_state, (u1)ztos);
+ __ subi(t0, tos_state, (u1)ztos);
__ bnez(t0, notBool);
// ztos
@@ -2792,7 +2791,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr
}
__ bind(notBool);
- __ sub(t0, tos_state, (u1)atos);
+ __ subi(t0, tos_state, (u1)atos);
__ bnez(t0, notObj);
// atos
@@ -2813,7 +2812,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr
}
__ bind(notObj);
- __ sub(t0, tos_state, (u1)itos);
+ __ subi(t0, tos_state, (u1)itos);
__ bnez(t0, notInt);
// itos
@@ -2833,7 +2832,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr
}
__ bind(notInt);
- __ sub(t0, tos_state, (u1)ctos);
+ __ subi(t0, tos_state, (u1)ctos);
__ bnez(t0, notChar);
// ctos
@@ -2853,7 +2852,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr
}
__ bind(notChar);
- __ sub(t0, tos_state, (u1)stos);
+ __ subi(t0, tos_state, (u1)stos);
__ bnez(t0, notShort);
// stos
@@ -2873,7 +2872,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr
}
__ bind(notShort);
- __ sub(t0, tos_state, (u1)ltos);
+ __ subi(t0, tos_state, (u1)ltos);
__ bnez(t0, notLong);
// ltos
@@ -2893,7 +2892,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr
}
__ bind(notLong);
- __ sub(t0, tos_state, (u1)ftos);
+ __ subi(t0, tos_state, (u1)ftos);
__ bnez(t0, notFloat);
// ftos
@@ -2914,7 +2913,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr
__ bind(notFloat);
#ifdef ASSERT
- __ sub(t0, tos_state, (u1)dtos);
+ __ subi(t0, tos_state, (u1)dtos);
__ bnez(t0, notDouble);
#endif
@@ -3207,7 +3206,7 @@ void TemplateTable::fast_xaccess(TosState state) {
__ bind(notVolatile);
}
- __ sub(xbcp, xbcp, 1);
+ __ subi(xbcp, xbcp, 1);
}
//-----------------------------------------------------------------------------
@@ -3521,7 +3520,7 @@ void TemplateTable::_new() {
__ la(t0, Address(t0, tags_offset));
__ lbu(t0, t0);
__ membar(MacroAssembler::LoadLoad | MacroAssembler::LoadStore);
- __ sub(t1, t0, (u1)JVM_CONSTANT_Class);
+ __ subi(t1, t0, (u1)JVM_CONSTANT_Class);
__ bnez(t1, slow_case);
// get InstanceKlass
@@ -3558,9 +3557,9 @@ void TemplateTable::_new() {
// zero, go directly to the header initialization.
if (UseCompactObjectHeaders) {
assert(is_aligned(oopDesc::base_offset_in_bytes(), BytesPerLong), "oop base offset must be 8-byte-aligned");
- __ sub(x13, x13, oopDesc::base_offset_in_bytes());
+ __ subi(x13, x13, oopDesc::base_offset_in_bytes());
} else {
- __ sub(x13, x13, sizeof(oopDesc));
+ __ subi(x13, x13, sizeof(oopDesc));
}
__ beqz(x13, initialize_header);
@@ -3568,15 +3567,15 @@ void TemplateTable::_new() {
{
if (UseCompactObjectHeaders) {
assert(is_aligned(oopDesc::base_offset_in_bytes(), BytesPerLong), "oop base offset must be 8-byte-aligned");
- __ add(x12, x10, oopDesc::base_offset_in_bytes());
+ __ addi(x12, x10, oopDesc::base_offset_in_bytes());
} else {
- __ add(x12, x10, sizeof(oopDesc));
+ __ addi(x12, x10, sizeof(oopDesc));
}
Label loop;
__ bind(loop);
__ sd(zr, Address(x12));
- __ add(x12, x12, BytesPerLong);
- __ sub(x13, x13, BytesPerLong);
+ __ addi(x12, x12, BytesPerLong);
+ __ subi(x13, x13, BytesPerLong);
__ bnez(x13, loop);
}
@@ -3649,11 +3648,11 @@ void TemplateTable::checkcast() {
__ get_cpool_and_tags(x12, x13); // x12=cpool, x13=tags array
__ get_unsigned_2_byte_index_at_bcp(x9, 1); // x9=index
// See if bytecode has already been quicked
- __ add(t0, x13, Array::base_offset_in_bytes());
+ __ addi(t0, x13, Array::base_offset_in_bytes());
__ add(x11, t0, x9);
__ lbu(x11, x11);
__ membar(MacroAssembler::LoadLoad | MacroAssembler::LoadStore);
- __ sub(t0, x11, (u1)JVM_CONSTANT_Class);
+ __ subi(t0, x11, (u1)JVM_CONSTANT_Class);
__ beqz(t0, quicked);
__ push(atos); // save receiver for result, and for GC
@@ -3704,11 +3703,11 @@ void TemplateTable::instanceof() {
__ get_cpool_and_tags(x12, x13); // x12=cpool, x13=tags array
__ get_unsigned_2_byte_index_at_bcp(x9, 1); // x9=index
// See if bytecode has already been quicked
- __ add(t0, x13, Array::base_offset_in_bytes());
+ __ addi(t0, x13, Array::base_offset_in_bytes());
__ add(x11, t0, x9);
__ lbu(x11, x11);
__ membar(MacroAssembler::LoadLoad | MacroAssembler::LoadStore);
- __ sub(t0, x11, (u1)JVM_CONSTANT_Class);
+ __ subi(t0, x11, (u1)JVM_CONSTANT_Class);
__ beqz(t0, quicked);
__ push(atos); // save receiver for result, and for GC
@@ -3884,7 +3883,7 @@ void TemplateTable::monitorenter() {
__ ld(c_rarg2, Address(c_rarg3, entry_size)); // load expression stack
// word from old location
__ sd(c_rarg2, Address(c_rarg3, 0)); // and store it at new location
- __ add(c_rarg3, c_rarg3, wordSize); // advance to next word
+ __ addi(c_rarg3, c_rarg3, wordSize); // advance to next word
__ bind(entry);
__ bne(c_rarg3, c_rarg1, loop); // check if bottom reached.if not at bottom
// then copy next word
@@ -3979,7 +3978,7 @@ void TemplateTable::multianewarray() {
// last dim is on top of stack; we want address of first one:
// first_addr = last_addr + (ndims - 1) * wordSize
__ shadd(c_rarg1, x10, esp, c_rarg1, 3);
- __ sub(c_rarg1, c_rarg1, wordSize);
+ __ subi(c_rarg1, c_rarg1, wordSize);
call_VM(x10,
CAST_FROM_FN_PTR(address, InterpreterRuntime::multianewarray),
c_rarg1);
diff --git a/src/hotspot/cpu/riscv/upcallLinker_riscv.cpp b/src/hotspot/cpu/riscv/upcallLinker_riscv.cpp
index 8fb0530d98fa1..fa6fe60b71e3d 100644
--- a/src/hotspot/cpu/riscv/upcallLinker_riscv.cpp
+++ b/src/hotspot/cpu/riscv/upcallLinker_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2023, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.hpp"
#include "classfile/javaClasses.hpp"
#include "logging/logStream.hpp"
diff --git a/src/hotspot/cpu/riscv/vm_version_riscv.cpp b/src/hotspot/cpu/riscv/vm_version_riscv.cpp
index a30ae45160611..5d7ed4bda601c 100644
--- a/src/hotspot/cpu/riscv/vm_version_riscv.cpp
+++ b/src/hotspot/cpu/riscv/vm_version_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2023, Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2023, Rivos Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -24,7 +24,6 @@
*
*/
-#include "precompiled.hpp"
#include "runtime/java.hpp"
#include "runtime/os.inline.hpp"
#include "runtime/vm_version.hpp"
diff --git a/src/hotspot/cpu/riscv/vm_version_riscv.hpp b/src/hotspot/cpu/riscv/vm_version_riscv.hpp
index 59b41892fef0c..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..37aa9d9a0e8a3 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"
@@ -191,7 +190,7 @@ void AbstractInterpreter::layout_activation(Method* method,
assert(is_bottom_frame && (sender_sp == caller->unextended_sp()),
"must initialize sender_sp of bottom skeleton frame when pushing it");
} else {
- assert(caller->is_entry_frame(), "is there a new frame type??");
+ assert(caller->is_entry_frame() || caller->is_upcall_stub_frame(), "is there a new frame type??");
sender_sp = caller->sp(); // Call_stub only uses it's fp.
}
@@ -201,6 +200,8 @@ void AbstractInterpreter::layout_activation(Method* method,
interpreter_frame->interpreter_frame_set_monitor_end((BasicObjectLock *)monitor);
*interpreter_frame->interpreter_frame_cache_addr() = method->constants()->cache();
interpreter_frame->interpreter_frame_set_tos_address(tos);
- interpreter_frame->interpreter_frame_set_sender_sp(sender_sp);
+ if (!is_bottom_frame) {
+ interpreter_frame->interpreter_frame_set_sender_sp(sender_sp);
+ }
interpreter_frame->interpreter_frame_set_top_frame_sp(top_frame_sp);
}
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..8cb8cef2b6bb3 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"
@@ -960,6 +959,11 @@ void LIRGenerator::do_InstanceOf(InstanceOf* x) {
x->profiled_method(), x->profiled_bci());
}
+// Intrinsic for Class::isInstance
+address LIRGenerator::isInstance_entry() {
+ return CAST_FROM_FN_PTR(address, Runtime1::is_instance_of);
+}
+
void LIRGenerator::do_If (If* x) {
assert(x->number_of_sux() == 2, "inconsistency");
diff --git a/src/hotspot/cpu/s390/c1_LIR_s390.cpp b/src/hotspot/cpu/s390/c1_LIR_s390.cpp
index 4788a398de8ab..3d36390a5ce52 100644
--- a/src/hotspot/cpu/s390/c1_LIR_s390.cpp
+++ b/src/hotspot/cpu/s390/c1_LIR_s390.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/register.hpp"
#include "c1/c1_FrameMap.hpp"
#include "c1/c1_LIR.hpp"
diff --git a/src/hotspot/cpu/s390/c1_LinearScan_s390.cpp b/src/hotspot/cpu/s390/c1_LinearScan_s390.cpp
index f48496f34d3ee..a5edd65ada845 100644
--- a/src/hotspot/cpu/s390/c1_LinearScan_s390.cpp
+++ b/src/hotspot/cpu/s390/c1_LinearScan_s390.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "c1/c1_LinearScan.hpp"
#include "utilities/debug.hpp"
diff --git a/src/hotspot/cpu/s390/c1_MacroAssembler_s390.cpp b/src/hotspot/cpu/s390/c1_MacroAssembler_s390.cpp
index bc269f9353ceb..5691a2055b3a2 100644
--- a/src/hotspot/cpu/s390/c1_MacroAssembler_s390.cpp
+++ b/src/hotspot/cpu/s390/c1_MacroAssembler_s390.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2024 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "c1/c1_MacroAssembler.hpp"
#include "c1/c1_Runtime1.hpp"
diff --git a/src/hotspot/cpu/s390/c1_Runtime1_s390.cpp b/src/hotspot/cpu/s390/c1_Runtime1_s390.cpp
index 0ada76ccef780..34b21ff3d15ca 100644
--- a/src/hotspot/cpu/s390/c1_Runtime1_s390.cpp
+++ b/src/hotspot/cpu/s390/c1_Runtime1_s390.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2023 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "c1/c1_Defs.hpp"
#include "c1/c1_MacroAssembler.hpp"
diff --git a/src/hotspot/cpu/s390/c2_MacroAssembler_s390.cpp b/src/hotspot/cpu/s390/c2_MacroAssembler_s390.cpp
index faa24bc880796..485efec6b9b68 100644
--- a/src/hotspot/cpu/s390/c2_MacroAssembler_s390.cpp
+++ b/src/hotspot/cpu/s390/c2_MacroAssembler_s390.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/assembler.hpp"
#include "asm/assembler.inline.hpp"
#include "opto/c2_MacroAssembler.hpp"
diff --git a/src/hotspot/cpu/s390/c2_init_s390.cpp b/src/hotspot/cpu/s390/c2_init_s390.cpp
index d2fa9f07f7897..ad18c71ee2f8b 100644
--- a/src/hotspot/cpu/s390/c2_init_s390.cpp
+++ b/src/hotspot/cpu/s390/c2_init_s390.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "opto/compile.hpp"
#include "opto/node.hpp"
diff --git a/src/hotspot/cpu/s390/compiledIC_s390.cpp b/src/hotspot/cpu/s390/compiledIC_s390.cpp
index 7891e85b9115e..8501a0cb346a1 100644
--- a/src/hotspot/cpu/s390/compiledIC_s390.cpp
+++ b/src/hotspot/cpu/s390/compiledIC_s390.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2019 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "code/compiledIC.hpp"
#include "code/nmethod.hpp"
diff --git a/src/hotspot/cpu/s390/compressedKlass_s390.cpp b/src/hotspot/cpu/s390/compressedKlass_s390.cpp
index 868df0f02d7cb..06077b48f99a1 100644
--- a/src/hotspot/cpu/s390/compressedKlass_s390.cpp
+++ b/src/hotspot/cpu/s390/compressedKlass_s390.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2023, Red Hat, Inc. All rights reserved.
- * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "oops/compressedKlass.hpp"
#include "utilities/globalDefinitions.hpp"
diff --git a/src/hotspot/cpu/s390/downcallLinker_s390.cpp b/src/hotspot/cpu/s390/downcallLinker_s390.cpp
index 85ddc5bf18548..ad375fb20ce82 100644
--- a/src/hotspot/cpu/s390/downcallLinker_s390.cpp
+++ b/src/hotspot/cpu/s390/downcallLinker_s390.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, Red Hat, Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -22,7 +22,6 @@
* questions.
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "code/codeBlob.hpp"
#include "code/codeCache.hpp"
diff --git a/src/hotspot/cpu/s390/foreignGlobals_s390.cpp b/src/hotspot/cpu/s390/foreignGlobals_s390.cpp
index b716b9126f2c8..1ad0570bad8ab 100644
--- a/src/hotspot/cpu/s390/foreignGlobals_s390.cpp
+++ b/src/hotspot/cpu/s390/foreignGlobals_s390.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, Red Hat, Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -22,7 +22,6 @@
* questions.
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "code/vmreg.inline.hpp"
#include "runtime/jniHandles.hpp"
diff --git a/src/hotspot/cpu/s390/frame_s390.cpp b/src/hotspot/cpu/s390/frame_s390.cpp
index f461aa67b08f2..01ed22c7d8620 100644
--- a/src/hotspot/cpu/s390/frame_s390.cpp
+++ b/src/hotspot/cpu/s390/frame_s390.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2023 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "compiler/oopMap.hpp"
#include "interpreter/interpreter.hpp"
#include "memory/resourceArea.hpp"
diff --git a/src/hotspot/cpu/s390/gc/g1/g1BarrierSetAssembler_s390.cpp b/src/hotspot/cpu/s390/gc/g1/g1BarrierSetAssembler_s390.cpp
index 544c82d34a769..2054c3db36c50 100644
--- a/src/hotspot/cpu/s390/gc/g1/g1BarrierSetAssembler_s390.cpp
+++ b/src/hotspot/cpu/s390/gc/g1/g1BarrierSetAssembler_s390.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2024 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "registerSaver_s390.hpp"
#include "gc/g1/g1CardTable.hpp"
diff --git a/src/hotspot/cpu/s390/gc/shared/barrierSetAssembler_s390.cpp b/src/hotspot/cpu/s390/gc/shared/barrierSetAssembler_s390.cpp
index 550bc9ba10938..d6fe10ac9c232 100644
--- a/src/hotspot/cpu/s390/gc/shared/barrierSetAssembler_s390.cpp
+++ b/src/hotspot/cpu/s390/gc/shared/barrierSetAssembler_s390.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "gc/shared/barrierSet.hpp"
#include "gc/shared/barrierSetAssembler.hpp"
diff --git a/src/hotspot/cpu/s390/gc/shared/barrierSetNMethod_s390.cpp b/src/hotspot/cpu/s390/gc/shared/barrierSetNMethod_s390.cpp
index a912cfcaf8253..85dcc0a4e73f3 100644
--- a/src/hotspot/cpu/s390/gc/shared/barrierSetNMethod_s390.cpp
+++ b/src/hotspot/cpu/s390/gc/shared/barrierSetNMethod_s390.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/assembler.inline.hpp"
#include "code/codeBlob.hpp"
#include "code/nativeInst.hpp"
diff --git a/src/hotspot/cpu/s390/gc/shared/cardTableBarrierSetAssembler_s390.cpp b/src/hotspot/cpu/s390/gc/shared/cardTableBarrierSetAssembler_s390.cpp
index 760f77951fa03..f8f1fe839d232 100644
--- a/src/hotspot/cpu/s390/gc/shared/cardTableBarrierSetAssembler_s390.cpp
+++ b/src/hotspot/cpu/s390/gc/shared/cardTableBarrierSetAssembler_s390.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "gc/shared/barrierSet.hpp"
#include "gc/shared/cardTable.hpp"
diff --git a/src/hotspot/cpu/s390/gc/shared/modRefBarrierSetAssembler_s390.cpp b/src/hotspot/cpu/s390/gc/shared/modRefBarrierSetAssembler_s390.cpp
index f44a72c27abc1..4d37ae2e4ce5f 100644
--- a/src/hotspot/cpu/s390/gc/shared/modRefBarrierSetAssembler_s390.cpp
+++ b/src/hotspot/cpu/s390/gc/shared/modRefBarrierSetAssembler_s390.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2024 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "gc/shared/modRefBarrierSetAssembler.hpp"
#include "runtime/jniHandles.hpp"
diff --git a/src/hotspot/cpu/s390/interp_masm_s390.cpp b/src/hotspot/cpu/s390/interp_masm_s390.cpp
index 5e80817aaba7b..cb335e407347b 100644
--- a/src/hotspot/cpu/s390/interp_masm_s390.cpp
+++ b/src/hotspot/cpu/s390/interp_masm_s390.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2024 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -25,7 +25,6 @@
// Major contributions by AHa, AS, JL, ML.
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "gc/shared/barrierSet.hpp"
#include "gc/shared/barrierSetAssembler.hpp"
@@ -780,7 +779,7 @@ void InterpreterMacroAssembler::unlock_if_synchronized_method(TosState state,
get_method(R_method);
verify_oop(Z_tos, state);
push(state); // Save tos/result.
- testbit(method2_(R_method, access_flags), JVM_ACC_SYNCHRONIZED_BIT);
+ testbit_ushort(method2_(R_method, access_flags), JVM_ACC_SYNCHRONIZED_BIT);
z_bfalse(unlocked);
// Don't unlock anything if the _do_not_unlock_if_synchronized flag
diff --git a/src/hotspot/cpu/s390/interpreterRT_s390.cpp b/src/hotspot/cpu/s390/interpreterRT_s390.cpp
index 0f3c18144e9cb..dd5bdc071fc57 100644
--- a/src/hotspot/cpu/s390/interpreterRT_s390.cpp
+++ b/src/hotspot/cpu/s390/interpreterRT_s390.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2023 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "interpreter/interp_masm.hpp"
#include "interpreter/interpreter.hpp"
diff --git a/src/hotspot/cpu/s390/jniFastGetField_s390.cpp b/src/hotspot/cpu/s390/jniFastGetField_s390.cpp
index 01b0bd528a8aa..f1c8095caa668 100644
--- a/src/hotspot/cpu/s390/jniFastGetField_s390.cpp
+++ b/src/hotspot/cpu/s390/jniFastGetField_s390.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "gc/shared/barrierSet.hpp"
#include "gc/shared/barrierSetAssembler.hpp"
diff --git a/src/hotspot/cpu/s390/macroAssembler_s390.cpp b/src/hotspot/cpu/s390/macroAssembler_s390.cpp
index a069d6ceafbf0..83a5c61bfc6c1 100644
--- a/src/hotspot/cpu/s390/macroAssembler_s390.cpp
+++ b/src/hotspot/cpu/s390/macroAssembler_s390.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2024 SAP SE. All rights reserved.
* Copyright 2024 IBM Corporation. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -24,7 +24,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/codeBuffer.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "code/compiledIC.hpp"
@@ -1015,6 +1014,18 @@ void MacroAssembler::load_and_test_long(Register dst, const Address &a) {
z_ltg(dst, a);
}
+// Test a bit in memory for 2 byte datatype.
+void MacroAssembler::testbit_ushort(const Address &a, unsigned int bit) {
+ assert(a.index() == noreg, "no index reg allowed in testbit");
+ if (bit <= 7) {
+ z_tm(a.disp() + 1, a.base(), 1 << bit);
+ } else if (bit <= 15) {
+ z_tm(a.disp() + 0, a.base(), 1 << (bit - 8));
+ } else {
+ ShouldNotReachHere();
+ }
+}
+
// Test a bit in memory.
void MacroAssembler::testbit(const Address &a, unsigned int bit) {
assert(a.index() == noreg, "no index reg allowed in testbit");
diff --git a/src/hotspot/cpu/s390/macroAssembler_s390.hpp b/src/hotspot/cpu/s390/macroAssembler_s390.hpp
index 159688128189a..d45f1321e0f28 100644
--- a/src/hotspot/cpu/s390/macroAssembler_s390.hpp
+++ b/src/hotspot/cpu/s390/macroAssembler_s390.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2024 SAP SE. All rights reserved.
* Copyright (c) 2024 IBM Corporation. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -199,6 +199,7 @@ class MacroAssembler: public Assembler {
// Test a bit in memory. Result is reflected in CC.
void testbit(const Address &a, unsigned int bit);
+ void testbit_ushort(const Address &a, unsigned int bit);
// Test a bit in a register. Result is reflected in CC.
void testbit(Register r, unsigned int bitPos);
diff --git a/src/hotspot/cpu/s390/macroAssembler_s390.inline.hpp b/src/hotspot/cpu/s390/macroAssembler_s390.inline.hpp
index d81562d9e9af0..72724fb66d110 100644
--- a/src/hotspot/cpu/s390/macroAssembler_s390.inline.hpp
+++ b/src/hotspot/cpu/s390/macroAssembler_s390.inline.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2023 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -75,7 +75,7 @@ inline void MacroAssembler::load_address(Register d, const Address &a) {
} else if (Displacement::is_validDisp(a.disp())) {
z_lay(d, a.disp(), a.indexOrR0(), a.baseOrR0());
} else {
- guarantee(false, "displacement = " SIZE_FORMAT_X ", out of range for LA/LAY", a.disp());
+ guarantee(false, "displacement = 0x%zx, out of range for LA/LAY", a.disp());
}
}
diff --git a/src/hotspot/cpu/s390/methodHandles_s390.cpp b/src/hotspot/cpu/s390/methodHandles_s390.cpp
index b2071e28478ea..e3de6d911be06 100644
--- a/src/hotspot/cpu/s390/methodHandles_s390.cpp
+++ b/src/hotspot/cpu/s390/methodHandles_s390.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2023 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "classfile/javaClasses.inline.hpp"
#include "classfile/vmClasses.hpp"
diff --git a/src/hotspot/cpu/s390/nativeInst_s390.cpp b/src/hotspot/cpu/s390/nativeInst_s390.cpp
index 6a6a774dfde58..9990c225a8986 100644
--- a/src/hotspot/cpu/s390/nativeInst_s390.cpp
+++ b/src/hotspot/cpu/s390/nativeInst_s390.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -25,7 +25,6 @@
// Major contributions by JL, LS
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "memory/resourceArea.hpp"
#include "nativeInst_s390.hpp"
diff --git a/src/hotspot/cpu/s390/register_s390.cpp b/src/hotspot/cpu/s390/register_s390.cpp
index 7292da43e5e0e..912984c5873dc 100644
--- a/src/hotspot/cpu/s390/register_s390.cpp
+++ b/src/hotspot/cpu/s390/register_s390.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2023 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "register_s390.hpp"
const char* Register::name() const {
diff --git a/src/hotspot/cpu/s390/relocInfo_s390.cpp b/src/hotspot/cpu/s390/relocInfo_s390.cpp
index 8afd80df6cee6..fdaf00e2bc34a 100644
--- a/src/hotspot/cpu/s390/relocInfo_s390.cpp
+++ b/src/hotspot/cpu/s390/relocInfo_s390.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/assembler.inline.hpp"
#include "code/relocInfo.hpp"
#include "nativeInst_s390.hpp"
diff --git a/src/hotspot/cpu/s390/runtime_s390.cpp b/src/hotspot/cpu/s390/runtime_s390.cpp
index 18f40e87876c7..dfaf73b9a7c24 100644
--- a/src/hotspot/cpu/s390/runtime_s390.cpp
+++ b/src/hotspot/cpu/s390/runtime_s390.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2023 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#ifdef COMPILER2
#include "asm/macroAssembler.inline.hpp"
#include "code/vmreg.hpp"
diff --git a/src/hotspot/cpu/s390/sharedRuntime_s390.cpp b/src/hotspot/cpu/s390/sharedRuntime_s390.cpp
index 2396a2a71059f..9716a5d71b3e6 100644
--- a/src/hotspot/cpu/s390/sharedRuntime_s390.cpp
+++ b/src/hotspot/cpu/s390/sharedRuntime_s390.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2024 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "code/debugInfoRec.hpp"
#include "code/vtableStubs.hpp"
@@ -2395,7 +2394,7 @@ AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm
Label L_skip_barrier;
{ // Bypass the barrier for non-static methods
- __ testbit(Address(Z_method, Method::access_flags_offset()), JVM_ACC_STATIC_BIT);
+ __ testbit_ushort(Address(Z_method, Method::access_flags_offset()), JVM_ACC_STATIC_BIT);
__ z_bfalse(L_skip_barrier); // non-static
}
diff --git a/src/hotspot/cpu/s390/stubDeclarations_s390.hpp b/src/hotspot/cpu/s390/stubDeclarations_s390.hpp
new file mode 100644
index 0000000000000..f382a319c489e
--- /dev/null
+++ b/src/hotspot/cpu/s390/stubDeclarations_s390.hpp
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2025, Red Hat, Inc. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef CPU_S390_STUBDECLARATIONS_HPP
+#define CPU_S390_STUBDECLARATIONS_HPP
+
+#define STUBGEN_INITIAL_BLOBS_ARCH_DO(do_stub, \
+ do_arch_blob, \
+ do_arch_entry, \
+ do_arch_entry_init) \
+ do_arch_blob(initial, 20000) \
+
+
+#define STUBGEN_CONTINUATION_BLOBS_ARCH_DO(do_stub, \
+ do_arch_blob, \
+ do_arch_entry, \
+ do_arch_entry_init) \
+ do_arch_blob(continuation, 2000) \
+
+
+#define STUBGEN_COMPILER_BLOBS_ARCH_DO(do_stub, \
+ do_arch_blob, \
+ do_arch_entry, \
+ do_arch_entry_init) \
+ do_arch_blob(compiler, 20000 ) \
+ do_stub(compiler, partial_subtype_check) \
+ do_arch_entry(zarch, compiler, partial_subtype_check, \
+ partial_subtype_check, partial_subtype_check) \
+
+
+#define STUBGEN_FINAL_BLOBS_ARCH_DO(do_stub, \
+ do_arch_blob, \
+ do_arch_entry, \
+ do_arch_entry_init) \
+ do_arch_blob(final, 20000) \
+
+
+#endif // CPU_S390_STUBDECLARATIONS_HPP
diff --git a/src/hotspot/cpu/s390/stubGenerator_s390.cpp b/src/hotspot/cpu/s390/stubGenerator_s390.cpp
index 0ff7dcbeed2f7..f542c125b3639 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"
@@ -119,7 +118,8 @@ class StubGenerator: public StubCodeGenerator {
// Set up a new C frame, copy Java arguments, call frame manager
// or native_entry, and process result.
- StubCodeMark mark(this, "StubRoutines", "call_stub");
+ StubGenStubId stub_id = StubGenStubId::call_stub_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Register r_arg_call_wrapper_addr = Z_ARG1;
@@ -459,7 +459,8 @@ class StubGenerator: public StubCodeGenerator {
// pending exception stored in JavaThread that can be tested from
// within the VM.
address generate_catch_exception() {
- StubCodeMark mark(this, "StubRoutines", "catch_exception");
+ StubGenStubId stub_id = StubGenStubId::catch_exception_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
@@ -510,7 +511,8 @@ class StubGenerator: public StubCodeGenerator {
// (Z_R14 is unchanged and is live out).
//
address generate_forward_exception() {
- StubCodeMark mark(this, "StubRoutines", "forward_exception");
+ StubGenStubId stub_id = StubGenStubId::forward_exception_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
#define pending_exception_offset in_bytes(Thread::pending_exception_offset())
@@ -590,7 +592,8 @@ class StubGenerator: public StubCodeGenerator {
// raddr: Z_R14, blown by call
//
address generate_partial_subtype_check() {
- StubCodeMark mark(this, "StubRoutines", "partial_subtype_check");
+ StubGenStubId stub_id = StubGenStubId::partial_subtype_check_id;
+ StubCodeMark mark(this, stub_id);
Label miss;
address start = __ pc();
@@ -622,8 +625,9 @@ class StubGenerator: public StubCodeGenerator {
return start;
}
- address generate_lookup_secondary_supers_table_stub(u1 super_klass_index) {
- StubCodeMark mark(this, "StubRoutines", "lookup_secondary_supers_table");
+ void generate_lookup_secondary_supers_table_stub() {
+ StubGenStubId stub_id = StubGenStubId::lookup_secondary_supers_table_id;
+ StubCodeMark mark(this, stub_id);
const Register
r_super_klass = Z_ARG1,
@@ -633,20 +637,20 @@ class StubGenerator: public StubCodeGenerator {
r_array_base = Z_ARG5,
r_bitmap = Z_R10,
r_result = Z_R11;
- address start = __ pc();
-
- __ lookup_secondary_supers_table_const(r_sub_klass, r_super_klass,
- r_array_base, r_array_length, r_array_index,
- r_bitmap, r_result, super_klass_index);
-
- __ z_br(Z_R14);
+ for (int slot = 0; slot < Klass::SECONDARY_SUPERS_TABLE_SIZE; slot++) {
+ StubRoutines::_lookup_secondary_supers_table_stubs[slot] = __ pc();
+ __ lookup_secondary_supers_table_const(r_sub_klass, r_super_klass,
+ r_array_base, r_array_length, r_array_index,
+ r_bitmap, r_result, slot);
- return start;
+ __ z_br(Z_R14);
+ }
}
// Slow path implementation for UseSecondarySupersTable.
address generate_lookup_secondary_supers_table_slow_path_stub() {
- StubCodeMark mark(this, "StubRoutines", "lookup_secondary_supers_table_slow_path");
+ StubGenStubId stub_id = StubGenStubId::lookup_secondary_supers_table_slow_path_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
@@ -1261,51 +1265,75 @@ class StubGenerator: public StubCodeGenerator {
}
}
- // Generate stub for disjoint byte copy. If "aligned" is true, the
- // "from" and "to" addresses are assumed to be heapword aligned.
- address generate_disjoint_byte_copy(bool aligned, const char * name) {
- StubCodeMark mark(this, "StubRoutines", name);
-
- // This is the zarch specific stub generator for byte array copy.
- // Refer to generate_disjoint_copy for a list of prereqs and features:
- unsigned int start_off = __ offset(); // Remember stub start address (is rtn value).
- generate_disjoint_copy(aligned, 1, false, false);
- return __ addr_at(start_off);
- }
-
-
- address generate_disjoint_short_copy(bool aligned, const char * name) {
- StubCodeMark mark(this, "StubRoutines", name);
- // This is the zarch specific stub generator for short array copy.
- // Refer to generate_disjoint_copy for a list of prereqs and features:
- unsigned int start_off = __ offset(); // Remember stub start address (is rtn value).
- generate_disjoint_copy(aligned, 2, false, false);
- return __ addr_at(start_off);
- }
-
-
- address generate_disjoint_int_copy(bool aligned, const char * name) {
- StubCodeMark mark(this, "StubRoutines", name);
- // This is the zarch specific stub generator for int array copy.
- // Refer to generate_disjoint_copy for a list of prereqs and features:
- unsigned int start_off = __ offset(); // Remember stub start address (is rtn value).
- generate_disjoint_copy(aligned, 4, false, false);
- return __ addr_at(start_off);
- }
-
-
- address generate_disjoint_long_copy(bool aligned, const char * name) {
- StubCodeMark mark(this, "StubRoutines", name);
- // This is the zarch specific stub generator for long array copy.
- // Refer to generate_disjoint_copy for a list of prereqs and features:
+ address generate_disjoint_nonoop_copy(StubGenStubId stub_id) {
+ bool aligned;
+ int element_size;
+ switch (stub_id) {
+ case jbyte_disjoint_arraycopy_id:
+ aligned = false;
+ element_size = 1;
+ break;
+ case arrayof_jbyte_disjoint_arraycopy_id:
+ aligned = true;
+ element_size = 1;
+ break;
+ case jshort_disjoint_arraycopy_id:
+ aligned = false;
+ element_size = 2;
+ break;
+ case arrayof_jshort_disjoint_arraycopy_id:
+ aligned = true;
+ element_size = 2;
+ break;
+ case jint_disjoint_arraycopy_id:
+ aligned = false;
+ element_size = 4;
+ break;
+ case arrayof_jint_disjoint_arraycopy_id:
+ aligned = true;
+ element_size = 4;
+ break;
+ case jlong_disjoint_arraycopy_id:
+ aligned = false;
+ element_size = 8;
+ break;
+ case arrayof_jlong_disjoint_arraycopy_id:
+ aligned = true;
+ element_size = 8;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+ StubCodeMark mark(this, stub_id);
unsigned int start_off = __ offset(); // Remember stub start address (is rtn value).
- generate_disjoint_copy(aligned, 8, false, false);
+ generate_disjoint_copy(aligned, element_size, false, false);
return __ addr_at(start_off);
}
-
- address generate_disjoint_oop_copy(bool aligned, const char * name, bool dest_uninitialized) {
- StubCodeMark mark(this, "StubRoutines", name);
+ address generate_disjoint_oop_copy(StubGenStubId stub_id) {
+ bool aligned;
+ bool dest_uninitialized;
+ switch (stub_id) {
+ case oop_disjoint_arraycopy_id:
+ aligned = false;
+ dest_uninitialized = false;
+ break;
+ case arrayof_oop_disjoint_arraycopy_id:
+ aligned = true;
+ dest_uninitialized = false;
+ break;
+ case oop_disjoint_arraycopy_uninit_id:
+ aligned = false;
+ dest_uninitialized = true;
+ break;
+ case arrayof_oop_disjoint_arraycopy_uninit_id:
+ aligned = true;
+ dest_uninitialized = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+ StubCodeMark mark(this, stub_id);
// This is the zarch specific stub generator for oop array copy.
// Refer to generate_disjoint_copy for a list of prereqs and features.
unsigned int start_off = __ offset(); // Remember stub start address (is rtn value).
@@ -1329,77 +1357,96 @@ class StubGenerator: public StubCodeGenerator {
return __ addr_at(start_off);
}
-
- address generate_conjoint_byte_copy(bool aligned, const char * name) {
- StubCodeMark mark(this, "StubRoutines", name);
- // This is the zarch specific stub generator for overlapping byte array copy.
- // Refer to generate_conjoint_copy for a list of prereqs and features:
- unsigned int start_off = __ offset(); // Remember stub start address (is rtn value).
- address nooverlap_target = aligned ? StubRoutines::arrayof_jbyte_disjoint_arraycopy()
- : StubRoutines::jbyte_disjoint_arraycopy();
-
- array_overlap_test(nooverlap_target, 0); // Branch away to nooverlap_target if disjoint.
- generate_conjoint_copy(aligned, 1, false);
-
- return __ addr_at(start_off);
- }
-
-
- address generate_conjoint_short_copy(bool aligned, const char * name) {
- StubCodeMark mark(this, "StubRoutines", name);
- // This is the zarch specific stub generator for overlapping short array copy.
- // Refer to generate_conjoint_copy for a list of prereqs and features:
- unsigned int start_off = __ offset(); // Remember stub start address (is rtn value).
- address nooverlap_target = aligned ? StubRoutines::arrayof_jshort_disjoint_arraycopy()
- : StubRoutines::jshort_disjoint_arraycopy();
-
- array_overlap_test(nooverlap_target, 1); // Branch away to nooverlap_target if disjoint.
- generate_conjoint_copy(aligned, 2, false);
-
- return __ addr_at(start_off);
- }
-
- address generate_conjoint_int_copy(bool aligned, const char * name) {
- StubCodeMark mark(this, "StubRoutines", name);
- // This is the zarch specific stub generator for overlapping int array copy.
- // Refer to generate_conjoint_copy for a list of prereqs and features:
-
- unsigned int start_off = __ offset(); // Remember stub start address (is rtn value).
- address nooverlap_target = aligned ? StubRoutines::arrayof_jint_disjoint_arraycopy()
- : StubRoutines::jint_disjoint_arraycopy();
-
- array_overlap_test(nooverlap_target, 2); // Branch away to nooverlap_target if disjoint.
- generate_conjoint_copy(aligned, 4, false);
-
- return __ addr_at(start_off);
- }
-
- address generate_conjoint_long_copy(bool aligned, const char * name) {
- StubCodeMark mark(this, "StubRoutines", name);
- // This is the zarch specific stub generator for overlapping long array copy.
- // Refer to generate_conjoint_copy for a list of prereqs and features:
-
- unsigned int start_off = __ offset(); // Remember stub start address (is rtn value).
- address nooverlap_target = aligned ? StubRoutines::arrayof_jlong_disjoint_arraycopy()
- : StubRoutines::jlong_disjoint_arraycopy();
-
- array_overlap_test(nooverlap_target, 3); // Branch away to nooverlap_target if disjoint.
- generate_conjoint_copy(aligned, 8, false);
-
+ address generate_conjoint_nonoop_copy(StubGenStubId stub_id) {
+ bool aligned;
+ int shift; // i.e. log2(element size)
+ address nooverlap_target;
+ switch (stub_id) {
+ case jbyte_arraycopy_id:
+ aligned = false;
+ shift = 0;
+ nooverlap_target = StubRoutines::jbyte_disjoint_arraycopy();
+ break;
+ case arrayof_jbyte_arraycopy_id:
+ aligned = true;
+ shift = 0;
+ nooverlap_target = StubRoutines::arrayof_jbyte_disjoint_arraycopy();
+ break;
+ case jshort_arraycopy_id:
+ aligned = false;
+ shift = 1;
+ nooverlap_target = StubRoutines::jshort_disjoint_arraycopy();
+ break;
+ case arrayof_jshort_arraycopy_id:
+ aligned = true;
+ shift = 1;
+ nooverlap_target = StubRoutines::arrayof_jshort_disjoint_arraycopy();
+ break;
+ case jint_arraycopy_id:
+ aligned = false;
+ shift = 2;
+ nooverlap_target = StubRoutines::jint_disjoint_arraycopy();
+ break;
+ case arrayof_jint_arraycopy_id:
+ aligned = true;
+ shift = 2;
+ nooverlap_target = StubRoutines::arrayof_jint_disjoint_arraycopy();
+ break;
+ case jlong_arraycopy_id:
+ aligned = false;
+ shift = 3;
+ nooverlap_target = StubRoutines::jlong_disjoint_arraycopy();
+ break;
+ case arrayof_jlong_arraycopy_id:
+ aligned = true;
+ shift = 3;
+ nooverlap_target = StubRoutines::arrayof_jlong_disjoint_arraycopy();
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+ StubCodeMark mark(this, stub_id);
+ unsigned int start_off = __ offset(); // Remember stub start address (is rtn value).
+ array_overlap_test(nooverlap_target, shift); // Branch away to nooverlap_target if disjoint.
+ generate_conjoint_copy(aligned, 1 << shift, false);
return __ addr_at(start_off);
}
- address generate_conjoint_oop_copy(bool aligned, const char * name, bool dest_uninitialized) {
- StubCodeMark mark(this, "StubRoutines", name);
+ address generate_conjoint_oop_copy(StubGenStubId stub_id) {
+ bool aligned;
+ bool dest_uninitialized;
+ address nooverlap_target;
+ switch (stub_id) {
+ case oop_arraycopy_id:
+ aligned = false;
+ dest_uninitialized = false;
+ nooverlap_target = StubRoutines::oop_disjoint_arraycopy(dest_uninitialized);
+ break;
+ case arrayof_oop_arraycopy_id:
+ aligned = true;
+ dest_uninitialized = false;
+ nooverlap_target = StubRoutines::arrayof_oop_disjoint_arraycopy(dest_uninitialized);
+ break;
+ case oop_arraycopy_uninit_id:
+ aligned = false;
+ dest_uninitialized = true;
+ nooverlap_target = StubRoutines::oop_disjoint_arraycopy(dest_uninitialized);
+ break;
+ case arrayof_oop_arraycopy_uninit_id:
+ aligned = true;
+ dest_uninitialized = true;
+ nooverlap_target = StubRoutines::arrayof_oop_disjoint_arraycopy(dest_uninitialized);
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+ StubCodeMark mark(this, stub_id);
// This is the zarch specific stub generator for overlapping oop array copy.
// Refer to generate_conjoint_copy for a list of prereqs and features.
unsigned int start_off = __ offset(); // Remember stub start address (is rtn value).
unsigned int size = UseCompressedOops ? 4 : 8;
unsigned int shift = UseCompressedOops ? 2 : 3;
- address nooverlap_target = aligned ? StubRoutines::arrayof_oop_disjoint_arraycopy(dest_uninitialized)
- : StubRoutines::oop_disjoint_arraycopy(dest_uninitialized);
-
// Branch to disjoint_copy (if applicable) before pre_barrier to avoid double pre_barrier.
array_overlap_test(nooverlap_target, shift); // Branch away to nooverlap_target if disjoint.
@@ -1426,33 +1473,33 @@ class StubGenerator: public StubCodeGenerator {
// Note: the disjoint stubs must be generated first, some of
// the conjoint stubs use them.
- StubRoutines::_jbyte_disjoint_arraycopy = generate_disjoint_byte_copy (false, "jbyte_disjoint_arraycopy");
- StubRoutines::_jshort_disjoint_arraycopy = generate_disjoint_short_copy(false, "jshort_disjoint_arraycopy");
- StubRoutines::_jint_disjoint_arraycopy = generate_disjoint_int_copy (false, "jint_disjoint_arraycopy");
- StubRoutines::_jlong_disjoint_arraycopy = generate_disjoint_long_copy (false, "jlong_disjoint_arraycopy");
- StubRoutines::_oop_disjoint_arraycopy = generate_disjoint_oop_copy (false, "oop_disjoint_arraycopy", false);
- StubRoutines::_oop_disjoint_arraycopy_uninit = generate_disjoint_oop_copy (false, "oop_disjoint_arraycopy_uninit", true);
-
- StubRoutines::_arrayof_jbyte_disjoint_arraycopy = generate_disjoint_byte_copy (true, "arrayof_jbyte_disjoint_arraycopy");
- StubRoutines::_arrayof_jshort_disjoint_arraycopy = generate_disjoint_short_copy(true, "arrayof_jshort_disjoint_arraycopy");
- StubRoutines::_arrayof_jint_disjoint_arraycopy = generate_disjoint_int_copy (true, "arrayof_jint_disjoint_arraycopy");
- StubRoutines::_arrayof_jlong_disjoint_arraycopy = generate_disjoint_long_copy (true, "arrayof_jlong_disjoint_arraycopy");
- StubRoutines::_arrayof_oop_disjoint_arraycopy = generate_disjoint_oop_copy (true, "arrayof_oop_disjoint_arraycopy", false);
- StubRoutines::_arrayof_oop_disjoint_arraycopy_uninit = generate_disjoint_oop_copy (true, "arrayof_oop_disjoint_arraycopy_uninit", true);
-
- StubRoutines::_jbyte_arraycopy = generate_conjoint_byte_copy (false, "jbyte_arraycopy");
- StubRoutines::_jshort_arraycopy = generate_conjoint_short_copy(false, "jshort_arraycopy");
- StubRoutines::_jint_arraycopy = generate_conjoint_int_copy (false, "jint_arraycopy");
- StubRoutines::_jlong_arraycopy = generate_conjoint_long_copy (false, "jlong_arraycopy");
- StubRoutines::_oop_arraycopy = generate_conjoint_oop_copy (false, "oop_arraycopy", false);
- StubRoutines::_oop_arraycopy_uninit = generate_conjoint_oop_copy (false, "oop_arraycopy_uninit", true);
-
- StubRoutines::_arrayof_jbyte_arraycopy = generate_conjoint_byte_copy (true, "arrayof_jbyte_arraycopy");
- StubRoutines::_arrayof_jshort_arraycopy = generate_conjoint_short_copy(true, "arrayof_jshort_arraycopy");
- StubRoutines::_arrayof_jint_arraycopy = generate_conjoint_int_copy (true, "arrayof_jint_arraycopy");
- StubRoutines::_arrayof_jlong_arraycopy = generate_conjoint_long_copy (true, "arrayof_jlong_arraycopy");
- StubRoutines::_arrayof_oop_arraycopy = generate_conjoint_oop_copy (true, "arrayof_oop_arraycopy", false);
- StubRoutines::_arrayof_oop_arraycopy_uninit = generate_conjoint_oop_copy (true, "arrayof_oop_arraycopy_uninit", true);
+ StubRoutines::_jbyte_disjoint_arraycopy = generate_disjoint_nonoop_copy (StubGenStubId::jbyte_disjoint_arraycopy_id);
+ StubRoutines::_jshort_disjoint_arraycopy = generate_disjoint_nonoop_copy(StubGenStubId::jshort_disjoint_arraycopy_id);
+ StubRoutines::_jint_disjoint_arraycopy = generate_disjoint_nonoop_copy (StubGenStubId::jint_disjoint_arraycopy_id);
+ StubRoutines::_jlong_disjoint_arraycopy = generate_disjoint_nonoop_copy (StubGenStubId::jlong_disjoint_arraycopy_id);
+ StubRoutines::_oop_disjoint_arraycopy = generate_disjoint_oop_copy (StubGenStubId::oop_disjoint_arraycopy_id);
+ StubRoutines::_oop_disjoint_arraycopy_uninit = generate_disjoint_oop_copy (StubGenStubId::oop_disjoint_arraycopy_uninit_id);
+
+ StubRoutines::_arrayof_jbyte_disjoint_arraycopy = generate_disjoint_nonoop_copy (StubGenStubId::arrayof_jbyte_disjoint_arraycopy_id);
+ StubRoutines::_arrayof_jshort_disjoint_arraycopy = generate_disjoint_nonoop_copy(StubGenStubId::arrayof_jshort_disjoint_arraycopy_id);
+ StubRoutines::_arrayof_jint_disjoint_arraycopy = generate_disjoint_nonoop_copy (StubGenStubId::arrayof_jint_disjoint_arraycopy_id);
+ StubRoutines::_arrayof_jlong_disjoint_arraycopy = generate_disjoint_nonoop_copy (StubGenStubId::arrayof_jlong_disjoint_arraycopy_id);
+ StubRoutines::_arrayof_oop_disjoint_arraycopy = generate_disjoint_oop_copy (StubGenStubId::arrayof_oop_disjoint_arraycopy_id);
+ StubRoutines::_arrayof_oop_disjoint_arraycopy_uninit = generate_disjoint_oop_copy (StubGenStubId::arrayof_oop_disjoint_arraycopy_uninit_id);
+
+ StubRoutines::_jbyte_arraycopy = generate_conjoint_nonoop_copy(StubGenStubId::jbyte_arraycopy_id);
+ StubRoutines::_jshort_arraycopy = generate_conjoint_nonoop_copy(StubGenStubId::jshort_arraycopy_id);
+ StubRoutines::_jint_arraycopy = generate_conjoint_nonoop_copy(StubGenStubId::jint_arraycopy_id);
+ StubRoutines::_jlong_arraycopy = generate_conjoint_nonoop_copy(StubGenStubId::jlong_arraycopy_id);
+ StubRoutines::_oop_arraycopy = generate_conjoint_oop_copy(StubGenStubId::oop_arraycopy_id);
+ StubRoutines::_oop_arraycopy_uninit = generate_conjoint_oop_copy(StubGenStubId::oop_arraycopy_uninit_id);
+
+ StubRoutines::_arrayof_jbyte_arraycopy = generate_conjoint_nonoop_copy(StubGenStubId::arrayof_jbyte_arraycopy_id);
+ StubRoutines::_arrayof_jshort_arraycopy = generate_conjoint_nonoop_copy(StubGenStubId::arrayof_jshort_arraycopy_id);
+ StubRoutines::_arrayof_jint_arraycopy = generate_conjoint_nonoop_copy (StubGenStubId::arrayof_jint_arraycopy_id);
+ StubRoutines::_arrayof_jlong_arraycopy = generate_conjoint_nonoop_copy(StubGenStubId::arrayof_jlong_arraycopy_id);
+ StubRoutines::_arrayof_oop_arraycopy = generate_conjoint_oop_copy(StubGenStubId::arrayof_oop_arraycopy_id);
+ StubRoutines::_arrayof_oop_arraycopy_uninit = generate_conjoint_oop_copy(StubGenStubId::arrayof_oop_arraycopy_uninit_id);
}
// Call interface for AES_encryptBlock, AES_decryptBlock stubs.
@@ -1734,9 +1781,10 @@ class StubGenerator: public StubCodeGenerator {
}
// Compute AES encrypt function.
- address generate_AES_encryptBlock(const char* name) {
+ address generate_AES_encryptBlock() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubGenStubId stub_id = StubGenStubId::aescrypt_encryptBlock_id;
+ StubCodeMark mark(this, stub_id);
unsigned int start_off = __ offset(); // Remember stub start address (is rtn value).
generate_AES_cipherBlock(false);
@@ -1745,9 +1793,10 @@ class StubGenerator: public StubCodeGenerator {
}
// Compute AES decrypt function.
- address generate_AES_decryptBlock(const char* name) {
+ address generate_AES_decryptBlock() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubGenStubId stub_id = StubGenStubId::aescrypt_decryptBlock_id;
+ StubCodeMark mark(this, stub_id);
unsigned int start_off = __ offset(); // Remember stub start address (is rtn value).
generate_AES_cipherBlock(true);
@@ -1805,9 +1854,10 @@ class StubGenerator: public StubCodeGenerator {
}
// Compute chained AES encrypt function.
- address generate_cipherBlockChaining_AES_encrypt(const char* name) {
+ address generate_cipherBlockChaining_AES_encrypt() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubGenStubId stub_id = StubGenStubId::cipherBlockChaining_encryptAESCrypt_id;
+ StubCodeMark mark(this, stub_id);
unsigned int start_off = __ offset(); // Remember stub start address (is rtn value).
generate_AES_cipherBlockChaining(false);
@@ -1816,9 +1866,10 @@ class StubGenerator: public StubCodeGenerator {
}
// Compute chained AES decrypt function.
- address generate_cipherBlockChaining_AES_decrypt(const char* name) {
+ address generate_cipherBlockChaining_AES_decrypt() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubGenStubId stub_id = StubGenStubId::cipherBlockChaining_decryptAESCrypt_id;
+ StubCodeMark mark(this, stub_id);
unsigned int start_off = __ offset(); // Remember stub start address (is rtn value).
generate_AES_cipherBlockChaining(true);
@@ -2522,9 +2573,10 @@ class StubGenerator: public StubCodeGenerator {
// Compute AES-CTR crypto function.
// Encrypt or decrypt is selected via parameters. Only one stub is necessary.
- address generate_counterMode_AESCrypt(const char* name) {
+ address generate_counterMode_AESCrypt() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubGenStubId stub_id = StubGenStubId::counterMode_AESCrypt_id;
+ StubCodeMark mark(this, stub_id);
unsigned int start_off = __ offset(); // Remember stub start address (is rtn value).
generate_counterMode_AES(false);
@@ -2537,7 +2589,8 @@ class StubGenerator: public StubCodeGenerator {
// Compute GHASH function.
address generate_ghash_processBlocks() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "ghash_processBlocks");
+ StubGenStubId stub_id = StubGenStubId::ghash_processBlocks_id;
+ StubCodeMark mark(this, stub_id);
unsigned int start_off = __ offset(); // Remember stub start address (is rtn value).
const Register state = Z_ARG1;
@@ -2614,9 +2667,20 @@ class StubGenerator: public StubCodeGenerator {
// provides for a large enough source data buffer.
//
// Compute SHA-1 function.
- address generate_SHA1_stub(bool multiBlock, const char* name) {
+ address generate_SHA1_stub(StubGenStubId stub_id) {
+ bool multiBlock;
+ switch (stub_id) {
+ case sha1_implCompress_id:
+ multiBlock = false;
+ break;
+ case sha1_implCompressMB_id:
+ multiBlock = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
unsigned int start_off = __ offset(); // Remember stub start address (is rtn value).
const Register srcBuff = Z_ARG1; // Points to first block to process (offset already added).
@@ -2696,9 +2760,20 @@ class StubGenerator: public StubCodeGenerator {
}
// Compute SHA-256 function.
- address generate_SHA256_stub(bool multiBlock, const char* name) {
+ address generate_SHA256_stub(StubGenStubId stub_id) {
+ bool multiBlock;
+ switch (stub_id) {
+ case sha256_implCompress_id:
+ multiBlock = false;
+ break;
+ case sha256_implCompressMB_id:
+ multiBlock = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
unsigned int start_off = __ offset(); // Remember stub start address (is rtn value).
const Register srcBuff = Z_ARG1;
@@ -2776,9 +2851,20 @@ class StubGenerator: public StubCodeGenerator {
}
// Compute SHA-512 function.
- address generate_SHA512_stub(bool multiBlock, const char* name) {
+ address generate_SHA512_stub(StubGenStubId stub_id) {
+ bool multiBlock;
+ switch (stub_id) {
+ case sha512_implCompress_id:
+ multiBlock = false;
+ break;
+ case sha512_implCompressMB_id:
+ multiBlock = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
unsigned int start_off = __ offset(); // Remember stub start address (is rtn value).
const Register srcBuff = Z_ARG1;
@@ -2868,7 +2954,7 @@ class StubGenerator: public StubCodeGenerator {
* Z_RET - int crc result
**/
// Compute CRC function (generic, for all polynomials).
- void generate_CRC_updateBytes(const char* name, Register table, bool invertCRC) {
+ void generate_CRC_updateBytes(Register table, bool invertCRC) {
// arguments to kernel_crc32:
Register crc = Z_ARG1; // Current checksum, preset by caller or result from previous call, int.
@@ -2899,18 +2985,19 @@ class StubGenerator: public StubCodeGenerator {
// Compute CRC32 function.
- address generate_CRC32_updateBytes(const char* name) {
+ address generate_CRC32_updateBytes() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubGenStubId stub_id = StubGenStubId::updateBytesCRC32_id;
+ StubCodeMark mark(this, stub_id);
unsigned int start_off = __ offset(); // Remember stub start address (is rtn value).
- assert(UseCRC32Intrinsics, "should not generate this stub (%s) with CRC32 intrinsics disabled", name);
+ assert(UseCRC32Intrinsics, "should not generate this stub (%s) with CRC32 intrinsics disabled", StubRoutines::get_stub_name(stub_id));
BLOCK_COMMENT("CRC32_updateBytes {");
Register table = Z_ARG4; // crc32 table address.
StubRoutines::zarch::generate_load_crc_table_addr(_masm, table);
- generate_CRC_updateBytes(name, table, true);
+ generate_CRC_updateBytes(table, true);
BLOCK_COMMENT("} CRC32_updateBytes");
return __ addr_at(start_off);
@@ -2918,18 +3005,19 @@ class StubGenerator: public StubCodeGenerator {
// Compute CRC32C function.
- address generate_CRC32C_updateBytes(const char* name) {
+ address generate_CRC32C_updateBytes() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubGenStubId stub_id = StubGenStubId::updateBytesCRC32C_id;
+ StubCodeMark mark(this, stub_id);
unsigned int start_off = __ offset(); // Remember stub start address (is rtn value).
- assert(UseCRC32CIntrinsics, "should not generate this stub (%s) with CRC32C intrinsics disabled", name);
+ assert(UseCRC32CIntrinsics, "should not generate this stub (%s) with CRC32C intrinsics disabled", StubRoutines::get_stub_name(stub_id));
BLOCK_COMMENT("CRC32C_updateBytes {");
Register table = Z_ARG4; // crc32c table address.
StubRoutines::zarch::generate_load_crc32c_table_addr(_masm, table);
- generate_CRC_updateBytes(name, table, false);
+ generate_CRC_updateBytes(table, false);
BLOCK_COMMENT("} CRC32C_updateBytes");
return __ addr_at(start_off);
@@ -2944,7 +3032,8 @@ class StubGenerator: public StubCodeGenerator {
// Z_ARG5 - z address
address generate_multiplyToLen() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "multiplyToLen");
+ StubGenStubId stub_id = StubGenStubId::multiplyToLen_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
@@ -2975,7 +3064,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_method_entry_barrier() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "nmethod_entry_barrier");
+ StubGenStubId stub_id = StubGenStubId::method_entry_barrier_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
@@ -3040,7 +3130,8 @@ class StubGenerator: public StubCodeGenerator {
// exception handler for upcall stubs
address generate_upcall_stub_exception_handler() {
- StubCodeMark mark(this, "StubRoutines", "upcall stub exception handler");
+ StubGenStubId stub_id = StubGenStubId::upcall_stub_exception_handler_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
// Native caller has no idea how to handle exceptions,
@@ -3057,7 +3148,8 @@ class StubGenerator: public StubCodeGenerator {
// Z_ARG1 = jobject receiver
// Z_method = Method* result
address generate_upcall_stub_load_target() {
- StubCodeMark mark(this, "StubRoutines", "upcall_stub_load_target");
+ StubGenStubId stub_id = StubGenStubId::upcall_stub_load_target_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ resolve_global_jobject(Z_ARG1, Z_tmp_1, Z_tmp_2);
@@ -3094,12 +3186,12 @@ class StubGenerator: public StubCodeGenerator {
if (UseCRC32Intrinsics) {
StubRoutines::_crc_table_adr = (address)StubRoutines::zarch::_crc_table;
- StubRoutines::_updateBytesCRC32 = generate_CRC32_updateBytes("CRC32_updateBytes");
+ StubRoutines::_updateBytesCRC32 = generate_CRC32_updateBytes();
}
if (UseCRC32CIntrinsics) {
StubRoutines::_crc32c_table_addr = (address)StubRoutines::zarch::_crc32c_table;
- StubRoutines::_updateBytesCRC32C = generate_CRC32C_updateBytes("CRC32C_updateBytes");
+ StubRoutines::_updateBytesCRC32C = generate_CRC32C_updateBytes();
}
// Comapct string intrinsics: Translate table for string inflate intrinsic. Used by trot instruction.
@@ -3118,8 +3210,6 @@ class StubGenerator: public StubCodeGenerator {
void generate_final_stubs() {
// Generates all stubs and initializes the entry points.
- StubRoutines::zarch::_partial_subtype_check = generate_partial_subtype_check();
-
// Support for verify_oop (must happen after universe_init).
StubRoutines::_verify_oop_subroutine_entry = generate_verify_oop_subroutine();
@@ -3132,19 +3222,31 @@ class StubGenerator: public StubCodeGenerator {
StubRoutines::_method_entry_barrier = generate_method_entry_barrier();
}
+#ifdef COMPILER2
+ if (UseSecondarySupersTable) {
+ StubRoutines::_lookup_secondary_supers_table_slow_path_stub = generate_lookup_secondary_supers_table_slow_path_stub();
+ if (!InlineSecondarySupersTest) {
+ generate_lookup_secondary_supers_table_stub();
+ }
+ }
+#endif // COMPILER2
+
StubRoutines::_upcall_stub_exception_handler = generate_upcall_stub_exception_handler();
StubRoutines::_upcall_stub_load_target = generate_upcall_stub_load_target();
}
void generate_compiler_stubs() {
+
+ StubRoutines::zarch::_partial_subtype_check = generate_partial_subtype_check();
+
#if COMPILER2_OR_JVMCI
// Generate AES intrinsics code.
if (UseAESIntrinsics) {
if (VM_Version::has_Crypto_AES()) {
- StubRoutines::_aescrypt_encryptBlock = generate_AES_encryptBlock("AES_encryptBlock");
- StubRoutines::_aescrypt_decryptBlock = generate_AES_decryptBlock("AES_decryptBlock");
- StubRoutines::_cipherBlockChaining_encryptAESCrypt = generate_cipherBlockChaining_AES_encrypt("AES_encryptBlock_chaining");
- StubRoutines::_cipherBlockChaining_decryptAESCrypt = generate_cipherBlockChaining_AES_decrypt("AES_decryptBlock_chaining");
+ StubRoutines::_aescrypt_encryptBlock = generate_AES_encryptBlock();
+ StubRoutines::_aescrypt_decryptBlock = generate_AES_decryptBlock();
+ StubRoutines::_cipherBlockChaining_encryptAESCrypt = generate_cipherBlockChaining_AES_encrypt();
+ StubRoutines::_cipherBlockChaining_decryptAESCrypt = generate_cipherBlockChaining_AES_decrypt();
} else {
// In PRODUCT builds, the function pointers will keep their initial (null) value.
// LibraryCallKit::try_to_inline() will return false then, preventing the intrinsic to be called.
@@ -3154,7 +3256,7 @@ class StubGenerator: public StubCodeGenerator {
if (UseAESCTRIntrinsics) {
if (VM_Version::has_Crypto_AES_CTR()) {
- StubRoutines::_counterMode_AESCrypt = generate_counterMode_AESCrypt("counterMode_AESCrypt");
+ StubRoutines::_counterMode_AESCrypt = generate_counterMode_AESCrypt();
} else {
// In PRODUCT builds, the function pointers will keep their initial (null) value.
// LibraryCallKit::try_to_inline() will return false then, preventing the intrinsic to be called.
@@ -3169,16 +3271,16 @@ class StubGenerator: public StubCodeGenerator {
// Generate SHA1/SHA256/SHA512 intrinsics code.
if (UseSHA1Intrinsics) {
- StubRoutines::_sha1_implCompress = generate_SHA1_stub(false, "SHA1_singleBlock");
- StubRoutines::_sha1_implCompressMB = generate_SHA1_stub(true, "SHA1_multiBlock");
+ StubRoutines::_sha1_implCompress = generate_SHA1_stub(StubGenStubId::sha1_implCompress_id);
+ StubRoutines::_sha1_implCompressMB = generate_SHA1_stub(StubGenStubId::sha1_implCompressMB_id);
}
if (UseSHA256Intrinsics) {
- StubRoutines::_sha256_implCompress = generate_SHA256_stub(false, "SHA256_singleBlock");
- StubRoutines::_sha256_implCompressMB = generate_SHA256_stub(true, "SHA256_multiBlock");
+ StubRoutines::_sha256_implCompress = generate_SHA256_stub(StubGenStubId::sha256_implCompress_id);
+ StubRoutines::_sha256_implCompressMB = generate_SHA256_stub(StubGenStubId::sha256_implCompressMB_id);
}
if (UseSHA512Intrinsics) {
- StubRoutines::_sha512_implCompress = generate_SHA512_stub(false, "SHA512_singleBlock");
- StubRoutines::_sha512_implCompressMB = generate_SHA512_stub(true, "SHA512_multiBlock");
+ StubRoutines::_sha512_implCompress = generate_SHA512_stub(StubGenStubId::sha512_implCompress_id);
+ StubRoutines::_sha512_implCompressMB = generate_SHA512_stub(StubGenStubId::sha512_implCompressMB_id);
}
#ifdef COMPILER2
@@ -3193,35 +3295,27 @@ class StubGenerator: public StubCodeGenerator {
StubRoutines::_montgomerySquare
= CAST_FROM_FN_PTR(address, SharedRuntime::montgomery_square);
}
- if (UseSecondarySupersTable) {
- StubRoutines::_lookup_secondary_supers_table_slow_path_stub = generate_lookup_secondary_supers_table_slow_path_stub();
- if (!InlineSecondarySupersTest) {
- for (int slot = 0; slot < Klass::SECONDARY_SUPERS_TABLE_SIZE; slot++) {
- StubRoutines::_lookup_secondary_supers_table_stubs[slot] = generate_lookup_secondary_supers_table_stub(slot);
- }
- }
- }
#endif
#endif // COMPILER2_OR_JVMCI
}
public:
- StubGenerator(CodeBuffer* code, StubsKind kind) : StubCodeGenerator(code) {
- switch(kind) {
- case Initial_stubs:
+ StubGenerator(CodeBuffer* code, StubGenBlobId blob_id) : StubCodeGenerator(code, blob_id) {
+ switch(blob_id) {
+ case initial_id:
generate_initial_stubs();
break;
- case Continuation_stubs:
+ case continuation_id:
generate_continuation_stubs();
break;
- case Compiler_stubs:
+ case compiler_id:
generate_compiler_stubs();
break;
- case Final_stubs:
+ case final_id:
generate_final_stubs();
break;
default:
- fatal("unexpected stubs kind: %d", kind);
+ fatal("unexpected blob id: %d", blob_id);
break;
};
}
@@ -3260,6 +3354,6 @@ class StubGenerator: public StubCodeGenerator {
};
-void StubGenerator_generate(CodeBuffer* code, StubCodeGenerator::StubsKind kind) {
- StubGenerator g(code, kind);
+void StubGenerator_generate(CodeBuffer* code, StubGenBlobId blob_id) {
+ StubGenerator g(code, blob_id);
}
diff --git a/src/hotspot/cpu/s390/stubRoutines_s390.cpp b/src/hotspot/cpu/s390/stubRoutines_s390.cpp
index 2a60f71557c71..e75928ad00e61 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"
@@ -33,7 +32,18 @@
// Implementation of the platform-specific part of StubRoutines - for
// a description of how to extend it, see the stubRoutines.hpp file.
-address StubRoutines::zarch::_partial_subtype_check = nullptr;
+// define fields for arch-specific entries
+
+#define DEFINE_ARCH_ENTRY(arch, blob_name, stub_name, field_name, getter_name) \
+ address StubRoutines:: arch :: STUB_FIELD_NAME(field_name) = nullptr;
+
+#define DEFINE_ARCH_ENTRY_INIT(arch, blob_name, stub_name, field_name, getter_name, init_function) \
+ address StubRoutines:: arch :: STUB_FIELD_NAME(field_name) = CAST_FROM_FN_PTR(address, init_function);
+
+STUBGEN_ARCH_ENTRIES_DO(DEFINE_ARCH_ENTRY, DEFINE_ARCH_ENTRY_INIT)
+
+#undef DEFINE_ARCH_ENTRY_INIT
+#undef DEFINE_ARCH_ENTRY
// Comapct string intrinsics: Translate table for string inflate intrinsic. Used by trot instruction.
address StubRoutines::zarch::_trot_table_addr = nullptr;
diff --git a/src/hotspot/cpu/s390/stubRoutines_s390.hpp b/src/hotspot/cpu/s390/stubRoutines_s390.hpp
index 7116d441715ad..7a4bc18eb7d4c 100644
--- a/src/hotspot/cpu/s390/stubRoutines_s390.hpp
+++ b/src/hotspot/cpu/s390/stubRoutines_s390.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -31,14 +31,17 @@
static bool returns_to_call_stub(address return_pc) { return return_pc == _call_stub_return_address; }
-enum { // Platform dependent constants.
- // simply increase sizes if too small (assembler will crash if too small)
- _initial_stubs_code_size = 20000,
- _continuation_stubs_code_size = 2000,
- _compiler_stubs_code_size = 20000,
- _final_stubs_code_size = 20000
+// emit enum used to size per-blob code buffers
+
+#define DEFINE_BLOB_SIZE(blob_name, size) \
+ _ ## blob_name ## _code_size = size,
+
+enum platform_dependent_constants {
+ STUBGEN_ARCH_BLOBS_DO(DEFINE_BLOB_SIZE)
};
+#undef DEFINE_BLOB_SIZE
+
// MethodHandles adapters
enum method_handles_platform_dependent_constants {
method_handles_adapters_code_size = 5000
@@ -69,10 +72,24 @@ class zarch {
locked = 1
};
+ // declare fields for arch-specific entries
+
+#define DECLARE_ARCH_ENTRY(arch, blob_name, stub_name, field_name, getter_name) \
+ static address STUB_FIELD_NAME(field_name) ;
+
+#define DECLARE_ARCH_ENTRY_INIT(arch, blob_name, stub_name, field_name, getter_name, init_function) \
+ DECLARE_ARCH_ENTRY(arch, blob_name, stub_name, field_name, getter_name)
+
+private:
+ STUBGEN_ARCH_ENTRIES_DO(DECLARE_ARCH_ENTRY, DECLARE_ARCH_ENTRY_INIT)
+
+#undef DECLARE_ARCH_ENTRY_INIT
+#undef DECLARE_ARCH_ENTRY
+
private:
+
static int _atomic_memory_operation_lock;
- static address _partial_subtype_check;
static juint _crc_table[CRC32_TABLES][CRC32_COLUMN_SIZE];
static juint _crc32c_table[CRC32_TABLES][CRC32_COLUMN_SIZE];
@@ -81,6 +98,20 @@ class zarch {
static jlong _trot_table[TROT_COLUMN_SIZE];
public:
+
+ // declare getters for arch-specific entries
+
+#define DEFINE_ARCH_ENTRY_GETTER(arch, blob_name, stub_name, field_name, getter_name) \
+ static address getter_name() { return STUB_FIELD_NAME(field_name) ; }
+
+#define DEFINE_ARCH_ENTRY_GETTER_INIT(arch, blob_name, stub_name, field_name, getter_name, init_function) \
+ DEFINE_ARCH_ENTRY_GETTER(arch, blob_name, stub_name, field_name, getter_name)
+
+ STUBGEN_ARCH_ENTRIES_DO(DEFINE_ARCH_ENTRY_GETTER, DEFINE_ARCH_ENTRY_GETTER_INIT)
+
+#undef DEFINE_ARCH_ENTRY_GETTER_INIT
+#undef DEFINE_ARCH_ENTRY_GETTER
+
// Global lock for everyone who needs to use atomic_compare_and_exchange
// or atomic_increment -- should probably use more locks for more
// scalability -- for instance one for each eden space or group of.
@@ -92,8 +123,6 @@ class zarch {
static int atomic_memory_operation_lock() { return _atomic_memory_operation_lock; }
static void set_atomic_memory_operation_lock(int value) { _atomic_memory_operation_lock = value; }
- static address partial_subtype_check() { return _partial_subtype_check; }
-
static void generate_load_absolute_address(MacroAssembler* masm, Register table, address table_addr, uint64_t table_contents);
static void generate_load_crc_table_addr(MacroAssembler* masm, Register table);
static void generate_load_crc32c_table_addr(MacroAssembler* masm, Register table);
diff --git a/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp b/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp
index 1c4089d5beb07..c40be5edec754 100644
--- a/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp
+++ b/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2024 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "classfile/javaClasses.hpp"
#include "compiler/disassembler.hpp"
@@ -164,7 +163,7 @@ address TemplateInterpreterGenerator::generate_slow_signature_handler() {
// Therefore add 3 to address that byte within "_flags".
// Reload method. VM call above may have destroyed register contents
__ get_method(method);
- __ testbit(method2_(method, access_flags), JVM_ACC_STATIC_BIT);
+ __ testbit_ushort(method2_(method, access_flags), JVM_ACC_STATIC_BIT);
method = noreg; // end of life
__ z_btrue(isStatic);
@@ -883,7 +882,7 @@ void TemplateInterpreterGenerator::lock_method(void) {
address reentry = nullptr;
{
Label L;
- __ testbit(method2_(method, access_flags), JVM_ACC_SYNCHRONIZED_BIT);
+ __ testbit_ushort(method2_(method, access_flags), JVM_ACC_SYNCHRONIZED_BIT);
__ z_btrue(L);
reentry = __ stop_chain_static(reentry, "method doesn't need synchronization");
__ bind(L);
@@ -897,7 +896,7 @@ void TemplateInterpreterGenerator::lock_method(void) {
Label done;
Label static_method;
- __ testbit(method2_(method, access_flags), JVM_ACC_STATIC_BIT);
+ __ testbit_ushort(method2_(method, access_flags), JVM_ACC_STATIC_BIT);
__ z_btrue(static_method);
// non-static method: Load receiver obj from stack.
@@ -1349,15 +1348,17 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
// Make sure method is native and not abstract.
#ifdef ASSERT
+ // _access_flags must be a 16 bit value.
+ assert(sizeof(AccessFlags) == 2, "testbit_ushort will fail");
address reentry = nullptr;
{ Label L;
- __ testbit(method_(access_flags), JVM_ACC_NATIVE_BIT);
+ __ testbit_ushort(method_(access_flags), JVM_ACC_NATIVE_BIT);
__ z_btrue(L);
reentry = __ stop_chain_static(reentry, "tried to execute non-native method as native");
__ bind(L);
}
{ Label L;
- __ testbit(method_(access_flags), JVM_ACC_ABSTRACT_BIT);
+ __ testbit_ushort(method_(access_flags), JVM_ACC_ABSTRACT_BIT);
__ z_bfalse(L);
reentry = __ stop_chain_static(reentry, "tried to execute abstract method as non-abstract");
__ bind(L);
@@ -1403,7 +1404,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
#ifdef ASSERT
{ Label L;
__ get_method(Z_R1_scratch);
- __ testbit(method2_(Z_R1_scratch, access_flags), JVM_ACC_SYNCHRONIZED_BIT);
+ __ testbit_ushort(method2_(Z_R1_scratch, access_flags), JVM_ACC_SYNCHRONIZED_BIT);
__ z_bfalse(L);
reentry = __ stop_chain_static(reentry, "method needs synchronization");
__ bind(L);
@@ -1461,7 +1462,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
// Pass mirror handle if static call.
{
Label method_is_not_static;
- __ testbit(method2_(Rmethod, access_flags), JVM_ACC_STATIC_BIT);
+ __ testbit_ushort(method2_(Rmethod, access_flags), JVM_ACC_STATIC_BIT);
__ z_bfalse(method_is_not_static);
// Load mirror from interpreter frame.
__ z_lg(Z_R1, _z_ijava_state_neg(mirror), Z_fp);
@@ -1719,13 +1720,13 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) {
#ifdef ASSERT
address reentry = nullptr;
{ Label L;
- __ testbit(method_(access_flags), JVM_ACC_NATIVE_BIT);
+ __ testbit_ushort(method_(access_flags), JVM_ACC_NATIVE_BIT);
__ z_bfalse(L);
reentry = __ stop_chain_static(reentry, "tried to execute native method as non-native");
__ bind(L);
}
{ Label L;
- __ testbit(method_(access_flags), JVM_ACC_ABSTRACT_BIT);
+ __ testbit_ushort(method_(access_flags), JVM_ACC_ABSTRACT_BIT);
__ z_bfalse(L);
reentry = __ stop_chain_static(reentry, "tried to execute abstract method as non-abstract");
__ bind(L);
@@ -1775,7 +1776,7 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) {
#ifdef ASSERT
{ Label L;
__ get_method(Z_R1_scratch);
- __ testbit(method2_(Z_R1_scratch, access_flags), JVM_ACC_SYNCHRONIZED_BIT);
+ __ testbit_ushort(method2_(Z_R1_scratch, access_flags), JVM_ACC_SYNCHRONIZED_BIT);
__ z_bfalse(L);
reentry = __ stop_chain_static(reentry, "method needs synchronization");
__ bind(L);
diff --git a/src/hotspot/cpu/s390/templateTable_s390.cpp b/src/hotspot/cpu/s390/templateTable_s390.cpp
index 3cb1aba810df4..e6c0c7781a3ba 100644
--- a/src/hotspot/cpu/s390/templateTable_s390.cpp
+++ b/src/hotspot/cpu/s390/templateTable_s390.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2024 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "compiler/disassembler.hpp"
#include "gc/shared/barrierSetAssembler.hpp"
diff --git a/src/hotspot/cpu/s390/upcallLinker_s390.cpp b/src/hotspot/cpu/s390/upcallLinker_s390.cpp
index 8baad40a519a4..ab8bf7718123d 100644
--- a/src/hotspot/cpu/s390/upcallLinker_s390.cpp
+++ b/src/hotspot/cpu/s390/upcallLinker_s390.cpp
@@ -21,7 +21,6 @@
* questions.
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "classfile/javaClasses.hpp"
#include "logging/logStream.hpp"
diff --git a/src/hotspot/cpu/s390/vm_version_s390.cpp b/src/hotspot/cpu/s390/vm_version_s390.cpp
index a5195e753bbf8..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"
@@ -308,6 +307,12 @@ void VM_Version::initialize() {
if (FLAG_IS_DEFAULT(UseMontgomerySquareIntrinsic)) {
FLAG_SET_DEFAULT(UseMontgomerySquareIntrinsic, true);
}
+
+ // The OptoScheduling information is not maintained in s390.ad.
+ if (OptoScheduling) {
+ warning("OptoScheduling is not supported on this CPU.");
+ FLAG_SET_DEFAULT(OptoScheduling, false);
+ }
#endif
if (FLAG_IS_DEFAULT(UsePopCountInstruction)) {
FLAG_SET_DEFAULT(UsePopCountInstruction, true);
@@ -323,12 +328,6 @@ void VM_Version::initialize() {
if (FLAG_IS_DEFAULT(UseUnalignedAccesses)) {
FLAG_SET_DEFAULT(UseUnalignedAccesses, true);
}
-
- // The OptoScheduling information is not maintained in s390.ad.
- if (OptoScheduling) {
- warning("OptoScheduling is not supported on this CPU.");
- FLAG_SET_DEFAULT(OptoScheduling, false);
- }
}
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..085ae4a6dddce 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"
@@ -3476,6 +3475,22 @@ void Assembler::vmovdqu(XMMRegister dst, XMMRegister src) {
emit_int16(0x6F, (0xC0 | encode));
}
+void Assembler::vmovw(XMMRegister dst, Register src) {
+ assert(VM_Version::supports_avx512_fp16(), "requires AVX512-FP16");
+ InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
+ attributes.set_is_evex_instruction();
+ int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_MAP5, &attributes, true);
+ emit_int16(0x6E, (0xC0 | encode));
+}
+
+void Assembler::vmovw(Register dst, XMMRegister src) {
+ assert(VM_Version::supports_avx512_fp16(), "requires AVX512-FP16");
+ InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
+ attributes.set_is_evex_instruction();
+ int encode = vex_prefix_and_encode(src->encoding(), 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_MAP5, &attributes, true);
+ emit_int16(0x7E, (0xC0 | encode));
+}
+
void Assembler::vmovdqu(XMMRegister dst, Address src) {
assert(UseAVX > 0, "");
InstructionMark im(this);
@@ -8443,6 +8458,70 @@ void Assembler::vpaddq(XMMRegister dst, XMMRegister nds, Address src, int vector
emit_operand(dst, src, 0);
}
+void Assembler::vaddsh(XMMRegister dst, XMMRegister nds, XMMRegister src) {
+ assert(VM_Version::supports_avx512_fp16(), "requires AVX512-FP16");
+ InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
+ attributes.set_is_evex_instruction();
+ int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_F3, VEX_OPCODE_MAP5, &attributes);
+ emit_int16(0x58, (0xC0 | encode));
+}
+
+void Assembler::vsubsh(XMMRegister dst, XMMRegister nds, XMMRegister src) {
+ assert(VM_Version::supports_avx512_fp16(), "requires AVX512-FP16");
+ InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
+ attributes.set_is_evex_instruction();
+ int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_F3, VEX_OPCODE_MAP5, &attributes);
+ emit_int16(0x5C, (0xC0 | encode));
+}
+
+void Assembler::vdivsh(XMMRegister dst, XMMRegister nds, XMMRegister src) {
+ assert(VM_Version::supports_avx512_fp16(), "requires AVX512-FP16");
+ InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
+ attributes.set_is_evex_instruction();
+ int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_F3, VEX_OPCODE_MAP5, &attributes);
+ emit_int16(0x5E, (0xC0 | encode));
+}
+
+void Assembler::vmulsh(XMMRegister dst, XMMRegister nds, XMMRegister src) {
+ assert(VM_Version::supports_avx512_fp16(), "requires AVX512-FP16");
+ InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
+ attributes.set_is_evex_instruction();
+ int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_F3, VEX_OPCODE_MAP5, &attributes);
+ emit_int16(0x59, (0xC0 | encode));
+}
+
+void Assembler::vmaxsh(XMMRegister dst, XMMRegister nds, XMMRegister src) {
+ assert(VM_Version::supports_avx512_fp16(), "requires AVX512-FP16");
+ InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
+ attributes.set_is_evex_instruction();
+ int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_F3, VEX_OPCODE_MAP5, &attributes);
+ emit_int16(0x5F, (0xC0 | encode));
+}
+
+void Assembler::vminsh(XMMRegister dst, XMMRegister nds, XMMRegister src) {
+ assert(VM_Version::supports_avx512_fp16(), "requires AVX512-FP16");
+ InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
+ attributes.set_is_evex_instruction();
+ int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_F3, VEX_OPCODE_MAP5, &attributes);
+ emit_int16(0x5D, (0xC0 | encode));
+}
+
+void Assembler::vsqrtsh(XMMRegister dst, XMMRegister src) {
+ assert(VM_Version::supports_avx512_fp16(), "requires AVX512-FP16");
+ InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
+ attributes.set_is_evex_instruction();
+ int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_F3, VEX_OPCODE_MAP5, &attributes);
+ emit_int16(0x51, (0xC0 | encode));
+}
+
+void Assembler::vfmadd132sh(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
+ assert(VM_Version::supports_avx512_fp16(), "");
+ InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
+ attributes.set_is_evex_instruction();
+ int encode = vex_prefix_and_encode(dst->encoding(), src1->encoding(), src2->encoding(), VEX_SIMD_66, VEX_OPCODE_MAP6, &attributes);
+ emit_int16((unsigned char)0x99, (0xC0 | encode));
+}
+
void Assembler::vpaddsb(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
assert(UseAVX > 0 && (vector_len == Assembler::AVX_512bit || (!needs_evex(dst, nds, src) || VM_Version::supports_avx512vl())), "");
assert(!needs_evex(dst, nds, src) || VM_Version::supports_avx512bw(), "");
diff --git a/src/hotspot/cpu/x86/assembler_x86.hpp b/src/hotspot/cpu/x86/assembler_x86.hpp
index 25be0d6a48d32..1eb12fb93f023 100644
--- a/src/hotspot/cpu/x86/assembler_x86.hpp
+++ b/src/hotspot/cpu/x86/assembler_x86.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
@@ -585,6 +585,8 @@ class Assembler : public AbstractAssembler {
VEX_OPCODE_0F_38 = 0x2,
VEX_OPCODE_0F_3A = 0x3,
VEX_OPCODE_0F_3C = 0x4,
+ VEX_OPCODE_MAP5 = 0x5,
+ VEX_OPCODE_MAP6 = 0x6,
VEX_OPCODE_MASK = 0x1F
};
@@ -1815,6 +1817,9 @@ class Assembler : public AbstractAssembler {
void movsbl(Register dst, Address src);
void movsbl(Register dst, Register src);
+ void vmovw(XMMRegister dst, Register src);
+ void vmovw(Register dst, XMMRegister src);
+
#ifdef _LP64
void movsbq(Register dst, Address src);
void movsbq(Register dst, Register src);
@@ -2691,6 +2696,16 @@ class Assembler : public AbstractAssembler {
void vpaddd(XMMRegister dst, XMMRegister nds, Address src, int vector_len);
void vpaddq(XMMRegister dst, XMMRegister nds, Address src, int vector_len);
+ // FP16 instructions
+ void vaddsh(XMMRegister dst, XMMRegister nds, XMMRegister src);
+ void vsubsh(XMMRegister dst, XMMRegister nds, XMMRegister src);
+ void vmulsh(XMMRegister dst, XMMRegister nds, XMMRegister src);
+ void vdivsh(XMMRegister dst, XMMRegister nds, XMMRegister src);
+ void vmaxsh(XMMRegister dst, XMMRegister nds, XMMRegister src);
+ void vminsh(XMMRegister dst, XMMRegister nds, XMMRegister src);
+ void vsqrtsh(XMMRegister dst, XMMRegister src);
+ void vfmadd132sh(XMMRegister dst, XMMRegister src1, XMMRegister src2);
+
// Saturating packed insturctions.
void vpaddsb(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len);
void vpaddsw(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len);
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..7e28b288f71d3 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()) {
@@ -1512,6 +1490,11 @@ void LIRGenerator::do_InstanceOf(InstanceOf* x) {
x->direct_compare(), patching_info, x->profiled_method(), x->profiled_bci());
}
+// Intrinsic for Class::isInstance
+address LIRGenerator::isInstance_entry() {
+ return Runtime1::entry_for(C1StubId::is_instance_of_id);
+}
+
void LIRGenerator::do_If(If* x) {
assert(x->number_of_sux() == 2, "inconsistency");
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..cb4cb3af8c3d4 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"
@@ -1318,6 +1317,60 @@ OopMapSet* Runtime1::generate_code_for(C1StubId id, StubAssembler* sasm) {
}
break;
+ case C1StubId::is_instance_of_id:
+ {
+ // Mirror: c_rarg0 (Windows: rcx, SysV: rdi)
+ // Object: c_rarg1 (Windows: rdx, SysV: rsi)
+ // ObjClass: r9
+ // Temps: rcx, r8, r10, r11
+ // Result: rax
+
+ Register klass = r9, obj = c_rarg1, result = rax;
+ Register temp0 = rcx, temp1 = r8, temp2 = r10, temp3 = r11;
+
+ // Get the Klass* into r9. c_rarg0 is now dead.
+ __ movptr(klass, Address(c_rarg0, java_lang_Class::klass_offset()));
+
+ Label done, is_secondary, same;
+
+ __ xorq(result, result);
+ __ testq(klass, klass);
+ __ jcc(Assembler::equal, done); // Klass is null
+
+ __ testq(obj, obj);
+ __ jcc(Assembler::equal, done); // obj is null
+
+ __ movl(temp0, Address(klass, in_bytes(Klass::super_check_offset_offset())));
+ __ cmpl(temp0, in_bytes(Klass::secondary_super_cache_offset()));
+ __ jcc(Assembler::equal, is_secondary); // Klass is a secondary superclass
+
+ // Klass is a concrete class
+ __ load_klass(temp2, obj, /*tmp*/temp1);
+ __ cmpptr(klass, Address(temp2, temp0));
+ __ setcc(Assembler::equal, result);
+ __ ret(0);
+
+ __ bind(is_secondary);
+
+ __ load_klass(obj, obj, /*tmp*/temp1);
+
+ // This is necessary because I am never in my own secondary_super list.
+ __ cmpptr(obj, klass);
+ __ jcc(Assembler::equal, same);
+
+ __ lookup_secondary_supers_table_var(obj, klass,
+ /*temps*/temp0, temp1, temp2, temp3,
+ result);
+ __ testq(result, result);
+
+ __ bind(same);
+ __ setcc(Assembler::equal, result);
+
+ __ bind(done);
+ __ ret(0);
+ }
+ break;
+
case C1StubId::monitorenter_nofpu_id:
save_fpu_registers = false;
// fall through
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..7356f5a1913c9 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"
@@ -6676,6 +6675,18 @@ void C2_MacroAssembler::vector_rearrange_int_float(BasicType bt, XMMRegister dst
}
}
+void C2_MacroAssembler::efp16sh(int opcode, XMMRegister dst, XMMRegister src1, XMMRegister src2) {
+ switch(opcode) {
+ case Op_AddHF: vaddsh(dst, src1, src2); break;
+ case Op_SubHF: vsubsh(dst, src1, src2); break;
+ case Op_MulHF: vmulsh(dst, src1, src2); break;
+ case Op_DivHF: vdivsh(dst, src1, src2); break;
+ case Op_MaxHF: vmaxsh(dst, src1, src2); break;
+ case Op_MinHF: vminsh(dst, src1, src2); break;
+ default: assert(false, "%s", NodeClassNames[opcode]); break;
+ }
+}
+
void C2_MacroAssembler::vector_saturating_op(int ideal_opc, BasicType elem_bt, XMMRegister dst, XMMRegister src1, XMMRegister src2, int vlen_enc) {
switch(elem_bt) {
case T_BYTE:
diff --git a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.hpp b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.hpp
index 6e49cdefa6c94..4fe2cc397b5ae 100644
--- a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.hpp
+++ b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.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
@@ -505,6 +505,7 @@
void vector_rearrange_int_float(BasicType bt, XMMRegister dst, XMMRegister shuffle,
XMMRegister src, int vlen_enc);
+ void efp16sh(int opcode, XMMRegister dst, XMMRegister src1, XMMRegister src2);
void vgather_subword(BasicType elem_ty, XMMRegister dst, Register base, Register idx_base, Register offset,
Register mask, XMMRegister xtmp1, XMMRegister xtmp2, XMMRegister xtmp3, Register rtmp,
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..ee2d6d8a0bedc 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"
@@ -200,13 +199,14 @@ void StubGenerator::generate_string_indexof(address *fnptrs) {
static void generate_string_indexof_stubs(StubGenerator *stubgen, address *fnptrs,
StrIntrinsicNode::ArgEncoding ae, MacroAssembler *_masm) {
- StubCodeMark mark(stubgen, "StubRoutines", "stringIndexOf");
bool isLL = (ae == StrIntrinsicNode::LL);
bool isUL = (ae == StrIntrinsicNode::UL);
bool isUU = (ae == StrIntrinsicNode::UU);
bool isU = isUL || isUU; // At least one is UTF-16
assert(isLL || isUL || isUU, "Encoding not recognized");
+ StubGenStubId stub_id = (isLL ? StubGenStubId::string_indexof_linear_ll_id : (isUL ? StubGenStubId::string_indexof_linear_ul_id : StubGenStubId::string_indexof_linear_uu_id));
+ StubCodeMark mark(stubgen, stub_id);
// Keep track of isUL since we need to generate UU code in the main body
// for the case where we expand the needle from bytes to words on the stack.
// This is done at L_wcharBegin. The algorithm used is:
diff --git a/src/hotspot/cpu/x86/codeBuffer_x86.cpp b/src/hotspot/cpu/x86/codeBuffer_x86.cpp
index 3c406ed1b198e..75cc9b9896bb0 100644
--- a/src/hotspot/cpu/x86/codeBuffer_x86.cpp
+++ b/src/hotspot/cpu/x86/codeBuffer_x86.cpp
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/codeBuffer.inline.hpp"
#include "asm/macroAssembler.hpp"
diff --git a/src/hotspot/cpu/x86/compiledIC_x86.cpp b/src/hotspot/cpu/x86/compiledIC_x86.cpp
index 51563d35d5dfd..53ad9aeec9162 100644
--- a/src/hotspot/cpu/x86/compiledIC_x86.cpp
+++ b/src/hotspot/cpu/x86/compiledIC_x86.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "code/codeCache.hpp"
#include "code/compiledIC.hpp"
diff --git a/src/hotspot/cpu/x86/compressedKlass_x86.cpp b/src/hotspot/cpu/x86/compressedKlass_x86.cpp
index 5b5a405bcef86..8a06a7ba3d503 100644
--- a/src/hotspot/cpu/x86/compressedKlass_x86.cpp
+++ b/src/hotspot/cpu/x86/compressedKlass_x86.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2023, Red Hat, Inc. All rights reserved.
- * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,8 +23,6 @@
*
*/
-#include "precompiled.hpp"
-
#ifdef _LP64
#include "oops/compressedKlass.hpp"
diff --git a/src/hotspot/cpu/x86/downcallLinker_x86_32.cpp b/src/hotspot/cpu/x86/downcallLinker_x86_32.cpp
index 4e549552e96da..3c7d93fc79e91 100644
--- a/src/hotspot/cpu/x86/downcallLinker_x86_32.cpp
+++ b/src/hotspot/cpu/x86/downcallLinker_x86_32.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -21,7 +21,6 @@
* questions.
*/
-#include "precompiled.hpp"
#include "prims/downcallLinker.hpp"
RuntimeStub* DowncallLinker::make_downcall_stub(BasicType* signature,
diff --git a/src/hotspot/cpu/x86/downcallLinker_x86_64.cpp b/src/hotspot/cpu/x86/downcallLinker_x86_64.cpp
index 00cc69651f15f..7f531ca56b143 100644
--- a/src/hotspot/cpu/x86/downcallLinker_x86_64.cpp
+++ b/src/hotspot/cpu/x86/downcallLinker_x86_64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -21,7 +21,6 @@
* questions.
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.hpp"
#include "code/codeBlob.hpp"
#include "logging/logStream.hpp"
diff --git a/src/hotspot/cpu/x86/foreignGlobals_x86_32.cpp b/src/hotspot/cpu/x86/foreignGlobals_x86_32.cpp
index c62021c32637c..18aa454e61cbf 100644
--- a/src/hotspot/cpu/x86/foreignGlobals_x86_32.cpp
+++ b/src/hotspot/cpu/x86/foreignGlobals_x86_32.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -21,7 +21,6 @@
* questions.
*/
-#include "precompiled.hpp"
#include "code/vmreg.hpp"
#include "prims/foreignGlobals.hpp"
#include "utilities/debug.hpp"
diff --git a/src/hotspot/cpu/x86/foreignGlobals_x86_64.cpp b/src/hotspot/cpu/x86/foreignGlobals_x86_64.cpp
index 658ff6fecddb9..cc5627f6ffd82 100644
--- a/src/hotspot/cpu/x86/foreignGlobals_x86_64.cpp
+++ b/src/hotspot/cpu/x86/foreignGlobals_x86_64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -21,7 +21,6 @@
* questions.
*/
-#include "precompiled.hpp"
#include "classfile/javaClasses.hpp"
#include "runtime/jniHandles.inline.hpp"
#include "oops/typeArrayOop.inline.hpp"
diff --git a/src/hotspot/cpu/x86/frame_x86.cpp b/src/hotspot/cpu/x86/frame_x86.cpp
index 4e28dc125341a..a5700134f60c7 100644
--- a/src/hotspot/cpu/x86/frame_x86.cpp
+++ b/src/hotspot/cpu/x86/frame_x86.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "compiler/oopMap.hpp"
#include "interpreter/interpreter.hpp"
#include "memory/resourceArea.hpp"
@@ -154,6 +153,11 @@ bool frame::safe_for_sender(JavaThread *thread) {
}
if (Continuation::is_return_barrier_entry(sender_pc)) {
+ // sender_pc might be invalid so check that the frame
+ // actually belongs to a Continuation.
+ if (!Continuation::is_frame_in_continuation(thread, *this)) {
+ return false;
+ }
// If our sender_pc is the return barrier, then our "real" sender is the continuation entry
frame s = Continuation::continuation_bottom_sender(thread, *this, sender_sp);
sender_sp = s.sp();
diff --git a/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp b/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp
index 5af36d84e6ed8..4aa02c4d6278b 100644
--- a/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp
+++ b/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "gc/g1/g1BarrierSet.hpp"
#include "gc/g1/g1BarrierSetAssembler.hpp"
diff --git a/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp b/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp
index cd0e43b68bf9e..50dea42d5a300 100644
--- a/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp
+++ b/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "classfile/classLoaderData.hpp"
#include "gc/shared/barrierSet.hpp"
#include "gc/shared/barrierSetAssembler.hpp"
diff --git a/src/hotspot/cpu/x86/gc/shared/barrierSetNMethod_x86.cpp b/src/hotspot/cpu/x86/gc/shared/barrierSetNMethod_x86.cpp
index dfd9d59016f0a..e99774cbc401a 100644
--- a/src/hotspot/cpu/x86/gc/shared/barrierSetNMethod_x86.cpp
+++ b/src/hotspot/cpu/x86/gc/shared/barrierSetNMethod_x86.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "code/codeCache.hpp"
#include "code/nativeInst.hpp"
#include "gc/shared/barrierSetNMethod.hpp"
diff --git a/src/hotspot/cpu/x86/gc/shared/cardTableBarrierSetAssembler_x86.cpp b/src/hotspot/cpu/x86/gc/shared/cardTableBarrierSetAssembler_x86.cpp
index b04ab35862a3e..7954ce38d03ef 100644
--- a/src/hotspot/cpu/x86/gc/shared/cardTableBarrierSetAssembler_x86.cpp
+++ b/src/hotspot/cpu/x86/gc/shared/cardTableBarrierSetAssembler_x86.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "gc/shared/barrierSet.hpp"
#include "gc/shared/cardTable.hpp"
diff --git a/src/hotspot/cpu/x86/gc/shared/modRefBarrierSetAssembler_x86.cpp b/src/hotspot/cpu/x86/gc/shared/modRefBarrierSetAssembler_x86.cpp
index 618095bdfa634..76066409a7caa 100644
--- a/src/hotspot/cpu/x86/gc/shared/modRefBarrierSetAssembler_x86.cpp
+++ b/src/hotspot/cpu/x86/gc/shared/modRefBarrierSetAssembler_x86.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "gc/shared/modRefBarrierSetAssembler.hpp"
diff --git a/src/hotspot/cpu/x86/gc/shenandoah/c1/shenandoahBarrierSetC1_x86.cpp b/src/hotspot/cpu/x86/gc/shenandoah/c1/shenandoahBarrierSetC1_x86.cpp
index eb6da25d1bc7a..063f4c2cc5ddf 100644
--- a/src/hotspot/cpu/x86/gc/shenandoah/c1/shenandoahBarrierSetC1_x86.cpp
+++ b/src/hotspot/cpu/x86/gc/shenandoah/c1/shenandoahBarrierSetC1_x86.cpp
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "c1/c1_LIRAssembler.hpp"
#include "c1/c1_MacroAssembler.hpp"
#include "gc/shared/gc_globals.hpp"
diff --git a/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp b/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp
index a452850b1e814..75ab8fca05152 100644
--- a/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp
+++ b/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "gc/shenandoah/shenandoahBarrierSet.hpp"
#include "gc/shenandoah/shenandoahBarrierSetAssembler.hpp"
#include "gc/shenandoah/shenandoahForwarding.hpp"
diff --git a/src/hotspot/cpu/x86/gc/z/zAddress_x86.cpp b/src/hotspot/cpu/x86/gc/z/zAddress_x86.cpp
index ed177f37e0d45..3667a52050c7a 100644
--- a/src/hotspot/cpu/x86/gc/z/zAddress_x86.cpp
+++ b/src/hotspot/cpu/x86/gc/z/zAddress_x86.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -21,7 +21,6 @@
* questions.
*/
-#include "precompiled.hpp"
#include "gc/shared/gc_globals.hpp"
#include "gc/z/zAddress.inline.hpp"
#include "gc/z/zGlobals.hpp"
diff --git a/src/hotspot/cpu/x86/gc/z/zAddress_x86.inline.hpp b/src/hotspot/cpu/x86/gc/z/zAddress_x86.inline.hpp
index e0be06395946a..d0816aee74f76 100644
--- a/src/hotspot/cpu/x86/gc/z/zAddress_x86.inline.hpp
+++ b/src/hotspot/cpu/x86/gc/z/zAddress_x86.inline.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@ inline uintptr_t ZPointer::remap_bits(uintptr_t colored) {
inline constexpr int ZPointer::load_shift_lookup(uintptr_t value) {
const size_t index = load_shift_lookup_index(value);
- assert(index == 0 || is_power_of_2(index), "Incorrect load shift: " SIZE_FORMAT, index);
+ assert(index == 0 || is_power_of_2(index), "Incorrect load shift: %zu", index);
return ZPointerLoadShiftTable[index];
}
diff --git a/src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp b/src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp
index 1bc8e5c45443b..f7b1e25cf3b5d 100644
--- a/src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp
+++ b/src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -21,7 +21,6 @@
* questions.
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "code/codeBlob.hpp"
#include "code/vmreg.inline.hpp"
diff --git a/src/hotspot/cpu/x86/icache_x86.cpp b/src/hotspot/cpu/x86/icache_x86.cpp
index b9ec2f6d18649..45679332ecaca 100644
--- a/src/hotspot/cpu/x86/icache_x86.cpp
+++ b/src/hotspot/cpu/x86/icache_x86.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.hpp"
#include "runtime/icache.hpp"
diff --git a/src/hotspot/cpu/x86/interp_masm_x86.cpp b/src/hotspot/cpu/x86/interp_masm_x86.cpp
index 3a3f01a640983..44087663a34b5 100644
--- a/src/hotspot/cpu/x86/interp_masm_x86.cpp
+++ b/src/hotspot/cpu/x86/interp_masm_x86.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "compiler/compiler_globals.hpp"
#include "interp_masm_x86.hpp"
#include "interpreter/interpreter.hpp"
@@ -1030,7 +1029,7 @@ void InterpreterMacroAssembler::remove_activation(
// get method access flags
movptr(rcx, Address(rbp, frame::interpreter_frame_method_offset * wordSize));
- movl(rcx, Address(rcx, Method::access_flags_offset()));
+ load_unsigned_short(rcx, Address(rcx, Method::access_flags_offset()));
testl(rcx, JVM_ACC_SYNCHRONIZED);
jcc(Assembler::zero, unlocked);
diff --git a/src/hotspot/cpu/x86/interpreterRT_x86_32.cpp b/src/hotspot/cpu/x86/interpreterRT_x86_32.cpp
index 4f463b1d77140..14f11596924a5 100644
--- a/src/hotspot/cpu/x86/interpreterRT_x86_32.cpp
+++ b/src/hotspot/cpu/x86/interpreterRT_x86_32.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "interpreter/interp_masm.hpp"
#include "interpreter/interpreter.hpp"
#include "interpreter/interpreterRuntime.hpp"
diff --git a/src/hotspot/cpu/x86/interpreterRT_x86_64.cpp b/src/hotspot/cpu/x86/interpreterRT_x86_64.cpp
index c37287635bab9..8909df5b3f081 100644
--- a/src/hotspot/cpu/x86/interpreterRT_x86_64.cpp
+++ b/src/hotspot/cpu/x86/interpreterRT_x86_64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "interpreter/interp_masm.hpp"
#include "interpreter/interpreter.hpp"
#include "interpreter/interpreterRuntime.hpp"
diff --git a/src/hotspot/cpu/x86/jniFastGetField_x86_32.cpp b/src/hotspot/cpu/x86/jniFastGetField_x86_32.cpp
index 123362894122c..eee82a5c6820e 100644
--- a/src/hotspot/cpu/x86/jniFastGetField_x86_32.cpp
+++ b/src/hotspot/cpu/x86/jniFastGetField_x86_32.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.hpp"
#include "memory/resourceArea.hpp"
#include "prims/jniFastGetField.hpp"
diff --git a/src/hotspot/cpu/x86/jniFastGetField_x86_64.cpp b/src/hotspot/cpu/x86/jniFastGetField_x86_64.cpp
index e94b7d12b0b3c..09ba4537854fa 100644
--- a/src/hotspot/cpu/x86/jniFastGetField_x86_64.cpp
+++ b/src/hotspot/cpu/x86/jniFastGetField_x86_64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.hpp"
#include "code/codeBlob.hpp"
#include "gc/shared/barrierSet.hpp"
diff --git a/src/hotspot/cpu/x86/jvmciCodeInstaller_x86.cpp b/src/hotspot/cpu/x86/jvmciCodeInstaller_x86.cpp
index 8eff2590bfcea..9e6a4789dc2cd 100644
--- a/src/hotspot/cpu/x86/jvmciCodeInstaller_x86.cpp
+++ b/src/hotspot/cpu/x86/jvmciCodeInstaller_x86.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -21,7 +21,6 @@
* questions.
*/
-#include "precompiled.hpp"
#include "compiler/disassembler.hpp"
#include "oops/compressedKlass.hpp"
#include "oops/oop.inline.hpp"
diff --git a/src/hotspot/cpu/x86/macroAssembler_x86.cpp b/src/hotspot/cpu/x86/macroAssembler_x86.cpp
index a798dea08cc79..00f9358de6706 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"
@@ -779,9 +778,17 @@ void MacroAssembler::warn(const char* msg) {
andq(rsp, -16); // align stack as required by push_CPU_state and call
push_CPU_state(); // keeps alignment at 16 bytes
+#ifdef _WIN64
+ // Windows always allocates space for its register args
+ subq(rsp, frame::arg_reg_save_area_bytes);
+#endif
lea(c_rarg0, ExternalAddress((address) msg));
call(RuntimeAddress(CAST_FROM_FN_PTR(address, warning)));
+#ifdef _WIN64
+ // restore stack pointer
+ addq(rsp, frame::arg_reg_save_area_bytes);
+#endif
pop_CPU_state();
mov(rsp, rbp);
pop(rbp);
@@ -1194,7 +1201,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);
@@ -2376,6 +2387,22 @@ void MacroAssembler::jump_cc(Condition cc, AddressLiteral dst, Register rscratch
}
}
+void MacroAssembler::cmp32_mxcsr_std(Address mxcsr_save, Register tmp, Register rscratch) {
+ ExternalAddress mxcsr_std(StubRoutines::x86::addr_mxcsr_std());
+ assert(rscratch != noreg || always_reachable(mxcsr_std), "missing");
+
+ stmxcsr(mxcsr_save);
+ movl(tmp, mxcsr_save);
+ if (EnableX86ECoreOpts) {
+ // The mxcsr_std has status bits set for performance on ECore
+ orl(tmp, 0x003f);
+ } else {
+ // Mask out status bits (only check control and mask bits)
+ andl(tmp, 0xFFC0);
+ }
+ cmp32(tmp, mxcsr_std, rscratch);
+}
+
void MacroAssembler::ldmxcsr(AddressLiteral src, Register rscratch) {
assert(rscratch != noreg || always_reachable(src), "missing");
@@ -3332,7 +3359,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 +3373,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 +3397,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);
@@ -9120,14 +9160,14 @@ void MacroAssembler::crc32c_ipl_alg2_alt2(Register in_out, Register in1, Registe
Label L_exit;
if (is_pclmulqdq_supported ) {
- const_or_pre_comp_const_index[1] = *(uint32_t *)StubRoutines::_crc32c_table_addr;
- const_or_pre_comp_const_index[0] = *((uint32_t *)StubRoutines::_crc32c_table_addr+1);
+ const_or_pre_comp_const_index[1] = *(uint32_t *)StubRoutines::crc32c_table_addr();
+ const_or_pre_comp_const_index[0] = *((uint32_t *)StubRoutines::crc32c_table_addr() + 1);
- const_or_pre_comp_const_index[3] = *((uint32_t *)StubRoutines::_crc32c_table_addr + 2);
- const_or_pre_comp_const_index[2] = *((uint32_t *)StubRoutines::_crc32c_table_addr + 3);
+ const_or_pre_comp_const_index[3] = *((uint32_t *)StubRoutines::crc32c_table_addr() + 2);
+ const_or_pre_comp_const_index[2] = *((uint32_t *)StubRoutines::crc32c_table_addr() + 3);
- const_or_pre_comp_const_index[5] = *((uint32_t *)StubRoutines::_crc32c_table_addr + 4);
- const_or_pre_comp_const_index[4] = *((uint32_t *)StubRoutines::_crc32c_table_addr + 5);
+ const_or_pre_comp_const_index[5] = *((uint32_t *)StubRoutines::crc32c_table_addr() + 4);
+ const_or_pre_comp_const_index[4] = *((uint32_t *)StubRoutines::crc32c_table_addr() + 5);
assert((CRC32C_NUM_PRECOMPUTED_CONSTANTS - 1 ) == 5, "Checking whether you declared all of the constants based on the number of \"chunks\"");
} else {
const_or_pre_comp_const_index[0] = 1;
@@ -9200,14 +9240,14 @@ void MacroAssembler::crc32c_ipl_alg2_alt2(Register in_out, Register in1, Registe
Label L_exit;
if (is_pclmulqdq_supported) {
- const_or_pre_comp_const_index[1] = *(uint32_t *)StubRoutines::_crc32c_table_addr;
- const_or_pre_comp_const_index[0] = *((uint32_t *)StubRoutines::_crc32c_table_addr + 1);
+ const_or_pre_comp_const_index[1] = *(uint32_t *)StubRoutines::crc32c_table_addr();
+ const_or_pre_comp_const_index[0] = *((uint32_t *)StubRoutines::crc32c_table_addr() + 1);
- const_or_pre_comp_const_index[3] = *((uint32_t *)StubRoutines::_crc32c_table_addr + 2);
- const_or_pre_comp_const_index[2] = *((uint32_t *)StubRoutines::_crc32c_table_addr + 3);
+ const_or_pre_comp_const_index[3] = *((uint32_t *)StubRoutines::crc32c_table_addr() + 2);
+ const_or_pre_comp_const_index[2] = *((uint32_t *)StubRoutines::crc32c_table_addr() + 3);
- const_or_pre_comp_const_index[5] = *((uint32_t *)StubRoutines::_crc32c_table_addr + 4);
- const_or_pre_comp_const_index[4] = *((uint32_t *)StubRoutines::_crc32c_table_addr + 5);
+ const_or_pre_comp_const_index[5] = *((uint32_t *)StubRoutines::crc32c_table_addr() + 4);
+ const_or_pre_comp_const_index[4] = *((uint32_t *)StubRoutines::crc32c_table_addr() + 5);
} else {
const_or_pre_comp_const_index[0] = 1;
const_or_pre_comp_const_index[1] = 0;
diff --git a/src/hotspot/cpu/x86/macroAssembler_x86.hpp b/src/hotspot/cpu/x86/macroAssembler_x86.hpp
index c6e5b2a115f03..b6f229661a8e9 100644
--- a/src/hotspot/cpu/x86/macroAssembler_x86.hpp
+++ b/src/hotspot/cpu/x86/macroAssembler_x86.hpp
@@ -1135,6 +1135,7 @@ class MacroAssembler: public Assembler {
void fmul_s(AddressLiteral src) { Assembler::fmul_s(as_Address(src)); }
#endif // !_LP64
+ void cmp32_mxcsr_std(Address mxcsr_save, Register tmp, Register rscratch = noreg);
void ldmxcsr(Address src) { Assembler::ldmxcsr(src); }
void ldmxcsr(AddressLiteral src, Register rscratch = noreg);
diff --git a/src/hotspot/cpu/x86/macroAssembler_x86_32_constants.cpp b/src/hotspot/cpu/x86/macroAssembler_x86_32_constants.cpp
index e177c7d94624b..6fdda4c2f7130 100644
--- a/src/hotspot/cpu/x86/macroAssembler_x86_32_constants.cpp
+++ b/src/hotspot/cpu/x86/macroAssembler_x86_32_constants.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "macroAssembler_x86.hpp"
ATTRIBUTE_ALIGNED(16) static const juint _ONES[] = {
diff --git a/src/hotspot/cpu/x86/macroAssembler_x86_32_cos.cpp b/src/hotspot/cpu/x86/macroAssembler_x86_32_cos.cpp
index ce71bb50d8232..dce16756a6651 100644
--- a/src/hotspot/cpu/x86/macroAssembler_x86_32_cos.cpp
+++ b/src/hotspot/cpu/x86/macroAssembler_x86_32_cos.cpp
@@ -24,7 +24,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/assembler.hpp"
#include "asm/assembler.inline.hpp"
#include "macroAssembler_x86.hpp"
diff --git a/src/hotspot/cpu/x86/macroAssembler_x86_32_exp.cpp b/src/hotspot/cpu/x86/macroAssembler_x86_32_exp.cpp
index a490510b959d3..2e6c1a617bb85 100644
--- a/src/hotspot/cpu/x86/macroAssembler_x86_32_exp.cpp
+++ b/src/hotspot/cpu/x86/macroAssembler_x86_32_exp.cpp
@@ -25,7 +25,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/assembler.hpp"
#include "asm/assembler.inline.hpp"
#include "macroAssembler_x86.hpp"
diff --git a/src/hotspot/cpu/x86/macroAssembler_x86_32_log.cpp b/src/hotspot/cpu/x86/macroAssembler_x86_32_log.cpp
index 515717e2179ca..abaabef674105 100644
--- a/src/hotspot/cpu/x86/macroAssembler_x86_32_log.cpp
+++ b/src/hotspot/cpu/x86/macroAssembler_x86_32_log.cpp
@@ -25,7 +25,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/assembler.hpp"
#include "asm/assembler.inline.hpp"
#include "macroAssembler_x86.hpp"
diff --git a/src/hotspot/cpu/x86/macroAssembler_x86_32_log10.cpp b/src/hotspot/cpu/x86/macroAssembler_x86_32_log10.cpp
index fa8c3b4623518..1fc5f49cf7503 100644
--- a/src/hotspot/cpu/x86/macroAssembler_x86_32_log10.cpp
+++ b/src/hotspot/cpu/x86/macroAssembler_x86_32_log10.cpp
@@ -24,7 +24,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/assembler.hpp"
#include "asm/assembler.inline.hpp"
#include "macroAssembler_x86.hpp"
diff --git a/src/hotspot/cpu/x86/macroAssembler_x86_32_pow.cpp b/src/hotspot/cpu/x86/macroAssembler_x86_32_pow.cpp
index 7afad2fcc73b2..2d8a8ef91ac4f 100644
--- a/src/hotspot/cpu/x86/macroAssembler_x86_32_pow.cpp
+++ b/src/hotspot/cpu/x86/macroAssembler_x86_32_pow.cpp
@@ -25,7 +25,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/assembler.hpp"
#include "asm/assembler.inline.hpp"
#include "macroAssembler_x86.hpp"
diff --git a/src/hotspot/cpu/x86/macroAssembler_x86_32_sin.cpp b/src/hotspot/cpu/x86/macroAssembler_x86_32_sin.cpp
index 492d596f84b46..cd593ba335648 100644
--- a/src/hotspot/cpu/x86/macroAssembler_x86_32_sin.cpp
+++ b/src/hotspot/cpu/x86/macroAssembler_x86_32_sin.cpp
@@ -24,7 +24,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/assembler.hpp"
#include "asm/assembler.inline.hpp"
#include "macroAssembler_x86.hpp"
diff --git a/src/hotspot/cpu/x86/macroAssembler_x86_32_tan.cpp b/src/hotspot/cpu/x86/macroAssembler_x86_32_tan.cpp
index f2bc1efb483f9..4e8be8a1f1dc7 100644
--- a/src/hotspot/cpu/x86/macroAssembler_x86_32_tan.cpp
+++ b/src/hotspot/cpu/x86/macroAssembler_x86_32_tan.cpp
@@ -24,7 +24,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/assembler.hpp"
#include "asm/assembler.inline.hpp"
#include "macroAssembler_x86.hpp"
diff --git a/src/hotspot/cpu/x86/macroAssembler_x86_md5.cpp b/src/hotspot/cpu/x86/macroAssembler_x86_md5.cpp
index 09d379a4296d4..9d48838ab6e1b 100644
--- a/src/hotspot/cpu/x86/macroAssembler_x86_md5.cpp
+++ b/src/hotspot/cpu/x86/macroAssembler_x86_md5.cpp
@@ -43,7 +43,6 @@
* Software.
*/
-#include "precompiled.hpp"
#include "asm/assembler.hpp"
#include "asm/assembler.inline.hpp"
#include "runtime/stubRoutines.hpp"
diff --git a/src/hotspot/cpu/x86/macroAssembler_x86_sha.cpp b/src/hotspot/cpu/x86/macroAssembler_x86_sha.cpp
index e7d728c2e9672..5fd6db868cc8b 100644
--- a/src/hotspot/cpu/x86/macroAssembler_x86_sha.cpp
+++ b/src/hotspot/cpu/x86/macroAssembler_x86_sha.cpp
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/assembler.hpp"
#include "asm/assembler.inline.hpp"
#include "runtime/stubRoutines.hpp"
diff --git a/src/hotspot/cpu/x86/methodHandles_x86.cpp b/src/hotspot/cpu/x86/methodHandles_x86.cpp
index fd738b7333e4f..0d95af133fa81 100644
--- a/src/hotspot/cpu/x86/methodHandles_x86.cpp
+++ b/src/hotspot/cpu/x86/methodHandles_x86.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.hpp"
#include "classfile/vmClasses.hpp"
#include "compiler/disassembler.hpp"
diff --git a/src/hotspot/cpu/x86/nativeInst_x86.cpp b/src/hotspot/cpu/x86/nativeInst_x86.cpp
index d5021c29ed6b0..4ee741077dc06 100644
--- a/src/hotspot/cpu/x86/nativeInst_x86.cpp
+++ b/src/hotspot/cpu/x86/nativeInst_x86.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.hpp"
#include "code/compiledIC.hpp"
#include "memory/resourceArea.hpp"
diff --git a/src/hotspot/cpu/x86/peephole_x86_64.cpp b/src/hotspot/cpu/x86/peephole_x86_64.cpp
index 92a29490edaf8..2197055d1ecc0 100644
--- a/src/hotspot/cpu/x86/peephole_x86_64.cpp
+++ b/src/hotspot/cpu/x86/peephole_x86_64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -21,7 +21,6 @@
* questions.
*
*/
-#include "precompiled.hpp"
#ifdef COMPILER2
diff --git a/src/hotspot/cpu/x86/rdtsc_x86.cpp b/src/hotspot/cpu/x86/rdtsc_x86.cpp
index 8a927dd15e4e4..aac336019508d 100644
--- a/src/hotspot/cpu/x86/rdtsc_x86.cpp
+++ b/src/hotspot/cpu/x86/rdtsc_x86.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "rdtsc_x86.hpp"
#include "runtime/globals_extension.hpp"
#include "runtime/javaThread.hpp"
diff --git a/src/hotspot/cpu/x86/registerMap_x86.cpp b/src/hotspot/cpu/x86/registerMap_x86.cpp
index 34713ec4d38c9..295a8c0eb896b 100644
--- a/src/hotspot/cpu/x86/registerMap_x86.cpp
+++ b/src/hotspot/cpu/x86/registerMap_x86.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "runtime/registerMap.hpp"
#include "vmreg_x86.inline.hpp"
diff --git a/src/hotspot/cpu/x86/register_x86.cpp b/src/hotspot/cpu/x86/register_x86.cpp
index dc5aba3c17801..e60834293445b 100644
--- a/src/hotspot/cpu/x86/register_x86.cpp
+++ b/src/hotspot/cpu/x86/register_x86.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "register_x86.hpp"
diff --git a/src/hotspot/cpu/x86/relocInfo_x86.cpp b/src/hotspot/cpu/x86/relocInfo_x86.cpp
index 2df98c4311b2c..a447c5aca9d92 100644
--- a/src/hotspot/cpu/x86/relocInfo_x86.cpp
+++ b/src/hotspot/cpu/x86/relocInfo_x86.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.hpp"
#include "code/relocInfo.hpp"
#include "memory/universe.hpp"
diff --git a/src/hotspot/cpu/x86/runtime_x86_32.cpp b/src/hotspot/cpu/x86/runtime_x86_32.cpp
index 9bd4239d665f3..bcba609387132 100644
--- a/src/hotspot/cpu/x86/runtime_x86_32.cpp
+++ b/src/hotspot/cpu/x86/runtime_x86_32.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#ifdef COMPILER2
#include "asm/macroAssembler.hpp"
#include "asm/macroAssembler.inline.hpp"
diff --git a/src/hotspot/cpu/x86/runtime_x86_64.cpp b/src/hotspot/cpu/x86/runtime_x86_64.cpp
index 45f863b697b6b..d7d8fc1895b38 100644
--- a/src/hotspot/cpu/x86/runtime_x86_64.cpp
+++ b/src/hotspot/cpu/x86/runtime_x86_64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#ifdef COMPILER2
#include "asm/macroAssembler.hpp"
#include "asm/macroAssembler.inline.hpp"
diff --git a/src/hotspot/cpu/x86/sharedRuntime_x86.cpp b/src/hotspot/cpu/x86/sharedRuntime_x86.cpp
index ebdd47f3a3f87..0a277a4eb69f6 100644
--- a/src/hotspot/cpu/x86/sharedRuntime_x86.cpp
+++ b/src/hotspot/cpu/x86/sharedRuntime_x86.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.hpp"
#include "runtime/interfaceSupport.inline.hpp"
#include "runtime/sharedRuntime.hpp"
diff --git a/src/hotspot/cpu/x86/sharedRuntime_x86_32.cpp b/src/hotspot/cpu/x86/sharedRuntime_x86_32.cpp
index a6a662b3d1e0c..8e5e54f244cf9 100644
--- a/src/hotspot/cpu/x86/sharedRuntime_x86_32.cpp
+++ b/src/hotspot/cpu/x86/sharedRuntime_x86_32.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "code/compiledIC.hpp"
diff --git a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp
index ab7cbb9437453..bbe62db33f00e 100644
--- a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp
+++ b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#ifndef _WINDOWS
#include "alloca.h"
#endif
@@ -1099,7 +1098,7 @@ AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm
{ // Bypass the barrier for non-static methods
Register flags = rscratch1;
- __ movl(flags, Address(method, Method::access_flags_offset()));
+ __ load_unsigned_short(flags, Address(method, Method::access_flags_offset()));
__ testl(flags, JVM_ACC_STATIC);
__ jcc(Assembler::zero, L_skip_barrier); // non-static
}
@@ -3020,7 +3019,7 @@ SafepointBlob* SharedRuntime::generate_handler_blob(SharedStubId id, address cal
// Allocate space for the code. Setup code generation tools.
const char* name = SharedRuntime::stub_name(id);
- CodeBuffer buffer(name, 2348, 1024);
+ CodeBuffer buffer(name, 2548, 1024);
MacroAssembler* masm = new MacroAssembler(&buffer);
address start = __ pc();
@@ -3086,11 +3085,11 @@ SafepointBlob* SharedRuntime::generate_handler_blob(SharedStubId id, address cal
Label bail;
#endif
if (!cause_return) {
- Label no_prefix, not_special;
+ Label no_prefix, not_special, check_rex_prefix;
// If our stashed return pc was modified by the runtime we avoid touching it
__ cmpptr(rbx, Address(rbp, wordSize));
- __ jccb(Assembler::notEqual, no_adjust);
+ __ jcc(Assembler::notEqual, no_adjust);
// Skip over the poll instruction.
// See NativeInstruction::is_safepoint_poll()
@@ -3113,9 +3112,29 @@ SafepointBlob* SharedRuntime::generate_handler_blob(SharedStubId id, address cal
// 41 85 04 24 test %eax,(%r12)
// 85 45 00 test %eax,0x0(%rbp)
// 41 85 45 00 test %eax,0x0(%r13)
-
+ //
+ // Notes:
+ // Format of legacy MAP0 test instruction:-
+ // [REX/REX2] [OPCODE] [ModRM] [SIB] [DISP] [IMM32]
+ // o For safepoint polling instruction "test %eax,(%rax)", encoding of first register
+ // operand and base register of memory operand is b/w [0-8), hence we do not require
+ // additional REX prefix where REX.B bit stores MSB bit of register encoding, which
+ // is why two bytes encoding is sufficient here.
+ // o For safepoint polling instruction like "test %eax,(%r8)", register encoding of BASE
+ // register of memory operand is 1000, thus we need additional REX prefix in this case,
+ // there by adding additional byte to instruction encoding.
+ // o In case BASE register is one of the 32 extended GPR registers available only on targets
+ // supporting Intel APX extension, then we need to emit two bytes REX2 prefix to hold
+ // most significant two bits of 5 bit register encoding.
+
+ if (VM_Version::supports_apx_f()) {
+ __ cmpb(Address(rbx, 0), Assembler::REX2);
+ __ jccb(Assembler::notEqual, check_rex_prefix);
+ __ addptr(rbx, 2);
+ __ bind(check_rex_prefix);
+ }
__ cmpb(Address(rbx, 0), NativeTstRegMem::instruction_rex_b_prefix);
- __ jcc(Assembler::notEqual, no_prefix);
+ __ jccb(Assembler::notEqual, no_prefix);
__ addptr(rbx, 1);
__ bind(no_prefix);
#ifdef ASSERT
@@ -3128,7 +3147,7 @@ SafepointBlob* SharedRuntime::generate_handler_blob(SharedStubId id, address cal
__ andptr(rcx, 0x07); // looking for 0x04 .. 0x05
__ subptr(rcx, 4); // looking for 0x00 .. 0x01
__ cmpptr(rcx, 1);
- __ jcc(Assembler::above, not_special);
+ __ jccb(Assembler::above, not_special);
__ addptr(rbx, 1);
__ bind(not_special);
#ifdef ASSERT
diff --git a/src/hotspot/cpu/x86/stubDeclarations_x86.hpp b/src/hotspot/cpu/x86/stubDeclarations_x86.hpp
new file mode 100644
index 0000000000000..9f6c1ec60ef19
--- /dev/null
+++ b/src/hotspot/cpu/x86/stubDeclarations_x86.hpp
@@ -0,0 +1,262 @@
+/*
+ * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2025, Red Hat, Inc. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef CPU_X86_STUBDECLARATIONS_HPP
+#define CPU_X86_STUBDECLARATIONS_HPP
+
+#define STUBGEN_INITIAL_BLOBS_ARCH_DO(do_stub, \
+ do_arch_blob, \
+ do_arch_entry, \
+ do_arch_entry_init) \
+ do_arch_blob(initial, 20000 WINDOWS_ONLY(+1000)) \
+ do_stub(initial, verify_mxcsr) \
+ do_arch_entry(x86, initial, verify_mxcsr, verify_mxcsr_entry, \
+ verify_mxcsr_entry) \
+ LP64_ONLY( \
+ do_stub(initial, get_previous_sp) \
+ do_arch_entry(x86, initial, get_previous_sp, \
+ get_previous_sp_entry, \
+ get_previous_sp_entry) \
+ do_stub(initial, f2i_fixup) \
+ do_arch_entry(x86, initial, f2i_fixup, f2i_fixup, f2i_fixup) \
+ do_stub(initial, f2l_fixup) \
+ do_arch_entry(x86, initial, f2l_fixup, f2l_fixup, f2l_fixup) \
+ do_stub(initial, d2i_fixup) \
+ do_arch_entry(x86, initial, d2i_fixup, d2i_fixup, d2i_fixup) \
+ do_stub(initial, d2l_fixup) \
+ do_arch_entry(x86, initial, d2l_fixup, d2l_fixup, d2l_fixup) \
+ do_stub(initial, float_sign_mask) \
+ do_arch_entry(x86, initial, float_sign_mask, float_sign_mask, \
+ float_sign_mask) \
+ do_stub(initial, float_sign_flip) \
+ do_arch_entry(x86, initial, float_sign_flip, float_sign_flip, \
+ float_sign_flip) \
+ do_stub(initial, double_sign_mask) \
+ do_arch_entry(x86, initial, double_sign_mask, double_sign_mask, \
+ double_sign_mask) \
+ do_stub(initial, double_sign_flip) \
+ do_arch_entry(x86, initial, double_sign_flip, double_sign_flip, \
+ double_sign_flip) \
+ ) \
+ NOT_LP64( \
+ do_stub(initial, verify_fpu_cntrl_word) \
+ do_arch_entry(x86, initial, verify_fpu_cntrl_word, \
+ verify_fpu_cntrl_wrd_entry, \
+ verify_fpu_cntrl_wrd_entry) \
+ do_stub(initial, d2i_wrapper) \
+ do_arch_entry(x86, initial, d2i_wrapper, d2i_wrapper, \
+ d2i_wrapper) \
+ do_stub(initial, d2l_wrapper) \
+ do_arch_entry(x86, initial, d2l_wrapper, d2l_wrapper, \
+ d2l_wrapper) \
+ ) \
+
+
+#define STUBGEN_CONTINUATION_BLOBS_ARCH_DO(do_stub, \
+ do_arch_blob, \
+ do_arch_entry, \
+ do_arch_entry_init) \
+ do_arch_blob(continuation, 1000 LP64_ONLY(+2000)) \
+
+
+#define STUBGEN_COMPILER_BLOBS_ARCH_DO(do_stub, \
+ do_arch_blob, \
+ do_arch_entry, \
+ do_arch_entry_init) \
+ do_arch_blob(compiler, 20000 LP64_ONLY(+64000) WINDOWS_ONLY(+2000)) \
+ do_stub(compiler, vector_float_sign_mask) \
+ do_arch_entry(x86, compiler, vector_float_sign_mask, \
+ vector_float_sign_mask, vector_float_sign_mask) \
+ do_stub(compiler, vector_float_sign_flip) \
+ do_arch_entry(x86, compiler, vector_float_sign_flip, \
+ vector_float_sign_flip, vector_float_sign_flip) \
+ do_stub(compiler, vector_double_sign_mask) \
+ do_arch_entry(x86, compiler, vector_double_sign_mask, \
+ vector_double_sign_mask, vector_double_sign_mask) \
+ do_stub(compiler, vector_double_sign_flip) \
+ do_arch_entry(x86, compiler, vector_double_sign_flip, \
+ vector_double_sign_flip, vector_double_sign_flip) \
+ do_stub(compiler, vector_all_bits_set) \
+ do_arch_entry(x86, compiler, vector_all_bits_set, \
+ vector_all_bits_set, vector_all_bits_set) \
+ do_stub(compiler, vector_int_mask_cmp_bits) \
+ do_arch_entry(x86, compiler, vector_int_mask_cmp_bits, \
+ vector_int_mask_cmp_bits, vector_int_mask_cmp_bits) \
+ do_stub(compiler, vector_short_to_byte_mask) \
+ do_arch_entry(x86, compiler, vector_short_to_byte_mask, \
+ vector_short_to_byte_mask, vector_short_to_byte_mask) \
+ do_stub(compiler, vector_byte_perm_mask) \
+ do_arch_entry(x86, compiler,vector_byte_perm_mask, \
+ vector_byte_perm_mask, vector_byte_perm_mask) \
+ do_stub(compiler, vector_int_to_byte_mask) \
+ do_arch_entry(x86, compiler, vector_int_to_byte_mask, \
+ vector_int_to_byte_mask, vector_int_to_byte_mask) \
+ do_stub(compiler, vector_int_to_short_mask) \
+ do_arch_entry(x86, compiler, vector_int_to_short_mask, \
+ vector_int_to_short_mask, vector_int_to_short_mask) \
+ do_stub(compiler, vector_32_bit_mask) \
+ do_arch_entry(x86, compiler, vector_32_bit_mask, \
+ vector_32_bit_mask, vector_32_bit_mask) \
+ do_stub(compiler, vector_64_bit_mask) \
+ do_arch_entry(x86, compiler, vector_64_bit_mask, \
+ vector_64_bit_mask, vector_64_bit_mask) \
+ do_stub(compiler, vector_byte_shuffle_mask) \
+ do_arch_entry(x86, compiler, vector_int_shuffle_mask, \
+ vector_byte_shuffle_mask, vector_byte_shuffle_mask) \
+ do_stub(compiler, vector_short_shuffle_mask) \
+ do_arch_entry(x86, compiler, vector_int_shuffle_mask, \
+ vector_short_shuffle_mask, vector_short_shuffle_mask) \
+ do_stub(compiler, vector_int_shuffle_mask) \
+ do_arch_entry(x86, compiler, vector_int_shuffle_mask, \
+ vector_int_shuffle_mask, vector_int_shuffle_mask) \
+ do_stub(compiler, vector_long_shuffle_mask) \
+ do_arch_entry(x86, compiler, vector_long_shuffle_mask, \
+ vector_long_shuffle_mask, vector_long_shuffle_mask) \
+ do_stub(compiler, vector_long_sign_mask) \
+ do_arch_entry(x86, compiler, vector_long_sign_mask, \
+ vector_long_sign_mask, vector_long_sign_mask) \
+ do_stub(compiler, vector_iota_indices) \
+ do_arch_entry(x86, compiler, vector_iota_indices, \
+ vector_iota_indices, vector_iota_indices) \
+ do_stub(compiler, vector_count_leading_zeros_lut) \
+ do_arch_entry(x86, compiler, vector_count_leading_zeros_lut, \
+ vector_count_leading_zeros_lut, \
+ vector_count_leading_zeros_lut) \
+ do_stub(compiler, vector_reverse_bit_lut) \
+ do_arch_entry(x86, compiler, vector_reverse_bit_lut, \
+ vector_reverse_bit_lut, vector_reverse_bit_lut) \
+ do_stub(compiler, vector_reverse_byte_perm_mask_short) \
+ do_arch_entry(x86, compiler, vector_reverse_byte_perm_mask_short, \
+ vector_reverse_byte_perm_mask_short, \
+ vector_reverse_byte_perm_mask_short) \
+ do_stub(compiler, vector_reverse_byte_perm_mask_int) \
+ do_arch_entry(x86, compiler, vector_reverse_byte_perm_mask_int, \
+ vector_reverse_byte_perm_mask_int, \
+ vector_reverse_byte_perm_mask_int) \
+ do_stub(compiler, vector_reverse_byte_perm_mask_long) \
+ do_arch_entry(x86, compiler, vector_reverse_byte_perm_mask_long, \
+ vector_reverse_byte_perm_mask_long, \
+ vector_reverse_byte_perm_mask_long) \
+ do_stub(compiler, vector_popcount_lut) \
+ do_arch_entry(x86, compiler, vector_popcount_lut, \
+ vector_popcount_lut, vector_popcount_lut) \
+ do_stub(compiler, upper_word_mask) \
+ do_arch_entry(x86, compiler, upper_word_mask, upper_word_mask_addr, \
+ upper_word_mask_addr) \
+ do_stub(compiler, shuffle_byte_flip_mask) \
+ do_arch_entry(x86, compiler, shuffle_byte_flip_mask, \
+ shuffle_byte_flip_mask_addr, \
+ shuffle_byte_flip_mask_addr) \
+ do_stub(compiler, pshuffle_byte_flip_mask) \
+ do_arch_entry(x86, compiler, pshuffle_byte_flip_mask, \
+ pshuffle_byte_flip_mask_addr, \
+ pshuffle_byte_flip_mask_addr) \
+ LP64_ONLY( \
+ /* x86_64 exposes these 3 stubs via a generic entry array */ \
+ /* oher arches use arch-specific entries */ \
+ /* this really needs rationalising */ \
+ do_stub(compiler, string_indexof_linear_ll) \
+ do_stub(compiler, string_indexof_linear_uu) \
+ do_stub(compiler, string_indexof_linear_ul) \
+ do_stub(compiler, pshuffle_byte_flip_mask_sha512) \
+ do_arch_entry(x86, compiler, pshuffle_byte_flip_mask_sha512, \
+ pshuffle_byte_flip_mask_addr_sha512, \
+ pshuffle_byte_flip_mask_addr_sha512) \
+ do_stub(compiler, compress_perm_table32) \
+ do_arch_entry(x86, compiler, compress_perm_table32, \
+ compress_perm_table32, compress_perm_table32) \
+ do_stub(compiler, compress_perm_table64) \
+ do_arch_entry(x86, compiler, compress_perm_table64, \
+ compress_perm_table64, compress_perm_table64) \
+ do_stub(compiler, expand_perm_table32) \
+ do_arch_entry(x86, compiler, expand_perm_table32, \
+ expand_perm_table32, expand_perm_table32) \
+ do_stub(compiler, expand_perm_table64) \
+ do_arch_entry(x86, compiler, expand_perm_table64, \
+ expand_perm_table64, expand_perm_table64) \
+ do_stub(compiler, avx2_shuffle_base64) \
+ do_arch_entry(x86, compiler, avx2_shuffle_base64, \
+ avx2_shuffle_base64, base64_avx2_shuffle_addr) \
+ do_stub(compiler, avx2_input_mask_base64) \
+ do_arch_entry(x86, compiler, avx2_input_mask_base64, \
+ avx2_input_mask_base64, \
+ base64_avx2_input_mask_addr) \
+ do_stub(compiler, avx2_lut_base64) \
+ do_arch_entry(x86, compiler, avx2_lut_base64, \
+ avx2_lut_base64, base64_avx2_lut_addr) \
+ do_stub(compiler, avx2_decode_tables_base64) \
+ do_arch_entry(x86, compiler, avx2_decode_tables_base64, \
+ avx2_decode_tables_base64, \
+ base64_AVX2_decode_tables_addr) \
+ do_stub(compiler, avx2_decode_lut_tables_base64) \
+ do_arch_entry(x86, compiler, avx2_decode_lut_tables_base64, \
+ avx2_decode_lut_tables_base64, \
+ base64_AVX2_decode_LUT_tables_addr) \
+ do_stub(compiler, shuffle_base64) \
+ do_arch_entry(x86, compiler, shuffle_base64, shuffle_base64, \
+ base64_shuffle_addr) \
+ do_stub(compiler, lookup_lo_base64) \
+ do_arch_entry(x86, compiler, lookup_lo_base64, lookup_lo_base64, \
+ base64_vbmi_lookup_lo_addr) \
+ do_stub(compiler, lookup_hi_base64) \
+ do_arch_entry(x86, compiler, lookup_hi_base64, lookup_hi_base64, \
+ base64_vbmi_lookup_hi_addr) \
+ do_stub(compiler, lookup_lo_base64url) \
+ do_arch_entry(x86, compiler, lookup_lo_base64url, \
+ lookup_lo_base64url, \
+ base64_vbmi_lookup_lo_url_addr) \
+ do_stub(compiler, lookup_hi_base64url) \
+ do_arch_entry(x86, compiler, lookup_hi_base64url, \
+ lookup_hi_base64url, \
+ base64_vbmi_lookup_hi_url_addr) \
+ do_stub(compiler, pack_vec_base64) \
+ do_arch_entry(x86, compiler, pack_vec_base64, pack_vec_base64, \
+ base64_vbmi_pack_vec_addr) \
+ do_stub(compiler, join_0_1_base64) \
+ do_arch_entry(x86, compiler, join_0_1_base64, join_0_1_base64, \
+ base64_vbmi_join_0_1_addr) \
+ do_stub(compiler, join_1_2_base64) \
+ do_arch_entry(x86, compiler, join_1_2_base64, join_1_2_base64, \
+ base64_vbmi_join_1_2_addr) \
+ do_stub(compiler, join_2_3_base64) \
+ do_arch_entry(x86, compiler, join_2_3_base64, join_2_3_base64, \
+ base64_vbmi_join_2_3_addr) \
+ do_stub(compiler, encoding_table_base64) \
+ do_arch_entry(x86, compiler, encoding_table_base64, \
+ encoding_table_base64, base64_encoding_table_addr) \
+ do_stub(compiler, decoding_table_base64) \
+ do_arch_entry(x86, compiler, decoding_table_base64, \
+ decoding_table_base64, base64_decoding_table_addr) \
+ ) \
+
+
+#define STUBGEN_FINAL_BLOBS_ARCH_DO(do_stub, \
+ do_arch_blob, \
+ do_arch_entry, \
+ do_arch_entry_init) \
+ do_arch_blob(final, 11000 LP64_ONLY(+20000) \
+ WINDOWS_ONLY(+22000) ZGC_ONLY(+20000)) \
+
+#endif // CPU_X86_STUBDECLARATIONS_HPP
diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp
index de13772dcfb0d..27dc804a73d28 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"
@@ -62,7 +61,6 @@
#define BIND(label) bind(label); BLOCK_COMMENT(#label ":")
-const int MXCSR_MASK = 0xFFC0; // Mask out any pending exceptions
const int FPU_CNTRL_WRD_MASK = 0xFFFF;
ATTRIBUTE_ALIGNED(16) static const uint32_t KEY_SHUFFLE_MASK[] = {
@@ -138,7 +136,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_call_stub(address& return_address) {
- StubCodeMark mark(this, "StubRoutines", "call_stub");
+ StubGenStubId stub_id = StubGenStubId::call_stub_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
// stub code parameters / addresses
@@ -175,11 +174,7 @@ class StubGenerator: public StubCodeGenerator {
// save and initialize %mxcsr
if (sse_save) {
Label skip_ldmx;
- __ stmxcsr(mxcsr_save);
- __ movl(rax, mxcsr_save);
- __ andl(rax, MXCSR_MASK); // Only check control and mask bits
- ExternalAddress mxcsr_std(StubRoutines::x86::addr_mxcsr_std());
- __ cmp32(rax, mxcsr_std);
+ __ cmp32_mxcsr_std(mxcsr_save, rax);
__ jcc(Assembler::equal, skip_ldmx);
__ ldmxcsr(mxcsr_std);
__ bind(skip_ldmx);
@@ -340,7 +335,8 @@ class StubGenerator: public StubCodeGenerator {
// rax,: exception oop
address generate_catch_exception() {
- StubCodeMark mark(this, "StubRoutines", "catch_exception");
+ StubGenStubId stub_id = StubGenStubId::catch_exception_id;
+ StubCodeMark mark(this, stub_id);
const Address rsp_after_call(rbp, -4 * wordSize); // same as in generate_call_stub()!
const Address thread (rbp, 9 * wordSize); // same as in generate_call_stub()!
address start = __ pc();
@@ -383,7 +379,8 @@ class StubGenerator: public StubCodeGenerator {
// NOTE: At entry of this stub, exception-pc must be on stack !!
address generate_forward_exception() {
- StubCodeMark mark(this, "StubRoutines", "forward exception");
+ StubGenStubId stub_id = StubGenStubId::forward_exception_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
const Register thread = rcx;
@@ -455,24 +452,22 @@ class StubGenerator: public StubCodeGenerator {
address generate_verify_mxcsr() {
- StubCodeMark mark(this, "StubRoutines", "verify_mxcsr");
+ StubGenStubId stub_id = StubGenStubId::verify_mxcsr_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
const Address mxcsr_save(rsp, 0);
if (CheckJNICalls && UseSSE > 0 ) {
Label ok_ret;
- ExternalAddress mxcsr_std(StubRoutines::x86::addr_mxcsr_std());
__ push(rax);
__ subptr(rsp, wordSize); // allocate a temp location
- __ stmxcsr(mxcsr_save);
- __ movl(rax, mxcsr_save);
- __ andl(rax, MXCSR_MASK);
- __ cmp32(rax, mxcsr_std);
+ __ cmp32_mxcsr_std(mxcsr_save, rax);
__ jcc(Assembler::equal, ok_ret);
__ warn("MXCSR changed by native JNI code.");
+ ExternalAddress mxcsr_std(StubRoutines::x86::addr_mxcsr_std());
__ ldmxcsr(mxcsr_std);
__ bind(ok_ret);
@@ -494,7 +489,8 @@ class StubGenerator: public StubCodeGenerator {
// FP control word to our expected state.
address generate_verify_fpu_cntrl_wrd() {
- StubCodeMark mark(this, "StubRoutines", "verify_spcw");
+ StubGenStubId stub_id = StubGenStubId::verify_fpu_cntrl_word_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
const Address fpu_cntrl_wrd_save(rsp, 0);
@@ -532,7 +528,8 @@ class StubGenerator: public StubCodeGenerator {
// Output: rax, (rdx): integer (long) result
address generate_d2i_wrapper(BasicType t, address fcn) {
- StubCodeMark mark(this, "StubRoutines", "d2i_wrapper");
+ StubGenStubId stub_id = StubGenStubId::d2i_wrapper_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
// Capture info about frame layout
@@ -592,9 +589,9 @@ class StubGenerator: public StubCodeGenerator {
}
//---------------------------------------------------------------------------------------------------
- address generate_vector_mask(const char *stub_name, int32_t mask) {
+ address generate_vector_mask(StubGenStubId stub_id, int32_t mask) {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", stub_name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
for (int i = 0; i < 16; i++) {
@@ -604,9 +601,10 @@ class StubGenerator: public StubCodeGenerator {
return start;
}
- address generate_count_leading_zeros_lut(const char *stub_name) {
+ address generate_count_leading_zeros_lut() {
__ align64();
- StubCodeMark mark(this, "StubRoutines", stub_name);
+ StubGenStubId stub_id = StubGenStubId::vector_count_leading_zeros_lut_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ emit_data(0x02020304, relocInfo::none, 0);
__ emit_data(0x01010101, relocInfo::none, 0);
@@ -628,9 +626,10 @@ class StubGenerator: public StubCodeGenerator {
}
- address generate_popcount_avx_lut(const char *stub_name) {
+ address generate_popcount_avx_lut() {
__ align64();
- StubCodeMark mark(this, "StubRoutines", stub_name);
+ StubGenStubId stub_id = StubGenStubId::vector_popcount_lut_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ emit_data(0x02010100, relocInfo::none, 0);
__ emit_data(0x03020201, relocInfo::none, 0);
@@ -652,9 +651,10 @@ class StubGenerator: public StubCodeGenerator {
}
- address generate_iota_indices(const char *stub_name) {
+ address generate_iota_indices() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", stub_name);
+ StubGenStubId stub_id = StubGenStubId::vector_iota_indices_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
// B
__ emit_data(0x03020100, relocInfo::none, 0);
@@ -766,9 +766,10 @@ class StubGenerator: public StubCodeGenerator {
return start;
}
- address generate_vector_reverse_bit_lut(const char *stub_name) {
+ address generate_vector_reverse_bit_lut() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", stub_name);
+ StubGenStubId stub_id = StubGenStubId::vector_reverse_bit_lut_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ emit_data(0x0C040800, relocInfo::none, 0);
__ emit_data(0x0E060A02, relocInfo::none, 0);
@@ -789,9 +790,10 @@ class StubGenerator: public StubCodeGenerator {
return start;
}
- address generate_vector_reverse_byte_perm_mask_long(const char *stub_name) {
+ address generate_vector_reverse_byte_perm_mask_long() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", stub_name);
+ StubGenStubId stub_id = StubGenStubId::vector_reverse_byte_perm_mask_long_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ emit_data(0x04050607, relocInfo::none, 0);
__ emit_data(0x00010203, relocInfo::none, 0);
@@ -812,9 +814,10 @@ class StubGenerator: public StubCodeGenerator {
return start;
}
- address generate_vector_reverse_byte_perm_mask_int(const char *stub_name) {
+ address generate_vector_reverse_byte_perm_mask_int() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", stub_name);
+ StubGenStubId stub_id = StubGenStubId::vector_reverse_byte_perm_mask_int_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ emit_data(0x00010203, relocInfo::none, 0);
__ emit_data(0x04050607, relocInfo::none, 0);
@@ -835,9 +838,10 @@ class StubGenerator: public StubCodeGenerator {
return start;
}
- address generate_vector_reverse_byte_perm_mask_short(const char *stub_name) {
+ address generate_vector_reverse_byte_perm_mask_short() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", stub_name);
+ StubGenStubId stub_id = StubGenStubId::vector_reverse_byte_perm_mask_short_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ emit_data(0x02030001, relocInfo::none, 0);
__ emit_data(0x06070405, relocInfo::none, 0);
@@ -858,9 +862,10 @@ class StubGenerator: public StubCodeGenerator {
return start;
}
- address generate_vector_byte_shuffle_mask(const char *stub_name) {
+ address generate_vector_byte_shuffle_mask() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", stub_name);
+ StubGenStubId stub_id = StubGenStubId::vector_byte_shuffle_mask_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ emit_data(0x70707070, relocInfo::none, 0);
__ emit_data(0x70707070, relocInfo::none, 0);
@@ -873,9 +878,9 @@ class StubGenerator: public StubCodeGenerator {
return start;
}
- address generate_vector_mask_long_double(const char *stub_name, int32_t maskhi, int32_t masklo) {
+ address generate_vector_mask_long_double(StubGenStubId stub_id, int32_t maskhi, int32_t masklo) {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", stub_name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
for (int i = 0; i < 8; i++) {
@@ -888,9 +893,10 @@ class StubGenerator: public StubCodeGenerator {
//----------------------------------------------------------------------------------------------------
- address generate_vector_byte_perm_mask(const char *stub_name) {
+ address generate_vector_byte_perm_mask() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", stub_name);
+ StubGenStubId stub_id = StubGenStubId::vector_byte_perm_mask_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ emit_data(0x00000001, relocInfo::none, 0);
@@ -913,13 +919,13 @@ class StubGenerator: public StubCodeGenerator {
return start;
}
- address generate_vector_custom_i32(const char *stub_name, Assembler::AvxVectorLen len,
+ address generate_vector_custom_i32(StubGenStubId stub_id, Assembler::AvxVectorLen len,
int32_t val0, int32_t val1, int32_t val2, int32_t val3,
int32_t val4 = 0, int32_t val5 = 0, int32_t val6 = 0, int32_t val7 = 0,
int32_t val8 = 0, int32_t val9 = 0, int32_t val10 = 0, int32_t val11 = 0,
int32_t val12 = 0, int32_t val13 = 0, int32_t val14 = 0, int32_t val15 = 0) {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", stub_name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
assert(len != Assembler::AVX_NoVec, "vector len must be specified");
@@ -951,7 +957,8 @@ class StubGenerator: public StubCodeGenerator {
// Non-destructive plausibility checks for oops
address generate_verify_oop() {
- StubCodeMark mark(this, "StubRoutines", "verify_oop");
+ StubGenStubId stub_id = StubGenStubId::verify_oop_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
// Incoming arguments on stack after saving rax,:
@@ -1083,12 +1090,82 @@ class StubGenerator: public StubCodeGenerator {
__ BIND(L_exit);
}
- address generate_disjoint_copy(BasicType t, bool aligned,
- Address::ScaleFactor sf,
- address* entry, const char *name,
- bool dest_uninitialized = false) {
+ address generate_disjoint_copy(StubGenStubId stub_id, address* entry) {
+ BasicType t;
+ bool aligned;
+ Address::ScaleFactor sf;
+ bool dest_uninitialized;
+
+ switch (stub_id) {
+ case jbyte_disjoint_arraycopy_id:
+ t = T_BYTE;
+ aligned = false;
+ sf = Address::times_1;
+ dest_uninitialized = false;
+ break;
+ case arrayof_jbyte_disjoint_arraycopy_id:
+ t = T_BYTE;
+ aligned = true;
+ sf = Address::times_1;
+ dest_uninitialized = false;
+ break;
+ case jshort_disjoint_arraycopy_id:
+ t = T_SHORT;
+ aligned = false;
+ sf = Address::times_2;
+ dest_uninitialized = false;
+ break;
+ case arrayof_jshort_disjoint_arraycopy_id:
+ t = T_SHORT;
+ aligned = true;
+ sf = Address::times_2;
+ dest_uninitialized = false;
+ break;
+ case jint_disjoint_arraycopy_id:
+ t = T_INT;
+ aligned = true;
+ sf = Address::times_4;
+ dest_uninitialized = false;
+ break;
+ case arrayof_jint_disjoint_arraycopy_id:
+ // since this is always aligned we can (should!) use the same
+ // stub as for case jint_disjoint_arraycopy
+ ShouldNotReachHere();
+ break;
+ case jlong_disjoint_arraycopy_id:
+ case arrayof_jlong_disjoint_arraycopy_id:
+ // Handled by a special generator routine on 32 bit
+ ShouldNotReachHere();
+ break;
+ case oop_disjoint_arraycopy_id:
+ t = T_OBJECT;
+ aligned = true;
+ sf = Address::times_ptr;
+ dest_uninitialized = false;
+ break;
+ case arrayof_oop_disjoint_arraycopy_id:
+ // since this is always aligned we can (should!) use the same
+ // stub as for case oop_disjoint_arraycopy
+ ShouldNotReachHere();
+ break;
+ case oop_disjoint_arraycopy_uninit_id:
+ t = T_OBJECT;
+ aligned = true;
+ sf = Address::times_ptr;
+ dest_uninitialized = true;
+ break;
+ case arrayof_oop_disjoint_arraycopy_uninit_id:
+ // since this is always aligned we can (should!) use the same
+ // stub as for case oop_disjoint_arraycopy_uninit
+ ShouldNotReachHere();
+ break;
+ default:
+ ShouldNotReachHere();
+ break;
+ }
+
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Label L_0_count, L_exit, L_skip_align1, L_skip_align2, L_copy_byte;
@@ -1231,9 +1308,41 @@ class StubGenerator: public StubCodeGenerator {
}
- address generate_fill(BasicType t, bool aligned, const char *name) {
+ address generate_fill(StubGenStubId stub_id) {
+ BasicType t;
+ bool aligned;
+ switch(stub_id) {
+ case jbyte_fill_id:
+ t = T_BYTE;
+ aligned = false;
+ break;
+ case jshort_fill_id:
+ t = T_SHORT;
+ aligned = false;
+ break;
+ case jint_fill_id:
+ t = T_INT;
+ aligned = false;
+ break;
+ case arrayof_jbyte_fill_id:
+ t = T_BYTE;
+ aligned = true;
+ break;
+ case arrayof_jshort_fill_id:
+ t = T_SHORT;
+ aligned = true;
+ break;
+ case arrayof_jint_fill_id:
+ t = T_INT;
+ aligned = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ break;
+ }
+
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
BLOCK_COMMENT("Entry:");
@@ -1258,13 +1367,84 @@ class StubGenerator: public StubCodeGenerator {
return start;
}
- address generate_conjoint_copy(BasicType t, bool aligned,
- Address::ScaleFactor sf,
+ address generate_conjoint_copy(StubGenStubId stub_id,
address nooverlap_target,
- address* entry, const char *name,
- bool dest_uninitialized = false) {
+ address* entry) {
+ BasicType t;
+ bool aligned;
+ Address::ScaleFactor sf;
+ bool dest_uninitialized;
+
+ switch (stub_id) {
+ case jbyte_arraycopy_id:
+ t = T_BYTE;
+ aligned = false;
+ sf = Address::times_1;
+ dest_uninitialized = false;
+ break;
+ case arrayof_jbyte_arraycopy_id:
+ t = T_BYTE;
+ aligned = true;
+ sf = Address::times_1;
+ dest_uninitialized = false;
+ break;
+ case jshort_arraycopy_id:
+ t = T_SHORT;
+ aligned = false;
+ sf = Address::times_2;
+ dest_uninitialized = false;
+ break;
+ case arrayof_jshort_arraycopy_id:
+ t = T_SHORT;
+ aligned = true;
+ sf = Address::times_2;
+ dest_uninitialized = false;
+ break;
+ case jint_arraycopy_id:
+ t = T_INT;
+ aligned = true;
+ sf = Address::times_4;
+ dest_uninitialized = false;
+ break;
+ case arrayof_jint_arraycopy_id:
+ // since this is always aligned we can (should!) use the same
+ // stub as for case jint_arraycopy
+ ShouldNotReachHere();
+ break;
+ case jlong_arraycopy_id:
+ case arrayof_jlong_arraycopy_id:
+ // Handled by a special generator routine on 32 bit
+ ShouldNotReachHere();
+ break;
+ case oop_arraycopy_id:
+ t = T_OBJECT;
+ aligned = true;
+ sf = Address::times_ptr;
+ dest_uninitialized = false;
+ break;
+ case arrayof_oop_arraycopy_id:
+ // since this is always aligned we can (should!) use the same
+ // stub as for case oop_arraycopy
+ ShouldNotReachHere();
+ break;
+ case oop_arraycopy_uninit_id:
+ t = T_OBJECT;
+ aligned = true;
+ sf = Address::times_ptr;
+ dest_uninitialized = true;
+ break;
+ case arrayof_oop_arraycopy_uninit_id:
+ // since this is always aligned we can (should!) use the same
+ // stub as for case oop_arraycopy_uninit
+ ShouldNotReachHere();
+ break;
+ default:
+ ShouldNotReachHere();
+ break;
+ }
+
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Label L_0_count, L_exit, L_skip_align1, L_skip_align2, L_copy_byte;
@@ -1430,9 +1610,10 @@ class StubGenerator: public StubCodeGenerator {
}
- address generate_disjoint_long_copy(address* entry, const char *name) {
+ address generate_disjoint_long_copy(address* entry) {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubGenStubId stub_id = StubGenStubId::jlong_disjoint_arraycopy_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Label L_copy_8_bytes, L_copy_8_bytes_loop;
@@ -1475,10 +1656,10 @@ class StubGenerator: public StubCodeGenerator {
return start;
}
- address generate_conjoint_long_copy(address nooverlap_target,
- address* entry, const char *name) {
+ address generate_conjoint_long_copy(address nooverlap_target, address* entry) {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubGenStubId stub_id = StubGenStubId::jlong_arraycopy_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Label L_copy_8_bytes, L_copy_8_bytes_loop;
@@ -1599,9 +1780,21 @@ class StubGenerator: public StubCodeGenerator {
// rax, == 0 - success
// rax, == -1^K - failure, where K is partial transfer count
//
- address generate_checkcast_copy(const char *name, address* entry, bool dest_uninitialized = false) {
+ address generate_checkcast_copy(StubGenStubId stub_id, address* entry) {
+ bool dest_uninitialized;
+ switch(stub_id) {
+ case checkcast_arraycopy_id:
+ dest_uninitialized = false;
+ break;
+ case checkcast_arraycopy_uninit_id:
+ dest_uninitialized = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Label L_load_element, L_store_element, L_do_card_marks, L_done;
@@ -1756,8 +1949,7 @@ class StubGenerator: public StubCodeGenerator {
// Examines the alignment of the operands and dispatches
// to a long, int, short, or byte copy loop.
//
- address generate_unsafe_copy(const char *name,
- address byte_copy_entry,
+ address generate_unsafe_copy(address byte_copy_entry,
address short_copy_entry,
address int_copy_entry,
address long_copy_entry) {
@@ -1765,7 +1957,8 @@ class StubGenerator: public StubCodeGenerator {
Label L_long_aligned, L_int_aligned, L_short_aligned;
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubGenStubId stub_id = StubGenStubId::unsafe_arraycopy_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
const Register from = rax; // source array address
@@ -1862,8 +2055,7 @@ class StubGenerator: public StubCodeGenerator {
// rax, == 0 - success
// rax, == -1^K - failure, where K is partial transfer count
//
- address generate_generic_copy(const char *name,
- address entry_jbyte_arraycopy,
+ address generate_generic_copy(address entry_jbyte_arraycopy,
address entry_jshort_arraycopy,
address entry_jint_arraycopy,
address entry_oop_arraycopy,
@@ -1877,7 +2069,8 @@ class StubGenerator: public StubCodeGenerator {
if (advance < 0) advance += modulus;
if (advance > 0) __ nop(advance);
}
- StubCodeMark mark(this, "StubRoutines", name);
+ StubGenStubId stub_id = StubGenStubId::generic_arraycopy_id;
+ StubCodeMark mark(this, stub_id);
// Short-hop target to L_failed. Makes for denser prologue code.
__ BIND(L_failed_0);
@@ -2190,67 +2383,50 @@ class StubGenerator: public StubCodeGenerator {
address entry_checkcast_arraycopy;
StubRoutines::_arrayof_jbyte_disjoint_arraycopy =
- generate_disjoint_copy(T_BYTE, true, Address::times_1, &entry,
- "arrayof_jbyte_disjoint_arraycopy");
+ generate_disjoint_copy(StubGenStubId::arrayof_jbyte_disjoint_arraycopy_id, &entry);
StubRoutines::_arrayof_jbyte_arraycopy =
- generate_conjoint_copy(T_BYTE, true, Address::times_1, entry,
- nullptr, "arrayof_jbyte_arraycopy");
+ generate_conjoint_copy(StubGenStubId::arrayof_jbyte_arraycopy_id, entry, nullptr);
StubRoutines::_jbyte_disjoint_arraycopy =
- generate_disjoint_copy(T_BYTE, false, Address::times_1, &entry,
- "jbyte_disjoint_arraycopy");
+ generate_disjoint_copy(StubGenStubId::jbyte_disjoint_arraycopy_id, &entry);
StubRoutines::_jbyte_arraycopy =
- generate_conjoint_copy(T_BYTE, false, Address::times_1, entry,
- &entry_jbyte_arraycopy, "jbyte_arraycopy");
+ generate_conjoint_copy(StubGenStubId::jbyte_arraycopy_id, entry, &entry_jbyte_arraycopy);
StubRoutines::_arrayof_jshort_disjoint_arraycopy =
- generate_disjoint_copy(T_SHORT, true, Address::times_2, &entry,
- "arrayof_jshort_disjoint_arraycopy");
+ generate_disjoint_copy(StubGenStubId::arrayof_jshort_disjoint_arraycopy_id, &entry);
StubRoutines::_arrayof_jshort_arraycopy =
- generate_conjoint_copy(T_SHORT, true, Address::times_2, entry,
- nullptr, "arrayof_jshort_arraycopy");
+ generate_conjoint_copy(StubGenStubId::arrayof_jshort_arraycopy_id, entry, nullptr);
StubRoutines::_jshort_disjoint_arraycopy =
- generate_disjoint_copy(T_SHORT, false, Address::times_2, &entry,
- "jshort_disjoint_arraycopy");
+ generate_disjoint_copy(StubGenStubId::jshort_disjoint_arraycopy_id, &entry);
StubRoutines::_jshort_arraycopy =
- generate_conjoint_copy(T_SHORT, false, Address::times_2, entry,
- &entry_jshort_arraycopy, "jshort_arraycopy");
+ generate_conjoint_copy(StubGenStubId::jshort_arraycopy_id, entry, &entry_jshort_arraycopy);
// Next arrays are always aligned on 4 bytes at least.
StubRoutines::_jint_disjoint_arraycopy =
- generate_disjoint_copy(T_INT, true, Address::times_4, &entry,
- "jint_disjoint_arraycopy");
+ generate_disjoint_copy(StubGenStubId::jint_disjoint_arraycopy_id, &entry);
StubRoutines::_jint_arraycopy =
- generate_conjoint_copy(T_INT, true, Address::times_4, entry,
- &entry_jint_arraycopy, "jint_arraycopy");
+ generate_conjoint_copy(StubGenStubId::jint_arraycopy_id, entry, &entry_jint_arraycopy);
StubRoutines::_oop_disjoint_arraycopy =
- generate_disjoint_copy(T_OBJECT, true, Address::times_ptr, &entry,
- "oop_disjoint_arraycopy");
+ generate_disjoint_copy(StubGenStubId::oop_disjoint_arraycopy_id, &entry);
StubRoutines::_oop_arraycopy =
- generate_conjoint_copy(T_OBJECT, true, Address::times_ptr, entry,
- &entry_oop_arraycopy, "oop_arraycopy");
+ generate_conjoint_copy(StubGenStubId::oop_arraycopy_id, entry, &entry_oop_arraycopy);
StubRoutines::_oop_disjoint_arraycopy_uninit =
- generate_disjoint_copy(T_OBJECT, true, Address::times_ptr, &entry,
- "oop_disjoint_arraycopy_uninit",
- /*dest_uninitialized*/true);
+ generate_disjoint_copy(StubGenStubId::oop_disjoint_arraycopy_uninit_id, &entry);
StubRoutines::_oop_arraycopy_uninit =
- generate_conjoint_copy(T_OBJECT, true, Address::times_ptr, entry,
- nullptr, "oop_arraycopy_uninit",
- /*dest_uninitialized*/true);
+ generate_conjoint_copy(StubGenStubId::oop_arraycopy_uninit_id, entry, nullptr);
StubRoutines::_jlong_disjoint_arraycopy =
- generate_disjoint_long_copy(&entry, "jlong_disjoint_arraycopy");
+ generate_disjoint_long_copy(&entry);
StubRoutines::_jlong_arraycopy =
- generate_conjoint_long_copy(entry, &entry_jlong_arraycopy,
- "jlong_arraycopy");
+ generate_conjoint_long_copy(entry, &entry_jlong_arraycopy);
- StubRoutines::_jbyte_fill = generate_fill(T_BYTE, false, "jbyte_fill");
- StubRoutines::_jshort_fill = generate_fill(T_SHORT, false, "jshort_fill");
- StubRoutines::_jint_fill = generate_fill(T_INT, false, "jint_fill");
- StubRoutines::_arrayof_jbyte_fill = generate_fill(T_BYTE, true, "arrayof_jbyte_fill");
- StubRoutines::_arrayof_jshort_fill = generate_fill(T_SHORT, true, "arrayof_jshort_fill");
- StubRoutines::_arrayof_jint_fill = generate_fill(T_INT, true, "arrayof_jint_fill");
+ StubRoutines::_jbyte_fill = generate_fill(StubGenStubId::jbyte_fill_id);
+ StubRoutines::_jshort_fill = generate_fill(StubGenStubId::jshort_fill_id);
+ StubRoutines::_jint_fill = generate_fill(StubGenStubId::jint_fill_id);
+ StubRoutines::_arrayof_jbyte_fill = generate_fill(StubGenStubId::arrayof_jbyte_fill_id);
+ StubRoutines::_arrayof_jshort_fill = generate_fill(StubGenStubId::arrayof_jshort_fill_id);
+ StubRoutines::_arrayof_jint_fill = generate_fill(StubGenStubId::arrayof_jint_fill_id);
StubRoutines::_arrayof_jint_disjoint_arraycopy = StubRoutines::_jint_disjoint_arraycopy;
StubRoutines::_arrayof_oop_disjoint_arraycopy = StubRoutines::_oop_disjoint_arraycopy;
@@ -2263,20 +2439,18 @@ class StubGenerator: public StubCodeGenerator {
StubRoutines::_arrayof_jlong_arraycopy = StubRoutines::_jlong_arraycopy;
StubRoutines::_checkcast_arraycopy =
- generate_checkcast_copy("checkcast_arraycopy", &entry_checkcast_arraycopy);
+ generate_checkcast_copy(StubGenStubId::checkcast_arraycopy_id, &entry_checkcast_arraycopy);
StubRoutines::_checkcast_arraycopy_uninit =
- generate_checkcast_copy("checkcast_arraycopy_uninit", nullptr, /*dest_uninitialized*/true);
+ generate_checkcast_copy(StubGenStubId::checkcast_arraycopy_uninit_id, nullptr);
StubRoutines::_unsafe_arraycopy =
- generate_unsafe_copy("unsafe_arraycopy",
- entry_jbyte_arraycopy,
- entry_jshort_arraycopy,
- entry_jint_arraycopy,
- entry_jlong_arraycopy);
+ generate_unsafe_copy(entry_jbyte_arraycopy,
+ entry_jshort_arraycopy,
+ entry_jint_arraycopy,
+ entry_jlong_arraycopy);
StubRoutines::_generic_arraycopy =
- generate_generic_copy("generic_arraycopy",
- entry_jbyte_arraycopy,
+ generate_generic_copy( entry_jbyte_arraycopy,
entry_jshort_arraycopy,
entry_jint_arraycopy,
entry_oop_arraycopy,
@@ -2356,7 +2530,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_aescrypt_encryptBlock() {
assert(UseAES, "need AES instructions and misaligned SSE support");
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "aescrypt_encryptBlock");
+ StubGenStubId stub_id = StubGenStubId::aescrypt_encryptBlock_id;
+ StubCodeMark mark(this, stub_id);
Label L_doLast;
address start = __ pc();
@@ -2455,7 +2630,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_aescrypt_decryptBlock() {
assert(UseAES, "need AES instructions and misaligned SSE support");
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "aescrypt_decryptBlock");
+ StubGenStubId stub_id = StubGenStubId::aescrypt_decryptBlock_id;
+ StubCodeMark mark(this, stub_id);
Label L_doLast;
address start = __ pc();
@@ -2579,7 +2755,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_cipherBlockChaining_encryptAESCrypt() {
assert(UseAES, "need AES instructions and misaligned SSE support");
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "cipherBlockChaining_encryptAESCrypt");
+ StubGenStubId stub_id = StubGenStubId::cipherBlockChaining_encryptAESCrypt_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Label L_exit, L_key_192_256, L_key_256, L_loopTop_128, L_loopTop_192, L_loopTop_256;
@@ -2737,7 +2914,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_cipherBlockChaining_decryptAESCrypt_Parallel() {
assert(UseAES, "need AES instructions and misaligned SSE support");
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "cipherBlockChaining_decryptAESCrypt");
+ StubGenStubId stub_id = StubGenStubId::cipherBlockChaining_decryptAESCrypt_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
const Register from = rsi; // source array address
@@ -2910,7 +3088,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_counterMode_AESCrypt_Parallel() {
assert(UseAES, "need AES instructions and misaligned SSE support");
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "counterMode_AESCrypt");
+ StubGenStubId stub_id = StubGenStubId::counterMode_AESCrypt_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
const Register from = rsi; // source array address
const Register to = rdx; // destination array address
@@ -3192,9 +3371,21 @@ class StubGenerator: public StubCodeGenerator {
// ofs and limit are use for multi-block byte array.
// int com.sun.security.provider.MD5.implCompress(byte[] b, int ofs)
- address generate_md5_implCompress(bool multi_block, const char *name) {
+ address generate_md5_implCompress(StubGenStubId stub_id) {
+ bool multi_block;
+ switch(stub_id) {
+ case StubGenStubId::md5_implCompress_id:
+ multi_block = false;
+ break;
+ case StubGenStubId::md5_implCompressMB_id:
+ multi_block = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
const Register buf_param = rbp;
@@ -3232,7 +3423,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_upper_word_mask() {
__ align64();
- StubCodeMark mark(this, "StubRoutines", "upper_word_mask");
+ StubGenStubId stub_id = StubGenStubId::upper_word_mask_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ emit_data(0x00000000, relocInfo::none, 0);
__ emit_data(0x00000000, relocInfo::none, 0);
@@ -3243,7 +3435,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_shuffle_byte_flip_mask() {
__ align64();
- StubCodeMark mark(this, "StubRoutines", "shuffle_byte_flip_mask");
+ StubGenStubId stub_id = StubGenStubId::shuffle_byte_flip_mask_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ emit_data(0x0c0d0e0f, relocInfo::none, 0);
__ emit_data(0x08090a0b, relocInfo::none, 0);
@@ -3254,9 +3447,21 @@ class StubGenerator: public StubCodeGenerator {
// ofs and limit are use for multi-block byte array.
// int com.sun.security.provider.DigestBase.implCompressMultiBlock(byte[] b, int ofs, int limit)
- address generate_sha1_implCompress(bool multi_block, const char *name) {
+ address generate_sha1_implCompress(StubGenStubId stub_id) {
+ bool multi_block;
+ switch(stub_id) {
+ case StubGenStubId::sha1_implCompress_id:
+ multi_block = false;
+ break;
+ case StubGenStubId::sha1_implCompressMB_id:
+ multi_block = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Register buf = rax;
@@ -3302,7 +3507,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_pshuffle_byte_flip_mask() {
__ align64();
- StubCodeMark mark(this, "StubRoutines", "pshuffle_byte_flip_mask");
+ StubGenStubId stub_id = StubGenStubId::pshuffle_byte_flip_mask_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ emit_data(0x00010203, relocInfo::none, 0);
__ emit_data(0x04050607, relocInfo::none, 0);
@@ -3313,9 +3519,21 @@ class StubGenerator: public StubCodeGenerator {
// ofs and limit are use for multi-block byte array.
// int com.sun.security.provider.DigestBase.implCompressMultiBlock(byte[] b, int ofs, int limit)
- address generate_sha256_implCompress(bool multi_block, const char *name) {
+ address generate_sha256_implCompress(StubGenStubId stub_id) {
+ bool multi_block;
+ switch(stub_id) {
+ case StubGenStubId::sha256_implCompress_id:
+ multi_block = false;
+ break;
+ case StubGenStubId::sha256_implCompressMB_id:
+ multi_block = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Register buf = rbx;
@@ -3373,7 +3591,9 @@ class StubGenerator: public StubCodeGenerator {
assert(UseGHASHIntrinsics, "need GHASH intrinsics and CLMUL support");
__ align(CodeEntryAlignment);
Label L_ghash_loop, L_exit;
- StubCodeMark mark(this, "StubRoutines", "ghash_processBlocks");
+ StubGenStubId stub_id = StubGenStubId::ghash_processBlocks_id;
+ StubCodeMark mark(this, stub_id);
+
address start = __ pc();
const Register state = rdi;
@@ -3521,7 +3741,8 @@ class StubGenerator: public StubCodeGenerator {
assert(UseCRC32Intrinsics, "need AVX and CLMUL instructions");
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "updateBytesCRC32");
+ StubGenStubId stub_id = StubGenStubId::updateBytesCRC32_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
@@ -3576,7 +3797,9 @@ class StubGenerator: public StubCodeGenerator {
address generate_updateBytesCRC32C(bool is_pclmulqdq_supported) {
assert(UseCRC32CIntrinsics, "need SSE4_2");
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "updateBytesCRC32C");
+ StubGenStubId stub_id = StubGenStubId::updateBytesCRC32C_id;
+ StubCodeMark mark(this, stub_id);
+
address start = __ pc();
const Register crc = rax; // crc
const Register buf = rcx; // source java byte array address
@@ -3619,7 +3842,8 @@ class StubGenerator: public StubCodeGenerator {
}
address generate_libmExp() {
- StubCodeMark mark(this, "StubRoutines", "libmExp");
+ StubGenStubId stub_id = StubGenStubId::dexp_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
@@ -3635,7 +3859,8 @@ class StubGenerator: public StubCodeGenerator {
}
address generate_libmLog() {
- StubCodeMark mark(this, "StubRoutines", "libmLog");
+ StubGenStubId stub_id = StubGenStubId::dlog_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
@@ -3651,7 +3876,8 @@ class StubGenerator: public StubCodeGenerator {
}
address generate_libmLog10() {
- StubCodeMark mark(this, "StubRoutines", "libmLog10");
+ StubGenStubId stub_id = StubGenStubId::dlog10_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
@@ -3667,7 +3893,8 @@ class StubGenerator: public StubCodeGenerator {
}
address generate_libmPow() {
- StubCodeMark mark(this, "StubRoutines", "libmPow");
+ StubGenStubId stub_id = StubGenStubId::dpow_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
@@ -3683,7 +3910,8 @@ class StubGenerator: public StubCodeGenerator {
}
address generate_libm_reduce_pi04l() {
- StubCodeMark mark(this, "StubRoutines", "libm_reduce_pi04l");
+ StubGenStubId stub_id = StubGenStubId::dlibm_reduce_pi04l_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
@@ -3695,7 +3923,8 @@ class StubGenerator: public StubCodeGenerator {
}
address generate_libm_sin_cos_huge() {
- StubCodeMark mark(this, "StubRoutines", "libm_sin_cos_huge");
+ StubGenStubId stub_id = StubGenStubId::dlibm_sin_cos_huge_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
@@ -3707,7 +3936,8 @@ class StubGenerator: public StubCodeGenerator {
}
address generate_libmSin() {
- StubCodeMark mark(this, "StubRoutines", "libmSin");
+ StubGenStubId stub_id = StubGenStubId::dsin_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
@@ -3723,7 +3953,8 @@ class StubGenerator: public StubCodeGenerator {
}
address generate_libmCos() {
- StubCodeMark mark(this, "StubRoutines", "libmCos");
+ StubGenStubId stub_id = StubGenStubId::dcos_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
@@ -3739,7 +3970,8 @@ class StubGenerator: public StubCodeGenerator {
}
address generate_libm_tan_cot_huge() {
- StubCodeMark mark(this, "StubRoutines", "libm_tan_cot_huge");
+ StubGenStubId stub_id = StubGenStubId::dlibm_tan_cot_huge_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
@@ -3751,7 +3983,8 @@ class StubGenerator: public StubCodeGenerator {
}
address generate_libmTan() {
- StubCodeMark mark(this, "StubRoutines", "libmTan");
+ StubGenStubId stub_id = StubGenStubId::dtan_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
@@ -3768,7 +4001,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_method_entry_barrier() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "nmethod_entry_barrier");
+ StubGenStubId stub_id = StubGenStubId::method_entry_barrier_id;
+ StubCodeMark mark(this, stub_id);
Label deoptimize_label;
@@ -3988,35 +4222,35 @@ class StubGenerator: public StubCodeGenerator {
// entry points that are C2/JVMCI specific
- StubRoutines::x86::_vector_float_sign_mask = generate_vector_mask("vector_float_sign_mask", 0x7FFFFFFF);
- StubRoutines::x86::_vector_float_sign_flip = generate_vector_mask("vector_float_sign_flip", 0x80000000);
- StubRoutines::x86::_vector_double_sign_mask = generate_vector_mask_long_double("vector_double_sign_mask", 0x7FFFFFFF, 0xFFFFFFFF);
- StubRoutines::x86::_vector_double_sign_flip = generate_vector_mask_long_double("vector_double_sign_flip", 0x80000000, 0x00000000);
- StubRoutines::x86::_vector_short_to_byte_mask = generate_vector_mask("vector_short_to_byte_mask", 0x00ff00ff);
- StubRoutines::x86::_vector_int_to_byte_mask = generate_vector_mask("vector_int_to_byte_mask", 0x000000ff);
- StubRoutines::x86::_vector_int_to_short_mask = generate_vector_mask("vector_int_to_short_mask", 0x0000ffff);
- StubRoutines::x86::_vector_32_bit_mask = generate_vector_custom_i32("vector_32_bit_mask", Assembler::AVX_512bit,
+ StubRoutines::x86::_vector_float_sign_mask = generate_vector_mask(StubGenStubId::vector_float_sign_mask_id, 0x7FFFFFFF);
+ StubRoutines::x86::_vector_float_sign_flip = generate_vector_mask(StubGenStubId::vector_float_sign_flip_id, 0x80000000);
+ StubRoutines::x86::_vector_double_sign_mask = generate_vector_mask_long_double(StubGenStubId::vector_double_sign_mask_id, 0x7FFFFFFF, 0xFFFFFFFF);
+ StubRoutines::x86::_vector_double_sign_flip = generate_vector_mask_long_double(StubGenStubId::vector_double_sign_flip_id, 0x80000000, 0x00000000);
+ StubRoutines::x86::_vector_short_to_byte_mask = generate_vector_mask(StubGenStubId::vector_short_to_byte_mask_id, 0x00ff00ff);
+ StubRoutines::x86::_vector_int_to_byte_mask = generate_vector_mask(StubGenStubId::vector_int_to_byte_mask_id, 0x000000ff);
+ StubRoutines::x86::_vector_int_to_short_mask = generate_vector_mask(StubGenStubId::vector_int_to_short_mask_id, 0x0000ffff);
+ StubRoutines::x86::_vector_32_bit_mask = generate_vector_custom_i32(StubGenStubId::vector_32_bit_mask_id, Assembler::AVX_512bit,
0xFFFFFFFF, 0, 0, 0);
- StubRoutines::x86::_vector_64_bit_mask = generate_vector_custom_i32("vector_64_bit_mask", Assembler::AVX_512bit,
+ StubRoutines::x86::_vector_64_bit_mask = generate_vector_custom_i32(StubGenStubId::vector_64_bit_mask_id, Assembler::AVX_512bit,
0xFFFFFFFF, 0xFFFFFFFF, 0, 0);
- StubRoutines::x86::_vector_int_shuffle_mask = generate_vector_mask("vector_int_shuffle_mask", 0x03020100);
- StubRoutines::x86::_vector_byte_shuffle_mask = generate_vector_byte_shuffle_mask("vector_byte_shuffle_mask");
- StubRoutines::x86::_vector_short_shuffle_mask = generate_vector_mask("vector_short_shuffle_mask", 0x01000100);
- StubRoutines::x86::_vector_long_shuffle_mask = generate_vector_mask_long_double("vector_long_shuffle_mask", 0x00000001, 0x0);
- StubRoutines::x86::_vector_byte_perm_mask = generate_vector_byte_perm_mask("vector_byte_perm_mask");
- StubRoutines::x86::_vector_long_sign_mask = generate_vector_mask_long_double("vector_long_sign_mask", 0x80000000, 0x00000000);
- StubRoutines::x86::_vector_all_bits_set = generate_vector_mask("vector_all_bits_set", 0xFFFFFFFF);
- StubRoutines::x86::_vector_int_mask_cmp_bits = generate_vector_mask("vector_int_mask_cmp_bits", 0x00000001);
- StubRoutines::x86::_vector_iota_indices = generate_iota_indices("iota_indices");
- StubRoutines::x86::_vector_count_leading_zeros_lut = generate_count_leading_zeros_lut("count_leading_zeros_lut");
- StubRoutines::x86::_vector_reverse_bit_lut = generate_vector_reverse_bit_lut("reverse_bit_lut");
- StubRoutines::x86::_vector_reverse_byte_perm_mask_long = generate_vector_reverse_byte_perm_mask_long("perm_mask_long");
- StubRoutines::x86::_vector_reverse_byte_perm_mask_int = generate_vector_reverse_byte_perm_mask_int("perm_mask_int");
- StubRoutines::x86::_vector_reverse_byte_perm_mask_short = generate_vector_reverse_byte_perm_mask_short("perm_mask_short");
+ StubRoutines::x86::_vector_int_shuffle_mask = generate_vector_mask(StubGenStubId::vector_int_shuffle_mask_id, 0x03020100);
+ StubRoutines::x86::_vector_byte_shuffle_mask = generate_vector_byte_shuffle_mask();
+ StubRoutines::x86::_vector_short_shuffle_mask = generate_vector_mask(StubGenStubId::vector_short_shuffle_mask_id, 0x01000100);
+ StubRoutines::x86::_vector_long_shuffle_mask = generate_vector_mask_long_double(StubGenStubId::vector_long_shuffle_mask_id, 0x00000001, 0x0);
+ StubRoutines::x86::_vector_byte_perm_mask = generate_vector_byte_perm_mask();
+ StubRoutines::x86::_vector_long_sign_mask = generate_vector_mask_long_double(StubGenStubId::vector_long_sign_mask_id, 0x80000000, 0x00000000);
+ StubRoutines::x86::_vector_all_bits_set = generate_vector_mask(StubGenStubId::vector_all_bits_set_id, 0xFFFFFFFF);
+ StubRoutines::x86::_vector_int_mask_cmp_bits = generate_vector_mask(StubGenStubId::vector_int_mask_cmp_bits_id, 0x00000001);
+ StubRoutines::x86::_vector_iota_indices = generate_iota_indices();
+ StubRoutines::x86::_vector_count_leading_zeros_lut = generate_count_leading_zeros_lut();
+ StubRoutines::x86::_vector_reverse_bit_lut = generate_vector_reverse_bit_lut();
+ StubRoutines::x86::_vector_reverse_byte_perm_mask_long = generate_vector_reverse_byte_perm_mask_long();
+ StubRoutines::x86::_vector_reverse_byte_perm_mask_int = generate_vector_reverse_byte_perm_mask_int();
+ StubRoutines::x86::_vector_reverse_byte_perm_mask_short = generate_vector_reverse_byte_perm_mask_short();
if (VM_Version::supports_avx2() && !VM_Version::supports_avx512_vpopcntdq()) {
// lut implementation influenced by counting 1s algorithm from section 5-1 of Hackers' Delight.
- StubRoutines::x86::_vector_popcount_lut = generate_popcount_avx_lut("popcount_lut");
+ StubRoutines::x86::_vector_popcount_lut = generate_popcount_avx_lut();
}
// don't bother generating these AES intrinsic stubs unless global flag is set
@@ -4032,20 +4266,20 @@ class StubGenerator: public StubCodeGenerator {
}
if (UseMD5Intrinsics) {
- StubRoutines::_md5_implCompress = generate_md5_implCompress(false, "md5_implCompress");
- StubRoutines::_md5_implCompressMB = generate_md5_implCompress(true, "md5_implCompressMB");
+ StubRoutines::_md5_implCompress = generate_md5_implCompress(StubGenStubId::md5_implCompress_id);
+ StubRoutines::_md5_implCompressMB = generate_md5_implCompress(StubGenStubId::md5_implCompressMB_id);
}
if (UseSHA1Intrinsics) {
StubRoutines::x86::_upper_word_mask_addr = generate_upper_word_mask();
StubRoutines::x86::_shuffle_byte_flip_mask_addr = generate_shuffle_byte_flip_mask();
- StubRoutines::_sha1_implCompress = generate_sha1_implCompress(false, "sha1_implCompress");
- StubRoutines::_sha1_implCompressMB = generate_sha1_implCompress(true, "sha1_implCompressMB");
+ StubRoutines::_sha1_implCompress = generate_sha1_implCompress(StubGenStubId::sha1_implCompress_id);
+ StubRoutines::_sha1_implCompressMB = generate_sha1_implCompress(StubGenStubId::sha1_implCompressMB_id);
}
if (UseSHA256Intrinsics) {
StubRoutines::x86::_k256_adr = (address)StubRoutines::x86::_k256;
StubRoutines::x86::_pshuffle_byte_flip_mask_addr = generate_pshuffle_byte_flip_mask();
- StubRoutines::_sha256_implCompress = generate_sha256_implCompress(false, "sha256_implCompress");
- StubRoutines::_sha256_implCompressMB = generate_sha256_implCompress(true, "sha256_implCompressMB");
+ StubRoutines::_sha256_implCompress = generate_sha256_implCompress(StubGenStubId::sha256_implCompress_id);
+ StubRoutines::_sha256_implCompressMB = generate_sha256_implCompress(StubGenStubId::sha256_implCompressMB_id);
}
// Generate GHASH intrinsics code
@@ -4057,27 +4291,27 @@ class StubGenerator: public StubCodeGenerator {
public:
- StubGenerator(CodeBuffer* code, StubsKind kind) : StubCodeGenerator(code) {
- switch(kind) {
- case Initial_stubs:
+ StubGenerator(CodeBuffer* code, StubGenBlobId blob_id) : StubCodeGenerator(code, blob_id) {
+ switch(blob_id) {
+ case initial_id:
generate_initial_stubs();
break;
- case Continuation_stubs:
+ case continuation_id:
generate_continuation_stubs();
break;
- case Compiler_stubs:
+ case compiler_id:
generate_compiler_stubs();
break;
- case Final_stubs:
+ case final_id:
generate_final_stubs();
break;
default:
- fatal("unexpected stubs kind: %d", kind);
+ fatal("unexpected blob id: %d", blob_id);
break;
};
}
}; // end class declaration
-void StubGenerator_generate(CodeBuffer* code, StubCodeGenerator::StubsKind kind) {
- StubGenerator g(code, kind);
+void StubGenerator_generate(CodeBuffer* code, StubGenBlobId blob_id) {
+ StubGenerator g(code, blob_id);
}
diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp
index 3979237619c92..d2a0c81b2c98a 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"
@@ -188,7 +187,8 @@ address StubGenerator::generate_call_stub(address& return_address) {
assert((int)frame::entry_frame_after_call_words == -(int)rsp_after_call_off + 1 &&
(int)frame::entry_frame_call_wrapper_offset == (int)call_wrapper_off,
"adjust this code");
- StubCodeMark mark(this, "StubRoutines", "call_stub");
+ StubGenStubId stub_id = StubGenStubId::call_stub_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
// same as in generate_catch_exception()!
@@ -248,12 +248,9 @@ address StubGenerator::generate_call_stub(address& return_address) {
const Address mxcsr_save(rbp, mxcsr_off * wordSize);
{
Label skip_ldmx;
- __ stmxcsr(mxcsr_save);
- __ movl(rax, mxcsr_save);
- __ andl(rax, 0xFFC0); // Mask out any pending exceptions (only check control and mask bits)
- ExternalAddress mxcsr_std(StubRoutines::x86::addr_mxcsr_std());
- __ cmp32(rax, mxcsr_std, rscratch1);
+ __ cmp32_mxcsr_std(mxcsr_save, rax, rscratch1);
__ jcc(Assembler::equal, skip_ldmx);
+ ExternalAddress mxcsr_std(StubRoutines::x86::addr_mxcsr_std());
__ ldmxcsr(mxcsr_std, rscratch1);
__ bind(skip_ldmx);
}
@@ -413,7 +410,8 @@ address StubGenerator::generate_call_stub(address& return_address) {
// rax: exception oop
address StubGenerator::generate_catch_exception() {
- StubCodeMark mark(this, "StubRoutines", "catch_exception");
+ StubGenStubId stub_id = StubGenStubId::catch_exception_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
// same as in generate_call_stub():
@@ -468,7 +466,8 @@ address StubGenerator::generate_catch_exception() {
// NOTE: At entry of this stub, exception-pc must be on stack !!
address StubGenerator::generate_forward_exception() {
- StubCodeMark mark(this, "StubRoutines", "forward exception");
+ StubGenStubId stub_id = StubGenStubId::forward_exception_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
// Upon entry, the sp points to the return address returning into
@@ -531,7 +530,8 @@ address StubGenerator::generate_forward_exception() {
//
// Result:
address StubGenerator::generate_orderaccess_fence() {
- StubCodeMark mark(this, "StubRoutines", "orderaccess_fence");
+ StubGenStubId stub_id = StubGenStubId::fence_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ membar(Assembler::StoreLoad);
@@ -546,7 +546,8 @@ address StubGenerator::generate_orderaccess_fence() {
// This routine is used to find the previous stack pointer for the
// caller.
address StubGenerator::generate_get_previous_sp() {
- StubCodeMark mark(this, "StubRoutines", "get_previous_sp");
+ StubGenStubId stub_id = StubGenStubId::get_previous_sp_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ movptr(rax, rsp);
@@ -564,7 +565,8 @@ address StubGenerator::generate_get_previous_sp() {
// MXCSR register to our expected state.
address StubGenerator::generate_verify_mxcsr() {
- StubCodeMark mark(this, "StubRoutines", "verify_mxcsr");
+ StubGenStubId stub_id = StubGenStubId::verify_mxcsr_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
const Address mxcsr_save(rsp, 0);
@@ -574,10 +576,7 @@ address StubGenerator::generate_verify_mxcsr() {
ExternalAddress mxcsr_std(StubRoutines::x86::addr_mxcsr_std());
__ push(rax);
__ subptr(rsp, wordSize); // allocate a temp location
- __ stmxcsr(mxcsr_save);
- __ movl(rax, mxcsr_save);
- __ andl(rax, 0xFFC0); // Mask out any pending exceptions (only check control and mask bits)
- __ cmp32(rax, mxcsr_std, rscratch1);
+ __ cmp32_mxcsr_std(mxcsr_save, rax, rscratch1);
__ jcc(Assembler::equal, ok_ret);
__ warn("MXCSR changed by native JNI code, use -XX:+RestoreMXCSROnJNICall");
@@ -595,7 +594,8 @@ address StubGenerator::generate_verify_mxcsr() {
}
address StubGenerator::generate_f2i_fixup() {
- StubCodeMark mark(this, "StubRoutines", "f2i_fixup");
+ StubGenStubId stub_id = StubGenStubId::f2i_fixup_id;
+ StubCodeMark mark(this, stub_id);
Address inout(rsp, 5 * wordSize); // return address + 4 saves
address start = __ pc();
@@ -633,7 +633,8 @@ address StubGenerator::generate_f2i_fixup() {
}
address StubGenerator::generate_f2l_fixup() {
- StubCodeMark mark(this, "StubRoutines", "f2l_fixup");
+ StubGenStubId stub_id = StubGenStubId::f2l_fixup_id;
+ StubCodeMark mark(this, stub_id);
Address inout(rsp, 5 * wordSize); // return address + 4 saves
address start = __ pc();
@@ -670,7 +671,8 @@ address StubGenerator::generate_f2l_fixup() {
}
address StubGenerator::generate_d2i_fixup() {
- StubCodeMark mark(this, "StubRoutines", "d2i_fixup");
+ StubGenStubId stub_id = StubGenStubId::d2i_fixup_id;
+ StubCodeMark mark(this, stub_id);
Address inout(rsp, 6 * wordSize); // return address + 5 saves
address start = __ pc();
@@ -717,7 +719,8 @@ address StubGenerator::generate_d2i_fixup() {
}
address StubGenerator::generate_d2l_fixup() {
- StubCodeMark mark(this, "StubRoutines", "d2l_fixup");
+ StubGenStubId stub_id = StubGenStubId::d2l_fixup_id;
+ StubCodeMark mark(this, stub_id);
Address inout(rsp, 6 * wordSize); // return address + 5 saves
address start = __ pc();
@@ -763,9 +766,10 @@ address StubGenerator::generate_d2l_fixup() {
return start;
}
-address StubGenerator::generate_count_leading_zeros_lut(const char *stub_name) {
+address StubGenerator::generate_count_leading_zeros_lut() {
__ align64();
- StubCodeMark mark(this, "StubRoutines", stub_name);
+ StubGenStubId stub_id = StubGenStubId::vector_count_leading_zeros_lut_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ emit_data64(0x0101010102020304, relocInfo::none);
@@ -780,9 +784,10 @@ address StubGenerator::generate_count_leading_zeros_lut(const char *stub_name) {
return start;
}
-address StubGenerator::generate_popcount_avx_lut(const char *stub_name) {
+address StubGenerator::generate_popcount_avx_lut() {
__ align64();
- StubCodeMark mark(this, "StubRoutines", stub_name);
+ StubGenStubId stub_id = StubGenStubId::vector_popcount_lut_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ emit_data64(0x0302020102010100, relocInfo::none);
@@ -797,9 +802,10 @@ address StubGenerator::generate_popcount_avx_lut(const char *stub_name) {
return start;
}
-address StubGenerator::generate_iota_indices(const char *stub_name) {
+address StubGenerator::generate_iota_indices() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", stub_name);
+ StubGenStubId stub_id = StubGenStubId::vector_iota_indices_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
// B
__ emit_data64(0x0706050403020100, relocInfo::none);
@@ -858,9 +864,10 @@ address StubGenerator::generate_iota_indices(const char *stub_name) {
return start;
}
-address StubGenerator::generate_vector_reverse_bit_lut(const char *stub_name) {
+address StubGenerator::generate_vector_reverse_bit_lut() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", stub_name);
+ StubGenStubId stub_id = StubGenStubId::vector_reverse_bit_lut_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ emit_data64(0x0E060A020C040800, relocInfo::none);
@@ -875,9 +882,10 @@ address StubGenerator::generate_vector_reverse_bit_lut(const char *stub_name) {
return start;
}
-address StubGenerator::generate_vector_reverse_byte_perm_mask_long(const char *stub_name) {
+address StubGenerator::generate_vector_reverse_byte_perm_mask_long() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", stub_name);
+ StubGenStubId stub_id = StubGenStubId::vector_reverse_byte_perm_mask_long_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ emit_data64(0x0001020304050607, relocInfo::none);
@@ -892,9 +900,10 @@ address StubGenerator::generate_vector_reverse_byte_perm_mask_long(const char *s
return start;
}
-address StubGenerator::generate_vector_reverse_byte_perm_mask_int(const char *stub_name) {
+address StubGenerator::generate_vector_reverse_byte_perm_mask_int() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", stub_name);
+ StubGenStubId stub_id = StubGenStubId::vector_reverse_byte_perm_mask_int_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ emit_data64(0x0405060700010203, relocInfo::none);
@@ -909,9 +918,10 @@ address StubGenerator::generate_vector_reverse_byte_perm_mask_int(const char *st
return start;
}
-address StubGenerator::generate_vector_reverse_byte_perm_mask_short(const char *stub_name) {
+address StubGenerator::generate_vector_reverse_byte_perm_mask_short() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", stub_name);
+ StubGenStubId stub_id = StubGenStubId::vector_reverse_byte_perm_mask_short_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ emit_data64(0x0607040502030001, relocInfo::none);
@@ -926,9 +936,10 @@ address StubGenerator::generate_vector_reverse_byte_perm_mask_short(const char *
return start;
}
-address StubGenerator::generate_vector_byte_shuffle_mask(const char *stub_name) {
+address StubGenerator::generate_vector_byte_shuffle_mask() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", stub_name);
+ StubGenStubId stub_id = StubGenStubId::vector_byte_shuffle_mask_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ emit_data64(0x7070707070707070, relocInfo::none);
@@ -939,9 +950,9 @@ address StubGenerator::generate_vector_byte_shuffle_mask(const char *stub_name)
return start;
}
-address StubGenerator::generate_fp_mask(const char *stub_name, int64_t mask) {
+address StubGenerator::generate_fp_mask(StubGenStubId stub_id, int64_t mask) {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", stub_name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ emit_data64( mask, relocInfo::none );
@@ -950,9 +961,20 @@ address StubGenerator::generate_fp_mask(const char *stub_name, int64_t mask) {
return start;
}
-address StubGenerator::generate_compress_perm_table(const char *stub_name, int32_t esize) {
+address StubGenerator::generate_compress_perm_table(StubGenStubId stub_id) {
+ int esize;
+ switch (stub_id) {
+ case compress_perm_table32_id:
+ esize = 32;
+ break;
+ case compress_perm_table64_id:
+ esize = 64;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", stub_name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
if (esize == 32) {
// Loop to generate 256 x 8 int compression permute index table. A row is
@@ -994,9 +1016,20 @@ address StubGenerator::generate_compress_perm_table(const char *stub_name, int32
return start;
}
-address StubGenerator::generate_expand_perm_table(const char *stub_name, int32_t esize) {
+address StubGenerator::generate_expand_perm_table(StubGenStubId stub_id) {
+ int esize;
+ switch (stub_id) {
+ case expand_perm_table32_id:
+ esize = 32;
+ break;
+ case expand_perm_table64_id:
+ esize = 64;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", stub_name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
if (esize == 32) {
// Loop to generate 256 x 8 int expand permute index table. A row is accessed
@@ -1036,9 +1069,9 @@ address StubGenerator::generate_expand_perm_table(const char *stub_name, int32_t
return start;
}
-address StubGenerator::generate_vector_mask(const char *stub_name, int64_t mask) {
+address StubGenerator::generate_vector_mask(StubGenStubId stub_id, int64_t mask) {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", stub_name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ emit_data64(mask, relocInfo::none);
@@ -1053,9 +1086,10 @@ address StubGenerator::generate_vector_mask(const char *stub_name, int64_t mask)
return start;
}
-address StubGenerator::generate_vector_byte_perm_mask(const char *stub_name) {
+address StubGenerator::generate_vector_byte_perm_mask() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", stub_name);
+ StubGenStubId stub_id = StubGenStubId::vector_byte_perm_mask_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ emit_data64(0x0000000000000001, relocInfo::none);
@@ -1070,9 +1104,9 @@ address StubGenerator::generate_vector_byte_perm_mask(const char *stub_name) {
return start;
}
-address StubGenerator::generate_vector_fp_mask(const char *stub_name, int64_t mask) {
+address StubGenerator::generate_vector_fp_mask(StubGenStubId stub_id, int64_t mask) {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", stub_name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ emit_data64(mask, relocInfo::none);
@@ -1087,13 +1121,13 @@ address StubGenerator::generate_vector_fp_mask(const char *stub_name, int64_t ma
return start;
}
-address StubGenerator::generate_vector_custom_i32(const char *stub_name, Assembler::AvxVectorLen len,
+address StubGenerator::generate_vector_custom_i32(StubGenStubId stub_id, Assembler::AvxVectorLen len,
int32_t val0, int32_t val1, int32_t val2, int32_t val3,
int32_t val4, int32_t val5, int32_t val6, int32_t val7,
int32_t val8, int32_t val9, int32_t val10, int32_t val11,
int32_t val12, int32_t val13, int32_t val14, int32_t val15) {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", stub_name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
assert(len != Assembler::AVX_NoVec, "vector len must be specified");
@@ -1137,7 +1171,8 @@ address StubGenerator::generate_vector_custom_i32(const char *stub_name, Assembl
// * [tos + 8]: saved r10 (rscratch1) - saved by caller
// * = popped on exit
address StubGenerator::generate_verify_oop() {
- StubCodeMark mark(this, "StubRoutines", "verify_oop");
+ StubGenStubId stub_id = StubGenStubId::verify_oop_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Label exit, error;
@@ -1334,7 +1369,8 @@ address StubGenerator::generate_data_cache_writeback() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "_data_cache_writeback");
+ StubGenStubId stub_id = StubGenStubId::data_cache_writeback_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
@@ -1351,7 +1387,8 @@ address StubGenerator::generate_data_cache_writeback_sync() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "_data_cache_writeback_sync");
+ StubGenStubId stub_id = StubGenStubId::data_cache_writeback_sync_id;
+ StubCodeMark mark(this, stub_id);
// pre wbsync is a no-op
// post wbsync translates to an sfence
@@ -1372,9 +1409,20 @@ address StubGenerator::generate_data_cache_writeback_sync() {
// ofs and limit are use for multi-block byte array.
// int com.sun.security.provider.MD5.implCompress(byte[] b, int ofs)
-address StubGenerator::generate_md5_implCompress(bool multi_block, const char *name) {
+address StubGenerator::generate_md5_implCompress(StubGenStubId stub_id) {
+ bool multi_block;
+ switch (stub_id) {
+ case md5_implCompress_id:
+ multi_block = false;
+ break;
+ case md5_implCompressMB_id:
+ multi_block = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
const Register buf_param = r15;
@@ -1410,7 +1458,8 @@ address StubGenerator::generate_md5_implCompress(bool multi_block, const char *n
address StubGenerator::generate_upper_word_mask() {
__ align64();
- StubCodeMark mark(this, "StubRoutines", "upper_word_mask");
+ StubGenStubId stub_id = StubGenStubId::upper_word_mask_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ emit_data64(0x0000000000000000, relocInfo::none);
@@ -1421,7 +1470,8 @@ address StubGenerator::generate_upper_word_mask() {
address StubGenerator::generate_shuffle_byte_flip_mask() {
__ align64();
- StubCodeMark mark(this, "StubRoutines", "shuffle_byte_flip_mask");
+ StubGenStubId stub_id = StubGenStubId::shuffle_byte_flip_mask_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ emit_data64(0x08090a0b0c0d0e0f, relocInfo::none);
@@ -1432,9 +1482,20 @@ address StubGenerator::generate_shuffle_byte_flip_mask() {
// ofs and limit are use for multi-block byte array.
// int com.sun.security.provider.DigestBase.implCompressMultiBlock(byte[] b, int ofs, int limit)
-address StubGenerator::generate_sha1_implCompress(bool multi_block, const char *name) {
+address StubGenerator::generate_sha1_implCompress(StubGenStubId stub_id) {
+ bool multi_block;
+ switch (stub_id) {
+ case sha1_implCompress_id:
+ multi_block = false;
+ break;
+ case sha1_implCompressMB_id:
+ multi_block = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Register buf = c_rarg0;
@@ -1469,7 +1530,8 @@ address StubGenerator::generate_sha1_implCompress(bool multi_block, const char *
address StubGenerator::generate_pshuffle_byte_flip_mask() {
__ align64();
- StubCodeMark mark(this, "StubRoutines", "pshuffle_byte_flip_mask");
+ StubGenStubId stub_id = StubGenStubId::pshuffle_byte_flip_mask_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ emit_data64(0x0405060700010203, relocInfo::none);
@@ -1496,7 +1558,8 @@ address StubGenerator::generate_pshuffle_byte_flip_mask() {
//Mask for byte-swapping a couple of qwords in an XMM register using (v)pshufb.
address StubGenerator::generate_pshuffle_byte_flip_mask_sha512() {
__ align32();
- StubCodeMark mark(this, "StubRoutines", "pshuffle_byte_flip_mask_sha512");
+ StubGenStubId stub_id = StubGenStubId::pshuffle_byte_flip_mask_sha512_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
if (VM_Version::supports_avx2()) {
@@ -1515,10 +1578,21 @@ address StubGenerator::generate_pshuffle_byte_flip_mask_sha512() {
// ofs and limit are use for multi-block byte array.
// int com.sun.security.provider.DigestBase.implCompressMultiBlock(byte[] b, int ofs, int limit)
-address StubGenerator::generate_sha256_implCompress(bool multi_block, const char *name) {
+address StubGenerator::generate_sha256_implCompress(StubGenStubId stub_id) {
+ bool multi_block;
+ switch (stub_id) {
+ case sha256_implCompress_id:
+ multi_block = false;
+ break;
+ case sha256_implCompressMB_id:
+ multi_block = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
assert(VM_Version::supports_sha() || VM_Version::supports_avx2(), "");
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Register buf = c_rarg0;
@@ -1557,11 +1631,22 @@ address StubGenerator::generate_sha256_implCompress(bool multi_block, const char
return start;
}
-address StubGenerator::generate_sha512_implCompress(bool multi_block, const char *name) {
+address StubGenerator::generate_sha512_implCompress(StubGenStubId stub_id) {
+ bool multi_block;
+ switch (stub_id) {
+ case sha512_implCompress_id:
+ multi_block = false;
+ break;
+ case sha512_implCompressMB_id:
+ multi_block = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
assert(VM_Version::supports_avx2(), "");
assert(VM_Version::supports_bmi2() || VM_Version::supports_sha512(), "");
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Register buf = c_rarg0;
@@ -1596,7 +1681,8 @@ address StubGenerator::generate_sha512_implCompress(bool multi_block, const char
address StubGenerator::base64_shuffle_addr() {
__ align64();
- StubCodeMark mark(this, "StubRoutines", "shuffle_base64");
+ StubGenStubId stub_id = StubGenStubId::shuffle_base64_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
assert(((unsigned long long)start & 0x3f) == 0,
@@ -1615,7 +1701,8 @@ address StubGenerator::base64_shuffle_addr() {
address StubGenerator::base64_avx2_shuffle_addr() {
__ align32();
- StubCodeMark mark(this, "StubRoutines", "avx2_shuffle_base64");
+ StubGenStubId stub_id = StubGenStubId::avx2_shuffle_base64_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ emit_data64(0x0809070805060405, relocInfo::none);
@@ -1628,7 +1715,8 @@ address StubGenerator::base64_avx2_shuffle_addr() {
address StubGenerator::base64_avx2_input_mask_addr() {
__ align32();
- StubCodeMark mark(this, "StubRoutines", "avx2_input_mask_base64");
+ StubGenStubId stub_id = StubGenStubId::avx2_input_mask_base64_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ emit_data64(0x8000000000000000, relocInfo::none);
@@ -1641,7 +1729,8 @@ address StubGenerator::base64_avx2_input_mask_addr() {
address StubGenerator::base64_avx2_lut_addr() {
__ align32();
- StubCodeMark mark(this, "StubRoutines", "avx2_lut_base64");
+ StubGenStubId stub_id = StubGenStubId::avx2_lut_base64_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ emit_data64(0xfcfcfcfcfcfc4741, relocInfo::none);
@@ -1660,7 +1749,8 @@ address StubGenerator::base64_avx2_lut_addr() {
address StubGenerator::base64_encoding_table_addr() {
__ align64();
- StubCodeMark mark(this, "StubRoutines", "encoding_table_base64");
+ StubGenStubId stub_id = StubGenStubId::encoding_table_base64_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
assert(((unsigned long long)start & 0x3f) == 0, "Alignment problem (0x%08llx)", (unsigned long long)start);
@@ -1693,7 +1783,8 @@ address StubGenerator::base64_encoding_table_addr() {
address StubGenerator::generate_base64_encodeBlock()
{
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "implEncode");
+ StubGenStubId stub_id = StubGenStubId::base64_encodeBlock_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ enter();
@@ -2075,7 +2166,8 @@ address StubGenerator::generate_base64_encodeBlock()
// base64 AVX512vbmi tables
address StubGenerator::base64_vbmi_lookup_lo_addr() {
__ align64();
- StubCodeMark mark(this, "StubRoutines", "lookup_lo_base64");
+ StubGenStubId stub_id = StubGenStubId::lookup_lo_base64_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
assert(((unsigned long long)start & 0x3f) == 0,
@@ -2094,7 +2186,8 @@ address StubGenerator::base64_vbmi_lookup_lo_addr() {
address StubGenerator::base64_vbmi_lookup_hi_addr() {
__ align64();
- StubCodeMark mark(this, "StubRoutines", "lookup_hi_base64");
+ StubGenStubId stub_id = StubGenStubId::lookup_hi_base64_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
assert(((unsigned long long)start & 0x3f) == 0,
@@ -2112,7 +2205,8 @@ address StubGenerator::base64_vbmi_lookup_hi_addr() {
}
address StubGenerator::base64_vbmi_lookup_lo_url_addr() {
__ align64();
- StubCodeMark mark(this, "StubRoutines", "lookup_lo_base64url");
+ StubGenStubId stub_id = StubGenStubId::lookup_lo_base64url_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
assert(((unsigned long long)start & 0x3f) == 0,
@@ -2131,7 +2225,8 @@ address StubGenerator::base64_vbmi_lookup_lo_url_addr() {
address StubGenerator::base64_vbmi_lookup_hi_url_addr() {
__ align64();
- StubCodeMark mark(this, "StubRoutines", "lookup_hi_base64url");
+ StubGenStubId stub_id = StubGenStubId::lookup_hi_base64url_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
assert(((unsigned long long)start & 0x3f) == 0,
@@ -2150,7 +2245,8 @@ address StubGenerator::base64_vbmi_lookup_hi_url_addr() {
address StubGenerator::base64_vbmi_pack_vec_addr() {
__ align64();
- StubCodeMark mark(this, "StubRoutines", "pack_vec_base64");
+ StubGenStubId stub_id = StubGenStubId::pack_vec_base64_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
assert(((unsigned long long)start & 0x3f) == 0,
@@ -2169,7 +2265,8 @@ address StubGenerator::base64_vbmi_pack_vec_addr() {
address StubGenerator::base64_vbmi_join_0_1_addr() {
__ align64();
- StubCodeMark mark(this, "StubRoutines", "join_0_1_base64");
+ StubGenStubId stub_id = StubGenStubId::join_0_1_base64_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
assert(((unsigned long long)start & 0x3f) == 0,
@@ -2188,7 +2285,8 @@ address StubGenerator::base64_vbmi_join_0_1_addr() {
address StubGenerator::base64_vbmi_join_1_2_addr() {
__ align64();
- StubCodeMark mark(this, "StubRoutines", "join_1_2_base64");
+ StubGenStubId stub_id = StubGenStubId::join_1_2_base64_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
assert(((unsigned long long)start & 0x3f) == 0,
@@ -2207,7 +2305,8 @@ address StubGenerator::base64_vbmi_join_1_2_addr() {
address StubGenerator::base64_vbmi_join_2_3_addr() {
__ align64();
- StubCodeMark mark(this, "StubRoutines", "join_2_3_base64");
+ StubGenStubId stub_id = StubGenStubId::join_2_3_base64_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
assert(((unsigned long long)start & 0x3f) == 0,
@@ -2226,7 +2325,8 @@ address StubGenerator::base64_vbmi_join_2_3_addr() {
address StubGenerator::base64_AVX2_decode_tables_addr() {
__ align64();
- StubCodeMark mark(this, "StubRoutines", "AVX2_tables_base64");
+ StubGenStubId stub_id = StubGenStubId::avx2_decode_tables_base64_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
assert(((unsigned long long)start & 0x3f) == 0,
@@ -2260,7 +2360,8 @@ address StubGenerator::base64_AVX2_decode_tables_addr() {
address StubGenerator::base64_AVX2_decode_LUT_tables_addr() {
__ align64();
- StubCodeMark mark(this, "StubRoutines", "AVX2_tables_URL_base64");
+ StubGenStubId stub_id = StubGenStubId::avx2_decode_lut_tables_base64_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
assert(((unsigned long long)start & 0x3f) == 0,
@@ -2299,7 +2400,8 @@ address StubGenerator::base64_AVX2_decode_LUT_tables_addr() {
}
address StubGenerator::base64_decoding_table_addr() {
- StubCodeMark mark(this, "StubRoutines", "decoding_table_base64");
+ StubGenStubId stub_id = StubGenStubId::decoding_table_base64_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ emit_data64(0xffffffffffffffff, relocInfo::none);
@@ -2381,7 +2483,8 @@ address StubGenerator::base64_decoding_table_addr() {
// private void decodeBlock(byte[] src, int sp, int sl, byte[] dst, int dp, boolean isURL, isMIME) {
address StubGenerator::generate_base64_decodeBlock() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "implDecode");
+ StubGenStubId stub_id = StubGenStubId::base64_decodeBlock_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ enter();
@@ -2914,7 +3017,8 @@ address StubGenerator::generate_updateBytesCRC32() {
assert(UseCRC32Intrinsics, "need AVX and CLMUL instructions");
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "updateBytesCRC32");
+ StubGenStubId stub_id = StubGenStubId::updateBytesCRC32_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
@@ -2970,7 +3074,8 @@ address StubGenerator::generate_updateBytesCRC32() {
address StubGenerator::generate_updateBytesCRC32C(bool is_pclmulqdq_supported) {
assert(UseCRC32CIntrinsics, "need SSE4_2");
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "updateBytesCRC32C");
+ StubGenStubId stub_id = StubGenStubId::updateBytesCRC32C_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
//reg.arg int#0 int#1 int#2 int#3 int#4 int#5 float regs
@@ -3050,7 +3155,8 @@ address StubGenerator::generate_updateBytesCRC32C(bool is_pclmulqdq_supported) {
*/
address StubGenerator::generate_multiplyToLen() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "multiplyToLen");
+ StubGenStubId stub_id = StubGenStubId::multiplyToLen_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
// Win64: rcx, rdx, r8, r9 (c_rarg0, c_rarg1, ...)
@@ -3106,7 +3212,8 @@ address StubGenerator::generate_multiplyToLen() {
*/
address StubGenerator::generate_vectorizedMismatch() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "vectorizedMismatch");
+ StubGenStubId stub_id = StubGenStubId::vectorizedMismatch_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
BLOCK_COMMENT("Entry:");
@@ -3157,7 +3264,8 @@ address StubGenerator::generate_vectorizedMismatch() {
address StubGenerator::generate_squareToLen() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "squareToLen");
+ StubGenStubId stub_id = StubGenStubId::squareToLen_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
// Win64: rcx, rdx, r8, r9 (c_rarg0, c_rarg1, ...)
@@ -3192,7 +3300,8 @@ address StubGenerator::generate_squareToLen() {
address StubGenerator::generate_method_entry_barrier() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "nmethod_entry_barrier");
+ StubGenStubId stub_id = StubGenStubId::method_entry_barrier_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Label deoptimize_label;
@@ -3281,7 +3390,8 @@ address StubGenerator::generate_method_entry_barrier() {
*/
address StubGenerator::generate_mulAdd() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "mulAdd");
+ StubGenStubId stub_id = StubGenStubId::mulAdd_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
// Win64: rcx, rdx, r8, r9 (c_rarg0, c_rarg1, ...)
@@ -3322,7 +3432,8 @@ address StubGenerator::generate_mulAdd() {
address StubGenerator::generate_bigIntegerRightShift() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "bigIntegerRightShiftWorker");
+ StubGenStubId stub_id = StubGenStubId::bigIntegerRightShiftWorker_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Label Shift512Loop, ShiftTwo, ShiftTwoLoop, ShiftOne, Exit;
@@ -3457,7 +3568,8 @@ address StubGenerator::generate_bigIntegerRightShift() {
*/
address StubGenerator::generate_bigIntegerLeftShift() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "bigIntegerLeftShiftWorker");
+ StubGenStubId stub_id = StubGenStubId::bigIntegerLeftShiftWorker_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Label Shift512Loop, ShiftTwo, ShiftTwoLoop, ShiftOne, Exit;
@@ -3605,7 +3717,8 @@ void StubGenerator::generate_libm_stubs() {
* xmm0 - float
*/
address StubGenerator::generate_float16ToFloat() {
- StubCodeMark mark(this, "StubRoutines", "float16ToFloat");
+ StubGenStubId stub_id = StubGenStubId::hf2f_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
@@ -3630,7 +3743,8 @@ address StubGenerator::generate_float16ToFloat() {
* rax - float16 jshort
*/
address StubGenerator::generate_floatToFloat16() {
- StubCodeMark mark(this, "StubRoutines", "floatToFloat16");
+ StubGenStubId stub_id = StubGenStubId::f2hf_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
@@ -3645,13 +3759,33 @@ address StubGenerator::generate_floatToFloat16() {
return start;
}
-address StubGenerator::generate_cont_thaw(const char* label, Continuation::thaw_kind kind) {
+address StubGenerator::generate_cont_thaw(StubGenStubId stub_id) {
if (!Continuations::enabled()) return nullptr;
- bool return_barrier = Continuation::is_thaw_return_barrier(kind);
- bool return_barrier_exception = Continuation::is_thaw_return_barrier_exception(kind);
-
- StubCodeMark mark(this, "StubRoutines", label);
+ bool return_barrier;
+ bool return_barrier_exception;
+ Continuation::thaw_kind kind;
+
+ switch (stub_id) {
+ case cont_thaw_id:
+ return_barrier = false;
+ return_barrier_exception = false;
+ kind = Continuation::thaw_top;
+ break;
+ case cont_returnBarrier_id:
+ return_barrier = true;
+ return_barrier_exception = false;
+ kind = Continuation::thaw_return_barrier;
+ break;
+ case cont_returnBarrierExc_id:
+ return_barrier = true;
+ return_barrier_exception = true;
+ kind = Continuation::thaw_return_barrier_exception;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
// TODO: Handle Valhalla return types. May require generating different return barriers.
@@ -3769,22 +3903,23 @@ address StubGenerator::generate_cont_thaw(const char* label, Continuation::thaw_
}
address StubGenerator::generate_cont_thaw() {
- return generate_cont_thaw("Cont thaw", Continuation::thaw_top);
+ return generate_cont_thaw(StubGenStubId::cont_thaw_id);
}
// TODO: will probably need multiple return barriers depending on return type
address StubGenerator::generate_cont_returnBarrier() {
- return generate_cont_thaw("Cont thaw return barrier", Continuation::thaw_return_barrier);
+ return generate_cont_thaw(StubGenStubId::cont_returnBarrier_id);
}
address StubGenerator::generate_cont_returnBarrier_exception() {
- return generate_cont_thaw("Cont thaw return barrier exception", Continuation::thaw_return_barrier_exception);
+ return generate_cont_thaw(StubGenStubId::cont_returnBarrierExc_id);
}
address StubGenerator::generate_cont_preempt_stub() {
if (!Continuations::enabled()) return nullptr;
- StubCodeMark mark(this, "StubRoutines","Continuation preempt stub");
+ StubGenStubId stub_id = StubGenStubId::cont_preempt_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ reset_last_Java_frame(true);
@@ -3814,7 +3949,8 @@ address StubGenerator::generate_cont_preempt_stub() {
// exception handler for upcall stubs
address StubGenerator::generate_upcall_stub_exception_handler() {
- StubCodeMark mark(this, "StubRoutines", "upcall stub exception handler");
+ StubGenStubId stub_id = StubGenStubId::upcall_stub_exception_handler_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
// native caller has no idea how to handle exceptions
@@ -3834,7 +3970,8 @@ address StubGenerator::generate_upcall_stub_exception_handler() {
// j_rarg0 = jobject receiver
// rbx = result
address StubGenerator::generate_upcall_stub_load_target() {
- StubCodeMark mark(this, "StubRoutines", "upcall_stub_load_target");
+ StubGenStubId stub_id = StubGenStubId::upcall_stub_load_target_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ resolve_global_jobject(j_rarg0, r15_thread, rscratch1);
@@ -3852,28 +3989,29 @@ address StubGenerator::generate_upcall_stub_load_target() {
return start;
}
-address StubGenerator::generate_lookup_secondary_supers_table_stub(u1 super_klass_index) {
- StubCodeMark mark(this, "StubRoutines", "lookup_secondary_supers_table");
-
- address start = __ pc();
+void StubGenerator::generate_lookup_secondary_supers_table_stub() {
+ StubGenStubId stub_id = StubGenStubId::lookup_secondary_supers_table_id;
+ StubCodeMark mark(this, stub_id);
const Register
r_super_klass = rax,
r_sub_klass = rsi,
result = rdi;
- __ lookup_secondary_supers_table_const(r_sub_klass, r_super_klass,
- rdx, rcx, rbx, r11, // temps
- result,
- super_klass_index);
- __ ret(0);
-
- return start;
+ for (int slot = 0; slot < Klass::SECONDARY_SUPERS_TABLE_SIZE; slot++) {
+ StubRoutines::_lookup_secondary_supers_table_stubs[slot] = __ pc();
+ __ lookup_secondary_supers_table_const(r_sub_klass, r_super_klass,
+ rdx, rcx, rbx, r11, // temps
+ result,
+ slot);
+ __ ret(0);
+ }
}
// Slow path implementation for UseSecondarySupersTable.
address StubGenerator::generate_lookup_secondary_supers_table_slow_path_stub() {
- StubCodeMark mark(this, "StubRoutines", "lookup_secondary_supers_table");
+ StubGenStubId stub_id = StubGenStubId::lookup_secondary_supers_table_slow_path_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
@@ -3946,10 +4084,10 @@ void StubGenerator::generate_initial_stubs() {
StubRoutines::x86::_d2i_fixup = generate_d2i_fixup();
StubRoutines::x86::_d2l_fixup = generate_d2l_fixup();
- StubRoutines::x86::_float_sign_mask = generate_fp_mask("float_sign_mask", 0x7FFFFFFF7FFFFFFF);
- StubRoutines::x86::_float_sign_flip = generate_fp_mask("float_sign_flip", 0x8000000080000000);
- StubRoutines::x86::_double_sign_mask = generate_fp_mask("double_sign_mask", 0x7FFFFFFFFFFFFFFF);
- StubRoutines::x86::_double_sign_flip = generate_fp_mask("double_sign_flip", 0x8000000000000000);
+ StubRoutines::x86::_float_sign_mask = generate_fp_mask(StubGenStubId::float_sign_mask_id, 0x7FFFFFFF7FFFFFFF);
+ StubRoutines::x86::_float_sign_flip = generate_fp_mask(StubGenStubId::float_sign_flip_id, 0x8000000080000000);
+ StubRoutines::x86::_double_sign_mask = generate_fp_mask(StubGenStubId::double_sign_mask_id, 0x7FFFFFFFFFFFFFFF);
+ StubRoutines::x86::_double_sign_flip = generate_fp_mask(StubGenStubId::double_sign_flip_id, 0x8000000000000000);
if (UseCRC32Intrinsics) {
// set table address before stub generation which use it
@@ -3995,10 +4133,6 @@ void StubGenerator::generate_final_stubs() {
StubRoutines::_verify_oop_subroutine_entry = generate_verify_oop();
}
- // data cache line writeback
- StubRoutines::_data_cache_writeback = generate_data_cache_writeback();
- StubRoutines::_data_cache_writeback_sync = generate_data_cache_writeback_sync();
-
// arraycopy stubs used by compilers
generate_arraycopy_stubs();
@@ -4007,6 +4141,15 @@ void StubGenerator::generate_final_stubs() {
StubRoutines::_method_entry_barrier = generate_method_entry_barrier();
}
+#ifdef COMPILER2
+ if (UseSecondarySupersTable) {
+ StubRoutines::_lookup_secondary_supers_table_slow_path_stub = generate_lookup_secondary_supers_table_slow_path_stub();
+ if (! InlineSecondarySupersTest) {
+ generate_lookup_secondary_supers_table_stub();
+ }
+ }
+#endif // COMPILER2
+
if (UseVectorizedMismatchIntrinsic) {
StubRoutines::_vectorizedMismatch = generate_vectorizedMismatch();
}
@@ -4020,42 +4163,42 @@ void StubGenerator::generate_compiler_stubs() {
// Entry points that are C2 compiler specific.
- StubRoutines::x86::_vector_float_sign_mask = generate_vector_mask("vector_float_sign_mask", 0x7FFFFFFF7FFFFFFF);
- StubRoutines::x86::_vector_float_sign_flip = generate_vector_mask("vector_float_sign_flip", 0x8000000080000000);
- StubRoutines::x86::_vector_double_sign_mask = generate_vector_mask("vector_double_sign_mask", 0x7FFFFFFFFFFFFFFF);
- StubRoutines::x86::_vector_double_sign_flip = generate_vector_mask("vector_double_sign_flip", 0x8000000000000000);
- StubRoutines::x86::_vector_all_bits_set = generate_vector_mask("vector_all_bits_set", 0xFFFFFFFFFFFFFFFF);
- StubRoutines::x86::_vector_int_mask_cmp_bits = generate_vector_mask("vector_int_mask_cmp_bits", 0x0000000100000001);
- StubRoutines::x86::_vector_short_to_byte_mask = generate_vector_mask("vector_short_to_byte_mask", 0x00ff00ff00ff00ff);
- StubRoutines::x86::_vector_byte_perm_mask = generate_vector_byte_perm_mask("vector_byte_perm_mask");
- StubRoutines::x86::_vector_int_to_byte_mask = generate_vector_mask("vector_int_to_byte_mask", 0x000000ff000000ff);
- StubRoutines::x86::_vector_int_to_short_mask = generate_vector_mask("vector_int_to_short_mask", 0x0000ffff0000ffff);
- StubRoutines::x86::_vector_32_bit_mask = generate_vector_custom_i32("vector_32_bit_mask", Assembler::AVX_512bit,
+ StubRoutines::x86::_vector_float_sign_mask = generate_vector_mask(StubGenStubId::vector_float_sign_mask_id, 0x7FFFFFFF7FFFFFFF);
+ StubRoutines::x86::_vector_float_sign_flip = generate_vector_mask(StubGenStubId::vector_float_sign_flip_id, 0x8000000080000000);
+ StubRoutines::x86::_vector_double_sign_mask = generate_vector_mask(StubGenStubId::vector_double_sign_mask_id, 0x7FFFFFFFFFFFFFFF);
+ StubRoutines::x86::_vector_double_sign_flip = generate_vector_mask(StubGenStubId::vector_double_sign_flip_id, 0x8000000000000000);
+ StubRoutines::x86::_vector_all_bits_set = generate_vector_mask(StubGenStubId::vector_all_bits_set_id, 0xFFFFFFFFFFFFFFFF);
+ StubRoutines::x86::_vector_int_mask_cmp_bits = generate_vector_mask(StubGenStubId::vector_int_mask_cmp_bits_id, 0x0000000100000001);
+ StubRoutines::x86::_vector_short_to_byte_mask = generate_vector_mask(StubGenStubId::vector_short_to_byte_mask_id, 0x00ff00ff00ff00ff);
+ StubRoutines::x86::_vector_byte_perm_mask = generate_vector_byte_perm_mask();
+ StubRoutines::x86::_vector_int_to_byte_mask = generate_vector_mask(StubGenStubId::vector_int_to_byte_mask_id, 0x000000ff000000ff);
+ StubRoutines::x86::_vector_int_to_short_mask = generate_vector_mask(StubGenStubId::vector_int_to_short_mask_id, 0x0000ffff0000ffff);
+ StubRoutines::x86::_vector_32_bit_mask = generate_vector_custom_i32(StubGenStubId::vector_32_bit_mask_id, Assembler::AVX_512bit,
0xFFFFFFFF, 0, 0, 0);
- StubRoutines::x86::_vector_64_bit_mask = generate_vector_custom_i32("vector_64_bit_mask", Assembler::AVX_512bit,
+ StubRoutines::x86::_vector_64_bit_mask = generate_vector_custom_i32(StubGenStubId::vector_64_bit_mask_id, Assembler::AVX_512bit,
0xFFFFFFFF, 0xFFFFFFFF, 0, 0);
- StubRoutines::x86::_vector_int_shuffle_mask = generate_vector_mask("vector_int_shuffle_mask", 0x0302010003020100);
- StubRoutines::x86::_vector_byte_shuffle_mask = generate_vector_byte_shuffle_mask("vector_byte_shuffle_mask");
- StubRoutines::x86::_vector_short_shuffle_mask = generate_vector_mask("vector_short_shuffle_mask", 0x0100010001000100);
- StubRoutines::x86::_vector_long_shuffle_mask = generate_vector_mask("vector_long_shuffle_mask", 0x0000000100000000);
- StubRoutines::x86::_vector_long_sign_mask = generate_vector_mask("vector_long_sign_mask", 0x8000000000000000);
- StubRoutines::x86::_vector_iota_indices = generate_iota_indices("iota_indices");
- StubRoutines::x86::_vector_count_leading_zeros_lut = generate_count_leading_zeros_lut("count_leading_zeros_lut");
- StubRoutines::x86::_vector_reverse_bit_lut = generate_vector_reverse_bit_lut("reverse_bit_lut");
- StubRoutines::x86::_vector_reverse_byte_perm_mask_long = generate_vector_reverse_byte_perm_mask_long("perm_mask_long");
- StubRoutines::x86::_vector_reverse_byte_perm_mask_int = generate_vector_reverse_byte_perm_mask_int("perm_mask_int");
- StubRoutines::x86::_vector_reverse_byte_perm_mask_short = generate_vector_reverse_byte_perm_mask_short("perm_mask_short");
+ StubRoutines::x86::_vector_int_shuffle_mask = generate_vector_mask(StubGenStubId::vector_int_shuffle_mask_id, 0x0302010003020100);
+ StubRoutines::x86::_vector_byte_shuffle_mask = generate_vector_byte_shuffle_mask();
+ StubRoutines::x86::_vector_short_shuffle_mask = generate_vector_mask(StubGenStubId::vector_short_shuffle_mask_id, 0x0100010001000100);
+ StubRoutines::x86::_vector_long_shuffle_mask = generate_vector_mask(StubGenStubId::vector_long_shuffle_mask_id, 0x0000000100000000);
+ StubRoutines::x86::_vector_long_sign_mask = generate_vector_mask(StubGenStubId::vector_long_sign_mask_id, 0x8000000000000000);
+ StubRoutines::x86::_vector_iota_indices = generate_iota_indices();
+ StubRoutines::x86::_vector_count_leading_zeros_lut = generate_count_leading_zeros_lut();
+ StubRoutines::x86::_vector_reverse_bit_lut = generate_vector_reverse_bit_lut();
+ StubRoutines::x86::_vector_reverse_byte_perm_mask_long = generate_vector_reverse_byte_perm_mask_long();
+ StubRoutines::x86::_vector_reverse_byte_perm_mask_int = generate_vector_reverse_byte_perm_mask_int();
+ StubRoutines::x86::_vector_reverse_byte_perm_mask_short = generate_vector_reverse_byte_perm_mask_short();
if (VM_Version::supports_avx2() && !VM_Version::supports_avx512vl()) {
- StubRoutines::x86::_compress_perm_table32 = generate_compress_perm_table("compress_perm_table32", 32);
- StubRoutines::x86::_compress_perm_table64 = generate_compress_perm_table("compress_perm_table64", 64);
- StubRoutines::x86::_expand_perm_table32 = generate_expand_perm_table("expand_perm_table32", 32);
- StubRoutines::x86::_expand_perm_table64 = generate_expand_perm_table("expand_perm_table64", 64);
+ StubRoutines::x86::_compress_perm_table32 = generate_compress_perm_table(StubGenStubId::compress_perm_table32_id);
+ StubRoutines::x86::_compress_perm_table64 = generate_compress_perm_table(StubGenStubId::compress_perm_table64_id);
+ StubRoutines::x86::_expand_perm_table32 = generate_expand_perm_table(StubGenStubId::expand_perm_table32_id);
+ StubRoutines::x86::_expand_perm_table64 = generate_expand_perm_table(StubGenStubId::expand_perm_table64_id);
}
if (VM_Version::supports_avx2() && !VM_Version::supports_avx512_vpopcntdq()) {
// lut implementation influenced by counting 1s algorithm from section 5-1 of Hackers' Delight.
- StubRoutines::x86::_vector_popcount_lut = generate_popcount_avx_lut("popcount_lut");
+ StubRoutines::x86::_vector_popcount_lut = generate_popcount_avx_lut();
}
generate_aes_stubs();
@@ -4066,6 +4209,10 @@ void StubGenerator::generate_compiler_stubs() {
generate_sha3_stubs();
+ // data cache line writeback
+ StubRoutines::_data_cache_writeback = generate_data_cache_writeback();
+ StubRoutines::_data_cache_writeback_sync = generate_data_cache_writeback_sync();
+
#ifdef COMPILER2
if ((UseAVX == 2) && EnableX86ECoreOpts) {
generate_string_indexof(StubRoutines::_string_indexof_array);
@@ -4086,15 +4233,15 @@ void StubGenerator::generate_compiler_stubs() {
}
if (UseMD5Intrinsics) {
- StubRoutines::_md5_implCompress = generate_md5_implCompress(false, "md5_implCompress");
- StubRoutines::_md5_implCompressMB = generate_md5_implCompress(true, "md5_implCompressMB");
+ StubRoutines::_md5_implCompress = generate_md5_implCompress(StubGenStubId::md5_implCompress_id);
+ StubRoutines::_md5_implCompressMB = generate_md5_implCompress(StubGenStubId::md5_implCompressMB_id);
}
if (UseSHA1Intrinsics) {
StubRoutines::x86::_upper_word_mask_addr = generate_upper_word_mask();
StubRoutines::x86::_shuffle_byte_flip_mask_addr = generate_shuffle_byte_flip_mask();
- StubRoutines::_sha1_implCompress = generate_sha1_implCompress(false, "sha1_implCompress");
- StubRoutines::_sha1_implCompressMB = generate_sha1_implCompress(true, "sha1_implCompressMB");
+ StubRoutines::_sha1_implCompress = generate_sha1_implCompress(StubGenStubId::sha1_implCompress_id);
+ StubRoutines::_sha1_implCompressMB = generate_sha1_implCompress(StubGenStubId::sha1_implCompressMB_id);
}
if (UseSHA256Intrinsics) {
@@ -4107,15 +4254,15 @@ void StubGenerator::generate_compiler_stubs() {
}
StubRoutines::x86::_k256_W_adr = (address)StubRoutines::x86::_k256_W;
StubRoutines::x86::_pshuffle_byte_flip_mask_addr = generate_pshuffle_byte_flip_mask();
- StubRoutines::_sha256_implCompress = generate_sha256_implCompress(false, "sha256_implCompress");
- StubRoutines::_sha256_implCompressMB = generate_sha256_implCompress(true, "sha256_implCompressMB");
+ StubRoutines::_sha256_implCompress = generate_sha256_implCompress(StubGenStubId::sha256_implCompress_id);
+ StubRoutines::_sha256_implCompressMB = generate_sha256_implCompress(StubGenStubId::sha256_implCompressMB_id);
}
if (UseSHA512Intrinsics) {
StubRoutines::x86::_k512_W_addr = (address)StubRoutines::x86::_k512_W;
StubRoutines::x86::_pshuffle_byte_flip_mask_addr_sha512 = generate_pshuffle_byte_flip_mask_sha512();
- StubRoutines::_sha512_implCompress = generate_sha512_implCompress(false, "sha512_implCompress");
- StubRoutines::_sha512_implCompressMB = generate_sha512_implCompress(true, "sha512_implCompressMB");
+ StubRoutines::_sha512_implCompress = generate_sha512_implCompress(StubGenStubId::sha512_implCompress_id);
+ StubRoutines::_sha512_implCompressMB = generate_sha512_implCompress(StubGenStubId::sha512_implCompressMB_id);
}
if (UseBASE64Intrinsics) {
@@ -4157,14 +4304,6 @@ void StubGenerator::generate_compiler_stubs() {
StubRoutines::_bigIntegerRightShiftWorker = generate_bigIntegerRightShift();
StubRoutines::_bigIntegerLeftShiftWorker = generate_bigIntegerLeftShift();
}
- if (UseSecondarySupersTable) {
- StubRoutines::_lookup_secondary_supers_table_slow_path_stub = generate_lookup_secondary_supers_table_slow_path_stub();
- if (! InlineSecondarySupersTest) {
- for (int slot = 0; slot < Klass::SECONDARY_SUPERS_TABLE_SIZE; slot++) {
- StubRoutines::_lookup_secondary_supers_table_stubs[slot] = generate_lookup_secondary_supers_table_stub(slot);
- }
- }
- }
if (UseMontgomeryMultiplyIntrinsic) {
StubRoutines::_montgomeryMultiply
= CAST_FROM_FN_PTR(address, SharedRuntime::montgomery_multiply);
@@ -4263,29 +4402,28 @@ void StubGenerator::generate_compiler_stubs() {
#endif // COMPILER2_OR_JVMCI
}
-StubGenerator::StubGenerator(CodeBuffer* code, StubsKind kind) : StubCodeGenerator(code) {
- DEBUG_ONLY( _regs_in_thread = false; )
- switch(kind) {
- case Initial_stubs:
- generate_initial_stubs();
- break;
- case Continuation_stubs:
- generate_continuation_stubs();
- break;
- case Compiler_stubs:
- generate_compiler_stubs();
- break;
- case Final_stubs:
- generate_final_stubs();
- break;
- default:
- fatal("unexpected stubs kind: %d", kind);
- break;
- };
+StubGenerator::StubGenerator(CodeBuffer* code, StubGenBlobId blob_id) : StubCodeGenerator(code, blob_id) {
+ switch(blob_id) {
+ case initial_id:
+ generate_initial_stubs();
+ break;
+ case continuation_id:
+ generate_continuation_stubs();
+ break;
+ case compiler_id:
+ generate_compiler_stubs();
+ break;
+ case final_id:
+ generate_final_stubs();
+ break;
+ default:
+ fatal("unexpected blob id: %d", blob_id);
+ break;
+ };
}
-void StubGenerator_generate(CodeBuffer* code, StubCodeGenerator::StubsKind kind) {
- StubGenerator g(code, kind);
+void StubGenerator_generate(CodeBuffer* code, StubGenBlobId blob_id) {
+ StubGenerator g(code, blob_id);
}
#undef __
diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64.hpp b/src/hotspot/cpu/x86/stubGenerator_x86_64.hpp
index f883b6453a690..2263188216c41 100644
--- a/src/hotspot/cpu/x86/stubGenerator_x86_64.hpp
+++ b/src/hotspot/cpu/x86/stubGenerator_x86_64.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
#include "code/codeBlob.hpp"
#include "runtime/continuation.hpp"
#include "runtime/stubCodeGenerator.hpp"
+#include "runtime/stubRoutines.hpp"
// Stub Code definitions
@@ -87,29 +88,29 @@ class StubGenerator: public StubCodeGenerator {
address generate_d2i_fixup();
address generate_d2l_fixup();
- address generate_count_leading_zeros_lut(const char *stub_name);
- address generate_popcount_avx_lut(const char *stub_name);
- address generate_iota_indices(const char *stub_name);
- address generate_vector_reverse_bit_lut(const char *stub_name);
+ address generate_count_leading_zeros_lut();
+ address generate_popcount_avx_lut();
+ address generate_iota_indices();
+ address generate_vector_reverse_bit_lut();
- address generate_vector_reverse_byte_perm_mask_long(const char *stub_name);
- address generate_vector_reverse_byte_perm_mask_int(const char *stub_name);
- address generate_vector_reverse_byte_perm_mask_short(const char *stub_name);
- address generate_vector_byte_shuffle_mask(const char *stub_name);
+ address generate_vector_reverse_byte_perm_mask_long();
+ address generate_vector_reverse_byte_perm_mask_int();
+ address generate_vector_reverse_byte_perm_mask_short();
+ address generate_vector_byte_shuffle_mask();
- address generate_fp_mask(const char *stub_name, int64_t mask);
+ address generate_fp_mask(StubGenStubId stub_id, int64_t mask);
- address generate_compress_perm_table(const char *stub_name, int32_t esize);
+ address generate_compress_perm_table(StubGenStubId stub_id);
- address generate_expand_perm_table(const char *stub_name, int32_t esize);
+ address generate_expand_perm_table(StubGenStubId stub_id);
- address generate_vector_mask(const char *stub_name, int64_t mask);
+ address generate_vector_mask(StubGenStubId stub_id, int64_t mask);
- address generate_vector_byte_perm_mask(const char *stub_name);
+ address generate_vector_byte_perm_mask();
- address generate_vector_fp_mask(const char *stub_name, int64_t mask);
+ address generate_vector_fp_mask(StubGenStubId stub_id, int64_t mask);
- address generate_vector_custom_i32(const char *stub_name, Assembler::AvxVectorLen len,
+ address generate_vector_custom_i32(StubGenStubId stub_id, Assembler::AvxVectorLen len,
int32_t val0, int32_t val1, int32_t val2, int32_t val3,
int32_t val4 = 0, int32_t val5 = 0, int32_t val6 = 0, int32_t val7 = 0,
int32_t val8 = 0, int32_t val9 = 0, int32_t val10 = 0, int32_t val11 = 0,
@@ -179,12 +180,10 @@ class StubGenerator: public StubCodeGenerator {
// - If user sets AVX3Threshold=0, then special cases for small blocks sizes operate over
// 64 byte vector registers (ZMMs).
- address generate_disjoint_copy_avx3_masked(address* entry, const char *name, int shift,
- bool aligned, bool is_oop, bool dest_uninitialized);
+ address generate_disjoint_copy_avx3_masked(StubGenStubId stub_id, address* entry);
- address generate_conjoint_copy_avx3_masked(address* entry, const char *name, int shift,
- address nooverlap_target, bool aligned, bool is_oop,
- bool dest_uninitialized);
+ address generate_conjoint_copy_avx3_masked(StubGenStubId stub_id, address* entry,
+ address nooverlap_target);
void arraycopy_avx3_special_cases(XMMRegister xmm, KRegister mask, Register from,
Register to, Register count, int shift,
@@ -225,27 +224,21 @@ class StubGenerator: public StubCodeGenerator {
Register temp, int shift = Address::times_1, int offset = 0);
#endif // COMPILER2_OR_JVMCI
- address generate_disjoint_byte_copy(bool aligned, address* entry, const char *name);
+ address generate_disjoint_byte_copy(address* entry);
- address generate_conjoint_byte_copy(bool aligned, address nooverlap_target,
- address* entry, const char *name);
+ address generate_conjoint_byte_copy(address nooverlap_target, address* entry);
- address generate_disjoint_short_copy(bool aligned, address *entry, const char *name);
+ address generate_disjoint_short_copy(address *entry);
- address generate_fill(BasicType t, bool aligned, const char *name);
+ address generate_fill(StubGenStubId stub_id);
- address generate_conjoint_short_copy(bool aligned, address nooverlap_target,
- address *entry, const char *name);
- address generate_disjoint_int_oop_copy(bool aligned, bool is_oop, address* entry,
- const char *name, bool dest_uninitialized = false);
- address generate_conjoint_int_oop_copy(bool aligned, bool is_oop, address nooverlap_target,
- address *entry, const char *name,
- bool dest_uninitialized = false);
- address generate_disjoint_long_oop_copy(bool aligned, bool is_oop, address *entry,
- const char *name, bool dest_uninitialized = false);
- address generate_conjoint_long_oop_copy(bool aligned, bool is_oop,
- address nooverlap_target, address *entry,
- const char *name, bool dest_uninitialized = false);
+ address generate_conjoint_short_copy(address nooverlap_target, address *entry);
+ address generate_disjoint_int_oop_copy(StubGenStubId stub_id, address* entry);
+ address generate_conjoint_int_oop_copy(StubGenStubId stub_id, address nooverlap_target,
+ address *entry);
+ address generate_disjoint_long_oop_copy(StubGenStubId stub_id, address* entry);
+ address generate_conjoint_long_oop_copy(StubGenStubId stub_id, address nooverlap_target,
+ address *entry);
// Helper for generating a dynamic type check.
// Smashes no registers.
@@ -255,8 +248,7 @@ class StubGenerator: public StubCodeGenerator {
Label& L_success);
// Generate checkcasting array copy stub
- address generate_checkcast_copy(const char *name, address *entry,
- bool dest_uninitialized = false);
+ address generate_checkcast_copy(StubGenStubId stub_id, address *entry);
// Generate 'unsafe' array copy stub
// Though just as safe as the other stubs, it takes an unscaled
@@ -264,8 +256,7 @@ class StubGenerator: public StubCodeGenerator {
//
// Examines the alignment of the operands and dispatches
// to a long, int, short, or byte copy loop.
- address generate_unsafe_copy(const char *name,
- address byte_copy_entry, address short_copy_entry,
+ address generate_unsafe_copy(address byte_copy_entry, address short_copy_entry,
address int_copy_entry, address long_copy_entry);
// Generate 'unsafe' set memory stub
@@ -274,7 +265,7 @@ class StubGenerator: public StubCodeGenerator {
//
// Examines the alignment of the operands and dispatches
// to an int, short, or byte copy loop.
- address generate_unsafe_setmemory(const char *name, address byte_copy_entry);
+ address generate_unsafe_setmemory(address byte_copy_entry);
// Perform range checks on the proposed arraycopy.
// Kills temp, but nothing else.
@@ -288,8 +279,7 @@ class StubGenerator: public StubCodeGenerator {
Label& L_failed);
// Generate generic array copy stubs
- address generate_generic_copy(const char *name,
- address byte_copy_entry, address short_copy_entry,
+ address generate_generic_copy(address byte_copy_entry, address short_copy_entry,
address int_copy_entry, address oop_copy_entry,
address long_copy_entry, address checkcast_copy_entry);
@@ -304,19 +294,19 @@ class StubGenerator: public StubCodeGenerator {
// ofs and limit are use for multi-block byte array.
// int com.sun.security.provider.MD5.implCompress(byte[] b, int ofs)
- address generate_md5_implCompress(bool multi_block, const char *name);
+ address generate_md5_implCompress(StubGenStubId stub_id);
// SHA stubs
// ofs and limit are use for multi-block byte array.
// int com.sun.security.provider.DigestBase.implCompressMultiBlock(byte[] b, int ofs, int limit)
- address generate_sha1_implCompress(bool multi_block, const char *name);
+ address generate_sha1_implCompress(StubGenStubId stub_id);
// ofs and limit are use for multi-block byte array.
// int com.sun.security.provider.DigestBase.implCompressMultiBlock(byte[] b, int ofs, int limit)
- address generate_sha256_implCompress(bool multi_block, const char *name);
- address generate_sha512_implCompress(bool multi_block, const char *name);
+ address generate_sha256_implCompress(StubGenStubId stub_id);
+ address generate_sha512_implCompress(StubGenStubId stub_id);
// Mask for byte-swapping a couple of qwords in an XMM register using (v)pshufb.
address generate_pshuffle_byte_flip_mask_sha512();
@@ -499,7 +489,7 @@ class StubGenerator: public StubCodeGenerator {
// SHA3 stubs
void generate_sha3_stubs();
- address generate_sha3_implCompress(bool multiBlock, const char *name);
+ address generate_sha3_implCompress(StubGenStubId stub_id);
// BASE64 stubs
@@ -595,7 +585,7 @@ class StubGenerator: public StubCodeGenerator {
void generate_string_indexof(address *fnptrs);
#endif
- address generate_cont_thaw(const char* label, Continuation::thaw_kind kind);
+ address generate_cont_thaw(StubGenStubId stub_id);
address generate_cont_thaw();
// TODO: will probably need multiple return barriers depending on return type
@@ -604,6 +594,8 @@ class StubGenerator: public StubCodeGenerator {
address generate_cont_preempt_stub();
+ // TODO -- delete this as it is not implemented?
+ //
// Continuation point for throwing of implicit exceptions that are
// not handled in the current activation. Fabricates an exception
// oop and initiates normal exception dispatching in this
@@ -629,7 +621,7 @@ class StubGenerator: public StubCodeGenerator {
address generate_upcall_stub_load_target();
// Specialized stub implementations for UseSecondarySupersTable.
- address generate_lookup_secondary_supers_table_stub(u1 super_klass_index);
+ void generate_lookup_secondary_supers_table_stub();
// Slow path implementation for UseSecondarySupersTable.
address generate_lookup_secondary_supers_table_slow_path_stub();
@@ -642,8 +634,8 @@ class StubGenerator: public StubCodeGenerator {
void generate_compiler_stubs();
void generate_final_stubs();
- public:
- StubGenerator(CodeBuffer* code, StubsKind kind);
+public:
+ StubGenerator(CodeBuffer* code, StubGenBlobId blob_id);
};
#endif // CPU_X86_STUBGENERATOR_X86_64_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..8a2aeaa5887a6 100644
--- a/src/hotspot/cpu/x86/stubGenerator_x86_64_adler.cpp
+++ b/src/hotspot/cpu/x86/stubGenerator_x86_64_adler.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2021, 2023, Intel Corporation. All rights reserved.
+* Copyright (c) 2021, 2024, Intel Corporation. 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 "utilities/globalDefinitions.hpp"
@@ -67,7 +66,8 @@ address StubGenerator::generate_updateBytesAdler32() {
assert(UseAdler32Intrinsics, "");
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "updateBytesAdler32");
+ StubGenStubId stub_id = StubGenStubId::updateBytesAdler32_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
// Choose an appropriate LIMIT for inner loop based on the granularity
diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64_aes.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64_aes.cpp
index f14d368c376e1..26bf3f7d725e7 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"
@@ -250,7 +249,8 @@ void StubGenerator::generate_aes_stubs() {
// rax - number of processed bytes
address StubGenerator::generate_galoisCounterMode_AESCrypt() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "galoisCounterMode_AESCrypt");
+ StubGenStubId stub_id = StubGenStubId::galoisCounterMode_AESCrypt_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
const Register in = c_rarg0;
@@ -336,7 +336,8 @@ address StubGenerator::generate_galoisCounterMode_AESCrypt() {
// rax - number of processed bytes
address StubGenerator::generate_avx2_galoisCounterMode_AESCrypt() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "galoisCounterMode_AESCrypt");
+ StubGenStubId stub_id = StubGenStubId::galoisCounterMode_AESCrypt_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
const Register in = c_rarg0;
@@ -407,7 +408,8 @@ address StubGenerator::generate_avx2_galoisCounterMode_AESCrypt() {
// Vector AES Counter implementation
address StubGenerator::generate_counterMode_VectorAESCrypt() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "counterMode_AESCrypt");
+ StubGenStubId stub_id = StubGenStubId::counterMode_AESCrypt_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
const Register from = c_rarg0; // source array address
@@ -495,7 +497,8 @@ address StubGenerator::generate_counterMode_VectorAESCrypt() {
address StubGenerator::generate_counterMode_AESCrypt_Parallel() {
assert(UseAES, "need AES instructions and misaligned SSE support");
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "counterMode_AESCrypt");
+ StubGenStubId stub_id = StubGenStubId::counterMode_AESCrypt_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
const Register from = c_rarg0; // source array address
@@ -782,7 +785,8 @@ address StubGenerator::generate_counterMode_AESCrypt_Parallel() {
address StubGenerator::generate_cipherBlockChaining_decryptVectorAESCrypt() {
assert(VM_Version::supports_avx512_vaes(), "need AES instructions and misaligned SSE support");
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "cipherBlockChaining_decryptAESCrypt");
+ StubGenStubId stub_id = StubGenStubId::cipherBlockChaining_decryptAESCrypt_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
const Register from = c_rarg0; // source array address
@@ -1064,7 +1068,8 @@ address StubGenerator::generate_cipherBlockChaining_decryptVectorAESCrypt() {
address StubGenerator::generate_aescrypt_encryptBlock() {
assert(UseAES, "need AES instructions and misaligned SSE support");
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "aescrypt_encryptBlock");
+ StubGenStubId stub_id = StubGenStubId::aescrypt_encryptBlock_id;
+ StubCodeMark mark(this, stub_id);
Label L_doLast;
address start = __ pc();
@@ -1158,7 +1163,8 @@ address StubGenerator::generate_aescrypt_encryptBlock() {
address StubGenerator::generate_aescrypt_decryptBlock() {
assert(UseAES, "need AES instructions and misaligned SSE support");
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "aescrypt_decryptBlock");
+ StubGenStubId stub_id = StubGenStubId::aescrypt_decryptBlock_id;
+ StubCodeMark mark(this, stub_id);
Label L_doLast;
address start = __ pc();
@@ -1259,7 +1265,8 @@ address StubGenerator::generate_aescrypt_decryptBlock() {
address StubGenerator::generate_cipherBlockChaining_encryptAESCrypt() {
assert(UseAES, "need AES instructions and misaligned SSE support");
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "cipherBlockChaining_encryptAESCrypt");
+ StubGenStubId stub_id = StubGenStubId::cipherBlockChaining_encryptAESCrypt_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Label L_exit, L_key_192_256, L_key_256, L_loopTop_128, L_loopTop_192, L_loopTop_256;
@@ -1410,7 +1417,8 @@ address StubGenerator::generate_cipherBlockChaining_encryptAESCrypt() {
address StubGenerator::generate_cipherBlockChaining_decryptAESCrypt_Parallel() {
assert(UseAES, "need AES instructions and misaligned SSE support");
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "cipherBlockChaining_decryptAESCrypt");
+ StubGenStubId stub_id = StubGenStubId::cipherBlockChaining_decryptAESCrypt_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
const Register from = c_rarg0; // source array address
@@ -1652,7 +1660,8 @@ __ opc(xmm_result3, src_reg); \
address StubGenerator::generate_electronicCodeBook_encryptAESCrypt() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "electronicCodeBook_encryptAESCrypt");
+ StubGenStubId stub_id = StubGenStubId::electronicCodeBook_encryptAESCrypt_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
const Register from = c_rarg0; // source array address
@@ -1672,7 +1681,8 @@ address StubGenerator::generate_electronicCodeBook_encryptAESCrypt() {
address StubGenerator::generate_electronicCodeBook_decryptAESCrypt() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "electronicCodeBook_decryptAESCrypt");
+ StubGenStubId stub_id = StubGenStubId::electronicCodeBook_decryptAESCrypt_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
const Register from = c_rarg0; // source array address
diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64_arraycopy.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64_arraycopy.cpp
index c72c32e796d2d..ccc8e456d5717 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"
@@ -85,74 +84,51 @@ void StubGenerator::generate_arraycopy_stubs() {
address entry_jlong_arraycopy;
address entry_checkcast_arraycopy;
- StubRoutines::_jbyte_disjoint_arraycopy = generate_disjoint_byte_copy(false, &entry,
- "jbyte_disjoint_arraycopy");
- StubRoutines::_jbyte_arraycopy = generate_conjoint_byte_copy(false, entry, &entry_jbyte_arraycopy,
- "jbyte_arraycopy");
-
- StubRoutines::_jshort_disjoint_arraycopy = generate_disjoint_short_copy(false, &entry,
- "jshort_disjoint_arraycopy");
- StubRoutines::_jshort_arraycopy = generate_conjoint_short_copy(false, entry, &entry_jshort_arraycopy,
- "jshort_arraycopy");
-
- StubRoutines::_jint_disjoint_arraycopy = generate_disjoint_int_oop_copy(false, false, &entry,
- "jint_disjoint_arraycopy");
- StubRoutines::_jint_arraycopy = generate_conjoint_int_oop_copy(false, false, entry,
- &entry_jint_arraycopy, "jint_arraycopy");
-
- StubRoutines::_jlong_disjoint_arraycopy = generate_disjoint_long_oop_copy(false, false, &entry,
- "jlong_disjoint_arraycopy");
- StubRoutines::_jlong_arraycopy = generate_conjoint_long_oop_copy(false, false, entry,
- &entry_jlong_arraycopy, "jlong_arraycopy");
+ StubRoutines::_jbyte_disjoint_arraycopy = generate_disjoint_byte_copy(&entry);
+ StubRoutines::_jbyte_arraycopy = generate_conjoint_byte_copy(entry, &entry_jbyte_arraycopy);
+
+ StubRoutines::_jshort_disjoint_arraycopy = generate_disjoint_short_copy(&entry);
+ StubRoutines::_jshort_arraycopy = generate_conjoint_short_copy(entry, &entry_jshort_arraycopy);
+
+ StubRoutines::_jint_disjoint_arraycopy = generate_disjoint_int_oop_copy(StubGenStubId::jint_disjoint_arraycopy_id, &entry);
+ StubRoutines::_jint_arraycopy = generate_conjoint_int_oop_copy(StubGenStubId::jint_arraycopy_id, entry, &entry_jint_arraycopy);
+
+ StubRoutines::_jlong_disjoint_arraycopy = generate_disjoint_long_oop_copy(StubGenStubId::jlong_disjoint_arraycopy_id, &entry);
+ StubRoutines::_jlong_arraycopy = generate_conjoint_long_oop_copy(StubGenStubId::jlong_arraycopy_id, entry, &entry_jlong_arraycopy);
if (UseCompressedOops) {
- StubRoutines::_oop_disjoint_arraycopy = generate_disjoint_int_oop_copy(false, true, &entry,
- "oop_disjoint_arraycopy");
- StubRoutines::_oop_arraycopy = generate_conjoint_int_oop_copy(false, true, entry,
- &entry_oop_arraycopy, "oop_arraycopy");
- StubRoutines::_oop_disjoint_arraycopy_uninit = generate_disjoint_int_oop_copy(false, true, &entry,
- "oop_disjoint_arraycopy_uninit",
- /*dest_uninitialized*/true);
- StubRoutines::_oop_arraycopy_uninit = generate_conjoint_int_oop_copy(false, true, entry,
- nullptr, "oop_arraycopy_uninit",
- /*dest_uninitialized*/true);
+ StubRoutines::_oop_disjoint_arraycopy = generate_disjoint_int_oop_copy(StubGenStubId::oop_disjoint_arraycopy_id, &entry);
+ StubRoutines::_oop_arraycopy = generate_conjoint_int_oop_copy(StubGenStubId::oop_arraycopy_id, entry, &entry_oop_arraycopy);
+ StubRoutines::_oop_disjoint_arraycopy_uninit = generate_disjoint_int_oop_copy(StubGenStubId::oop_disjoint_arraycopy_uninit_id, &entry);
+ StubRoutines::_oop_arraycopy_uninit = generate_conjoint_int_oop_copy(StubGenStubId::oop_arraycopy_uninit_id, entry, nullptr);
} else {
- StubRoutines::_oop_disjoint_arraycopy = generate_disjoint_long_oop_copy(false, true, &entry,
- "oop_disjoint_arraycopy");
- StubRoutines::_oop_arraycopy = generate_conjoint_long_oop_copy(false, true, entry,
- &entry_oop_arraycopy, "oop_arraycopy");
- StubRoutines::_oop_disjoint_arraycopy_uninit = generate_disjoint_long_oop_copy(false, true, &entry,
- "oop_disjoint_arraycopy_uninit",
- /*dest_uninitialized*/true);
- StubRoutines::_oop_arraycopy_uninit = generate_conjoint_long_oop_copy(false, true, entry,
- nullptr, "oop_arraycopy_uninit",
- /*dest_uninitialized*/true);
- }
-
- StubRoutines::_checkcast_arraycopy = generate_checkcast_copy("checkcast_arraycopy", &entry_checkcast_arraycopy);
- StubRoutines::_checkcast_arraycopy_uninit = generate_checkcast_copy("checkcast_arraycopy_uninit", nullptr,
- /*dest_uninitialized*/true);
-
- StubRoutines::_unsafe_arraycopy = generate_unsafe_copy("unsafe_arraycopy",
- entry_jbyte_arraycopy,
+ StubRoutines::_oop_disjoint_arraycopy = generate_disjoint_long_oop_copy(StubGenStubId::oop_disjoint_arraycopy_id, &entry);
+ StubRoutines::_oop_arraycopy = generate_conjoint_long_oop_copy(StubGenStubId::oop_arraycopy_id, entry, &entry_oop_arraycopy);
+ StubRoutines::_oop_disjoint_arraycopy_uninit = generate_disjoint_long_oop_copy(StubGenStubId::oop_disjoint_arraycopy_uninit_id, &entry);
+ StubRoutines::_oop_arraycopy_uninit = generate_conjoint_long_oop_copy(StubGenStubId::oop_arraycopy_uninit_id, entry, nullptr);
+ }
+
+ StubRoutines::_checkcast_arraycopy = generate_checkcast_copy(StubGenStubId::checkcast_arraycopy_id, &entry_checkcast_arraycopy);
+ StubRoutines::_checkcast_arraycopy_uninit = generate_checkcast_copy(StubGenStubId::checkcast_arraycopy_uninit_id, nullptr);
+
+ StubRoutines::_unsafe_arraycopy = generate_unsafe_copy(entry_jbyte_arraycopy,
entry_jshort_arraycopy,
entry_jint_arraycopy,
entry_jlong_arraycopy);
- StubRoutines::_generic_arraycopy = generate_generic_copy("generic_arraycopy",
- entry_jbyte_arraycopy,
+ StubRoutines::_generic_arraycopy = generate_generic_copy(entry_jbyte_arraycopy,
entry_jshort_arraycopy,
entry_jint_arraycopy,
entry_oop_arraycopy,
entry_jlong_arraycopy,
entry_checkcast_arraycopy);
- StubRoutines::_jbyte_fill = generate_fill(T_BYTE, false, "jbyte_fill");
- StubRoutines::_jshort_fill = generate_fill(T_SHORT, false, "jshort_fill");
- StubRoutines::_jint_fill = generate_fill(T_INT, false, "jint_fill");
- StubRoutines::_arrayof_jbyte_fill = generate_fill(T_BYTE, true, "arrayof_jbyte_fill");
- StubRoutines::_arrayof_jshort_fill = generate_fill(T_SHORT, true, "arrayof_jshort_fill");
- StubRoutines::_arrayof_jint_fill = generate_fill(T_INT, true, "arrayof_jint_fill");
+ StubRoutines::_jbyte_fill = generate_fill(StubGenStubId::jbyte_fill_id);
+ StubRoutines::_jshort_fill = generate_fill(StubGenStubId::jshort_fill_id);
+ StubRoutines::_jint_fill = generate_fill(StubGenStubId::jint_fill_id);
+ StubRoutines::_arrayof_jbyte_fill = generate_fill(StubGenStubId::arrayof_jbyte_fill_id);
+ StubRoutines::_arrayof_jshort_fill = generate_fill(StubGenStubId::arrayof_jshort_fill_id);
+ StubRoutines::_arrayof_jint_fill = generate_fill(StubGenStubId::arrayof_jint_fill_id);
- StubRoutines::_unsafe_setmemory = generate_unsafe_setmemory("unsafe_setmemory", StubRoutines::_jbyte_fill);
+ StubRoutines::_unsafe_setmemory = generate_unsafe_setmemory(StubRoutines::_jbyte_fill);
// We don't generate specialized code for HeapWord-aligned source
// arrays, so just use the code we've already generated
@@ -508,11 +484,50 @@ void StubGenerator::copy_bytes_backward(Register from, Register dest,
// disjoint_copy_avx3_masked is set to the no-overlap entry point
// used by generate_conjoint_[byte/int/short/long]_copy().
//
-address StubGenerator::generate_disjoint_copy_avx3_masked(address* entry, const char *name,
- int shift, bool aligned, bool is_oop,
- bool dest_uninitialized) {
+address StubGenerator::generate_disjoint_copy_avx3_masked(StubGenStubId stub_id, address* entry) {
+ // aligned is always false -- x86_64 always uses the unaligned code
+ const bool aligned = false;
+ int shift;
+ bool is_oop;
+ bool dest_uninitialized;
+
+ switch (stub_id) {
+ case jbyte_disjoint_arraycopy_id:
+ shift = 0;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case jshort_disjoint_arraycopy_id:
+ shift = 1;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case jint_disjoint_arraycopy_id:
+ shift = 2;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case jlong_disjoint_arraycopy_id:
+ shift = 3;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case oop_disjoint_arraycopy_id:
+ shift = (UseCompressedOops ? 2 : 3);
+ is_oop = true;
+ dest_uninitialized = false;
+ break;
+ case oop_disjoint_arraycopy_uninit_id:
+ shift = (UseCompressedOops ? 2 : 3);
+ is_oop = true;
+ dest_uninitialized = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
int avx3threshold = VM_Version::avx3_threshold();
@@ -807,11 +822,50 @@ void StubGenerator::arraycopy_avx3_large(Register to, Register from, Register te
// c_rarg2 - element count, treated as ssize_t, can be zero
//
//
-address StubGenerator::generate_conjoint_copy_avx3_masked(address* entry, const char *name, int shift,
- address nooverlap_target, bool aligned,
- bool is_oop, bool dest_uninitialized) {
+address StubGenerator::generate_conjoint_copy_avx3_masked(StubGenStubId stub_id, address* entry, address nooverlap_target) {
+ // aligned is always false -- x86_64 always uses the unaligned code
+ const bool aligned = false;
+ int shift;
+ bool is_oop;
+ bool dest_uninitialized;
+
+ switch (stub_id) {
+ case jbyte_arraycopy_id:
+ shift = 0;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case jshort_arraycopy_id:
+ shift = 1;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case jint_arraycopy_id:
+ shift = 2;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case jlong_arraycopy_id:
+ shift = 3;
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case oop_arraycopy_id:
+ shift = (UseCompressedOops ? 2 : 3);
+ is_oop = true;
+ dest_uninitialized = false;
+ break;
+ case oop_arraycopy_uninit_id:
+ shift = (UseCompressedOops ? 2 : 3);
+ is_oop = true;
+ dest_uninitialized = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
int avx3threshold = VM_Version::avx3_threshold();
@@ -1263,9 +1317,7 @@ void StubGenerator::copy64_avx(Register dst, Register src, Register index, XMMRe
// Arguments:
-// aligned - true => Input and output aligned on a HeapWord == 8-byte boundary
-// ignored
-// name - stub name string
+// entry - location for return of (post-push) entry
//
// Inputs:
// c_rarg0 - source array address
@@ -1278,18 +1330,20 @@ void StubGenerator::copy64_avx(Register dst, Register src, Register index, XMMRe
// and stored atomically.
//
// Side Effects:
-// disjoint_byte_copy_entry is set to the no-overlap entry point
+// entry is set to the no-overlap entry point
// used by generate_conjoint_byte_copy().
//
-address StubGenerator::generate_disjoint_byte_copy(bool aligned, address* entry, const char *name) {
+address StubGenerator::generate_disjoint_byte_copy(address* entry) {
+ StubGenStubId stub_id = StubGenStubId::jbyte_disjoint_arraycopy_id;
+ // aligned is always false -- x86_64 always uses the unaligned code
+ const bool aligned = false;
#if COMPILER2_OR_JVMCI
if (VM_Version::supports_avx512vlbw() && VM_Version::supports_bmi2() && MaxVectorSize >= 32) {
- return generate_disjoint_copy_avx3_masked(entry, "jbyte_disjoint_arraycopy_avx3", 0,
- aligned, false, false);
+ return generate_disjoint_copy_avx3_masked(stub_id, entry);
}
#endif
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
DecoratorSet decorators = IN_HEAP | IS_ARRAY | ARRAYCOPY_DISJOINT;
@@ -1384,9 +1438,8 @@ __ BIND(L_exit);
// Arguments:
-// aligned - true => Input and output aligned on a HeapWord == 8-byte boundary
-// ignored
-// name - stub name string
+// entry - location for return of (post-push) entry
+// nooverlap_target - entry to branch to if no overlap detected
//
// Inputs:
// c_rarg0 - source array address
@@ -1398,16 +1451,17 @@ __ BIND(L_exit);
// dwords or qwords that span cache line boundaries will still be loaded
// and stored atomically.
//
-address StubGenerator::generate_conjoint_byte_copy(bool aligned, address nooverlap_target,
- address* entry, const char *name) {
+address StubGenerator::generate_conjoint_byte_copy(address nooverlap_target, address* entry) {
+ StubGenStubId stub_id = StubGenStubId::jbyte_arraycopy_id;
+ // aligned is always false -- x86_64 always uses the unaligned code
+ const bool aligned = false;
#if COMPILER2_OR_JVMCI
if (VM_Version::supports_avx512vlbw() && VM_Version::supports_bmi2() && MaxVectorSize >= 32) {
- return generate_conjoint_copy_avx3_masked(entry, "jbyte_conjoint_arraycopy_avx3", 0,
- nooverlap_target, aligned, false, false);
+ return generate_conjoint_copy_avx3_masked(stub_id, entry, nooverlap_target);
}
#endif
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
DecoratorSet decorators = IN_HEAP | IS_ARRAY;
@@ -1494,9 +1548,7 @@ address StubGenerator::generate_conjoint_byte_copy(bool aligned, address nooverl
// Arguments:
-// aligned - true => Input and output aligned on a HeapWord == 8-byte boundary
-// ignored
-// name - stub name string
+// entry - location for return of (post-push) entry
//
// Inputs:
// c_rarg0 - source array address
@@ -1509,19 +1561,21 @@ address StubGenerator::generate_conjoint_byte_copy(bool aligned, address nooverl
// and stored atomically.
//
// Side Effects:
-// disjoint_short_copy_entry is set to the no-overlap entry point
+// entry is set to the no-overlap entry point
// used by generate_conjoint_short_copy().
//
-address StubGenerator::generate_disjoint_short_copy(bool aligned, address *entry, const char *name) {
+address StubGenerator::generate_disjoint_short_copy(address *entry) {
+ StubGenStubId stub_id = StubGenStubId::jshort_disjoint_arraycopy_id;
+ // aligned is always false -- x86_64 always uses the unaligned code
+ const bool aligned = false;
#if COMPILER2_OR_JVMCI
if (VM_Version::supports_avx512vlbw() && VM_Version::supports_bmi2() && MaxVectorSize >= 32) {
- return generate_disjoint_copy_avx3_masked(entry, "jshort_disjoint_arraycopy_avx3", 1,
- aligned, false, false);
+ return generate_disjoint_copy_avx3_masked(stub_id, entry);
}
#endif
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
DecoratorSet decorators = IN_HEAP | IS_ARRAY | ARRAYCOPY_DISJOINT;
@@ -1608,9 +1662,41 @@ __ BIND(L_exit);
}
-address StubGenerator::generate_fill(BasicType t, bool aligned, const char *name) {
+address StubGenerator::generate_fill(StubGenStubId stub_id) {
+ BasicType t;
+ bool aligned;
+
+ switch (stub_id) {
+ case jbyte_fill_id:
+ t = T_BYTE;
+ aligned = false;
+ break;
+ case jshort_fill_id:
+ t = T_SHORT;
+ aligned = false;
+ break;
+ case jint_fill_id:
+ t = T_INT;
+ aligned = false;
+ break;
+ case arrayof_jbyte_fill_id:
+ t = T_BYTE;
+ aligned = true;
+ break;
+ case arrayof_jshort_fill_id:
+ t = T_SHORT;
+ aligned = true;
+ break;
+ case arrayof_jint_fill_id:
+ t = T_INT;
+ aligned = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
BLOCK_COMMENT("Entry:");
@@ -1637,9 +1723,8 @@ address StubGenerator::generate_fill(BasicType t, bool aligned, const char *name
// Arguments:
-// aligned - true => Input and output aligned on a HeapWord == 8-byte boundary
-// ignored
-// name - stub name string
+// entry - location for return of (post-push) entry
+// nooverlap_target - entry to branch to if no overlap detected
//
// Inputs:
// c_rarg0 - source array address
@@ -1651,16 +1736,18 @@ address StubGenerator::generate_fill(BasicType t, bool aligned, const char *name
// or qwords that span cache line boundaries will still be loaded
// and stored atomically.
//
-address StubGenerator::generate_conjoint_short_copy(bool aligned, address nooverlap_target,
- address *entry, const char *name) {
+address StubGenerator::generate_conjoint_short_copy(address nooverlap_target, address *entry) {
+ StubGenStubId stub_id = StubGenStubId::jshort_arraycopy_id;
+ // aligned is always false -- x86_64 always uses the unaligned code
+ const bool aligned = false;
#if COMPILER2_OR_JVMCI
if (VM_Version::supports_avx512vlbw() && VM_Version::supports_bmi2() && MaxVectorSize >= 32) {
- return generate_conjoint_copy_avx3_masked(entry, "jshort_conjoint_arraycopy_avx3", 1,
- nooverlap_target, aligned, false, false);
+ return generate_conjoint_copy_avx3_masked(stub_id, entry, nooverlap_target);
}
#endif
+
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
DecoratorSet decorators = IN_HEAP | IS_ARRAY;
@@ -1739,10 +1826,9 @@ address StubGenerator::generate_conjoint_short_copy(bool aligned, address noover
// Arguments:
-// aligned - true => Input and output aligned on a HeapWord == 8-byte boundary
-// ignored
-// is_oop - true => oop array, so generate store check code
-// name - stub name string
+// stub_id - unqiue id for stub to generate
+// entry - location for return of (post-push) entry
+// is_oop - true => oop array, so generate store check code
//
// Inputs:
// c_rarg0 - source array address
@@ -1757,18 +1843,39 @@ address StubGenerator::generate_conjoint_short_copy(bool aligned, address noover
// disjoint_int_copy_entry is set to the no-overlap entry point
// used by generate_conjoint_int_oop_copy().
//
-address StubGenerator::generate_disjoint_int_oop_copy(bool aligned, bool is_oop, address* entry,
- const char *name, bool dest_uninitialized) {
+address StubGenerator::generate_disjoint_int_oop_copy(StubGenStubId stub_id, address* entry) {
+ // aligned is always false -- x86_64 always uses the unaligned code
+ const bool aligned = false;
+ bool is_oop;
+ bool dest_uninitialized;
+ switch (stub_id) {
+ case StubGenStubId::jint_disjoint_arraycopy_id:
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case StubGenStubId::oop_disjoint_arraycopy_id:
+ assert(UseCompressedOops, "inconsistent oop copy size!");
+ is_oop = true;
+ dest_uninitialized = false;
+ break;
+ case StubGenStubId::oop_disjoint_arraycopy_uninit_id:
+ assert(UseCompressedOops, "inconsistent oop copy size!");
+ is_oop = true;
+ dest_uninitialized = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+
BarrierSetAssembler *bs = BarrierSet::barrier_set()->barrier_set_assembler();
#if COMPILER2_OR_JVMCI
if ((!is_oop || bs->supports_avx3_masked_arraycopy()) && VM_Version::supports_avx512vlbw() && VM_Version::supports_bmi2() && MaxVectorSize >= 32) {
- return generate_disjoint_copy_avx3_masked(entry, "jint_disjoint_arraycopy_avx3", 2,
- aligned, is_oop, dest_uninitialized);
+ return generate_disjoint_copy_avx3_masked(stub_id, entry);
}
#endif
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Label L_copy_bytes, L_copy_8_bytes, L_copy_4_bytes, L_exit;
@@ -1854,10 +1961,9 @@ __ BIND(L_exit);
// Arguments:
-// aligned - true => Input and output aligned on a HeapWord == 8-byte boundary
-// ignored
+// entry - location for return of (post-push) entry
+// nooverlap_target - entry to branch to if no overlap detected
// is_oop - true => oop array, so generate store check code
-// name - stub name string
//
// Inputs:
// c_rarg0 - source array address
@@ -1868,18 +1974,39 @@ __ BIND(L_exit);
// the hardware handle it. The two dwords within qwords that span
// cache line boundaries will still be loaded and stored atomically.
//
-address StubGenerator::generate_conjoint_int_oop_copy(bool aligned, bool is_oop, address nooverlap_target,
- address *entry, const char *name,
- bool dest_uninitialized) {
+address StubGenerator::generate_conjoint_int_oop_copy(StubGenStubId stub_id, address nooverlap_target, address *entry) {
+ // aligned is always false -- x86_64 always uses the unaligned code
+ const bool aligned = false;
+ bool is_oop;
+ bool dest_uninitialized;
+ switch (stub_id) {
+ case StubGenStubId::jint_arraycopy_id:
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case StubGenStubId::oop_arraycopy_id:
+ assert(UseCompressedOops, "inconsistent oop copy size!");
+ is_oop = true;
+ dest_uninitialized = false;
+ break;
+ case StubGenStubId::oop_arraycopy_uninit_id:
+ assert(UseCompressedOops, "inconsistent oop copy size!");
+ is_oop = true;
+ dest_uninitialized = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+
BarrierSetAssembler *bs = BarrierSet::barrier_set()->barrier_set_assembler();
#if COMPILER2_OR_JVMCI
if ((!is_oop || bs->supports_avx3_masked_arraycopy()) && VM_Version::supports_avx512vlbw() && VM_Version::supports_bmi2() && MaxVectorSize >= 32) {
- return generate_conjoint_copy_avx3_masked(entry, "jint_conjoint_arraycopy_avx3", 2,
- nooverlap_target, aligned, is_oop, dest_uninitialized);
+ return generate_conjoint_copy_avx3_masked(stub_id, entry, nooverlap_target);
}
#endif
+
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Label L_copy_bytes, L_copy_8_bytes, L_exit;
@@ -1969,10 +2096,7 @@ __ BIND(L_exit);
// Arguments:
-// aligned - true => Input and output aligned on a HeapWord boundary == 8 bytes
-// ignored
-// is_oop - true => oop array, so generate store check code
-// name - stub name string
+// entry - location for return of (post-push) entry
//
// Inputs:
// c_rarg0 - source array address
@@ -1983,17 +2107,39 @@ __ BIND(L_exit);
// disjoint_oop_copy_entry or disjoint_long_copy_entry is set to the
// no-overlap entry point used by generate_conjoint_long_oop_copy().
//
-address StubGenerator::generate_disjoint_long_oop_copy(bool aligned, bool is_oop, address *entry,
- const char *name, bool dest_uninitialized) {
+address StubGenerator::generate_disjoint_long_oop_copy(StubGenStubId stub_id, address *entry) {
+ // aligned is always false -- x86_64 always uses the unaligned code
+ const bool aligned = false;
+ bool is_oop;
+ bool dest_uninitialized;
+ switch (stub_id) {
+ case StubGenStubId::jlong_disjoint_arraycopy_id:
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case StubGenStubId::oop_disjoint_arraycopy_id:
+ assert(!UseCompressedOops, "inconsistent oop copy size!");
+ is_oop = true;
+ dest_uninitialized = false;
+ break;
+ case StubGenStubId::oop_disjoint_arraycopy_uninit_id:
+ assert(!UseCompressedOops, "inconsistent oop copy size!");
+ is_oop = true;
+ dest_uninitialized = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+
BarrierSetAssembler *bs = BarrierSet::barrier_set()->barrier_set_assembler();
#if COMPILER2_OR_JVMCI
if ((!is_oop || bs->supports_avx3_masked_arraycopy()) && VM_Version::supports_avx512vlbw() && VM_Version::supports_bmi2() && MaxVectorSize >= 32) {
- return generate_disjoint_copy_avx3_masked(entry, "jlong_disjoint_arraycopy_avx3", 3,
- aligned, is_oop, dest_uninitialized);
+ return generate_disjoint_copy_avx3_masked(stub_id, entry);
}
#endif
+
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Label L_copy_bytes, L_copy_8_bytes, L_exit;
@@ -2085,28 +2231,48 @@ address StubGenerator::generate_disjoint_long_oop_copy(bool aligned, bool is_oop
// Arguments:
-// aligned - true => Input and output aligned on a HeapWord boundary == 8 bytes
-// ignored
+// entry - location for return of (post-push) entry
+// nooverlap_target - entry to branch to if no overlap detected
// is_oop - true => oop array, so generate store check code
-// name - stub name string
//
// Inputs:
// c_rarg0 - source array address
// c_rarg1 - destination array address
// c_rarg2 - element count, treated as ssize_t, can be zero
//
-address StubGenerator::generate_conjoint_long_oop_copy(bool aligned, bool is_oop, address nooverlap_target,
- address *entry, const char *name,
- bool dest_uninitialized) {
+address StubGenerator::generate_conjoint_long_oop_copy(StubGenStubId stub_id, address nooverlap_target, address *entry) {
+ // aligned is always false -- x86_64 always uses the unaligned code
+ const bool aligned = false;
+ bool is_oop;
+ bool dest_uninitialized;
+ switch (stub_id) {
+ case StubGenStubId::jlong_arraycopy_id:
+ is_oop = false;
+ dest_uninitialized = false;
+ break;
+ case StubGenStubId::oop_arraycopy_id:
+ assert(!UseCompressedOops, "inconsistent oop copy size!");
+ is_oop = true;
+ dest_uninitialized = false;
+ break;
+ case StubGenStubId::oop_arraycopy_uninit_id:
+ assert(!UseCompressedOops, "inconsistent oop copy size!");
+ is_oop = true;
+ dest_uninitialized = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+
BarrierSetAssembler *bs = BarrierSet::barrier_set()->barrier_set_assembler();
#if COMPILER2_OR_JVMCI
if ((!is_oop || bs->supports_avx3_masked_arraycopy()) && VM_Version::supports_avx512vlbw() && VM_Version::supports_bmi2() && MaxVectorSize >= 32) {
- return generate_conjoint_copy_avx3_masked(entry, "jlong_conjoint_arraycopy_avx3", 3,
- nooverlap_target, aligned, is_oop, dest_uninitialized);
+ return generate_conjoint_copy_avx3_masked(stub_id, entry, nooverlap_target);
}
#endif
+
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Label L_copy_bytes, L_copy_8_bytes, L_exit;
@@ -2225,7 +2391,19 @@ void StubGenerator::generate_type_check(Register sub_klass,
// rax == 0 - success
// rax == -1^K - failure, where K is partial transfer count
//
-address StubGenerator::generate_checkcast_copy(const char *name, address *entry, bool dest_uninitialized) {
+address StubGenerator::generate_checkcast_copy(StubGenStubId stub_id, address *entry) {
+
+ bool dest_uninitialized;
+ switch (stub_id) {
+ case StubGenStubId::checkcast_arraycopy_id:
+ dest_uninitialized = false;
+ break;
+ case StubGenStubId::checkcast_arraycopy_uninit_id:
+ dest_uninitialized = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
Label L_load_element, L_store_element, L_do_card_marks, L_done;
@@ -2255,7 +2433,7 @@ address StubGenerator::generate_checkcast_copy(const char *name, address *entry,
// checked.
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ enter(); // required for proper stackwalking of RuntimeStub frame
@@ -2431,8 +2609,7 @@ address StubGenerator::generate_checkcast_copy(const char *name, address *entry,
// Examines the alignment of the operands and dispatches
// to a long, int, short, or byte copy loop.
//
-address StubGenerator::generate_unsafe_copy(const char *name,
- address byte_copy_entry, address short_copy_entry,
+address StubGenerator::generate_unsafe_copy(address byte_copy_entry, address short_copy_entry,
address int_copy_entry, address long_copy_entry) {
Label L_long_aligned, L_int_aligned, L_short_aligned;
@@ -2446,7 +2623,8 @@ address StubGenerator::generate_unsafe_copy(const char *name,
const Register bits = rax; // test copy of low bits
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubGenStubId stub_id = StubGenStubId::unsafe_arraycopy_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ enter(); // required for proper stackwalking of RuntimeStub frame
@@ -2579,10 +2757,10 @@ static void do_setmemory_atomic_loop(USM_TYPE type, Register dest,
// Examines the alignment of the operands and dispatches
// to an int, short, or byte fill loop.
//
-address StubGenerator::generate_unsafe_setmemory(const char *name,
- address unsafe_byte_fill) {
+address StubGenerator::generate_unsafe_setmemory(address unsafe_byte_fill) {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubGenStubId stub_id = StubGenStubId::unsafe_setmemory_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ enter(); // required for proper stackwalking of RuntimeStub frame
@@ -2725,8 +2903,7 @@ void StubGenerator::arraycopy_range_checks(Register src, // source array oop
// rax == 0 - success
// rax == -1^K - failure, where K is partial transfer count
//
-address StubGenerator::generate_generic_copy(const char *name,
- address byte_copy_entry, address short_copy_entry,
+address StubGenerator::generate_generic_copy(address byte_copy_entry, address short_copy_entry,
address int_copy_entry, address oop_copy_entry,
address long_copy_entry, address checkcast_copy_entry) {
@@ -2752,7 +2929,8 @@ address StubGenerator::generate_generic_copy(const char *name,
if (advance < 0) advance += modulus;
if (advance > 0) __ nop(advance);
}
- StubCodeMark mark(this, "StubRoutines", name);
+ StubGenStubId stub_id = StubGenStubId::generic_arraycopy_id;
+ StubCodeMark mark(this, stub_id);
// Short-hop target to L_failed. Makes for denser prologue code.
__ BIND(L_failed_0);
diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64_chacha.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64_chacha.cpp
index 47354f4fc7cf7..f7fb402407772 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"
@@ -114,7 +112,8 @@ void StubGenerator::generate_chacha_stubs() {
/* The 2-block AVX/AVX2-enabled ChaCha20 block function implementation */
address StubGenerator::generate_chacha20Block_avx() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "chacha20Block");
+ StubGenStubId stub_id = StubGenStubId::chacha20Block_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Label L_twoRounds;
@@ -302,7 +301,8 @@ address StubGenerator::generate_chacha20Block_avx() {
/* The 4-block AVX512-enabled ChaCha20 block function implementation */
address StubGenerator::generate_chacha20Block_avx512() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "chacha20Block");
+ StubGenStubId stub_id = StubGenStubId::chacha20Block_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Label L_twoRounds;
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..3f037a919d784 100644
--- a/src/hotspot/cpu/x86/stubGenerator_x86_64_cos.cpp
+++ b/src/hotspot/cpu/x86/stubGenerator_x86_64_cos.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2021, Intel Corporation. All rights reserved.
+ * Copyright (c) 2016, 2024, Intel Corporation. All rights reserved.
* Intel Math Library (LIBM) Source Code
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -24,7 +24,6 @@
*
*/
-#include "precompiled.hpp"
#include "macroAssembler_x86.hpp"
#include "stubGenerator_x86_64.hpp"
@@ -174,7 +173,8 @@
#define __ _masm->
address StubGenerator::generate_libmCos() {
- StubCodeMark mark(this, "StubRoutines", "libmCos");
+ StubGenStubId stub_id = StubGenStubId::dcos_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Label L_2TAG_PACKET_0_0_1, L_2TAG_PACKET_1_0_1, L_2TAG_PACKET_2_0_1, L_2TAG_PACKET_3_0_1;
diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64_exp.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64_exp.cpp
index f716e2a7282d9..b48ed80788b17 100644
--- a/src/hotspot/cpu/x86/stubGenerator_x86_64_exp.cpp
+++ b/src/hotspot/cpu/x86/stubGenerator_x86_64_exp.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2016, 2021, Intel Corporation. All rights reserved.
+* Copyright (c) 2016, 2024, Intel Corporation. All rights reserved.
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
* Intel Math Library (LIBM) Source Code
*
@@ -25,7 +25,6 @@
*
*/
-#include "precompiled.hpp"
#include "macroAssembler_x86.hpp"
#include "stubGenerator_x86_64.hpp"
@@ -166,7 +165,8 @@ ATTRIBUTE_ALIGNED(4) static const juint _INF[] =
#define __ _masm->
address StubGenerator::generate_libmExp() {
- StubCodeMark mark(this, "StubRoutines", "libmExp");
+ StubGenStubId stub_id = StubGenStubId::dexp_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Label L_2TAG_PACKET_0_0_2, L_2TAG_PACKET_1_0_2, L_2TAG_PACKET_2_0_2, L_2TAG_PACKET_3_0_2;
diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64_fmod.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64_fmod.cpp
index 26b5b594424d2..958f65c883ac4 100644
--- a/src/hotspot/cpu/x86/stubGenerator_x86_64_fmod.cpp
+++ b/src/hotspot/cpu/x86/stubGenerator_x86_64_fmod.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2023, Intel Corporation. All rights reserved.
+ * Copyright (c) 2023, 2024, Intel Corporation. All rights reserved.
* Intel Math Library (LIBM) Source Code
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -24,7 +24,6 @@
*
*/
-#include "precompiled.hpp"
#include "macroAssembler_x86.hpp"
#include "stubGenerator_x86_64.hpp"
#include "runtime/stubRoutines.hpp"
@@ -74,7 +73,8 @@ ATTRIBUTE_ALIGNED(32) static const uint64_t CONST_e307[] = {
address StubGenerator::generate_libmFmod() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "libmFmod");
+ StubGenStubId stub_id = StubGenStubId::fmod_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ enter(); // required for proper stackwalking of RuntimeStub frame
diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64_ghash.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64_ghash.cpp
index 5a9b084841376..6d1f9fbd5a18f 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"
@@ -84,7 +82,8 @@ void StubGenerator::generate_ghash_stubs() {
address StubGenerator::generate_ghash_processBlocks() {
__ align(CodeEntryAlignment);
Label L_ghash_loop, L_exit;
- StubCodeMark mark(this, "StubRoutines", "ghash_processBlocks");
+ StubGenStubId stub_id = StubGenStubId::ghash_processBlocks_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
const Register state = c_rarg0;
@@ -220,7 +219,8 @@ address StubGenerator::generate_ghash_processBlocks() {
address StubGenerator::generate_avx_ghash_processBlocks() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "ghash_processBlocks");
+ StubGenStubId stub_id = StubGenStubId::ghash_processBlocks_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
// arguments
diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64_log.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64_log.cpp
index c9d339680c44c..6aacfaaea03de 100644
--- a/src/hotspot/cpu/x86/stubGenerator_x86_64_log.cpp
+++ b/src/hotspot/cpu/x86/stubGenerator_x86_64_log.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2016, 2021, Intel Corporation. All rights reserved.
+* Copyright (c) 2016, 2024, Intel Corporation. All rights reserved.
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
* Intel Math Library (LIBM) Source Code
*
@@ -25,7 +25,6 @@
*
*/
-#include "precompiled.hpp"
#include "macroAssembler_x86.hpp"
#include "stubGenerator_x86_64.hpp"
@@ -177,7 +176,8 @@ ATTRIBUTE_ALIGNED(16) static const juint _coeff[] =
#define __ _masm->
address StubGenerator::generate_libmLog() {
- StubCodeMark mark(this, "StubRoutines", "libmLog");
+ StubGenStubId stub_id = StubGenStubId::dlog_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Label L_2TAG_PACKET_0_0_2, L_2TAG_PACKET_1_0_2, L_2TAG_PACKET_2_0_2, L_2TAG_PACKET_3_0_2;
@@ -515,7 +515,8 @@ ATTRIBUTE_ALIGNED(16) static const juint _coeff_log10[] =
};
address StubGenerator::generate_libmLog10() {
- StubCodeMark mark(this, "StubRoutines", "libmLog10");
+ StubGenStubId stub_id = StubGenStubId::dlog10_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Label L_2TAG_PACKET_0_0_2, L_2TAG_PACKET_1_0_2, L_2TAG_PACKET_2_0_2, L_2TAG_PACKET_3_0_2;
diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64_poly1305.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64_poly1305.cpp
index 6d3da2e6c759f..dfd4ca21dbd28 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"
@@ -911,7 +910,8 @@ void StubGenerator::poly1305_process_blocks_avx512(
// and accumulator will point to the current accumulator value
address StubGenerator::generate_poly1305_processBlocks() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "poly1305_processBlocks");
+ StubGenStubId stub_id = StubGenStubId::poly1305_processBlocks_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ enter();
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..b75162dbb47ad 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"
@@ -238,7 +237,8 @@ void montgomeryMultiply(const Register aLimbs, const Register bLimbs, const Regi
address StubGenerator::generate_intpoly_montgomeryMult_P256() {
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "intpoly_montgomeryMult_P256");
+ StubGenStubId stub_id = StubGenStubId::intpoly_montgomeryMult_P256_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ enter();
@@ -296,7 +296,8 @@ address StubGenerator::generate_intpoly_assign() {
// Special Cases 5, 10, 14, 16, 19
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "intpoly_assign");
+ StubGenStubId stub_id = StubGenStubId::intpoly_assign_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
__ enter();
diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64_pow.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64_pow.cpp
index 2e9ea125abcb4..4029e53d1b14e 100644
--- a/src/hotspot/cpu/x86/stubGenerator_x86_64_pow.cpp
+++ b/src/hotspot/cpu/x86/stubGenerator_x86_64_pow.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2016, 2021, Intel Corporation. All rights reserved.
+* Copyright (c) 2016, 2024, Intel Corporation. All rights reserved.
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
* Intel Math Library (LIBM) Source Code
*
@@ -25,7 +25,6 @@
*
*/
-#include "precompiled.hpp"
#include "macroAssembler_x86.hpp"
#include "stubGenerator_x86_64.hpp"
@@ -760,7 +759,8 @@ ATTRIBUTE_ALIGNED(8) static const juint _DOUBLE0DOT5[] = {
#define __ _masm->
address StubGenerator::generate_libmPow() {
- StubCodeMark mark(this, "StubRoutines", "libmPow");
+ StubGenStubId stub_id = StubGenStubId::dpow_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Label L_2TAG_PACKET_0_0_2, L_2TAG_PACKET_1_0_2, L_2TAG_PACKET_2_0_2, L_2TAG_PACKET_3_0_2;
diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64_sha3.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64_sha3.cpp
index 49c39226708e3..7d1051711f20c 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"
@@ -82,8 +81,8 @@ static address permsAndRotsAddr() {
void StubGenerator::generate_sha3_stubs() {
if (UseSHA3Intrinsics) {
- StubRoutines::_sha3_implCompress = generate_sha3_implCompress(false,"sha3_implCompress");
- StubRoutines::_sha3_implCompressMB = generate_sha3_implCompress(true, "sha3_implCompressMB");
+ StubRoutines::_sha3_implCompress = generate_sha3_implCompress(StubGenStubId::sha3_implCompress_id);
+ StubRoutines::_sha3_implCompressMB = generate_sha3_implCompress(StubGenStubId::sha3_implCompressMB_id);
}
}
@@ -96,9 +95,21 @@ void StubGenerator::generate_sha3_stubs() {
// c_rarg3 - int offset
// c_rarg4 - int limit
//
-address StubGenerator::generate_sha3_implCompress(bool multiBlock, const char *name) {
+address StubGenerator::generate_sha3_implCompress(StubGenStubId stub_id) {
+ bool multiBlock;
+ switch(stub_id) {
+ case sha3_implCompress_id:
+ multiBlock = false;
+ break;
+ case sha3_implCompressMB_id:
+ multiBlock = true;
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", name);
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
const Register buf = c_rarg0;
diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64_sin.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64_sin.cpp
index 1f07229034dd4..362eeb95e41a3 100644
--- a/src/hotspot/cpu/x86/stubGenerator_x86_64_sin.cpp
+++ b/src/hotspot/cpu/x86/stubGenerator_x86_64_sin.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2021, Intel Corporation. All rights reserved.
+ * Copyright (c) 2016, 2024, Intel Corporation. All rights reserved.
* Intel Math Library (LIBM) Source Code
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -24,7 +24,6 @@
*
*/
-#include "precompiled.hpp"
#include "macroAssembler_x86.hpp"
#include "stubGenerator_x86_64.hpp"
@@ -181,7 +180,8 @@ ATTRIBUTE_ALIGNED(8) static const juint _ALL_ONES[] =
#define __ _masm->
address StubGenerator::generate_libmSin() {
- StubCodeMark mark(this, "StubRoutines", "libmSin");
+ StubGenStubId stub_id = StubGenStubId::dsin_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Label L_2TAG_PACKET_0_0_1, L_2TAG_PACKET_1_0_1, L_2TAG_PACKET_2_0_1, L_2TAG_PACKET_3_0_1;
diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64_tan.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64_tan.cpp
index 58165aa6f9866..46cb0801a81ff 100644
--- a/src/hotspot/cpu/x86/stubGenerator_x86_64_tan.cpp
+++ b/src/hotspot/cpu/x86/stubGenerator_x86_64_tan.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2016, 2021, Intel Corporation. All rights reserved.
+* Copyright (c) 2016, 2024, Intel Corporation. All rights reserved.
* Intel Math Library (LIBM) Source Code
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -24,7 +24,6 @@
*
*/
-#include "precompiled.hpp"
#include "macroAssembler_x86.hpp"
#include "stubGenerator_x86_64.hpp"
@@ -456,7 +455,8 @@ ATTRIBUTE_ALIGNED(8) static const juint _QQ_2_tan[] =
#define __ _masm->
address StubGenerator::generate_libmTan() {
- StubCodeMark mark(this, "StubRoutines", "libmTan");
+ StubGenStubId stub_id = StubGenStubId::dtan_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Label L_2TAG_PACKET_0_0_1, L_2TAG_PACKET_1_0_1, L_2TAG_PACKET_2_0_1, L_2TAG_PACKET_3_0_1;
diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64_tanh.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64_tanh.cpp
index 92ac78e15cba9..d13809bfcd911 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"
@@ -303,7 +302,8 @@ ATTRIBUTE_ALIGNED(16) static const juint _T2_neg_f[] =
#define __ _masm->
address StubGenerator::generate_libmTanh() {
- StubCodeMark mark(this, "StubRoutines", "libmTanh");
+ StubGenStubId stub_id = StubGenStubId::dtanh_id;
+ StubCodeMark mark(this, stub_id);
address start = __ pc();
Label L_2TAG_PACKET_0_0_1, L_2TAG_PACKET_1_0_1, L_2TAG_PACKET_2_0_1, L_2TAG_PACKET_3_0_1;
diff --git a/src/hotspot/cpu/x86/stubRoutines_x86.cpp b/src/hotspot/cpu/x86/stubRoutines_x86.cpp
index bc1cbdbba26b5..861c1e1216e3b 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"
@@ -33,61 +32,24 @@
// Implementation of the platform-specific part of StubRoutines - for
// a description of how to extend it, see the stubRoutines.hpp file.
-address StubRoutines::x86::_verify_mxcsr_entry = nullptr;
-address StubRoutines::x86::_upper_word_mask_addr = nullptr;
-address StubRoutines::x86::_shuffle_byte_flip_mask_addr = nullptr;
+// define fields for arch-specific entries
+
+#define DEFINE_ARCH_ENTRY(arch, blob_name, stub_name, field_name, getter_name) \
+ address StubRoutines:: arch :: STUB_FIELD_NAME(field_name) = nullptr;
+
+#define DEFINE_ARCH_ENTRY_INIT(arch, blob_name, stub_name, field_name, getter_name, init_function) \
+ address StubRoutines:: arch :: STUB_FIELD_NAME(field_name) = CAST_FROM_FN_PTR(address, init_function);
+
+STUBGEN_ARCH_ENTRIES_DO(DEFINE_ARCH_ENTRY, DEFINE_ARCH_ENTRY_INIT)
+
+#undef DEFINE_ARCH_ENTRY_INIT
+#undef DEFINE_ARCH_ENTRY
+
address StubRoutines::x86::_k256_adr = nullptr;
-address StubRoutines::x86::_vector_short_to_byte_mask = nullptr;
-address StubRoutines::x86::_vector_int_to_byte_mask = nullptr;
-address StubRoutines::x86::_vector_int_to_short_mask = nullptr;
-address StubRoutines::x86::_vector_all_bits_set = nullptr;
-address StubRoutines::x86::_vector_byte_shuffle_mask = nullptr;
-address StubRoutines::x86::_vector_int_mask_cmp_bits = nullptr;
-address StubRoutines::x86::_vector_short_shuffle_mask = nullptr;
-address StubRoutines::x86::_vector_int_shuffle_mask = nullptr;
-address StubRoutines::x86::_vector_long_shuffle_mask = nullptr;
-address StubRoutines::x86::_vector_float_sign_mask = nullptr;
-address StubRoutines::x86::_vector_float_sign_flip = nullptr;
-address StubRoutines::x86::_vector_double_sign_mask = nullptr;
-address StubRoutines::x86::_vector_double_sign_flip = nullptr;
-address StubRoutines::x86::_vector_byte_perm_mask = nullptr;
-address StubRoutines::x86::_vector_long_sign_mask = nullptr;
-address StubRoutines::x86::_vector_iota_indices = nullptr;
-address StubRoutines::x86::_vector_reverse_bit_lut = nullptr;
-address StubRoutines::x86::_vector_reverse_byte_perm_mask_long = nullptr;
-address StubRoutines::x86::_vector_reverse_byte_perm_mask_int = nullptr;
-address StubRoutines::x86::_vector_reverse_byte_perm_mask_short = nullptr;
-address StubRoutines::x86::_vector_popcount_lut = nullptr;
-address StubRoutines::x86::_vector_count_leading_zeros_lut = nullptr;
-address StubRoutines::x86::_vector_32_bit_mask = nullptr;
-address StubRoutines::x86::_vector_64_bit_mask = nullptr;
#ifdef _LP64
address StubRoutines::x86::_k256_W_adr = nullptr;
address StubRoutines::x86::_k512_W_addr = nullptr;
-address StubRoutines::x86::_pshuffle_byte_flip_mask_addr_sha512 = nullptr;
-// Base64 masks
-address StubRoutines::x86::_encoding_table_base64 = nullptr;
-address StubRoutines::x86::_shuffle_base64 = nullptr;
-address StubRoutines::x86::_avx2_shuffle_base64 = nullptr;
-address StubRoutines::x86::_avx2_input_mask_base64 = nullptr;
-address StubRoutines::x86::_avx2_lut_base64 = nullptr;
-address StubRoutines::x86::_avx2_decode_tables_base64 = nullptr;
-address StubRoutines::x86::_avx2_decode_lut_tables_base64 = nullptr;
-address StubRoutines::x86::_lookup_lo_base64 = nullptr;
-address StubRoutines::x86::_lookup_hi_base64 = nullptr;
-address StubRoutines::x86::_lookup_lo_base64url = nullptr;
-address StubRoutines::x86::_lookup_hi_base64url = nullptr;
-address StubRoutines::x86::_pack_vec_base64 = nullptr;
-address StubRoutines::x86::_join_0_1_base64 = nullptr;
-address StubRoutines::x86::_join_1_2_base64 = nullptr;
-address StubRoutines::x86::_join_2_3_base64 = nullptr;
-address StubRoutines::x86::_decoding_table_base64 = nullptr;
-address StubRoutines::x86::_compress_perm_table32 = nullptr;
-address StubRoutines::x86::_compress_perm_table64 = nullptr;
-address StubRoutines::x86::_expand_perm_table32 = nullptr;
-address StubRoutines::x86::_expand_perm_table64 = nullptr;
#endif
-address StubRoutines::x86::_pshuffle_byte_flip_mask_addr = nullptr;
const uint64_t StubRoutines::x86::_crc_by128_masks[] =
{
diff --git a/src/hotspot/cpu/x86/stubRoutines_x86.hpp b/src/hotspot/cpu/x86/stubRoutines_x86.hpp
index 0a6d091de8c7f..aaf84eb843777 100644
--- a/src/hotspot/cpu/x86/stubRoutines_x86.hpp
+++ b/src/hotspot/cpu/x86/stubRoutines_x86.hpp
@@ -31,82 +31,52 @@
static bool returns_to_call_stub(address return_pc) { return return_pc == _call_stub_return_address; }
+// emit enum used to size per-blob code buffers
+
+#define DEFINE_BLOB_SIZE(blob_name, size) \
+ _ ## blob_name ## _code_size = size,
+
enum platform_dependent_constants {
- // simply increase sizes if too small (assembler will crash if too small)
- _initial_stubs_code_size = 20000 WINDOWS_ONLY(+1000),
- _continuation_stubs_code_size = 1000 LP64_ONLY(+2000),
- // AVX512 intrinsics add more code in 64-bit VM,
- // Windows have more code to save/restore registers
- _compiler_stubs_code_size = 20000 LP64_ONLY(+47000) WINDOWS_ONLY(+2000),
- _final_stubs_code_size = 10000 LP64_ONLY(+20000) WINDOWS_ONLY(+22000) ZGC_ONLY(+20000)
+ STUBGEN_ARCH_BLOBS_DO(DEFINE_BLOB_SIZE)
};
+#undef DEFINE_BLOB_SIZE
+
class x86 {
friend class StubGenerator;
friend class VMStructs;
-#ifdef _LP64
- private:
- static address _get_previous_sp_entry;
-
- static address _f2i_fixup;
- static address _f2l_fixup;
- static address _d2i_fixup;
- static address _d2l_fixup;
+ // declare fields for arch-specific entries
- static address _float_sign_mask;
- static address _float_sign_flip;
- static address _double_sign_mask;
- static address _double_sign_flip;
- static address _compress_perm_table32;
- static address _compress_perm_table64;
- static address _expand_perm_table32;
- static address _expand_perm_table64;
+#define DECLARE_ARCH_ENTRY(arch, blob_name, stub_name, field_name, getter_name) \
+ static address STUB_FIELD_NAME(field_name) ;
- public:
+#define DECLARE_ARCH_ENTRY_INIT(arch, blob_name, stub_name, field_name, getter_name, init_function) \
+ DECLARE_ARCH_ENTRY(arch, blob_name, stub_name, field_name, getter_name)
- static address get_previous_sp_entry() {
- return _get_previous_sp_entry;
- }
+private:
+ STUBGEN_ARCH_ENTRIES_DO(DECLARE_ARCH_ENTRY, DECLARE_ARCH_ENTRY_INIT)
- static address f2i_fixup() {
- return _f2i_fixup;
- }
+#undef DECLARE_ARCH_ENTRY_INIT
+#undef DECLARE_ARCH_ENTRY
- static address f2l_fixup() {
- return _f2l_fixup;
- }
- static address d2i_fixup() {
- return _d2i_fixup;
- }
+ // define getters for arch-specific entries
- static address d2l_fixup() {
- return _d2l_fixup;
- }
+#define DEFINE_ARCH_ENTRY_GETTER(arch, blob_name, stub_name, field_name, getter_name) \
+ static address getter_name() { return STUB_FIELD_NAME(field_name); }
- static address float_sign_mask() {
- return _float_sign_mask;
- }
+#define DEFINE_ARCH_ENTRY_GETTER_INIT(arch, blob_name, stub_name, field_name, getter_name, init_function) \
+ DEFINE_ARCH_ENTRY_GETTER(arch, blob_name, stub_name, field_name, getter_name)
- static address float_sign_flip() {
- return _float_sign_flip;
- }
+public:
+ STUBGEN_ARCH_ENTRIES_DO(DEFINE_ARCH_ENTRY_GETTER, DEFINE_ARCH_ENTRY_GETTER_INIT)
- static address double_sign_mask() {
- return _double_sign_mask;
- }
+#undef DEFINE_ARCH_ENTRY_GETTER_INIT
+#undef DEFINE_ARCH_GETTER_ENTRY
- static address double_sign_flip() {
- return _double_sign_flip;
- }
-#else // !LP64
-
- private:
- static address _verify_fpu_cntrl_wrd_entry;
- static address _d2i_wrapper;
- static address _d2l_wrapper;
+#ifndef _LP64
static jint _fpu_cntrl_wrd_std;
static jint _fpu_cntrl_wrd_24;
@@ -115,10 +85,6 @@ class x86 {
static jint _fpu_subnormal_bias1[3];
static jint _fpu_subnormal_bias2[3];
- public:
- static address verify_fpu_cntrl_wrd_entry() { return _verify_fpu_cntrl_wrd_entry; }
- static address d2i_wrapper() { return _d2i_wrapper; }
- static address d2l_wrapper() { return _d2l_wrapper; }
static address addr_fpu_cntrl_wrd_std() { return (address)&_fpu_cntrl_wrd_std; }
static address addr_fpu_cntrl_wrd_24() { return (address)&_fpu_cntrl_wrd_24; }
static address addr_fpu_cntrl_wrd_trunc() { return (address)&_fpu_cntrl_wrd_trunc; }
@@ -133,9 +99,6 @@ class x86 {
#ifdef _LP64
static jint _mxcsr_rz;
#endif // _LP64
-
- static address _verify_mxcsr_entry;
-
// masks and table for CRC32
static const uint64_t _crc_by128_masks[];
static const juint _crc_table[];
@@ -149,73 +112,21 @@ class x86 {
static juint* _crc32c_table;
// table for arrays_hashcode
static const jint _arrays_hashcode_powers_of_31[];
-
- // upper word mask for sha1
- static address _upper_word_mask_addr;
- // byte flip mask for sha1
- static address _shuffle_byte_flip_mask_addr;
-
//k256 table for sha256
static const juint _k256[];
static address _k256_adr;
- static address _vector_short_to_byte_mask;
- static address _vector_float_sign_mask;
- static address _vector_float_sign_flip;
- static address _vector_double_sign_mask;
- static address _vector_double_sign_flip;
- static address _vector_long_sign_mask;
- static address _vector_all_bits_set;
- static address _vector_int_mask_cmp_bits;
- static address _vector_byte_perm_mask;
- static address _vector_int_to_byte_mask;
- static address _vector_int_to_short_mask;
- static address _vector_32_bit_mask;
- static address _vector_64_bit_mask;
- static address _vector_int_shuffle_mask;
- static address _vector_byte_shuffle_mask;
- static address _vector_short_shuffle_mask;
- static address _vector_long_shuffle_mask;
- static address _vector_iota_indices;
- static address _vector_popcount_lut;
- static address _vector_count_leading_zeros_lut;
- static address _vector_reverse_bit_lut;
- static address _vector_reverse_byte_perm_mask_long;
- static address _vector_reverse_byte_perm_mask_int;
- static address _vector_reverse_byte_perm_mask_short;
#ifdef _LP64
static juint _k256_W[];
static address _k256_W_adr;
static const julong _k512_W[];
static address _k512_W_addr;
- // byte flip mask for sha512
- static address _pshuffle_byte_flip_mask_addr_sha512;
- // Masks for base64
- static address _encoding_table_base64;
- static address _shuffle_base64;
- static address _avx2_shuffle_base64;
- static address _avx2_input_mask_base64;
- static address _avx2_lut_base64;
- static address _avx2_decode_tables_base64;
- static address _avx2_decode_lut_tables_base64;
- static address _lookup_lo_base64;
- static address _lookup_hi_base64;
- static address _lookup_lo_base64url;
- static address _lookup_hi_base64url;
- static address _pack_vec_base64;
- static address _join_0_1_base64;
- static address _join_1_2_base64;
- static address _join_2_3_base64;
- static address _decoding_table_base64;
#endif
- // byte flip mask for sha256
- static address _pshuffle_byte_flip_mask_addr;
public:
static address addr_mxcsr_std() { return (address)&_mxcsr_std; }
#ifdef _LP64
static address addr_mxcsr_rz() { return (address)&_mxcsr_rz; }
#endif // _LP64
- static address verify_mxcsr_entry() { return _verify_mxcsr_entry; }
static address crc_by128_masks_addr() { return (address)_crc_by128_masks; }
#ifdef _LP64
static address crc_by128_masks_avx512_addr() { return (address)_crc_by128_masks_avx512; }
@@ -223,131 +134,12 @@ class x86 {
static address crc_table_avx512_addr() { return (address)_crc_table_avx512; }
static address crc32c_table_avx512_addr() { return (address)_crc32c_table_avx512; }
#endif // _LP64
- static address upper_word_mask_addr() { return _upper_word_mask_addr; }
- static address shuffle_byte_flip_mask_addr() { return _shuffle_byte_flip_mask_addr; }
static address k256_addr() { return _k256_adr; }
- static address method_entry_barrier() { return _method_entry_barrier; }
-
- static address vector_short_to_byte_mask() {
- return _vector_short_to_byte_mask;
- }
- static address vector_float_sign_mask() {
- return _vector_float_sign_mask;
- }
-
- static address vector_float_sign_flip() {
- return _vector_float_sign_flip;
- }
-
- static address vector_double_sign_mask() {
- return _vector_double_sign_mask;
- }
-
- static address vector_double_sign_flip() {
- return _vector_double_sign_flip;
- }
-
- static address vector_all_bits_set() {
- return _vector_all_bits_set;
- }
-
- static address vector_int_mask_cmp_bits() {
- return _vector_int_mask_cmp_bits;
- }
-
- static address vector_byte_perm_mask() {
- return _vector_byte_perm_mask;
- }
-
- static address vector_int_to_byte_mask() {
- return _vector_int_to_byte_mask;
- }
-
- static address vector_int_to_short_mask() {
- return _vector_int_to_short_mask;
- }
-
- static address vector_32_bit_mask() {
- return _vector_32_bit_mask;
- }
-
- static address vector_64_bit_mask() {
- return _vector_64_bit_mask;
- }
-
- static address vector_int_shuffle_mask() {
- return _vector_int_shuffle_mask;
- }
-
- static address vector_byte_shuffle_mask() {
- return _vector_byte_shuffle_mask;
- }
-
- static address vector_short_shuffle_mask() {
- return _vector_short_shuffle_mask;
- }
-
- static address vector_long_shuffle_mask() {
- return _vector_long_shuffle_mask;
- }
-
- static address vector_long_sign_mask() {
- return _vector_long_sign_mask;
- }
-
- static address vector_iota_indices() {
- return _vector_iota_indices;
- }
-
- static address vector_count_leading_zeros_lut() {
- return _vector_count_leading_zeros_lut;
- }
-
- static address vector_reverse_bit_lut() {
- return _vector_reverse_bit_lut;
- }
-
- static address vector_reverse_byte_perm_mask_long() {
- return _vector_reverse_byte_perm_mask_long;
- }
-
- static address vector_reverse_byte_perm_mask_int() {
- return _vector_reverse_byte_perm_mask_int;
- }
-
- static address vector_reverse_byte_perm_mask_short() {
- return _vector_reverse_byte_perm_mask_short;
- }
-
- static address vector_popcount_lut() {
- return _vector_popcount_lut;
- }
#ifdef _LP64
static address k256_W_addr() { return _k256_W_adr; }
static address k512_W_addr() { return _k512_W_addr; }
- static address pshuffle_byte_flip_mask_addr_sha512() { return _pshuffle_byte_flip_mask_addr_sha512; }
- static address base64_encoding_table_addr() { return _encoding_table_base64; }
- static address base64_shuffle_addr() { return _shuffle_base64; }
- static address base64_avx2_shuffle_addr() { return _avx2_shuffle_base64; }
- static address base64_avx2_input_mask_addr() { return _avx2_input_mask_base64; }
- static address base64_avx2_lut_addr() { return _avx2_lut_base64; }
- static address base64_vbmi_lookup_lo_addr() { return _lookup_lo_base64; }
- static address base64_vbmi_lookup_hi_addr() { return _lookup_hi_base64; }
- static address base64_vbmi_lookup_lo_url_addr() { return _lookup_lo_base64url; }
- static address base64_vbmi_lookup_hi_url_addr() { return _lookup_hi_base64url; }
- static address base64_vbmi_pack_vec_addr() { return _pack_vec_base64; }
- static address base64_vbmi_join_0_1_addr() { return _join_0_1_base64; }
- static address base64_vbmi_join_1_2_addr() { return _join_1_2_base64; }
- static address base64_vbmi_join_2_3_addr() { return _join_2_3_base64; }
- static address base64_decoding_table_addr() { return _decoding_table_base64; }
- static address base64_AVX2_decode_tables_addr() { return _avx2_decode_tables_base64; }
- static address base64_AVX2_decode_LUT_tables_addr() { return _avx2_decode_lut_tables_base64; }
- static address compress_perm_table32() { return _compress_perm_table32; }
- static address compress_perm_table64() { return _compress_perm_table64; }
- static address expand_perm_table32() { return _expand_perm_table32; }
- static address expand_perm_table64() { return _expand_perm_table64; }
#endif
- static address pshuffle_byte_flip_mask_addr() { return _pshuffle_byte_flip_mask_addr; }
+
static address arrays_hashcode_powers_of_31() { return (address)_arrays_hashcode_powers_of_31; }
static void generate_CRC32C_table(bool is_pclmulqdq_supported);
};
diff --git a/src/hotspot/cpu/x86/stubRoutines_x86_32.cpp b/src/hotspot/cpu/x86/stubRoutines_x86_32.cpp
index 7916a3b36305a..810f421f1418c 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"
@@ -31,11 +30,6 @@
// Implementation of the platform-specific part of StubRoutines - for
// a description of how to extend it, see the stubRoutines.hpp file.
-address StubRoutines::x86::_verify_fpu_cntrl_wrd_entry = nullptr;
-
-address StubRoutines::x86::_d2i_wrapper = nullptr;
-address StubRoutines::x86::_d2l_wrapper = nullptr;
-
jint StubRoutines::x86::_fpu_cntrl_wrd_std = 0;
jint StubRoutines::x86::_fpu_cntrl_wrd_24 = 0;
jint StubRoutines::x86::_fpu_cntrl_wrd_trunc = 0;
diff --git a/src/hotspot/cpu/x86/stubRoutines_x86_64.cpp b/src/hotspot/cpu/x86/stubRoutines_x86_64.cpp
index f37d6698d39fc..0825ba63b4fe8 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"
@@ -33,14 +32,3 @@
jint StubRoutines::x86::_mxcsr_std = 0;
jint StubRoutines::x86::_mxcsr_rz = 0;
-
-address StubRoutines::x86::_get_previous_sp_entry = nullptr;
-
-address StubRoutines::x86::_f2i_fixup = nullptr;
-address StubRoutines::x86::_f2l_fixup = nullptr;
-address StubRoutines::x86::_d2i_fixup = nullptr;
-address StubRoutines::x86::_d2l_fixup = nullptr;
-address StubRoutines::x86::_float_sign_mask = nullptr;
-address StubRoutines::x86::_float_sign_flip = nullptr;
-address StubRoutines::x86::_double_sign_mask = nullptr;
-address StubRoutines::x86::_double_sign_flip = nullptr;
diff --git a/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp b/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp
index 823b965a09b51..548243cba838d 100644
--- a/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp
+++ b/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.hpp"
#include "classfile/javaClasses.hpp"
#include "compiler/compiler_globals.hpp"
@@ -596,7 +595,7 @@ void TemplateInterpreterGenerator::lock_method() {
#ifdef ASSERT
{
Label L;
- __ movl(rax, access_flags);
+ __ load_unsigned_short(rax, access_flags);
__ testl(rax, JVM_ACC_SYNCHRONIZED);
__ jcc(Assembler::notZero, L);
__ stop("method doesn't need synchronization");
@@ -607,7 +606,7 @@ void TemplateInterpreterGenerator::lock_method() {
// get synchronization object
{
Label done;
- __ movl(rax, access_flags);
+ __ load_unsigned_short(rax, access_flags);
__ testl(rax, JVM_ACC_STATIC);
// get receiver (assume this is frequent case)
__ movptr(rax, Address(rlocals, Interpreter::local_offset_in_bytes(0)));
@@ -855,7 +854,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
// make sure method is native & not abstract
#ifdef ASSERT
- __ movl(rax, access_flags);
+ __ load_unsigned_short(rax, access_flags);
{
Label L;
__ testl(rax, JVM_ACC_NATIVE);
@@ -909,7 +908,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
#ifdef ASSERT
{
Label L;
- __ movl(rax, access_flags);
+ __ load_unsigned_short(rax, access_flags);
__ testl(rax, JVM_ACC_SYNCHRONIZED);
__ jcc(Assembler::zero, L);
__ stop("method needs synchronization");
@@ -999,7 +998,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
// pass mirror handle if static call
{
Label L;
- __ movl(t, Address(method, Method::access_flags_offset()));
+ __ load_unsigned_short(t, Address(method, Method::access_flags_offset()));
__ testl(t, JVM_ACC_STATIC);
__ jcc(Assembler::zero, L);
// get mirror
@@ -1280,7 +1279,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
// do unlocking if necessary
{
Label L;
- __ movl(t, Address(method, Method::access_flags_offset()));
+ __ load_unsigned_short(t, Address(method, Method::access_flags_offset()));
__ testl(t, JVM_ACC_SYNCHRONIZED);
__ jcc(Assembler::zero, L);
// the code below should be shared with interpreter macro
@@ -1432,7 +1431,7 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) {
// make sure method is not native & not abstract
#ifdef ASSERT
- __ movl(rax, access_flags);
+ __ load_unsigned_short(rax, access_flags);
{
Label L;
__ testl(rax, JVM_ACC_NATIVE);
@@ -1489,7 +1488,7 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) {
#ifdef ASSERT
{
Label L;
- __ movl(rax, access_flags);
+ __ load_unsigned_short(rax, access_flags);
__ testl(rax, JVM_ACC_SYNCHRONIZED);
__ jcc(Assembler::zero, L);
__ stop("method needs synchronization");
diff --git a/src/hotspot/cpu/x86/templateInterpreterGenerator_x86_32.cpp b/src/hotspot/cpu/x86/templateInterpreterGenerator_x86_32.cpp
index 75611524e3b0a..df8633bdd1502 100644
--- a/src/hotspot/cpu/x86/templateInterpreterGenerator_x86_32.cpp
+++ b/src/hotspot/cpu/x86/templateInterpreterGenerator_x86_32.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.hpp"
#include "compiler/disassembler.hpp"
#include "interpreter/interp_masm.hpp"
diff --git a/src/hotspot/cpu/x86/templateInterpreterGenerator_x86_64.cpp b/src/hotspot/cpu/x86/templateInterpreterGenerator_x86_64.cpp
index 5ea2d8eba259b..af5c0fa94b1c0 100644
--- a/src/hotspot/cpu/x86/templateInterpreterGenerator_x86_64.cpp
+++ b/src/hotspot/cpu/x86/templateInterpreterGenerator_x86_64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.hpp"
#include "compiler/disassembler.hpp"
#include "interpreter/interp_masm.hpp"
@@ -74,7 +73,7 @@ address TemplateInterpreterGenerator::generate_slow_signature_handler() {
// Do Int register here
switch ( i ) {
case 0:
- __ movl(rscratch1, Address(rbx, Method::access_flags_offset()));
+ __ load_unsigned_short(rscratch1, Address(rbx, Method::access_flags_offset()));
__ testl(rscratch1, JVM_ACC_STATIC);
__ cmovptr(Assembler::zero, c_rarg1, Address(rsp, 0));
break;
@@ -159,7 +158,7 @@ address TemplateInterpreterGenerator::generate_slow_signature_handler() {
}
// Now handle integrals. Only do c_rarg1 if not static.
- __ movl(c_rarg3, Address(rbx, Method::access_flags_offset()));
+ __ load_unsigned_short(c_rarg3, Address(rbx, Method::access_flags_offset()));
__ testl(c_rarg3, JVM_ACC_STATIC);
__ cmovptr(Assembler::zero, c_rarg1, Address(rsp, 0));
diff --git a/src/hotspot/cpu/x86/templateTable_x86.cpp b/src/hotspot/cpu/x86/templateTable_x86.cpp
index 441e4c8a0b877..55bdb52c442d0 100644
--- a/src/hotspot/cpu/x86/templateTable_x86.cpp
+++ b/src/hotspot/cpu/x86/templateTable_x86.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/macroAssembler.hpp"
#include "compiler/disassembler.hpp"
#include "gc/shared/collectedHeap.hpp"
diff --git a/src/hotspot/cpu/x86/upcallLinker_x86_32.cpp b/src/hotspot/cpu/x86/upcallLinker_x86_32.cpp
index 6ccf965a771d3..6dd2ddd58747d 100644
--- a/src/hotspot/cpu/x86/upcallLinker_x86_32.cpp
+++ b/src/hotspot/cpu/x86/upcallLinker_x86_32.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -21,7 +21,6 @@
* questions.
*/
-#include "precompiled.hpp"
#include "prims/upcallLinker.hpp"
address UpcallLinker::make_upcall_stub(jobject receiver, Symbol* signature,
diff --git a/src/hotspot/cpu/x86/upcallLinker_x86_64.cpp b/src/hotspot/cpu/x86/upcallLinker_x86_64.cpp
index e2dadf7f0ef98..08884c99f9b98 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"
@@ -77,8 +76,6 @@ static int compute_reg_save_area_size(const ABIDescriptor& abi) {
return size;
}
-constexpr int MXCSR_MASK = 0xFFC0; // Mask out any pending exceptions
-
static void preserve_callee_saved_registers(MacroAssembler* _masm, const ABIDescriptor& abi, int reg_save_area_offset) {
// 1. iterate all registers in the architecture
// - check if they are volatile or not for the given abi
@@ -115,12 +112,9 @@ static void preserve_callee_saved_registers(MacroAssembler* _masm, const ABIDesc
{
const Address mxcsr_save(rsp, offset);
Label skip_ldmx;
- __ stmxcsr(mxcsr_save);
- __ movl(rax, mxcsr_save);
- __ andl(rax, MXCSR_MASK); // Only check control and mask bits
- ExternalAddress mxcsr_std(StubRoutines::x86::addr_mxcsr_std());
- __ cmp32(rax, mxcsr_std, rscratch1);
+ __ cmp32_mxcsr_std(mxcsr_save, rax, rscratch1);
__ jcc(Assembler::equal, skip_ldmx);
+ ExternalAddress mxcsr_std(StubRoutines::x86::addr_mxcsr_std());
__ ldmxcsr(mxcsr_std, rscratch1);
__ bind(skip_ldmx);
}
diff --git a/src/hotspot/cpu/x86/vm_version_x86.cpp b/src/hotspot/cpu/x86/vm_version_x86.cpp
index 688cd4fa5a6d1..68fc4380a59c9 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"
@@ -929,7 +928,8 @@ void VM_Version::get_processor_features() {
// Check if processor has Intel Ecore
if (FLAG_IS_DEFAULT(EnableX86ECoreOpts) && is_intel() && cpu_family() == 6 &&
- (_model == 0x97 || _model == 0xAA || _model == 0xAC || _model == 0xAF)) {
+ (_model == 0x97 || _model == 0xAA || _model == 0xAC || _model == 0xAF ||
+ _model == 0xCC || _model == 0xDD)) {
FLAG_SET_DEFAULT(EnableX86ECoreOpts, true);
}
@@ -1028,6 +1028,7 @@ void VM_Version::get_processor_features() {
_features &= ~CPU_AVX512_BITALG;
_features &= ~CPU_AVX512_IFMA;
_features &= ~CPU_APX_F;
+ _features &= ~CPU_AVX512_FP16;
}
// Currently APX support is only enabled for targets supporting AVX512VL feature.
@@ -1078,6 +1079,7 @@ void VM_Version::get_processor_features() {
_features &= ~CPU_AVX512_BITALG;
_features &= ~CPU_AVX512_IFMA;
_features &= ~CPU_AVX_IFMA;
+ _features &= ~CPU_AVX512_FP16;
}
}
@@ -1722,9 +1724,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);
}
}
}
@@ -3110,6 +3112,9 @@ uint64_t VM_Version::CpuidInfo::feature_flags() const {
}
if (sef_cpuid7_edx.bits.serialize != 0)
result |= CPU_SERIALIZE;
+
+ if (_cpuid_info.sef_cpuid7_edx.bits.avx512_fp16 != 0)
+ result |= CPU_AVX512_FP16;
}
// ZX features.
diff --git a/src/hotspot/cpu/x86/vm_version_x86.hpp b/src/hotspot/cpu/x86/vm_version_x86.hpp
index 004b64ebe6eb1..9bd3116cf84de 100644
--- a/src/hotspot/cpu/x86/vm_version_x86.hpp
+++ b/src/hotspot/cpu/x86/vm_version_x86.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
@@ -276,7 +276,9 @@ class VM_Version : public Abstract_VM_Version {
serialize : 1,
: 5,
cet_ibt : 1,
- : 11;
+ : 2,
+ avx512_fp16 : 1,
+ : 8;
} bits;
};
@@ -416,8 +418,9 @@ class VM_Version : public Abstract_VM_Version {
decl(CET_SS, "cet_ss", 57) /* Control Flow Enforcement - Shadow Stack */ \
decl(AVX512_IFMA, "avx512_ifma", 58) /* Integer Vector FMA instructions*/ \
decl(AVX_IFMA, "avx_ifma", 59) /* 256-bit VEX-coded variant of AVX512-IFMA*/ \
- decl(APX_F, "apx_f", 60) /* Intel Advanced Performance Extensions*/\
- decl(SHA512, "sha512", 61) /* SHA512 instructions*/
+ decl(APX_F, "apx_f", 60) /* Intel Advanced Performance Extensions*/ \
+ decl(SHA512, "sha512", 61) /* SHA512 instructions*/ \
+ decl(AVX512_FP16, "avx512_fp16", 62) /* AVX512 FP16 ISA support*/
#define DECLARE_CPU_FEATURE_FLAG(id, name, bit) CPU_##id = (1ULL << bit),
CPU_FEATURE_FLAGS(DECLARE_CPU_FEATURE_FLAG)
@@ -753,6 +756,7 @@ class VM_Version : public Abstract_VM_Version {
static bool supports_avx512_bitalg() { return (_features & CPU_AVX512_BITALG) != 0; }
static bool supports_avx512_vbmi() { return (_features & CPU_AVX512_VBMI) != 0; }
static bool supports_avx512_vbmi2() { return (_features & CPU_AVX512_VBMI2) != 0; }
+ static bool supports_avx512_fp16() { return (_features & CPU_AVX512_FP16) != 0; }
static bool supports_hv() { return (_features & CPU_HV) != 0; }
static bool supports_serialize() { return (_features & CPU_SERIALIZE) != 0; }
static bool supports_f16c() { return (_features & CPU_F16C) != 0; }
@@ -840,7 +844,7 @@ class VM_Version : public Abstract_VM_Version {
// For AVX CPUs only. f16c support is disabled if UseAVX == 0.
static bool supports_float16() {
- return supports_f16c() || supports_avx512vl();
+ return supports_f16c() || supports_avx512vl() || supports_avx512_fp16();
}
// Check intrinsic support
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.ad b/src/hotspot/cpu/x86/x86.ad
index 95b761ad44ead..8b2c583554470 100644
--- a/src/hotspot/cpu/x86/x86.ad
+++ b/src/hotspot/cpu/x86/x86.ad
@@ -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
@@ -1461,6 +1461,20 @@ bool Matcher::match_rule_supported(int opcode) {
return false;
}
break;
+ case Op_AddHF:
+ case Op_DivHF:
+ case Op_FmaHF:
+ case Op_MaxHF:
+ case Op_MinHF:
+ case Op_MulHF:
+ case Op_ReinterpretS2HF:
+ case Op_ReinterpretHF2S:
+ case Op_SubHF:
+ case Op_SqrtHF:
+ if (!VM_Version::supports_avx512_fp16()) {
+ return false;
+ }
+ break;
case Op_VectorLoadShuffle:
case Op_VectorRearrange:
case Op_MulReductionVI:
@@ -4521,6 +4535,35 @@ instruct vReplS_reg(vec dst, rRegI src) %{
ins_pipe( pipe_slow );
%}
+#ifdef _LP64
+instruct ReplHF_imm(vec dst, immH con, rRegI rtmp) %{
+ match(Set dst (Replicate con));
+ effect(TEMP rtmp);
+ format %{ "replicateHF $dst, $con \t! using $rtmp as TEMP" %}
+ ins_encode %{
+ int vlen_enc = vector_length_encoding(this);
+ BasicType bt = Matcher::vector_element_basic_type(this);
+ assert(VM_Version::supports_avx512_fp16() && bt == T_SHORT, "");
+ __ movl($rtmp$$Register, $con$$constant);
+ __ evpbroadcastw($dst$$XMMRegister, $rtmp$$Register, vlen_enc);
+ %}
+ ins_pipe( pipe_slow );
+%}
+
+instruct ReplHF_reg(vec dst, regF src, rRegI rtmp) %{
+ predicate(VM_Version::supports_avx512_fp16() && Matcher::vector_element_basic_type(n) == T_SHORT);
+ match(Set dst (Replicate src));
+ effect(TEMP rtmp);
+ format %{ "replicateHF $dst, $src \t! using $rtmp as TEMP" %}
+ ins_encode %{
+ int vlen_enc = vector_length_encoding(this);
+ __ vmovw($rtmp$$Register, $src$$XMMRegister);
+ __ evpbroadcastw($dst$$XMMRegister, $rtmp$$Register, vlen_enc);
+ %}
+ ins_pipe( pipe_slow );
+%}
+#endif
+
instruct ReplS_mem(vec dst, memory mem) %{
predicate(UseAVX >= 2 && Matcher::vector_element_basic_type(n) == T_SHORT);
match(Set dst (Replicate (LoadS mem)));
@@ -10837,3 +10880,80 @@ instruct vector_selectfrom_twovectors_reg_evex(vec index, vec src1, vec src2)
%}
ins_pipe(pipe_slow);
%}
+
+instruct reinterpretS2HF(regF dst, rRegI src)
+%{
+ match(Set dst (ReinterpretS2HF src));
+ format %{ "vmovw $dst, $src" %}
+ ins_encode %{
+ __ vmovw($dst$$XMMRegister, $src$$Register);
+ %}
+ ins_pipe(pipe_slow);
+%}
+
+instruct convF2HFAndS2HF(regF dst, regF src)
+%{
+ match(Set dst (ReinterpretS2HF (ConvF2HF src)));
+ format %{ "convF2HFAndS2HF $dst, $src" %}
+ ins_encode %{
+ __ vcvtps2ph($dst$$XMMRegister, $src$$XMMRegister, 0x04, Assembler::AVX_128bit);
+ %}
+ ins_pipe(pipe_slow);
+%}
+
+instruct convHF2SAndHF2F(regF dst, regF src)
+%{
+ match(Set dst (ConvHF2F (ReinterpretHF2S src)));
+ format %{ "convHF2SAndHF2F $dst, $src" %}
+ ins_encode %{
+ __ vcvtph2ps($dst$$XMMRegister, $src$$XMMRegister, Assembler::AVX_128bit);
+ %}
+ ins_pipe(pipe_slow);
+%}
+
+instruct reinterpretHF2S(rRegI dst, regF src)
+%{
+ match(Set dst (ReinterpretHF2S src));
+ format %{ "vmovw $dst, $src" %}
+ ins_encode %{
+ __ vmovw($dst$$Register, $src$$XMMRegister);
+ %}
+ ins_pipe(pipe_slow);
+%}
+
+instruct scalar_sqrt_HF_reg(regF dst, regF src)
+%{
+ match(Set dst (SqrtHF src));
+ format %{ "scalar_sqrt_fp16 $dst, $src" %}
+ ins_encode %{
+ __ vsqrtsh($dst$$XMMRegister, $src$$XMMRegister);
+ %}
+ ins_pipe(pipe_slow);
+%}
+
+instruct scalar_binOps_HF_reg(regF dst, regF src1, regF src2)
+%{
+ match(Set dst (AddHF src1 src2));
+ match(Set dst (DivHF src1 src2));
+ match(Set dst (MaxHF src1 src2));
+ match(Set dst (MinHF src1 src2));
+ match(Set dst (MulHF src1 src2));
+ match(Set dst (SubHF src1 src2));
+ format %{ "scalar_binop_fp16 $dst, $src1, $src2" %}
+ ins_encode %{
+ int opcode = this->ideal_Opcode();
+ __ efp16sh(opcode, $dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister);
+ %}
+ ins_pipe(pipe_slow);
+%}
+
+instruct scalar_fma_HF_reg(regF dst, regF src1, regF src2)
+%{
+ match(Set dst (FmaHF src2 (Binary dst src1)));
+ effect(DEF dst);
+ format %{ "scalar_fma_fp16 $dst, $src1, $src2\t# $dst = $dst * $src1 + $src2 fma packedH" %}
+ ins_encode %{
+ __ vfmadd132sh($dst$$XMMRegister, $src2$$XMMRegister, $src1$$XMMRegister);
+ %}
+ ins_pipe( pipe_slow );
+%}
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/x86/x86_64.ad b/src/hotspot/cpu/x86/x86_64.ad
index 4667922505cbc..8cc4a970bfd9f 100644
--- a/src/hotspot/cpu/x86/x86_64.ad
+++ b/src/hotspot/cpu/x86/x86_64.ad
@@ -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
@@ -2382,6 +2382,16 @@ operand immF()
interface(CONST_INTER);
%}
+// Half Float Immediate
+operand immH()
+%{
+ match(ConH);
+
+ op_cost(15);
+ format %{ %}
+ interface(CONST_INTER);
+%}
+
// Double Immediate zero
operand immD0()
%{
@@ -4840,6 +4850,16 @@ instruct loadConF(regF dst, immF con) %{
ins_pipe(pipe_slow);
%}
+instruct loadConH(regF dst, immH con) %{
+ match(Set dst con);
+ ins_cost(125);
+ format %{ "movss $dst, [$constantaddress]\t# load from constant table: halffloat=$con" %}
+ ins_encode %{
+ __ movflt($dst$$XMMRegister, $constantaddress($con));
+ %}
+ ins_pipe(pipe_slow);
+%}
+
instruct loadConN0(rRegN dst, immN0 src, rFlagsReg cr) %{
match(Set dst src);
effect(KILL cr);
@@ -7022,6 +7042,17 @@ instruct castFF(regF dst)
ins_pipe(empty);
%}
+instruct castHH(regF dst)
+%{
+ match(Set dst (CastHH dst));
+
+ size(0);
+ format %{ "# castHH of $dst" %}
+ ins_encode(/* empty encoding */);
+ ins_cost(0);
+ ins_pipe(empty);
+%}
+
instruct castDD(regD dst)
%{
match(Set dst (CastDD dst));
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/stubDeclarations_zero.hpp b/src/hotspot/cpu/zero/stubDeclarations_zero.hpp
new file mode 100644
index 0000000000000..5808ae3bd8fa1
--- /dev/null
+++ b/src/hotspot/cpu/zero/stubDeclarations_zero.hpp
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2025, Red Hat, Inc. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef CPU_ZERO_STUBDECLARATIONS_HPP
+#define CPU_ZERO_STUBDECLARATIONS_HPP
+
+#define STUBGEN_INITIAL_BLOBS_ARCH_DO(do_stub, \
+ do_arch_blob, \
+ do_arch_entry, \
+ do_arch_entry_init) \
+ do_arch_blob(initial, 0) \
+
+
+#define STUBGEN_CONTINUATION_BLOBS_ARCH_DO(do_stub, \
+ do_arch_blob, \
+ do_arch_entry, \
+ do_arch_entry_init) \
+ do_arch_blob(continuation, 0) \
+
+
+#define STUBGEN_COMPILER_BLOBS_ARCH_DO(do_stub, \
+ do_arch_blob, \
+ do_arch_entry, \
+ do_arch_entry_init) \
+ do_arch_blob(compiler, 0) \
+
+
+#define STUBGEN_FINAL_BLOBS_ARCH_DO(do_stub, \
+ do_arch_blob, \
+ do_arch_entry, \
+ do_arch_entry_init) \
+ do_arch_blob(final, 0) \
+
+
+#endif // CPU_ZERO_STUBDECLARATIONS_HPP
diff --git a/src/hotspot/cpu/zero/stubGenerator_zero.cpp b/src/hotspot/cpu/zero/stubGenerator_zero.cpp
index b6905791e9884..07b4e2a92afbe 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"
@@ -180,8 +179,6 @@ class StubGenerator: public StubCodeGenerator {
}
void generate_initial_stubs() {
- // Generates all stubs and initializes the entry points
-
// entry points that exist in all platforms Note: This is code
// that could be shared among different platforms - however the
// benefit seems to be smaller than the disadvantage of having a
@@ -200,26 +197,44 @@ class StubGenerator: public StubCodeGenerator {
StubRoutines::_fence_entry = ShouldNotCallThisStub();
}
- void generate_final_stubs() {
- // Generates all stubs and initializes the entry points
+ void generate_continuation_stubs() {
+ // do nothing
+ }
+ void generate_compiler_stubs() {
+ // do nothing
+ }
+
+ void generate_final_stubs() {
// arraycopy stubs used by compilers
generate_arraycopy_stubs();
}
public:
- StubGenerator(CodeBuffer* code, StubsKind kind) : StubCodeGenerator(code) {
- if (kind == Initial_stubs) {
+ StubGenerator(CodeBuffer* code, StubGenBlobId blob_id) : StubCodeGenerator(code, blob_id) {
+ switch(blob_id) {
+ case initial_id:
generate_initial_stubs();
- } else if (kind == Final_stubs) {
+ break;
+ case continuation_id:
+ generate_continuation_stubs();
+ break;
+ case compiler_id:
+ // do nothing
+ break;
+ case final_id:
generate_final_stubs();
- }
+ break;
+ default:
+ fatal("unexpected blob id: %d", blob_id);
+ break;
+ };
}
};
-void StubGenerator_generate(CodeBuffer* code, StubCodeGenerator::StubsKind kind) {
- StubGenerator g(code, kind);
+void StubGenerator_generate(CodeBuffer* code, StubGenBlobId blob_id) {
+ StubGenerator g(code, blob_id);
}
EntryFrame *EntryFrame::build(const intptr_t* parameters,
diff --git a/src/hotspot/cpu/zero/stubRoutines_zero.cpp b/src/hotspot/cpu/zero/stubRoutines_zero.cpp
index 0a9e3558711dd..47d2c27eefdf1 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,8 +23,9 @@
*
*/
-#include "precompiled.hpp"
#include "runtime/deoptimization.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/javaThread.hpp"
#include "runtime/stubRoutines.hpp"
+
+// zero has no arch-specific stubs nor any associated entries
diff --git a/src/hotspot/cpu/zero/stubRoutines_zero.hpp b/src/hotspot/cpu/zero/stubRoutines_zero.hpp
index bd04fdddc3d56..2002efc9f51d5 100644
--- a/src/hotspot/cpu/zero/stubRoutines_zero.hpp
+++ b/src/hotspot/cpu/zero/stubRoutines_zero.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -39,14 +39,18 @@
return return_pc == call_stub_return_pc();
}
- enum platform_dependent_constants {
- // The assembler will fail with a guarantee if these are too small.
- // Simply increase them if that happens.
- _initial_stubs_code_size = 0,
- _continuation_stubs_code_size = 0,
- _compiler_stubs_code_size = 0,
- _final_stubs_code_size = 0
- };
+// emit enum used to size per-blob code buffers
+
+#define DEFINE_BLOB_SIZE(blob_name, size) \
+ _ ## blob_name ## _code_size = size,
+
+enum platform_dependent_constants {
+ STUBGEN_ARCH_BLOBS_DO(DEFINE_BLOB_SIZE)
+};
+
+#undef DEFINE_BLOB_SIZE
+
+// zero has no arch-specific stubs nor any associated entries
enum method_handles_platform_dependent_constants {
method_handles_adapters_code_size = 0
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..e452bfdfd7c82 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"
@@ -165,6 +164,12 @@ extern "C" int getargs(procsinfo*, int, char*, int);
#ifndef PV_10_Compat
#define PV_10_Compat 0x508000 /* Power PC 10 */
#endif
+#ifndef PV_11
+ #define PV_11 0x600000 /* Power PC 11 */
+#endif
+#ifndef PV_11_Compat
+ #define PV_11_Compat 0x608000 /* Power PC 11 */
+#endif
static address resolve_function_descriptor_to_code_pointer(address p);
@@ -450,7 +455,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 +636,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 +686,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;
@@ -706,8 +711,12 @@ bool os::create_thread(Thread* thread, ThreadType thr_type,
// Init thread attributes.
pthread_attr_t attr;
int rslt = pthread_attr_init(&attr);
- guarantee(rslt == 0, "pthread_attr_init has to return 0");
- guarantee(pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED) == 0, "???");
+ if (rslt != 0) {
+ thread->set_osthread(nullptr);
+ delete osthread;
+ return false;
+ }
+ pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
// Make sure we run in 1:1 kernel-user-thread mode.
guarantee(pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM) == 0, "???");
@@ -733,7 +742,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 +770,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 +778,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 +848,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 +1076,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 +1203,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 +1214,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.
@@ -1217,6 +1229,9 @@ void os::print_memory_info(outputStream* st) {
void os::get_summary_cpu_info(char* buf, size_t buflen) {
// read _system_configuration.version
switch (_system_configuration.version) {
+ case PV_11:
+ strncpy(buf, "Power PC 11", buflen);
+ break;
case PV_10:
strncpy(buf, "Power PC 10", buflen);
break;
@@ -1262,6 +1277,9 @@ void os::get_summary_cpu_info(char* buf, size_t buflen) {
case PV_10_Compat:
strncpy(buf, "PV_10_Compat", buflen);
break;
+ case PV_11_Compat:
+ strncpy(buf, "PV_11_Compat", buflen);
+ break;
default:
strncpy(buf, "unknown", buflen);
}
@@ -1379,7 +1397,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 +1474,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 +1495,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 +1511,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 +1548,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 +1563,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 +1605,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 +1617,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 +1707,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 +1774,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 +1792,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 +1827,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 +2800,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..c538c54e86fe1 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;
@@ -638,7 +637,12 @@ bool os::create_thread(Thread* thread, ThreadType thr_type,
// init thread attributes
pthread_attr_t attr;
- pthread_attr_init(&attr);
+ int rslt = pthread_attr_init(&attr);
+ if (rslt != 0) {
+ thread->set_osthread(nullptr);
+ delete osthread;
+ return false;
+ }
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
// calculate stack size if it's not specified by caller
@@ -660,7 +664,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 +748,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 +1463,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 +1590,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 +2528,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 ac94309691747..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);
}
@@ -3247,6 +3256,8 @@ bool os::Linux::libnuma_init() {
libnuma_dlsym(handle, "numa_set_bind_policy")));
set_numa_bitmask_isbitset(CAST_TO_FN_PTR(numa_bitmask_isbitset_func_t,
libnuma_dlsym(handle, "numa_bitmask_isbitset")));
+ set_numa_bitmask_equal(CAST_TO_FN_PTR(numa_bitmask_equal_func_t,
+ libnuma_dlsym(handle, "numa_bitmask_equal")));
set_numa_distance(CAST_TO_FN_PTR(numa_distance_func_t,
libnuma_dlsym(handle, "numa_distance")));
set_numa_get_membind(CAST_TO_FN_PTR(numa_get_membind_func_t,
@@ -3257,6 +3268,8 @@ bool os::Linux::libnuma_init() {
libnuma_dlsym(handle, "numa_move_pages")));
set_numa_set_preferred(CAST_TO_FN_PTR(numa_set_preferred_func_t,
libnuma_dlsym(handle, "numa_set_preferred")));
+ set_numa_get_run_node_mask(CAST_TO_FN_PTR(numa_get_run_node_mask_func_t,
+ libnuma_v2_dlsym(handle, "numa_get_run_node_mask")));
if (numa_available() != -1) {
set_numa_all_nodes((unsigned long*)libnuma_dlsym(handle, "numa_all_nodes"));
@@ -3264,6 +3277,7 @@ bool os::Linux::libnuma_init() {
set_numa_nodes_ptr((struct bitmask **)libnuma_dlsym(handle, "numa_nodes_ptr"));
set_numa_interleave_bitmask(_numa_get_interleave_mask());
set_numa_membind_bitmask(_numa_get_membind());
+ set_numa_cpunodebind_bitmask(_numa_get_run_node_mask());
// Create an index -> node mapping, since nodes are not always consecutive
_nindex_to_node = new (mtInternal) GrowableArray(0, mtInternal);
rebuild_nindex_to_node_map();
@@ -3440,9 +3454,11 @@ os::Linux::numa_interleave_memory_func_t os::Linux::_numa_interleave_memory;
os::Linux::numa_interleave_memory_v2_func_t os::Linux::_numa_interleave_memory_v2;
os::Linux::numa_set_bind_policy_func_t os::Linux::_numa_set_bind_policy;
os::Linux::numa_bitmask_isbitset_func_t os::Linux::_numa_bitmask_isbitset;
+os::Linux::numa_bitmask_equal_func_t os::Linux::_numa_bitmask_equal;
os::Linux::numa_distance_func_t os::Linux::_numa_distance;
os::Linux::numa_get_membind_func_t os::Linux::_numa_get_membind;
os::Linux::numa_get_interleave_mask_func_t os::Linux::_numa_get_interleave_mask;
+os::Linux::numa_get_run_node_mask_func_t os::Linux::_numa_get_run_node_mask;
os::Linux::numa_move_pages_func_t os::Linux::_numa_move_pages;
os::Linux::numa_set_preferred_func_t os::Linux::_numa_set_preferred;
os::Linux::NumaAllocationPolicy os::Linux::_current_numa_policy;
@@ -3451,6 +3467,7 @@ struct bitmask* os::Linux::_numa_all_nodes_ptr;
struct bitmask* os::Linux::_numa_nodes_ptr;
struct bitmask* os::Linux::_numa_interleave_bitmask;
struct bitmask* os::Linux::_numa_membind_bitmask;
+struct bitmask* os::Linux::_numa_cpunodebind_bitmask;
bool os::pd_uncommit_memory(char* addr, size_t size, bool exec) {
uintptr_t res = (uintptr_t) ::mmap(addr, size, PROT_NONE,
@@ -3758,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));
@@ -3770,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;
@@ -3969,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),
@@ -4029,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);
}
@@ -4058,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),
@@ -4475,19 +4491,19 @@ void os::Linux::numa_init() {
// bitmask when externally configured to run on all or fewer nodes.
if (!Linux::libnuma_init()) {
- FLAG_SET_ERGO(UseNUMA, false);
- FLAG_SET_ERGO(UseNUMAInterleaving, false); // Also depends on libnuma.
+ disable_numa("Failed to initialize libnuma", true);
} else {
- if ((Linux::numa_max_node() < 1) || Linux::is_bound_to_single_node()) {
- // If there's only one node (they start from 0) or if the process
- // is bound explicitly to a single node using membind, disable NUMA
- UseNUMA = false;
+ Linux::set_configured_numa_policy(Linux::identify_numa_policy());
+ if (Linux::numa_max_node() < 1) {
+ 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", true);
+ } else if (Linux::mem_and_cpu_node_mismatch()) {
+ disable_numa("The process memory and cpu node configuration does not match", true);
} else {
LogTarget(Info,os) log;
LogStream ls(log);
- Linux::set_configured_numa_policy(Linux::identify_numa_policy());
-
struct bitmask* bmp = Linux::_numa_membind_bitmask;
const char* numa_mode = "membind";
@@ -4525,6 +4541,20 @@ void os::Linux::numa_init() {
}
}
+void os::Linux::disable_numa(const char* reason, bool warning) {
+ if ((UseNUMA && FLAG_IS_CMDLINE(UseNUMA)) ||
+ (UseNUMAInterleaving && FLAG_IS_CMDLINE(UseNUMAInterleaving))) {
+ // 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);
+}
+
#if defined(IA32) && !defined(ZERO)
/*
* Work-around (execute code at a high address) for broken NX emulation using CS limit,
@@ -5261,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 a2a13baa24f96..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,6 +199,7 @@ class os::Linux {
private:
static void numa_init();
+ 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);
@@ -204,10 +211,12 @@ class os::Linux {
typedef void (*numa_interleave_memory_v2_func_t)(void *start, size_t size, struct bitmask* mask);
typedef struct bitmask* (*numa_get_membind_func_t)(void);
typedef struct bitmask* (*numa_get_interleave_mask_func_t)(void);
+ typedef struct bitmask* (*numa_get_run_node_mask_func_t)(void);
typedef long (*numa_move_pages_func_t)(int pid, unsigned long count, void **pages, const int *nodes, int *status, int flags);
typedef void (*numa_set_preferred_func_t)(int node);
typedef void (*numa_set_bind_policy_func_t)(int policy);
typedef int (*numa_bitmask_isbitset_func_t)(struct bitmask *bmp, unsigned int n);
+ typedef int (*numa_bitmask_equal_func_t)(struct bitmask *bmp1, struct bitmask *bmp2);
typedef int (*numa_distance_func_t)(int node1, int node2);
static sched_getcpu_func_t _sched_getcpu;
@@ -221,8 +230,10 @@ class os::Linux {
static numa_interleave_memory_v2_func_t _numa_interleave_memory_v2;
static numa_set_bind_policy_func_t _numa_set_bind_policy;
static numa_bitmask_isbitset_func_t _numa_bitmask_isbitset;
+ static numa_bitmask_equal_func_t _numa_bitmask_equal;
static numa_distance_func_t _numa_distance;
static numa_get_membind_func_t _numa_get_membind;
+ static numa_get_run_node_mask_func_t _numa_get_run_node_mask;
static numa_get_interleave_mask_func_t _numa_get_interleave_mask;
static numa_move_pages_func_t _numa_move_pages;
static numa_set_preferred_func_t _numa_set_preferred;
@@ -231,6 +242,7 @@ class os::Linux {
static struct bitmask* _numa_nodes_ptr;
static struct bitmask* _numa_interleave_bitmask;
static struct bitmask* _numa_membind_bitmask;
+ static struct bitmask* _numa_cpunodebind_bitmask;
static void set_sched_getcpu(sched_getcpu_func_t func) { _sched_getcpu = func; }
static void set_numa_node_to_cpus(numa_node_to_cpus_func_t func) { _numa_node_to_cpus = func; }
@@ -243,8 +255,10 @@ class os::Linux {
static void set_numa_interleave_memory_v2(numa_interleave_memory_v2_func_t func) { _numa_interleave_memory_v2 = func; }
static void set_numa_set_bind_policy(numa_set_bind_policy_func_t func) { _numa_set_bind_policy = func; }
static void set_numa_bitmask_isbitset(numa_bitmask_isbitset_func_t func) { _numa_bitmask_isbitset = func; }
+ static void set_numa_bitmask_equal(numa_bitmask_equal_func_t func) { _numa_bitmask_equal = func; }
static void set_numa_distance(numa_distance_func_t func) { _numa_distance = func; }
static void set_numa_get_membind(numa_get_membind_func_t func) { _numa_get_membind = func; }
+ static void set_numa_get_run_node_mask(numa_get_run_node_mask_func_t func) { _numa_get_run_node_mask = func; }
static void set_numa_get_interleave_mask(numa_get_interleave_mask_func_t func) { _numa_get_interleave_mask = func; }
static void set_numa_move_pages(numa_move_pages_func_t func) { _numa_move_pages = func; }
static void set_numa_set_preferred(numa_set_preferred_func_t func) { _numa_set_preferred = func; }
@@ -253,6 +267,7 @@ class os::Linux {
static void set_numa_nodes_ptr(struct bitmask **ptr) { _numa_nodes_ptr = (ptr == nullptr ? nullptr : *ptr); }
static void set_numa_interleave_bitmask(struct bitmask* ptr) { _numa_interleave_bitmask = ptr ; }
static void set_numa_membind_bitmask(struct bitmask* ptr) { _numa_membind_bitmask = ptr ; }
+ static void set_numa_cpunodebind_bitmask(struct bitmask* ptr) { _numa_cpunodebind_bitmask = ptr ; }
static int sched_getcpu_syscall(void);
enum NumaAllocationPolicy{
@@ -358,21 +373,26 @@ class os::Linux {
}
return false;
}
- // Check if bound to only one numa node.
- // Returns true if bound to a single numa node, otherwise returns false.
- static bool is_bound_to_single_node() {
+ // Check if memory is bound to only one numa node.
+ // Returns true if memory is bound to a single numa node, otherwise returns false.
+ static bool is_bound_to_single_mem_node() {
int nodes = 0;
unsigned int node = 0;
unsigned int highest_node_number = 0;
- if (_numa_membind_bitmask != nullptr && _numa_max_node != nullptr && _numa_bitmask_isbitset != nullptr) {
+ struct bitmask* mem_nodes_bitmask = Linux::_numa_membind_bitmask;
+ if (Linux::is_running_in_interleave_mode()) {
+ mem_nodes_bitmask = Linux::_numa_interleave_bitmask;
+ }
+
+ if (mem_nodes_bitmask != nullptr && _numa_max_node != nullptr && _numa_bitmask_isbitset != nullptr) {
highest_node_number = _numa_max_node();
} else {
return false;
}
for (node = 0; node <= highest_node_number; node++) {
- if (_numa_bitmask_isbitset(_numa_membind_bitmask, node)) {
+ if (_numa_bitmask_isbitset(mem_nodes_bitmask, node)) {
nodes++;
}
}
@@ -383,6 +403,19 @@ class os::Linux {
return false;
}
}
+ // Check if cpu and memory nodes are aligned, returns true if nodes misalign
+ static bool mem_and_cpu_node_mismatch() {
+ struct bitmask* mem_nodes_bitmask = Linux::_numa_membind_bitmask;
+ if (Linux::is_running_in_interleave_mode()) {
+ mem_nodes_bitmask = Linux::_numa_interleave_bitmask;
+ }
+
+ if (mem_nodes_bitmask == nullptr || Linux::_numa_cpunodebind_bitmask == nullptr) {
+ return false;
+ }
+
+ return !_numa_bitmask_equal(mem_nodes_bitmask, Linux::_numa_cpunodebind_bitmask);
+ }
static const GrowableArray* numa_nindex_to_node() {
return _nindex_to_node;
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..4d6fc1e4b8c9e 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,16 +1085,16 @@ 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);
+ MemTracker::record_virtual_memory_release(addr, bytes);
}
} else {
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..7ad9f80141c20 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
@@ -2570,38 +2589,6 @@ LONG Handle_IDiv_Exception(struct _EXCEPTION_POINTERS* exceptionInfo) {
return EXCEPTION_CONTINUE_EXECUTION;
}
-#if defined(_M_AMD64)
-//-----------------------------------------------------------------------------
-static bool handle_FLT_exception(struct _EXCEPTION_POINTERS* exceptionInfo) {
- // handle exception caused by native method modifying control word
- DWORD exception_code = exceptionInfo->ExceptionRecord->ExceptionCode;
-
- switch (exception_code) {
- case EXCEPTION_FLT_DENORMAL_OPERAND:
- case EXCEPTION_FLT_DIVIDE_BY_ZERO:
- case EXCEPTION_FLT_INEXACT_RESULT:
- case EXCEPTION_FLT_INVALID_OPERATION:
- case EXCEPTION_FLT_OVERFLOW:
- case EXCEPTION_FLT_STACK_CHECK:
- case EXCEPTION_FLT_UNDERFLOW: {
- PCONTEXT ctx = exceptionInfo->ContextRecord;
- // On Windows, the mxcsr control bits are non-volatile across calls
- // See also CR 6192333
- //
- jint MxCsr = INITIAL_MXCSR;
- // we can't use StubRoutines::x86::addr_mxcsr_std()
- // because in Win64 mxcsr is not saved there
- if (MxCsr != ctx->MxCsr) {
- ctx->MxCsr = MxCsr;
- return true;
- }
- }
- }
-
- return false;
-}
-#endif
-
static inline void report_error(Thread* t, DWORD exception_code,
address addr, void* siginfo, void* context) {
VMError::report_and_die(t, exception_code, addr, siginfo, context);
@@ -2786,6 +2773,7 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) {
}
#if defined(_M_AMD64)
+ extern bool handle_FLT_exception(struct _EXCEPTION_POINTERS* exceptionInfo);
if ((in_java || in_native) && handle_FLT_exception(exceptionInfo)) {
return EXCEPTION_CONTINUE_EXECUTION;
}
@@ -3337,7 +3325,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 +3409,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 +3471,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 +3607,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 +3698,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 +4400,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 = nullptr;
+ GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, nullptr, &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..dda0acde79346 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,9 +1802,9 @@ 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);
+ MemTracker::record_virtual_memory_release(addr, bytes);
} else {
remove_file_mapping(addr);
}
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..3d11bfe037acd 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"
@@ -448,7 +447,7 @@ void os::print_context(outputStream *st, const void *context) {
}
void os::print_register_info(outputStream *st, const void *context, int& continuation) {
- const int register_count = 32 /* r0-r32 */ + 3 /* pc, lr, sp */;
+ const int register_count = 32 /* r0-r31 */ + 3 /* pc, lr, sp */;
int n = continuation;
assert(n >= 0 && n <= register_count, "Invalid continuation value");
if (context == nullptr || n == register_count) {
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..7728c62682c3b 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"
@@ -355,7 +354,7 @@ void os::print_context(outputStream *st, const void *context) {
}
void os::print_register_info(outputStream *st, const void *context, int& continuation) {
- const int register_count = 32 /* r0-r31 */;
+ const int register_count = 31 /* r0-r30 */;
int n = continuation;
assert(n >= 0 && n <= register_count, "Invalid continuation value");
if (context == nullptr || n == register_count) {
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 53e5631fc2b14..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, 2023, 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"
@@ -185,7 +184,14 @@ static bool read_fully(const char *fname, char *buf, size_t buflen) {
assert(buflen >= 1, "invalid argument");
int fd = os::open(fname, O_RDONLY, 0);
if (fd != -1) {
+ PRAGMA_DIAG_PUSH
+ PRAGMA_NONNULL_IGNORED
+ // Suppress false positive gcc warning, which may be an example of
+ // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87489
+ // The warning also hasn't been seen with vanilla gcc release, so may also
+ // involve some distro-specific gcc patch.
ssize_t read_sz = ::read(fd, buf, buflen);
+ PRAGMA_DIAG_POP
::close(fd);
// Skip if the contents is just "\n" because some machine only sets
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..5723e86f8594c 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"
@@ -538,7 +537,7 @@ int64_t ARMAtomicFuncs::cmpxchg_long_bootstrap(int64_t compare_value, int64_t ex
int64_t ARMAtomicFuncs::load_long_bootstrap(const volatile int64_t* src) {
// try to use the stub:
- load_long_func_t func = CAST_TO_FN_PTR(load_long_func_t, StubRoutines::atomic_load_long_entry());
+ load_long_func_t func = CAST_TO_FN_PTR(load_long_func_t, StubRoutines::Arm::atomic_load_long_entry());
if (func != nullptr) {
_load_long_func = func;
@@ -552,7 +551,7 @@ int64_t ARMAtomicFuncs::load_long_bootstrap(const volatile int64_t* src) {
void ARMAtomicFuncs::store_long_bootstrap(int64_t val, volatile int64_t* dest) {
// try to use the stub:
- store_long_func_t func = CAST_TO_FN_PTR(store_long_func_t, StubRoutines::atomic_store_long_entry());
+ store_long_func_t func = CAST_TO_FN_PTR(store_long_func_t, StubRoutines::Arm::atomic_store_long_entry());
if (func != nullptr) {
_store_long_func = func;
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..81fede02956d4 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"
@@ -468,7 +467,7 @@ void os::print_context(outputStream *st, const void *context) {
}
void os::print_register_info(outputStream *st, const void *context, int& continuation) {
- const int register_count = 32 /* r0-r32 */ + 3 /* pc, lr, ctr */;
+ const int register_count = 32 /* r0-r31 */ + 3 /* pc, lr, ctr */;
int n = continuation;
assert(n >= 0 && n <= register_count, "Invalid continuation value");
if (context == nullptr || n == register_count) {
diff --git a/src/hotspot/os_cpu/linux_riscv/javaThread_linux_riscv.cpp b/src/hotspot/os_cpu/linux_riscv/javaThread_linux_riscv.cpp
index c0dcba0ec51ea..4490ebcfdbf08 100644
--- a/src/hotspot/os_cpu/linux_riscv/javaThread_linux_riscv.cpp
+++ b/src/hotspot/os_cpu/linux_riscv/javaThread_linux_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2021, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/javaThread.hpp"
diff --git a/src/hotspot/os_cpu/linux_riscv/os_linux_riscv.cpp b/src/hotspot/os_cpu/linux_riscv/os_linux_riscv.cpp
index a00659f37cb42..945280bca10b9 100644
--- a/src/hotspot/os_cpu/linux_riscv/os_linux_riscv.cpp
+++ b/src/hotspot/os_cpu/linux_riscv/os_linux_riscv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2022, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-// no precompiled headers
#include "asm/macroAssembler.hpp"
#include "classfile/vmSymbols.hpp"
#include "code/codeCache.hpp"
@@ -56,8 +55,9 @@
// put OS-includes here
# include
-# include
# include
+# include
+# include
# include
# include
# include
@@ -350,6 +350,72 @@ void os::print_context(outputStream *st, const void *context) {
st->print_cr("%-*.*s=" INTPTR_FORMAT, 8, 8, reg_abi_names[r], (uintptr_t)uc->uc_mcontext.__gregs[r]);
}
st->cr();
+ const struct __riscv_mc_d_ext_state * const f_ext_state = &(uc->uc_mcontext.__fpregs.__d);
+ st->print_cr("Floating point state:");
+ st->print_cr("fcsr=" UINT32_FORMAT, f_ext_state->__fcsr);
+ st->print_cr("Floating point registers:");
+ for (int r = 0; r < 32; r++) {
+ st->print_cr("f%d=" INTPTR_FORMAT, r, (intptr_t)f_ext_state->__f[r]);
+ }
+ st->cr();
+
+#ifdef NO_RVV_SIGCONTEXT
+ st->print_cr("Vector state: JVM compiled without vector sigcontext support");
+#else // ifndef NO_RVV_SIGCONTEXT
+// This magic number is not in any user-space header.
+// No other choice but to define it (arch/riscv/include/uapi/asm/sigcontext.h).
+#ifndef RISCV_V_MAGIC
+#define RISCV_V_MAGIC 0x53465457
+#endif
+
+ // Find the vector context
+ struct __riscv_extra_ext_header *ext = (struct __riscv_extra_ext_header *)(&uc->uc_mcontext.__fpregs);
+ if (ext->hdr.magic != RISCV_V_MAGIC) {
+ st->print_cr("Vector state: not found");
+ return;
+ }
+
+ // The size passed to user-space is calculated accordingly:
+ // size = sizeof(struct __riscv_ctx_hdr) + sizeof(struct __riscv_v_ext_state) + riscv_v_vsize;
+ uint32_t ext_size = ext->hdr.size;
+
+ if (ext_size < (sizeof(struct __riscv_ctx_hdr) + sizeof(struct __riscv_v_ext_state))) {
+ st->print_cr("Vector state: not found, invalid size");
+ return;
+ }
+
+ struct __riscv_v_ext_state *v_ext_state = (struct __riscv_v_ext_state *)((char *)(ext) + sizeof(struct __riscv_extra_ext_header));
+
+ st->print_cr("Vector state:");
+ st->print_cr("vstart=" INTPTR_FORMAT, v_ext_state->vstart);
+ st->print_cr("vl =" INTPTR_FORMAT, v_ext_state->vl);
+ st->print_cr("vtype =" INTPTR_FORMAT, v_ext_state->vtype);
+ st->print_cr("vcsr =" INTPTR_FORMAT, v_ext_state->vcsr);
+ st->print_cr("vlenb =" INTPTR_FORMAT, v_ext_state->vlenb);
+ st->print_cr("Vector registers:");
+
+ uint64_t vr_size = v_ext_state->vlenb;
+
+ // Registers are after the v extensions header.
+ ext_size -= (sizeof(struct __riscv_ctx_hdr) + sizeof(struct __riscv_v_ext_state));
+
+ if (ext_size != (32 * vr_size)) {
+ st->print_cr("Vector registers: not found, invalid size");
+ return;
+ }
+
+ // datap format is undocumented, but is generated by kernel function riscv_v_vstate_save().
+ uint8_t *regp = (uint8_t *)v_ext_state->datap;
+ for (int r = 0; r < 32; r++) {
+ st->print("v%d=0x", r);
+ for (int i = vr_size; i > 0; i--) {
+ st->print("%02" PRIx8, regp[i-1]);
+ }
+ st->print_cr("");
+ regp += vr_size;
+ }
+ st->cr();
+#endif // #ifndef NO_RVV_SIGCONTEXT
}
void os::print_register_info(outputStream *st, const void *context, int& continuation) {
diff --git a/src/hotspot/os_cpu/linux_riscv/riscv_flush_icache.cpp b/src/hotspot/os_cpu/linux_riscv/riscv_flush_icache.cpp
index 4ca977bd57609..16c1445179bb8 100644
--- a/src/hotspot/os_cpu/linux_riscv/riscv_flush_icache.cpp
+++ b/src/hotspot/os_cpu/linux_riscv/riscv_flush_icache.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, Rivos Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,6 @@
*
*/
-#include "precompiled.hpp"
#include "logging/log.hpp"
#include "riscv_flush_icache.hpp"
#include "runtime/os.hpp"
diff --git a/src/hotspot/os_cpu/linux_riscv/riscv_hwprobe.cpp b/src/hotspot/os_cpu/linux_riscv/riscv_hwprobe.cpp
index e65254fc5718f..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..6414bb9eaf6c9 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"
@@ -160,6 +159,43 @@ bool os::win32::register_code_area(char *low, char *high) {
return true;
}
+#if defined(_M_AMD64)
+//-----------------------------------------------------------------------------
+bool handle_FLT_exception(struct _EXCEPTION_POINTERS* exceptionInfo) {
+ // handle exception caused by native method modifying control word
+ DWORD exception_code = exceptionInfo->ExceptionRecord->ExceptionCode;
+
+ switch (exception_code) {
+ case EXCEPTION_FLT_DENORMAL_OPERAND:
+ case EXCEPTION_FLT_DIVIDE_BY_ZERO:
+ case EXCEPTION_FLT_INEXACT_RESULT:
+ case EXCEPTION_FLT_INVALID_OPERATION:
+ case EXCEPTION_FLT_OVERFLOW:
+ case EXCEPTION_FLT_STACK_CHECK:
+ case EXCEPTION_FLT_UNDERFLOW: {
+ PCONTEXT ctx = exceptionInfo->ContextRecord;
+ // On Windows, the mxcsr control bits are non-volatile across calls
+ // See also CR 6192333
+ //
+ jint MxCsr = INITIAL_MXCSR; // set to 0x1f80` in winnt.h
+ if (EnableX86ECoreOpts) {
+ // On ECore restore with status bits enabled
+ MxCsr |= 0x3F;
+ }
+
+ // we can't use StubRoutines::x86::addr_mxcsr_std()
+ // because in Win64 mxcsr is not saved there
+ if (MxCsr != ctx->MxCsr) {
+ ctx->MxCsr = MxCsr;
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+#endif
+
#ifdef HAVE_PLATFORM_PRINT_NATIVE_STACK
/*
* Windows/x64 does not use stack frames the way expected by Java:
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/archDesc.cpp b/src/hotspot/share/adlc/archDesc.cpp
index f084f506bf587..edb07d2d22c93 100644
--- a/src/hotspot/share/adlc/archDesc.cpp
+++ b/src/hotspot/share/adlc/archDesc.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
@@ -1053,6 +1053,7 @@ const char *ArchDesc::getIdealType(const char *idealOp) {
case 'P': return "TypePtr::BOTTOM";
case 'N': return "TypeNarrowOop::BOTTOM";
case 'F': return "Type::FLOAT";
+ case 'H': return "Type::HALF_FLOAT";
case 'D': return "Type::DOUBLE";
case 'L': return "TypeLong::LONG";
case 's': return "TypeInt::CC /*flags*/";
@@ -1090,7 +1091,7 @@ void ArchDesc::initBaseOpTypes() {
char *ident = (char *)NodeClassNames[j];
if (!strcmp(ident, "ConI") || !strcmp(ident, "ConP") ||
!strcmp(ident, "ConN") || !strcmp(ident, "ConNKlass") ||
- !strcmp(ident, "ConF") || !strcmp(ident, "ConD") ||
+ !strcmp(ident, "ConH") || !strcmp(ident, "ConF") || !strcmp(ident, "ConD") ||
!strcmp(ident, "ConL") || !strcmp(ident, "Con" ) ||
!strcmp(ident, "Bool")) {
constructOperand(ident, true);
diff --git a/src/hotspot/share/adlc/forms.cpp b/src/hotspot/share/adlc/forms.cpp
index c34a73ea1e13f..e2265f70ed946 100644
--- a/src/hotspot/share/adlc/forms.cpp
+++ b/src/hotspot/share/adlc/forms.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
@@ -220,6 +220,7 @@ Form::DataType Form::ideal_to_const_type(const char *name) const {
if (strcmp(name,"ConNKlass")==0) return Form::idealNKlass;
if (strcmp(name,"ConL")==0) return Form::idealL;
if (strcmp(name,"ConF")==0) return Form::idealF;
+ if (strcmp(name,"ConH")==0) return Form::idealH;
if (strcmp(name,"ConD")==0) return Form::idealD;
if (strcmp(name,"Bool")==0) return Form::idealI;
diff --git a/src/hotspot/share/adlc/forms.hpp b/src/hotspot/share/adlc/forms.hpp
index a82b9bbb3382d..0b673bf854205 100644
--- a/src/hotspot/share/adlc/forms.hpp
+++ b/src/hotspot/share/adlc/forms.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
@@ -183,7 +183,8 @@ class Form {
idealS = 8, // String type
idealN = 9, // Narrow oop types
idealNKlass = 10, // Narrow klass types
- idealV = 11 // Vector type
+ idealV = 11, // Vector type
+ idealH = 12 // HalfFloat type
};
// Convert ideal name to a DataType, return DataType::none if not a 'ConX'
Form::DataType ideal_to_const_type(const char *ideal_type_name) const;
diff --git a/src/hotspot/share/adlc/formssel.cpp b/src/hotspot/share/adlc/formssel.cpp
index dfa414ef56484..f18e9eddba53d 100644
--- a/src/hotspot/share/adlc/formssel.cpp
+++ b/src/hotspot/share/adlc/formssel.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
@@ -1088,7 +1088,7 @@ uint InstructForm::reloc(FormDict &globals) {
} else if ( oper ) {
// floats and doubles loaded out of method's constant pool require reloc info
Form::DataType type = oper->is_base_constant(globals);
- if ( (type == Form::idealF) || (type == Form::idealD) ) {
+ if ( (type == Form::idealH) || (type == Form::idealF) || (type == Form::idealD) ) {
++reloc_entries;
}
}
@@ -1099,7 +1099,7 @@ uint InstructForm::reloc(FormDict &globals) {
// !!!!!
// Check for any component being an immediate float or double.
Form::DataType data_type = is_chain_of_constant(globals);
- if( data_type==idealD || data_type==idealF ) {
+ if( data_type==idealH || data_type==idealD || data_type==idealF ) {
reloc_entries++;
}
@@ -2662,6 +2662,7 @@ void OperandForm::format_constant(FILE *fp, uint const_index, uint const_type) {
case Form::idealN: fprintf(fp," if (_c%d) _c%d->dump_on(st);\n", const_index, const_index); break;
case Form::idealL: fprintf(fp," st->print(\"#\" INT64_FORMAT, (int64_t)_c%d);\n", const_index); break;
case Form::idealF: fprintf(fp," st->print(\"#%%f\", _c%d);\n", const_index); break;
+ case Form::idealH: fprintf(fp," st->print(\"#%%d\", _c%d);\n", const_index); break;
case Form::idealD: fprintf(fp," st->print(\"#%%f\", _c%d);\n", const_index); break;
default:
assert( false, "ShouldNotReachHere()");
@@ -2743,6 +2744,7 @@ void OperandForm::access_constant(FILE *fp, FormDict &globals,
case idealP: fprintf(fp,"_c%d->get_con()",const_index); break;
case idealL: fprintf(fp,"_c%d", const_index); break;
case idealF: fprintf(fp,"_c%d", const_index); break;
+ case idealH: fprintf(fp,"_c%d", const_index); break;
case idealD: fprintf(fp,"_c%d", const_index); break;
default:
assert( false, "ShouldNotReachHere()");
@@ -3953,11 +3955,12 @@ bool MatchNode::equivalent(FormDict &globals, MatchNode *mNode2) {
// which could be swapped.
void MatchNode::count_commutative_op(int& count) {
static const char *commut_op_list[] = {
- "AddI","AddL","AddF","AddD",
+ "AddI","AddL","AddHF","AddF","AddD",
"AndI","AndL",
- "MaxI","MinI","MaxF","MinF","MaxD","MinD",
- "MulI","MulL","MulF","MulD",
- "OrI","OrL", "XorI","XorL",
+ "MaxI","MinI","MaxHF","MinHF","MaxF","MinF","MaxD","MinD",
+ "MulI","MulL","MulHF","MulF","MulD",
+ "OrI","OrL",
+ "XorI","XorL"
"UMax","UMin"
};
@@ -4193,6 +4196,7 @@ int MatchRule::is_expensive() const {
if( strcmp(opType,"AtanD")==0 ||
strcmp(opType,"DivD")==0 ||
strcmp(opType,"DivF")==0 ||
+ strcmp(opType,"DivHF")==0 ||
strcmp(opType,"DivI")==0 ||
strcmp(opType,"Log10D")==0 ||
strcmp(opType,"ModD")==0 ||
@@ -4200,6 +4204,7 @@ int MatchRule::is_expensive() const {
strcmp(opType,"ModI")==0 ||
strcmp(opType,"SqrtD")==0 ||
strcmp(opType,"SqrtF")==0 ||
+ strcmp(opType,"SqrtHF")==0 ||
strcmp(opType,"TanD")==0 ||
strcmp(opType,"ConvD2F")==0 ||
strcmp(opType,"ConvD2I")==0 ||
@@ -4219,6 +4224,7 @@ int MatchRule::is_expensive() const {
strcmp(opType,"DecodeNKlass")==0 ||
strcmp(opType,"FmaD") == 0 ||
strcmp(opType,"FmaF") == 0 ||
+ strcmp(opType,"FmaHF") == 0 ||
strcmp(opType,"RoundDouble")==0 ||
strcmp(opType,"RoundDoubleMode")==0 ||
strcmp(opType,"RoundFloat")==0 ||
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/adlc/output_c.cpp b/src/hotspot/share/adlc/output_c.cpp
index cc6ed278b4901..0620f2f4496bf 100644
--- a/src/hotspot/share/adlc/output_c.cpp
+++ b/src/hotspot/share/adlc/output_c.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
@@ -2421,6 +2421,8 @@ class DefineEmitState {
if( _constant_status == LITERAL_NOT_SEEN ) {
if ( _constant_type == Form::idealD ) {
fprintf(_fp,"->constantD()");
+ } else if ( _constant_type == Form::idealH ) {
+ fprintf(_fp,"->constantH()");
} else if ( _constant_type == Form::idealF ) {
fprintf(_fp,"->constantF()");
} else if ( _constant_type == Form::idealL ) {
@@ -3789,6 +3791,8 @@ static void path_to_constant(FILE *fp, FormDict &globals,
fprintf(fp, "_leaf->bottom_type()->is_narrowoop()");
} else if ( (strcmp(optype,"ConNKlass") == 0) ) {
fprintf(fp, "_leaf->bottom_type()->is_narrowklass()");
+ } else if ( (strcmp(optype,"ConH") == 0) ) {
+ fprintf(fp, "_leaf->geth()");
} else if ( (strcmp(optype,"ConF") == 0) ) {
fprintf(fp, "_leaf->getf()");
} else if ( (strcmp(optype,"ConD") == 0) ) {
diff --git a/src/hotspot/share/adlc/output_h.cpp b/src/hotspot/share/adlc/output_h.cpp
index d6767bc1f7efc..a4ab29008f0af 100644
--- a/src/hotspot/share/adlc/output_h.cpp
+++ b/src/hotspot/share/adlc/output_h.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
@@ -233,6 +233,10 @@ static void declareConstStorage(FILE *fp, FormDict &globals, OperandForm *oper)
if (i > 0) fprintf(fp,", ");
fprintf(fp," jfloat _c%d;\n", i);
}
+ else if (!strcmp(type, "ConH")) {
+ if (i > 0) fprintf(fp,", ");
+ fprintf(fp," jshort _c%d;\n", i);
+ }
else if (!strcmp(type, "ConD")) {
if (i > 0) fprintf(fp,", ");
fprintf(fp," jdouble _c%d;\n", i);
@@ -269,6 +273,10 @@ static void declareConstStorage(FILE *fp, FormDict &globals, OperandForm *oper)
fprintf(fp," jlong _c%d;\n", i);
i++;
}
+ else if (!strcmp(comp->base_type(globals), "ConH")) {
+ fprintf(fp," jshort _c%d;\n", i);
+ i++;
+ }
else if (!strcmp(comp->base_type(globals), "ConF")) {
fprintf(fp," jfloat _c%d;\n", i);
i++;
@@ -314,6 +322,7 @@ static void defineConstructor(FILE *fp, const char *name, uint num_consts,
case Form::idealNKlass : { fprintf(fp,"const TypeNarrowKlass *c%d", i); break; }
case Form::idealP : { fprintf(fp,"const TypePtr *c%d", i); break; }
case Form::idealL : { fprintf(fp,"jlong c%d", i); break; }
+ case Form::idealH : { fprintf(fp,"jshort c%d", i); break; }
case Form::idealF : { fprintf(fp,"jfloat c%d", i); break; }
case Form::idealD : { fprintf(fp,"jdouble c%d", i); break; }
default:
@@ -403,6 +412,11 @@ static uint dump_spec_constant(FILE *fp, const char *ideal_type, uint i, Operand
fprintf(fp," st->print(\"/0x%%08x\", _c%d);\n", i);
++i;
}
+ else if (!strcmp(ideal_type, "ConH")) {
+ fprintf(fp," st->print(\"#%%d\", _c%d);\n", i);
+ fprintf(fp," st->print(\"/0x%%08x\", _c%d);\n", i);
+ ++i;
+ }
else if (!strcmp(ideal_type, "ConP")) {
fprintf(fp," _c%d->dump_on(st);\n", i);
++i;
@@ -1281,6 +1295,7 @@ void ArchDesc::declareClasses(FILE *fp) {
case Form::idealF: type = "Type::FLOAT"; break;
case Form::idealD: type = "Type::DOUBLE"; break;
case Form::idealL: type = "TypeLong::LONG"; break;
+ case Form::idealH: type = "Type::HALF_FLOAT"; break;
case Form::none: // fall through
default:
assert( false, "No support for this type of stackSlot");
@@ -1425,6 +1440,14 @@ void ArchDesc::declareClasses(FILE *fp) {
fprintf(fp, " return _c0;");
fprintf(fp, " }\n");
}
+ else if (!strcmp(oper->ideal_type(_globalNames), "ConH")) {
+ fprintf(fp," virtual intptr_t constant() const {");
+ fprintf(fp, " ShouldNotReachHere(); return 0; ");
+ fprintf(fp, " }\n");
+ fprintf(fp," virtual jshort constantH() const {");
+ fprintf(fp, " return (jshort)_c0;");
+ fprintf(fp, " }\n");
+ }
else if (!strcmp(oper->ideal_type(_globalNames), "ConF")) {
fprintf(fp," virtual intptr_t constant() const {");
fprintf(fp, " ShouldNotReachHere(); return 0; ");
@@ -1897,6 +1920,9 @@ void ArchDesc::declareClasses(FILE *fp) {
case Form::idealD:
fprintf(fp," return TypeD::make(opnd_array(1)->constantD());\n");
break;
+ case Form::idealH:
+ fprintf(fp," return TypeH::make(opnd_array(1)->constantH());\n");
+ break;
case Form::idealF:
fprintf(fp," return TypeF::make(opnd_array(1)->constantF());\n");
break;
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..f5a1d14e69431 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"
@@ -524,7 +523,7 @@ void Canonicalizer::do_Intrinsic (Intrinsic* x) {
ciType* t = c->value()->java_mirror_type();
if (t->is_klass()) {
// substitute cls.isInstance(obj) of a constant Class into
- // an InstantOf instruction
+ // an InstanceOf instruction
InstanceOf* i = new InstanceOf(t->as_klass(), x->argument_at(1), x->state_before());
set_canonical(i);
// and try to canonicalize even further
@@ -537,33 +536,6 @@ void Canonicalizer::do_Intrinsic (Intrinsic* x) {
}
break;
}
- case vmIntrinsics::_isPrimitive : {
- assert(x->number_of_arguments() == 1, "wrong type");
-
- // Class.isPrimitive is known on constant classes:
- InstanceConstant* c = x->argument_at(0)->type()->as_InstanceConstant();
- if (c != nullptr && !c->value()->is_null_object()) {
- ciType* t = c->value()->java_mirror_type();
- set_constant(t->is_primitive_type());
- }
- break;
- }
- case vmIntrinsics::_getModifiers: {
- assert(x->number_of_arguments() == 1, "wrong type");
-
- // Optimize for Foo.class.getModifier()
- InstanceConstant* c = x->argument_at(0)->type()->as_InstanceConstant();
- if (c != nullptr && !c->value()->is_null_object()) {
- ciType* t = c->value()->java_mirror_type();
- if (t->is_klass()) {
- set_constant(t->as_klass()->modifier_flags());
- } else {
- assert(t->is_primitive_type(), "should be a primitive type");
- set_constant(JVM_ACC_ABSTRACT | JVM_ACC_FINAL | JVM_ACC_PUBLIC);
- }
- }
- break;
- }
default:
break;
}
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..eb7c42e457633 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"
@@ -50,8 +49,8 @@ Compiler::Compiler() : AbstractCompiler(compiler_c1) {
void Compiler::init_c1_runtime() {
BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob();
- Runtime1::initialize(buffer_blob);
FrameMap::initialize();
+ Runtime1::initialize(buffer_blob);
// initialize data structures
ValueType::initialize();
GraphBuilder::initialize();
@@ -156,8 +155,6 @@ bool Compiler::is_intrinsic_supported(vmIntrinsics::ID id) {
case vmIntrinsics::_longBitsToDouble:
case vmIntrinsics::_getClass:
case vmIntrinsics::_isInstance:
- case vmIntrinsics::_isPrimitive:
- case vmIntrinsics::_getModifiers:
case vmIntrinsics::_currentCarrierThread:
case vmIntrinsics::_currentThread:
case vmIntrinsics::_scopedValueCache:
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_FrameMap.hpp b/src/hotspot/share/c1/c1_FrameMap.hpp
index 1fd7dd3edffe3..dab3aa6e734e0 100644
--- a/src/hotspot/share/c1/c1_FrameMap.hpp
+++ b/src/hotspot/share/c1/c1_FrameMap.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
@@ -32,6 +32,7 @@
#include "runtime/frame.hpp"
#include "utilities/globalDefinitions.hpp"
#include "utilities/macros.hpp"
+#include "oops/compressedOops.hpp"
class ciMethod;
class CallingConvention;
diff --git a/src/hotspot/share/c1/c1_GraphBuilder.cpp b/src/hotspot/share/c1/c1_GraphBuilder.cpp
index 9925c592f6f10..e918aa7d19ae7 100644
--- a/src/hotspot/share/c1/c1_GraphBuilder.cpp
+++ b/src/hotspot/share/c1/c1_GraphBuilder.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "c1/c1_CFGPrinter.hpp"
#include "c1/c1_Canonicalizer.hpp"
#include "c1/c1_Compilation.hpp"
diff --git a/src/hotspot/share/c1/c1_IR.cpp b/src/hotspot/share/c1/c1_IR.cpp
index b3faa54cc69b8..7f006c0b3ff5d 100644
--- a/src/hotspot/share/c1/c1_IR.cpp
+++ b/src/hotspot/share/c1/c1_IR.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "c1/c1_Compilation.hpp"
#include "c1/c1_FrameMap.hpp"
#include "c1/c1_GraphBuilder.hpp"
diff --git a/src/hotspot/share/c1/c1_IR.hpp b/src/hotspot/share/c1/c1_IR.hpp
index 9dfcb8419c3f1..a9a7a02639095 100644
--- a/src/hotspot/share/c1/c1_IR.hpp
+++ b/src/hotspot/share/c1/c1_IR.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
#include "c1/c1_Instruction.hpp"
#include "ci/ciExceptionHandler.hpp"
+#include "ci/ciStreams.hpp"
#include "memory/allocation.hpp"
// An XHandler is a C1 internal description for an exception handler
diff --git a/src/hotspot/share/c1/c1_Instruction.cpp b/src/hotspot/share/c1/c1_Instruction.cpp
index 431bcea42cb5b..92affba99b24e 100644
--- a/src/hotspot/share/c1/c1_Instruction.cpp
+++ b/src/hotspot/share/c1/c1_Instruction.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "c1/c1_IR.hpp"
#include "c1/c1_Instruction.hpp"
#include "c1/c1_InstructionPrinter.hpp"
diff --git a/src/hotspot/share/c1/c1_InstructionPrinter.cpp b/src/hotspot/share/c1/c1_InstructionPrinter.cpp
index 5f865ae518d00..35818188496f8 100644
--- a/src/hotspot/share/c1/c1_InstructionPrinter.cpp
+++ b/src/hotspot/share/c1/c1_InstructionPrinter.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "classfile/vmSymbols.hpp"
#include "c1/c1_InstructionPrinter.hpp"
#include "c1/c1_ValueStack.hpp"
diff --git a/src/hotspot/share/c1/c1_LIR.cpp b/src/hotspot/share/c1/c1_LIR.cpp
index 048eb6047ede9..fc90530ec95d8 100644
--- a/src/hotspot/share/c1/c1_LIR.cpp
+++ b/src/hotspot/share/c1/c1_LIR.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "c1/c1_CodeStubs.hpp"
#include "c1/c1_InstructionPrinter.hpp"
#include "c1/c1_LIR.hpp"
@@ -452,12 +451,18 @@ void LIR_OpVisitState::visit(LIR_Op* op) {
case lir_monaddr: // input and result always valid, info always invalid
case lir_null_check: // input and info always valid, result always invalid
case lir_move: // input and result always valid, may have info
+ case lir_sqrt: // FP Ops have no info, but input and result
+ case lir_abs:
+ case lir_neg:
+ case lir_f2hf:
+ case lir_hf2f:
{
assert(op->as_Op1() != nullptr, "must be");
LIR_Op1* op1 = (LIR_Op1*)op;
if (op1->_info) do_info(op1->_info);
if (op1->_opr->is_valid()) do_input(op1->_opr);
+ if (op1->_tmp->is_valid()) do_temp(op1->_tmp);
if (op1->_result->is_valid()) do_output(op1->_result);
break;
@@ -483,6 +488,7 @@ void LIR_OpVisitState::visit(LIR_Op* op) {
assert(op1->_info != nullptr, ""); do_info(op1->_info);
if (op1->_opr->is_valid()) do_temp(op1->_opr); // safepoints on SPARC need temporary register
+ assert(op1->_tmp->is_illegal(), "not used");
assert(op1->_result->is_illegal(), "safepoint does not produce value");
break;
@@ -566,11 +572,6 @@ void LIR_OpVisitState::visit(LIR_Op* op) {
case lir_add:
case lir_sub:
case lir_rem:
- case lir_sqrt:
- case lir_abs:
- case lir_neg:
- case lir_f2hf:
- case lir_hf2f:
case lir_logic_and:
case lir_logic_or:
case lir_logic_xor:
@@ -667,6 +668,7 @@ void LIR_OpVisitState::visit(LIR_Op* op) {
assert(op1->_info == nullptr, "no info");
assert(op1->_opr->is_valid(), "exception oop"); do_input(op1->_opr);
+ assert(op1->_tmp->is_illegal(), "not used");
assert(op1->_result->is_illegal(), "no result");
break;
@@ -1614,7 +1616,7 @@ void LIR_Address::print_value_on(outputStream* out) const {
case times_8: out->print(" * 8"); break;
}
}
- out->print(" Disp: " INTX_FORMAT, _disp);
+ out->print(" Disp: %zd", _disp);
}
// debug output of block header without InstructionPrinter
@@ -1730,6 +1732,11 @@ const char * LIR_Op::name() const {
case lir_cond_float_branch: s = "flt_cond_br"; break;
case lir_move: s = "move"; break;
case lir_roundfp: s = "roundfp"; break;
+ case lir_abs: s = "abs"; break;
+ case lir_neg: s = "neg"; break;
+ case lir_sqrt: s = "sqrt"; break;
+ case lir_f2hf: s = "f2hf"; break;
+ case lir_hf2f: s = "hf2f"; break;
case lir_rtcall: s = "rtcall"; break;
case lir_throw: s = "throw"; break;
case lir_unwind: s = "unwind"; break;
@@ -1746,11 +1753,6 @@ const char * LIR_Op::name() const {
case lir_mul: s = "mul"; break;
case lir_div: s = "div"; break;
case lir_rem: s = "rem"; break;
- case lir_abs: s = "abs"; break;
- case lir_neg: s = "neg"; break;
- case lir_sqrt: s = "sqrt"; break;
- case lir_f2hf: s = "f2hf"; break;
- case lir_hf2f: s = "hf2f"; break;
case lir_logic_and: s = "logic_and"; break;
case lir_logic_or: s = "logic_or"; break;
case lir_logic_xor: s = "logic_xor"; break;
diff --git a/src/hotspot/share/c1/c1_LIR.hpp b/src/hotspot/share/c1/c1_LIR.hpp
index c568caeca4b30..d9005c49c89d4 100644
--- a/src/hotspot/share/c1/c1_LIR.hpp
+++ b/src/hotspot/share/c1/c1_LIR.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -939,6 +939,11 @@ enum LIR_Code {
, lir_alloc_object
, lir_monaddr
, lir_roundfp
+ , lir_sqrt
+ , lir_abs
+ , lir_neg
+ , lir_f2hf
+ , lir_hf2f
, lir_safepoint
, lir_unwind
, lir_load_klass
@@ -955,13 +960,6 @@ enum LIR_Code {
, lir_mul
, lir_div
, lir_rem
- , lir_sqrt
- , lir_abs
- , lir_neg
- , lir_tan
- , lir_f2hf
- , lir_hf2f
- , lir_log10
, lir_logic_and
, lir_logic_or
, lir_logic_xor
@@ -1018,7 +1016,7 @@ enum LIR_Code {
, begin_opAssert
, lir_assert
, end_opAssert
-#ifdef INCLUDE_ZGC
+#if INCLUDE_ZGC
, begin_opXLoadBarrierTest
, lir_xloadbarrier_test
, end_opXLoadBarrierTest
@@ -1357,6 +1355,7 @@ class LIR_Op1: public LIR_Op {
protected:
LIR_Opr _opr; // input operand
+ LIR_Opr _tmp;
BasicType _type; // Operand types
LIR_PatchCode _patch; // only required with patchin (NEEDS_CLEANUP: do we want a special instruction for patching?)
@@ -1371,12 +1370,21 @@ class LIR_Op1: public LIR_Op {
LIR_Op1(LIR_Code code, LIR_Opr opr, LIR_Opr result = LIR_OprFact::illegalOpr, BasicType type = T_ILLEGAL, LIR_PatchCode patch = lir_patch_none, CodeEmitInfo* info = nullptr)
: LIR_Op(code, result, info)
, _opr(opr)
+ , _tmp(LIR_OprFact::illegalOpr)
+ , _type(type)
+ , _patch(patch) { assert(is_in_range(code, begin_op1, end_op1), "code check"); }
+
+ LIR_Op1(LIR_Code code, LIR_Opr opr, LIR_Opr result, LIR_Opr tmp, BasicType type = T_ILLEGAL, LIR_PatchCode patch = lir_patch_none, CodeEmitInfo* info = nullptr)
+ : LIR_Op(code, result, info)
+ , _opr(opr)
+ , _tmp(tmp)
, _type(type)
, _patch(patch) { assert(is_in_range(code, begin_op1, end_op1), "code check"); }
LIR_Op1(LIR_Code code, LIR_Opr opr, LIR_Opr result, BasicType type, LIR_PatchCode patch, CodeEmitInfo* info, LIR_MoveKind kind)
: LIR_Op(code, result, info)
, _opr(opr)
+ , _tmp(LIR_OprFact::illegalOpr)
, _type(type)
, _patch(patch) {
assert(code == lir_move, "must be");
@@ -1386,10 +1394,12 @@ class LIR_Op1: public LIR_Op {
LIR_Op1(LIR_Code code, LIR_Opr opr, CodeEmitInfo* info)
: LIR_Op(code, LIR_OprFact::illegalOpr, info)
, _opr(opr)
+ , _tmp(LIR_OprFact::illegalOpr)
, _type(T_ILLEGAL)
, _patch(lir_patch_none) { assert(is_in_range(code, begin_op1, end_op1), "code check"); }
LIR_Opr in_opr() const { return _opr; }
+ LIR_Opr tmp_opr() const { return _tmp; }
LIR_PatchCode patch_code() const { return _patch; }
BasicType type() const { return _type; }
@@ -1589,8 +1599,6 @@ class LIR_OpTypeCheck: public LIR_Op {
class LIR_Op2: public LIR_Op {
friend class LIR_OpVisitState;
- int _fpu_stack_size; // for sin/cos implementation on Intel
-
protected:
LIR_Opr _opr1;
LIR_Opr _opr2;
@@ -1607,7 +1615,6 @@ class LIR_Op2: public LIR_Op {
public:
LIR_Op2(LIR_Code code, LIR_Condition condition, LIR_Opr opr1, LIR_Opr opr2, CodeEmitInfo* info = nullptr, BasicType type = T_ILLEGAL)
: LIR_Op(code, LIR_OprFact::illegalOpr, info)
- , _fpu_stack_size(0)
, _opr1(opr1)
, _opr2(opr2)
, _tmp1(LIR_OprFact::illegalOpr)
@@ -1622,7 +1629,6 @@ class LIR_Op2: public LIR_Op {
LIR_Op2(LIR_Code code, LIR_Condition condition, LIR_Opr opr1, LIR_Opr opr2, LIR_Opr result, BasicType type)
: LIR_Op(code, result, nullptr)
- , _fpu_stack_size(0)
, _opr1(opr1)
, _opr2(opr2)
, _tmp1(LIR_OprFact::illegalOpr)
@@ -1639,7 +1645,6 @@ class LIR_Op2: public LIR_Op {
LIR_Op2(LIR_Code code, LIR_Opr opr1, LIR_Opr opr2, LIR_Opr result = LIR_OprFact::illegalOpr,
CodeEmitInfo* info = nullptr, BasicType type = T_ILLEGAL)
: LIR_Op(code, result, info)
- , _fpu_stack_size(0)
, _opr1(opr1)
, _opr2(opr2)
, _tmp1(LIR_OprFact::illegalOpr)
@@ -1655,7 +1660,6 @@ class LIR_Op2: public LIR_Op {
LIR_Op2(LIR_Code code, LIR_Opr opr1, LIR_Opr opr2, LIR_Opr result, LIR_Opr tmp1, LIR_Opr tmp2 = LIR_OprFact::illegalOpr,
LIR_Opr tmp3 = LIR_OprFact::illegalOpr, LIR_Opr tmp4 = LIR_OprFact::illegalOpr, LIR_Opr tmp5 = LIR_OprFact::illegalOpr)
: LIR_Op(code, result, nullptr)
- , _fpu_stack_size(0)
, _opr1(opr1)
, _opr2(opr2)
, _tmp1(tmp1)
@@ -1683,9 +1687,6 @@ class LIR_Op2: public LIR_Op {
assert(code() == lir_cmp || code() == lir_branch || code() == lir_cond_float_branch, "only valid for branch"); _condition = condition;
}
- void set_fpu_stack_size(int size) { _fpu_stack_size = size; }
- int fpu_stack_size() const { return _fpu_stack_size; }
-
void set_in_opr1(LIR_Opr opr) { _opr1 = opr; }
void set_in_opr2(LIR_Opr opr) { _opr2 = opr; }
@@ -2272,15 +2273,13 @@ class LIR_List: public CompilationResourceObj {
void cas_int(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value,
LIR_Opr t1, LIR_Opr t2, LIR_Opr result = LIR_OprFact::illegalOpr);
- void abs (LIR_Opr from, LIR_Opr to, LIR_Opr tmp) { append(new LIR_Op2(lir_abs , from, tmp, to)); }
- void negate(LIR_Opr from, LIR_Opr to, LIR_Opr tmp = LIR_OprFact::illegalOpr) { append(new LIR_Op2(lir_neg, from, tmp, to)); }
- void sqrt(LIR_Opr from, LIR_Opr to, LIR_Opr tmp) { append(new LIR_Op2(lir_sqrt, from, tmp, to)); }
+ void abs (LIR_Opr from, LIR_Opr to, LIR_Opr tmp) { append(new LIR_Op1(lir_abs , from, to, tmp)); }
+ void negate(LIR_Opr from, LIR_Opr to, LIR_Opr tmp = LIR_OprFact::illegalOpr) { append(new LIR_Op1(lir_neg, from, to, tmp)); }
+ void sqrt(LIR_Opr from, LIR_Opr to, LIR_Opr tmp) { append(new LIR_Op1(lir_sqrt, from, to, tmp)); }
void fmad(LIR_Opr from, LIR_Opr from1, LIR_Opr from2, LIR_Opr to) { append(new LIR_Op3(lir_fmad, from, from1, from2, to)); }
void fmaf(LIR_Opr from, LIR_Opr from1, LIR_Opr from2, LIR_Opr to) { append(new LIR_Op3(lir_fmaf, from, from1, from2, to)); }
- void log10 (LIR_Opr from, LIR_Opr to, LIR_Opr tmp) { append(new LIR_Op2(lir_log10, from, LIR_OprFact::illegalOpr, to, tmp)); }
- void tan (LIR_Opr from, LIR_Opr to, LIR_Opr tmp1, LIR_Opr tmp2) { append(new LIR_Op2(lir_tan , from, tmp1, to, tmp2)); }
- void f2hf(LIR_Opr from, LIR_Opr to, LIR_Opr tmp) { append(new LIR_Op2(lir_f2hf, from, tmp, to)); }
- void hf2f(LIR_Opr from, LIR_Opr to, LIR_Opr tmp) { append(new LIR_Op2(lir_hf2f, from, tmp, to)); }
+ void f2hf(LIR_Opr from, LIR_Opr to, LIR_Opr tmp) { append(new LIR_Op1(lir_f2hf, from, to, tmp)); }
+ void hf2f(LIR_Opr from, LIR_Opr to, LIR_Opr tmp) { append(new LIR_Op1(lir_hf2f, from, to, tmp)); }
void add (LIR_Opr left, LIR_Opr right, LIR_Opr res) { append(new LIR_Op2(lir_add, left, right, res)); }
void sub (LIR_Opr left, LIR_Opr right, LIR_Opr res, CodeEmitInfo* info = nullptr) { append(new LIR_Op2(lir_sub, left, right, res, info)); }
diff --git a/src/hotspot/share/c1/c1_LIRAssembler.cpp b/src/hotspot/share/c1/c1_LIRAssembler.cpp
index 0fa4b3a4c93d7..a5930ba54d880 100644
--- a/src/hotspot/share/c1/c1_LIRAssembler.cpp
+++ b/src/hotspot/share/c1/c1_LIRAssembler.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "asm/assembler.inline.hpp"
#include "c1/c1_Compilation.hpp"
#include "c1/c1_Instruction.hpp"
@@ -526,6 +525,17 @@ void LIR_Assembler::emit_op1(LIR_Op1* op) {
break;
}
+ case lir_abs:
+ case lir_sqrt:
+ case lir_f2hf:
+ case lir_hf2f:
+ intrinsic_op(op->code(), op->in_opr(), op->tmp_opr(), op->result_opr(), op);
+ break;
+
+ case lir_neg:
+ negate(op->in_opr(), op->result_opr(), op->tmp_opr());
+ break;
+
case lir_return: {
assert(op->as_OpReturn() != nullptr, "sanity");
LIR_OpReturn *ret_op = (LIR_OpReturn*)op;
@@ -723,19 +733,6 @@ void LIR_Assembler::emit_op2(LIR_Op2* op) {
op->fpu_pop_count() == 1);
break;
- case lir_abs:
- case lir_sqrt:
- case lir_tan:
- case lir_log10:
- case lir_f2hf:
- case lir_hf2f:
- intrinsic_op(op->code(), op->in_opr1(), op->in_opr2(), op->result_opr(), op);
- break;
-
- case lir_neg:
- negate(op->in_opr1(), op->result_opr(), op->in_opr2());
- break;
-
case lir_logic_and:
case lir_logic_or:
case lir_logic_xor:
diff --git a/src/hotspot/share/c1/c1_LIRAssembler.hpp b/src/hotspot/share/c1/c1_LIRAssembler.hpp
index eb89e3ea24870..34aa679daedd0 100644
--- a/src/hotspot/share/c1/c1_LIRAssembler.hpp
+++ b/src/hotspot/share/c1/c1_LIRAssembler.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -208,7 +208,7 @@ class LIR_Assembler: public CompilationResourceObj {
void arith_op(LIR_Code code, LIR_Opr left, LIR_Opr right, LIR_Opr dest, CodeEmitInfo* info, bool pop_fpu_stack);
void arithmetic_idiv(LIR_Code code, LIR_Opr left, LIR_Opr right, LIR_Opr temp, LIR_Opr result, CodeEmitInfo* info);
- void intrinsic_op(LIR_Code code, LIR_Opr value, LIR_Opr unused, LIR_Opr dest, LIR_Op* op);
+ void intrinsic_op(LIR_Code code, LIR_Opr value, LIR_Opr temp, LIR_Opr dest, LIR_Op* op);
#ifdef ASSERT
void emit_assert(LIR_OpAssert* op);
#endif
diff --git a/src/hotspot/share/c1/c1_LIRGenerator.cpp b/src/hotspot/share/c1/c1_LIRGenerator.cpp
index 74fdf7a5b76a3..959e49749c5e5 100644
--- a/src/hotspot/share/c1/c1_LIRGenerator.cpp
+++ b/src/hotspot/share/c1/c1_LIRGenerator.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "c1/c1_Compilation.hpp"
#include "c1/c1_Defs.hpp"
#include "c1/c1_FrameMap.hpp"
@@ -1232,13 +1231,6 @@ void LIRGenerator::do_Reference_get(Intrinsic* x) {
void LIRGenerator::do_isInstance(Intrinsic* x) {
assert(x->number_of_arguments() == 2, "wrong type");
- // TODO could try to substitute this node with an equivalent InstanceOf
- // if clazz is known to be a constant Class. This will pick up newly found
- // constants after HIR construction. I'll leave this to a future change.
-
- // as a first cut, make a simple leaf call to runtime to stay platform independent.
- // could follow the aastore example in a future change.
-
LIRItem clazz(x->argument_at(0), this);
LIRItem object(x->argument_at(1), this);
clazz.load_item();
@@ -1251,8 +1243,9 @@ void LIRGenerator::do_isInstance(Intrinsic* x) {
__ null_check(clazz.result(), info);
}
+ address pd_instanceof_fn = isInstance_entry();
LIR_Opr call_result = call_runtime(clazz.value(), object.value(),
- CAST_FROM_FN_PTR(address, Runtime1::is_instance_of),
+ pd_instanceof_fn,
x->type(),
nullptr); // null CodeEmitInfo results in a leaf call
__ move(call_result, result);
@@ -1285,61 +1278,6 @@ void LIRGenerator::do_getClass(Intrinsic* x) {
LIR_OprFact::address(new LIR_Address(temp, T_OBJECT)), result);
}
-// java.lang.Class::isPrimitive()
-void LIRGenerator::do_isPrimitive(Intrinsic* x) {
- assert(x->number_of_arguments() == 1, "wrong type");
-
- LIRItem rcvr(x->argument_at(0), this);
- rcvr.load_item();
- LIR_Opr temp = new_register(T_METADATA);
- LIR_Opr result = rlock_result(x);
-
- CodeEmitInfo* info = nullptr;
- if (x->needs_null_check()) {
- info = state_for(x);
- }
-
- __ move(new LIR_Address(rcvr.result(), java_lang_Class::klass_offset(), T_ADDRESS), temp, info);
- __ cmp(lir_cond_notEqual, temp, LIR_OprFact::metadataConst(nullptr));
- __ cmove(lir_cond_notEqual, LIR_OprFact::intConst(0), LIR_OprFact::intConst(1), result, T_BOOLEAN);
-}
-
-// Example: Foo.class.getModifiers()
-void LIRGenerator::do_getModifiers(Intrinsic* x) {
- assert(x->number_of_arguments() == 1, "wrong type");
-
- LIRItem receiver(x->argument_at(0), this);
- receiver.load_item();
- LIR_Opr result = rlock_result(x);
-
- CodeEmitInfo* info = nullptr;
- if (x->needs_null_check()) {
- info = state_for(x);
- }
-
- // While reading off the universal constant mirror is less efficient than doing
- // another branch and returning the constant answer, this branchless code runs into
- // much less risk of confusion for C1 register allocator. The choice of the universe
- // object here is correct as long as it returns the same modifiers we would expect
- // from the primitive class itself. See spec for Class.getModifiers that provides
- // the typed array klasses with similar modifiers as their component types.
-
- Klass* univ_klass = Universe::byteArrayKlass();
- assert(univ_klass->modifier_flags() == (JVM_ACC_ABSTRACT | JVM_ACC_FINAL | JVM_ACC_PUBLIC), "Sanity");
- LIR_Opr prim_klass = LIR_OprFact::metadataConst(univ_klass);
-
- LIR_Opr recv_klass = new_register(T_METADATA);
- __ move(new LIR_Address(receiver.result(), java_lang_Class::klass_offset(), T_ADDRESS), recv_klass, info);
-
- // Check if this is a Java mirror of primitive type, and select the appropriate klass.
- LIR_Opr klass = new_register(T_METADATA);
- __ cmp(lir_cond_equal, recv_klass, LIR_OprFact::metadataConst(nullptr));
- __ cmove(lir_cond_equal, prim_klass, recv_klass, klass, T_ADDRESS);
-
- // Get the answer.
- __ move(new LIR_Address(klass, in_bytes(Klass::modifier_flags_offset()), T_INT), result);
-}
-
void LIRGenerator::do_getObjectSize(Intrinsic* x) {
assert(x->number_of_arguments() == 3, "wrong type");
LIR_Opr result_reg = rlock_result(x);
@@ -2957,8 +2895,6 @@ void LIRGenerator::do_Intrinsic(Intrinsic* x) {
case vmIntrinsics::_Object_init: do_RegisterFinalizer(x); break;
case vmIntrinsics::_isInstance: do_isInstance(x); break;
- case vmIntrinsics::_isPrimitive: do_isPrimitive(x); break;
- case vmIntrinsics::_getModifiers: do_getModifiers(x); break;
case vmIntrinsics::_getClass: do_getClass(x); break;
case vmIntrinsics::_getObjectSize: do_getObjectSize(x); break;
case vmIntrinsics::_currentCarrierThread: do_currentCarrierThread(x); break;
diff --git a/src/hotspot/share/c1/c1_LIRGenerator.hpp b/src/hotspot/share/c1/c1_LIRGenerator.hpp
index a66758054d7d4..73bd883a7468e 100644
--- a/src/hotspot/share/c1/c1_LIRGenerator.hpp
+++ b/src/hotspot/share/c1/c1_LIRGenerator.hpp
@@ -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
@@ -254,8 +254,6 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure {
void do_RegisterFinalizer(Intrinsic* x);
void do_isInstance(Intrinsic* x);
- void do_isPrimitive(Intrinsic* x);
- void do_getModifiers(Intrinsic* x);
void do_getClass(Intrinsic* x);
void do_getObjectSize(Intrinsic* x);
void do_currentCarrierThread(Intrinsic* x);
@@ -536,6 +534,9 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure {
LIR_Opr syncTempOpr();
LIR_Opr atomicLockOpr();
+ // Intrinsic for Class::isInstance
+ address isInstance_entry();
+
// returns a register suitable for saving the thread in a
// call_runtime_leaf if one is needed.
LIR_Opr getThreadTemp();
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..3a30c9846aab7 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"
@@ -247,6 +246,7 @@ void Runtime1::generate_blob_for(BufferBlob* buffer_blob, C1StubId id) {
case C1StubId::fpu2long_stub_id:
case C1StubId::unwind_exception_id:
case C1StubId::counter_overflow_id:
+ case C1StubId::is_instance_of_id:
expect_oop_map = false;
break;
default:
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/aotClassLocation.cpp b/src/hotspot/share/cds/aotClassLocation.cpp
new file mode 100644
index 0000000000000..8d453fe17738d
--- /dev/null
+++ b/src/hotspot/share/cds/aotClassLocation.cpp
@@ -0,0 +1,999 @@
+/*
+ * 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
+ * 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/aotClassLocation.hpp"
+#include "cds/archiveBuilder.hpp"
+#include "cds/cdsConfig.hpp"
+#include "cds/dynamicArchive.hpp"
+#include "cds/filemap.hpp"
+#include "cds/metaspaceShared.hpp"
+#include "cds/serializeClosure.hpp"
+#include "classfile/classLoader.hpp"
+#include "classfile/classLoaderData.hpp"
+#include "classfile/javaClasses.hpp"
+#include "logging/log.hpp"
+#include "logging/logStream.hpp"
+#include "memory/metadataFactory.hpp"
+#include "memory/metaspaceClosure.hpp"
+#include "memory/resourceArea.hpp"
+#include "oops/array.hpp"
+#include "oops/objArrayKlass.hpp"
+#include "runtime/arguments.hpp"
+#include "utilities/classpathStream.hpp"
+#include "utilities/formatBuffer.hpp"
+#include "utilities/stringUtils.hpp"
+
+#include
+#include
+
+AOTClassLocationConfig* AOTClassLocationConfig::_dumptime_instance = nullptr;
+const AOTClassLocationConfig* AOTClassLocationConfig::_runtime_instance = nullptr;
+
+// A ClassLocationStream represents a list of code locations, which can be iterated using
+// start() and has_next().
+class ClassLocationStream {
+protected:
+ GrowableArray _array;
+ int _current;
+
+ // Add one path to this stream.
+ void add_one_path(const char* path) {
+ _array.append(path);
+ }
+
+ // Add all paths specified in cp; cp must be from -classpath or -Xbootclasspath/a.
+ void add_paths_in_classpath(const char* cp) {
+ ClasspathStream cp_stream(cp);
+ while (cp_stream.has_next()) {
+ add_one_path(cp_stream.get_next());
+ }
+ }
+
+public:
+ ClassLocationStream() : _array(), _current(0) {}
+
+ void print(outputStream* st) const {
+ const char* sep = "";
+ for (int i = 0; i < _array.length(); i++) {
+ st->print("%s%s", sep, _array.at(i));
+ sep = os::path_separator();
+ }
+ }
+
+ void add(ClassLocationStream& css) {
+ for (css.start(); css.has_next();) {
+ add_one_path(css.get_next());
+ }
+ }
+
+ // Iteration
+ void start() { _current = 0; }
+ bool has_next() const { return _current < _array.length(); }
+ const char* get_next() {
+ return _array.at(_current++);
+ }
+
+ int current() const { return _current; }
+ bool is_empty() const { return _array.length() == 0; }
+};
+
+class BootCpClassLocationStream : public ClassLocationStream {
+public:
+ BootCpClassLocationStream() : ClassLocationStream() {
+ // Arguments::get_boot_class_path() contains $JAVA_HOME/lib/modules, but we treat that separately
+ for (const char* bootcp = Arguments::get_boot_class_path(); *bootcp != '\0'; ++bootcp) {
+ if (*bootcp == *os::path_separator()) {
+ ++bootcp;
+ add_paths_in_classpath(bootcp);
+ break;
+ }
+ }
+ }
+};
+
+class AppCpClassLocationStream : public ClassLocationStream {
+public:
+ AppCpClassLocationStream() : ClassLocationStream() {
+ const char* appcp = Arguments::get_appclasspath();
+ if (strcmp(appcp, ".") == 0) {
+ appcp = "";
+ }
+ add_paths_in_classpath(appcp);
+ }
+};
+
+class ModulePathClassLocationStream : public ClassLocationStream {
+ bool _has_non_jar_modules;
+public:
+ ModulePathClassLocationStream();
+ bool has_non_jar_modules() { return _has_non_jar_modules; }
+};
+
+// AllClassLocationStreams is used to iterate over all the code locations that
+// are available to the application from -Xbootclasspath, -classpath and --module-path.
+// When creating an AOT cache, we store the contents from AllClassLocationStreams
+// into an array of AOTClassLocations. See AOTClassLocationConfig::dumptime_init_helper().
+// When loading the AOT cache in a production run, we compare the contents of the
+// stored AOTClassLocations against the current AllClassLocationStreams to determine whether
+// the AOT cache is compatible with the current JVM. See AOTClassLocationConfig::validate().
+class AllClassLocationStreams {
+ BootCpClassLocationStream _boot_cp; // Specified by -Xbootclasspath/a
+ AppCpClassLocationStream _app_cp; // Specified by -classpath
+ ModulePathClassLocationStream _module_path; // Specified by --module-path
+ ClassLocationStream _boot_and_app_cp; // Convenience for iterating over both _boot and _app
+public:
+ BootCpClassLocationStream& boot_cp() { return _boot_cp; }
+ AppCpClassLocationStream& app_cp() { return _app_cp; }
+ ModulePathClassLocationStream& module_path() { return _module_path; }
+ ClassLocationStream& boot_and_app_cp() { return _boot_and_app_cp; }
+
+ AllClassLocationStreams() : _boot_cp(), _app_cp(), _module_path(), _boot_and_app_cp() {
+ _boot_and_app_cp.add(_boot_cp);
+ _boot_and_app_cp.add(_app_cp);
+ }
+};
+
+static bool has_jar_suffix(const char* filename) {
+ // In jdk.internal.module.ModulePath.readModule(), it checks for the ".jar" suffix.
+ // Performing the same check here.
+ const char* dot = strrchr(filename, '.');
+ if (dot != nullptr && strcmp(dot + 1, "jar") == 0) {
+ return true;
+ }
+ return false;
+}
+
+static int compare_module_path_by_name(const char** p1, const char** p2) {
+ return strcmp(*p1, *p2);
+}
+
+ModulePathClassLocationStream::ModulePathClassLocationStream() : ClassLocationStream(), _has_non_jar_modules(false) {
+ // Note: for handling of --module-path, see
+ // https://openjdk.org/jeps/261#Module-paths
+ // https://docs.oracle.com/en/java/javase/23/docs/api/java.base/java/lang/module/ModuleFinder.html#of(java.nio.file.Path...)
+
+ const char* jdk_module_path = Arguments::get_property("jdk.module.path");
+ if (jdk_module_path == nullptr) {
+ return;
+ }
+
+ ClasspathStream cp_stream(jdk_module_path);
+ while (cp_stream.has_next()) {
+ const char* path = cp_stream.get_next();
+ DIR* dirp = os::opendir(path);
+ if (dirp == nullptr && errno == ENOTDIR && has_jar_suffix(path)) {
+ add_one_path(path);
+ } else if (dirp != nullptr) {
+ struct dirent* dentry;
+ bool found_jar = false;
+ while ((dentry = os::readdir(dirp)) != nullptr) {
+ const char* file_name = dentry->d_name;
+ if (has_jar_suffix(file_name)) {
+ size_t full_name_len = strlen(path) + strlen(file_name) + strlen(os::file_separator()) + 1;
+ char* full_name = NEW_RESOURCE_ARRAY(char, full_name_len);
+ int n = os::snprintf(full_name, full_name_len, "%s%s%s", path, os::file_separator(), file_name);
+ assert((size_t)n == full_name_len - 1, "Unexpected number of characters in string");
+ add_one_path(full_name);
+ found_jar = true;
+ } else if (strcmp(file_name, ".") != 0 && strcmp(file_name, "..") != 0) {
+ // Found some non jar entries
+ _has_non_jar_modules = true;
+ log_info(class, path)("Found non-jar path: '%s%s%s'", path, os::file_separator(), file_name);
+ }
+ }
+ if (!found_jar) {
+ log_info(class, path)("Found exploded module path: '%s'", path);
+ _has_non_jar_modules = true;
+ }
+ os::closedir(dirp);
+ } else {
+ _has_non_jar_modules = true;
+ }
+ }
+
+ _array.sort(compare_module_path_by_name);
+}
+
+AOTClassLocation* AOTClassLocation::allocate(JavaThread* current, const char* path, int index,
+ Group group, bool from_cpattr, bool is_jrt) {
+ size_t path_length = 0;
+ size_t manifest_length = 0;
+ bool check_time = false;
+ time_t timestamp = 0;
+ int64_t filesize = 0;
+ FileType type = FileType::NORMAL;
+ // Do not record the actual path of the jrt, as the entire JDK can be moved to a different
+ // directory.
+ const char* recorded_path = is_jrt ? "" : path;
+ path_length = strlen(recorded_path);
+
+ struct stat st;
+ if (os::stat(path, &st) == 0) {
+ if ((st.st_mode & S_IFMT) == S_IFDIR) {
+ type = FileType::DIR;
+ } else {
+ timestamp = st.st_mtime;
+ filesize = st.st_size;
+
+ // The timestamp of $JAVA_HOME/lib/modules is not checked at runtime.
+ check_time = !is_jrt;
+ }
+#ifdef _WINDOWS
+ } else if (errno == ERROR_FILE_NOT_FOUND || errno == ERROR_PATH_NOT_FOUND) {
+ // On Windows, the errno could be ERROR_PATH_NOT_FOUND (3) in case the directory
+ // path doesn't exist.
+ type = FileType::NOT_EXIST;
+#endif
+ } else if (errno == ENOENT) {
+ // We allow the file to not exist, as long as it also doesn't exist during runtime.
+ type = FileType::NOT_EXIST;
+ } else {
+ log_error(cds)("Unable to open file %s.", path);
+ MetaspaceShared::unrecoverable_loading_error();
+ }
+
+ ResourceMark rm(current);
+ char* manifest = nullptr;
+
+ if (!is_jrt && type == FileType::NORMAL) {
+ manifest = read_manifest(current, path, manifest_length); // resource allocated
+ }
+
+ size_t cs_size = header_size() +
+ + path_length + 1 /* nul-terminated */
+ + manifest_length + 1; /* nul-terminated */
+
+ AOTClassLocation* cs = (AOTClassLocation*)os::malloc(cs_size, mtClassShared);
+ memset(cs, 0, cs_size);
+ cs->_path_length = path_length;
+ cs->_manifest_length = manifest_length;
+ cs->_check_time = check_time;
+ cs->_from_cpattr = from_cpattr;
+ cs->_timestamp = timestamp;
+ cs->_filesize = filesize;
+ cs->_file_type = type;
+ cs->_group = group;
+ cs->_index = index;
+
+ strcpy(((char*)cs) + cs->path_offset(), recorded_path);
+ if (manifest_length > 0) {
+ memcpy(((char*)cs) + cs->manifest_offset(), manifest, manifest_length);
+ }
+ assert(*(cs->manifest() + cs->manifest_length()) == '\0', "should be nul-terminated");
+
+ if (strstr(cs->manifest(), "Multi-Release: true") != nullptr) {
+ cs->_is_multi_release_jar = true;
+ }
+
+ if (strstr(cs->manifest(), "Extension-List:") != nullptr) {
+ vm_exit_during_cds_dumping(err_msg("-Xshare:dump does not support Extension-List in JAR manifest: %s", path));
+ }
+
+ return cs;
+}
+
+char* AOTClassLocation::read_manifest(JavaThread* current, const char* path, size_t& manifest_length) {
+ manifest_length = 0;
+
+ struct stat st;
+ if (os::stat(path, &st) != 0) {
+ return nullptr;
+ }
+
+ ClassPathEntry* cpe = ClassLoader::create_class_path_entry(current, path, &st);
+ if (cpe == nullptr) {
+ // is a file, but not a JAR file
+ return nullptr;
+ }
+ assert(cpe->is_jar_file(), "should not be called with a directory");
+
+ const char* name = "META-INF/MANIFEST.MF";
+ char* manifest;
+ jint size;
+ manifest = (char*) ((ClassPathZipEntry*)cpe)->open_entry(current, name, &size, true);
+
+ if (manifest == nullptr || size <= 0) { // No Manifest
+ manifest_length = 0;
+ } else {
+ manifest_length = (size_t)size;
+ }
+
+ delete cpe;
+ return manifest;
+}
+
+// The result is resource allocated.
+char* AOTClassLocation::get_cpattr() const {
+ if (_manifest_length == 0) {
+ return nullptr;
+ }
+
+ size_t buf_size = _manifest_length + 1;
+ char* buf = NEW_RESOURCE_ARRAY(char, buf_size);
+ memcpy(buf, manifest(), _manifest_length);
+ buf[_manifest_length] = 0; // make sure it's 0-terminated
+
+ // See http://docs.oracle.com/javase/6/docs/technotes/guides/jar/jar.html#JAR%20Manifest
+ // Replace all CR/LF and CR with LF
+ StringUtils::replace_no_expand(buf, "\r\n", "\n");
+ // Remove all new-line continuation (remove all "\n " substrings)
+ StringUtils::replace_no_expand(buf, "\n ", "");
+
+ const char* tag = "Class-Path: ";
+ size_t tag_len = strlen(tag);
+ char* found = nullptr;
+ char* line_start = buf;
+ char* end = buf + _manifest_length;
+
+ assert(*end == 0, "must be nul-terminated");
+
+ while (line_start < end) {
+ char* line_end = strchr(line_start, '\n');
+ if (line_end == nullptr) {
+ // JAR spec require the manifest file to be terminated by a new line.
+ break;
+ }
+ if (strncmp(tag, line_start, tag_len) == 0) {
+ if (found != nullptr) {
+ // Same behavior as jdk/src/share/classes/java/util/jar/Attributes.java
+ // If duplicated entries are found, the last one is used.
+ log_warning(cds)("Warning: Duplicate name in Manifest: %s.\n"
+ "Ensure that the manifest does not have duplicate entries, and\n"
+ "that blank lines separate individual sections in both your\n"
+ "manifest and in the META-INF/MANIFEST.MF entry in the jar file:\n%s\n", tag, path());
+ }
+ found = line_start + tag_len;
+ assert(found <= line_end, "sanity");
+ *line_end = '\0';
+ }
+ line_start = line_end + 1;
+ }
+
+ return found;
+}
+
+AOTClassLocation* AOTClassLocation::write_to_archive() const {
+ AOTClassLocation* archived_copy = (AOTClassLocation*)ArchiveBuilder::ro_region_alloc(total_size());
+ memcpy((char*)archived_copy, (char*)this, total_size());
+ return archived_copy;
+}
+
+const char* AOTClassLocation::file_type_string() const {
+ switch (_file_type) {
+ case FileType::NORMAL: return "file";
+ case FileType::DIR: return "dir";
+ case FileType::NOT_EXIST: default: return "not-exist";
+ }
+}
+
+bool AOTClassLocation::check(const char* runtime_path, bool has_aot_linked_classes) const {
+ struct stat st;
+ if (os::stat(runtime_path, &st) != 0) {
+ if (_file_type != FileType::NOT_EXIST) {
+ log_warning(cds)("Required classpath entry does not exist: %s", runtime_path);
+ return false;
+ }
+ } else if ((st.st_mode & S_IFMT) == S_IFDIR) {
+ if (_file_type == FileType::NOT_EXIST) {
+ log_warning(cds)("'%s' must not exist", runtime_path);
+ return false;
+ }
+ if (_file_type == FileType::NORMAL) {
+ log_warning(cds)("'%s' must be a file", runtime_path);
+ return false;
+ }
+ if (!os::dir_is_empty(runtime_path)) {
+ log_warning(cds)("directory is not empty: '%s'", runtime_path);
+ return false;
+ }
+ } else {
+ if (_file_type == FileType::NOT_EXIST) {
+ log_warning(cds)("'%s' must not exist", runtime_path);
+ if (has_aot_linked_classes) {
+ log_error(cds)("CDS archive has aot-linked classes. It cannot be used because the "
+ "file %s exists", runtime_path);
+ return false;
+ } else {
+ log_warning(cds)("Archived non-system classes are disabled because the "
+ "file %s exists", runtime_path);
+ FileMapInfo::current_info()->set_has_platform_or_app_classes(false);
+ if (DynamicArchive::is_mapped()) {
+ FileMapInfo::dynamic_info()->set_has_platform_or_app_classes(false);
+ }
+ }
+ }
+ if (_file_type == FileType::DIR) {
+ log_warning(cds)("'%s' must be a directory", runtime_path);
+ return false;
+ }
+ bool size_differs = _filesize != st.st_size;
+ bool time_differs = _check_time && (_timestamp != st.st_mtime);
+ if (size_differs || time_differs) {
+ log_warning(cds)("This file is not the one used while building the shared archive file: '%s'%s%s",
+ runtime_path,
+ time_differs ? ", timestamp has changed" : "",
+ size_differs ? ", size has changed" : "");
+ return false;
+ }
+ }
+
+ log_info(class, path)("ok");
+ return true;
+}
+
+void AOTClassLocationConfig::dumptime_init(JavaThread* current) {
+ assert(CDSConfig::is_dumping_archive(), "");
+ _dumptime_instance = NEW_C_HEAP_OBJ(AOTClassLocationConfig, mtClassShared);
+ _dumptime_instance->dumptime_init_helper(current);
+ if (current->has_pending_exception()) {
+ // we can get an exception only when we run out of metaspace, but that
+ // shouldn't happen this early in bootstrap.
+ java_lang_Throwable::print(current->pending_exception(), tty);
+ vm_exit_during_initialization("AOTClassLocationConfig::dumptime_init_helper() failed unexpectedly");
+ }
+}
+
+void AOTClassLocationConfig::dumptime_init_helper(TRAPS) {
+ ResourceMark rm;
+ GrowableClassLocationArray tmp_array;
+ AllClassLocationStreams all_css;
+
+ AOTClassLocation* jrt = AOTClassLocation::allocate(THREAD, ClassLoader::get_jrt_entry()->name(),
+ 0, Group::MODULES_IMAGE,
+ /*from_cpattr*/false, /*is_jrt*/true);
+ tmp_array.append(jrt);
+
+ parse(THREAD, tmp_array, all_css.boot_cp(), Group::BOOT_CLASSPATH, /*parse_manifest*/true);
+ _boot_classpath_end = tmp_array.length();
+
+ parse(THREAD, tmp_array, all_css.app_cp(), Group::APP_CLASSPATH, /*parse_manifest*/true);
+ _app_classpath_end = tmp_array.length();
+
+ parse(THREAD, tmp_array, all_css.module_path(), Group::MODULE_PATH, /*parse_manifest*/false);
+ _module_end = tmp_array.length();
+
+ _class_locations = MetadataFactory::new_array(ClassLoaderData::the_null_class_loader_data(),
+ tmp_array.length(), CHECK);
+ for (int i = 0; i < tmp_array.length(); i++) {
+ _class_locations->at_put(i, tmp_array.at(i));
+ }
+
+ const char* lcp = find_lcp(all_css.boot_and_app_cp(), _dumptime_lcp_len);
+ if (_dumptime_lcp_len > 0) {
+ os::free((void*)lcp);
+ log_info(class, path)("Longest common prefix = %s (%zu chars)", lcp, _dumptime_lcp_len);
+ } else {
+ assert(_dumptime_lcp_len == 0, "sanity");
+ log_info(class, path)("Longest common prefix = (0 chars)");
+ }
+
+ _has_non_jar_modules = all_css.module_path().has_non_jar_modules();
+ _has_platform_classes = false;
+ _has_app_classes = false;
+ _max_used_index = 0;
+}
+
+// Find the longest common prefix of two paths, up to max_lcp_len.
+// E.g. p1 = "/a/b/foo"
+// p2 = "/a/b/bar"
+// max_lcp_len = 3
+// -> returns 3
+static size_t find_lcp_of_two_paths(const char* p1, const char* p2, size_t max_lcp_len) {
+ size_t lcp_len = 0;
+ char sep = os::file_separator()[0];
+ for (size_t i = 0; ; i++) {
+ char c1 = *p1++;
+ char c2 = *p2++;
+ if (c1 == 0 || c2 == 0 || c1 != c2) {
+ break;
+ }
+ if (c1 == sep) {
+ lcp_len = i + 1;
+ assert(lcp_len <= max_lcp_len, "sanity");
+ if (lcp_len == max_lcp_len) {
+ break;
+ }
+ }
+ }
+ return lcp_len;
+}
+
+// cheap-allocated if lcp_len > 0
+const char* AOTClassLocationConfig::find_lcp(ClassLocationStream& css, size_t& lcp_len) {
+ const char* first_path = nullptr;
+ char sep = os::file_separator()[0];
+
+ for (css.start(); css.has_next(); ) {
+ const char* path = css.get_next();
+ if (first_path == nullptr) {
+ first_path = path;
+ const char* p = strrchr(first_path, sep);
+ if (p == nullptr) {
+ lcp_len = 0;
+ return "";
+ } else {
+ lcp_len = p - first_path + 1;
+ }
+ } else {
+ lcp_len = find_lcp_of_two_paths(first_path, path, lcp_len);
+ if (lcp_len == 0) {
+ return "";
+ }
+ }
+ }
+
+ if (first_path != nullptr && lcp_len > 0) {
+ char* lcp = NEW_C_HEAP_ARRAY(char, lcp_len + 1, mtClassShared);
+ lcp[0] = 0;
+ strncat(lcp, first_path, lcp_len);
+ return lcp;
+ } else {
+ lcp_len = 0;
+ return "";
+ }
+}
+
+void AOTClassLocationConfig::parse(JavaThread* current, GrowableClassLocationArray& tmp_array,
+ ClassLocationStream& css, Group group, bool parse_manifest) {
+ for (css.start(); css.has_next(); ) {
+ add_class_location(current, tmp_array, css.get_next(), group, parse_manifest, /*from_cpattr*/false);
+ }
+}
+
+void AOTClassLocationConfig::add_class_location(JavaThread* current, GrowableClassLocationArray& tmp_array,
+ const char* path, Group group, bool parse_manifest, bool from_cpattr) {
+ AOTClassLocation* cs = AOTClassLocation::allocate(current, path, tmp_array.length(), group, from_cpattr);
+ tmp_array.append(cs);
+
+ if (!parse_manifest) {
+ // parse_manifest is true for -classpath and -Xbootclasspath/a, and false for --module-path.
+ return;
+ }
+
+ ResourceMark rm;
+ char* cp_attr = cs->get_cpattr(); // resource allocated
+ if (cp_attr != nullptr && strlen(cp_attr) > 0) {
+ //trace_class_path("found Class-Path: ", cp_attr); FIXME
+
+ char sep = os::file_separator()[0];
+ const char* dir_name = cs->path();
+ const char* dir_tail = strrchr(dir_name, sep);
+#ifdef _WINDOWS
+ // On Windows, we also support forward slash as the file separator when locating entries in the classpath entry.
+ const char* dir_tail2 = strrchr(dir_name, '/');
+ if (dir_tail == nullptr) {
+ dir_tail = dir_tail2;
+ } else if (dir_tail2 != nullptr && dir_tail2 > dir_tail) {
+ dir_tail = dir_tail2;
+ }
+#endif
+ int dir_len;
+ if (dir_tail == nullptr) {
+ dir_len = 0;
+ } else {
+ dir_len = pointer_delta_as_int(dir_tail, dir_name) + 1;
+ }
+
+ // Split the cp_attr by spaces, and add each file
+ char* file_start = cp_attr;
+ char* end = file_start + strlen(file_start);
+
+ while (file_start < end) {
+ char* file_end = strchr(file_start, ' ');
+ if (file_end != nullptr) {
+ *file_end = 0;
+ file_end += 1;
+ } else {
+ file_end = end;
+ }
+
+ size_t name_len = strlen(file_start);
+ if (name_len > 0) {
+ ResourceMark rm(current);
+ size_t libname_len = dir_len + name_len;
+ char* libname = NEW_RESOURCE_ARRAY(char, libname_len + 1);
+ int n = os::snprintf(libname, libname_len + 1, "%.*s%s", dir_len, dir_name, file_start);
+ assert((size_t)n == libname_len, "Unexpected number of characters in string");
+
+ // Avoid infinite recursion when two JAR files refer to each
+ // other via cpattr.
+ bool found_duplicate = false;
+ for (int i = boot_cp_start_index(); i < tmp_array.length(); i++) {
+ if (strcmp(tmp_array.at(i)->path(), libname) == 0) {
+ found_duplicate = true;
+ break;
+ }
+ }
+ if (!found_duplicate) {
+ add_class_location(current, tmp_array, libname, group, parse_manifest, /*from_cpattr*/true);
+ }
+ }
+
+ file_start = file_end;
+ }
+ }
+}
+
+AOTClassLocation const* AOTClassLocationConfig::class_location_at(int index) const {
+ return _class_locations->at(index);
+}
+
+int AOTClassLocationConfig::get_module_shared_path_index(Symbol* location) const {
+ if (location->starts_with("jrt:", 4)) {
+ assert(class_location_at(0)->is_modules_image(), "sanity");
+ return 0;
+ }
+
+ if (num_module_paths() == 0) {
+ // The archive(s) were created without --module-path option
+ return -1;
+ }
+
+ if (!location->starts_with("file:", 5)) {
+ return -1;
+ }
+
+ // skip_uri_protocol was also called during dump time -- see ClassLoaderExt::process_module_table()
+ ResourceMark rm;
+ const char* file = ClassLoader::uri_to_path(location->as_C_string());
+ for (int i = module_path_start_index(); i < module_path_end_index(); i++) {
+ const AOTClassLocation* cs = class_location_at(i);
+ assert(!cs->has_unnamed_module(), "must be");
+ bool same = os::same_files(file, cs->path());
+ log_debug(class, path)("get_module_shared_path_index (%d) %s : %s = %s", i,
+ location->as_C_string(), cs->path(), same ? "same" : "different");
+ if (same) {
+ return i;
+ }
+ }
+ return -1;
+}
+
+// We allow non-empty dirs as long as no classes have been loaded from them.
+void AOTClassLocationConfig::check_nonempty_dirs() const {
+ assert(CDSConfig::is_dumping_archive(), "sanity");
+
+ bool has_nonempty_dir = false;
+ dumptime_iterate([&](AOTClassLocation* cs) {
+ if (cs->index() > _max_used_index) {
+ return false; // stop iterating
+ }
+ if (cs->is_dir()) {
+ if (!os::dir_is_empty(cs->path())) {
+ log_error(cds)("Error: non-empty directory '%s'", cs->path());
+ has_nonempty_dir = true;
+ }
+ }
+ return true; // keep iterating
+ });
+
+ if (has_nonempty_dir) {
+ vm_exit_during_cds_dumping("Cannot have non-empty directory in paths", nullptr);
+ }
+}
+
+AOTClassLocationConfig* AOTClassLocationConfig::write_to_archive() const {
+ Array* archived_copy = ArchiveBuilder::new_ro_array(_class_locations->length());
+ for (int i = 0; i < _class_locations->length(); i++) {
+ archived_copy->at_put(i, _class_locations->at(i)->write_to_archive());
+ ArchivePtrMarker::mark_pointer((address*)archived_copy->adr_at(i));
+ }
+
+ AOTClassLocationConfig* dumped = (AOTClassLocationConfig*)ArchiveBuilder::ro_region_alloc(sizeof(AOTClassLocationConfig));
+ memcpy(dumped, this, sizeof(AOTClassLocationConfig));
+ dumped->_class_locations = archived_copy;
+ ArchivePtrMarker::mark_pointer(&dumped->_class_locations);
+
+ return dumped;
+}
+
+bool AOTClassLocationConfig::check_classpaths(bool is_boot_classpath, bool has_aot_linked_classes,
+ int index_start, int index_end,
+ ClassLocationStream& runtime_css,
+ bool use_lcp_match, const char* runtime_lcp,
+ size_t runtime_lcp_len) const {
+ if (index_start >= index_end && runtime_css.is_empty()) { // nothing to check
+ return true;
+ }
+
+ ResourceMark rm;
+ const char* which = is_boot_classpath ? "boot" : "app";
+ LogTarget(Info, class, path) lt;
+ if (lt.is_enabled()) {
+ LogStream ls(lt);
+ ls.print("Checking %s classpath", which);
+ ls.print_cr("%s", use_lcp_match ? " (with longest common prefix substitution)" : "");
+ ls.print("- expected : '");
+ print_dumptime_classpath(ls, index_start, index_end, use_lcp_match, _dumptime_lcp_len, runtime_lcp, runtime_lcp_len);
+ ls.print_cr("'");
+ ls.print("- actual : '");
+ runtime_css.print(&ls);
+ ls.print_cr("'");
+ }
+
+ runtime_css.start();
+ for (int i = index_start; i < index_end; i++) {
+ ResourceMark rm;
+ const AOTClassLocation* cs = class_location_at(i);
+ const char* effective_dumptime_path = cs->path();
+ if (use_lcp_match && _dumptime_lcp_len > 0) {
+ effective_dumptime_path = substitute(effective_dumptime_path, _dumptime_lcp_len, runtime_lcp, runtime_lcp_len);
+ }
+
+ log_info(class, path)("Checking '%s' %s%s", effective_dumptime_path, cs->file_type_string(),
+ cs->from_cpattr() ? " (from JAR manifest ClassPath attribute)" : "");
+ if (!cs->from_cpattr() && file_exists(effective_dumptime_path)) {
+ if (!runtime_css.has_next()) {
+ log_warning(cds)("%s classpath has fewer elements than expected", which);
+ return false;
+ }
+ const char* runtime_path = runtime_css.get_next();
+ while (!file_exists(runtime_path) && runtime_css.has_next()) {
+ runtime_path = runtime_css.get_next();
+ }
+ if (!os::same_files(effective_dumptime_path, runtime_path)) {
+ log_warning(cds)("The name of %s classpath [%d] does not match: expected '%s', got '%s'",
+ which, runtime_css.current(), effective_dumptime_path, runtime_path);
+ return false;
+ }
+ }
+
+ if (!cs->check(effective_dumptime_path, has_aot_linked_classes)) {
+ return false;
+ }
+ }
+
+ // Check if the runtime boot classpath has more entries than the one stored in the archive and if the app classpath
+ // or the module path requires validation.
+ if (is_boot_classpath && runtime_css.has_next() && (need_to_check_app_classpath() || num_module_paths() > 0)) {
+ // the check passes if all the extra runtime boot classpath entries are non-existent
+ if (check_paths_existence(runtime_css)) {
+ log_warning(cds)("boot classpath is longer than expected");
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool AOTClassLocationConfig::file_exists(const char* filename) const{
+ struct stat st;
+ return (os::stat(filename, &st) == 0 && st.st_size > 0);
+}
+
+bool AOTClassLocationConfig::check_paths_existence(ClassLocationStream& runtime_css) const {
+ bool exist = false;
+ while (runtime_css.has_next()) {
+ const char* path = runtime_css.get_next();
+ if (file_exists(path)) {
+ exist = true;
+ break;
+ }
+ }
+ return exist;
+}
+
+bool AOTClassLocationConfig::check_module_paths(bool has_aot_linked_classes, int index_start, int index_end,
+ ClassLocationStream& runtime_css,
+ bool* has_extra_module_paths) const {
+ if (index_start >= index_end && runtime_css.is_empty()) { // nothing to check
+ return true;
+ }
+
+ ResourceMark rm;
+
+ LogTarget(Info, class, path) lt;
+ if (lt.is_enabled()) {
+ LogStream ls(lt);
+ ls.print_cr("Checking module paths");
+ ls.print("- expected : '");
+ print_dumptime_classpath(ls, index_start, index_end, false, 0, nullptr, 0);
+ ls.print_cr("'");
+ ls.print("- actual : '");
+ runtime_css.print(&ls);
+ ls.print_cr("'");
+ }
+
+ // Make sure all the dumptime module paths exist and are unchanged
+ for (int i = index_start; i < index_end; i++) {
+ const AOTClassLocation* cs = class_location_at(i);
+ const char* dumptime_path = cs->path();
+
+ assert(!cs->from_cpattr(), "not applicable for module path");
+ log_info(class, path)("Checking '%s' %s", dumptime_path, cs->file_type_string());
+
+ if (!cs->check(dumptime_path, has_aot_linked_classes)) {
+ return false;
+ }
+ }
+
+ // We allow runtime_css to be a superset of the module paths specified in dumptime. E.g.,
+ // Dumptime: A:C
+ // Runtime: A:B:C
+ runtime_css.start();
+ for (int i = index_start; i < index_end; i++) {
+ const AOTClassLocation* cs = class_location_at(i);
+ const char* dumptime_path = cs->path();
+
+ while (true) {
+ if (!runtime_css.has_next()) {
+ log_warning(cds)("module path has fewer elements than expected");
+ *has_extra_module_paths = true;
+ return true;
+ }
+ // Both this->class_locations() and runtime_css are alphabetically sorted. Skip
+ // items in runtime_css until we see dumptime_path.
+ const char* runtime_path = runtime_css.get_next();
+ if (!os::same_files(dumptime_path, runtime_path)) {
+ *has_extra_module_paths = true;
+ return true;
+ } else {
+ break;
+ }
+ }
+ }
+
+ if (runtime_css.has_next()) {
+ *has_extra_module_paths = true;
+ }
+
+ return true;
+}
+
+void AOTClassLocationConfig::print_dumptime_classpath(LogStream& ls, int index_start, int index_end,
+ bool do_substitute, size_t remove_prefix_len,
+ const char* prepend, size_t prepend_len) const {
+ const char* sep = "";
+ for (int i = index_start; i < index_end; i++) {
+ ResourceMark rm;
+ const AOTClassLocation* cs = class_location_at(i);
+ const char* path = cs->path();
+ if (!cs->from_cpattr()) {
+ ls.print("%s", sep);
+ if (do_substitute) {
+ path = substitute(path, remove_prefix_len, prepend, prepend_len);
+ }
+ ls.print("%s", path);
+ sep = os::path_separator();
+ }
+ }
+}
+
+// Returned path is resource-allocated
+const char* AOTClassLocationConfig::substitute(const char* path, // start with this path (which was recorded from dump time)
+ size_t remove_prefix_len, // remove this number of chars from the beginning
+ const char* prepend, // prepend this string
+ size_t prepend_len) { // length of the prepended string
+ size_t len = strlen(path);
+ assert(len > remove_prefix_len, "sanity");
+ assert(prepend_len == strlen(prepend), "sanity");
+ len -= remove_prefix_len;
+ len += prepend_len;
+
+ char* buf = NEW_RESOURCE_ARRAY(char, len + 1);
+ int n = os::snprintf(buf, len + 1, "%s%s", prepend, path + remove_prefix_len);
+ assert(size_t(n) == len, "sanity");
+
+ return buf;
+}
+
+// For performance, we avoid using LCP match if there's at least one
+// AOTClassLocation can be matched exactly: this means all other AOTClassLocations must be
+// matched exactly.
+bool AOTClassLocationConfig::need_lcp_match(AllClassLocationStreams& all_css) const {
+ if (app_cp_end_index() == boot_cp_start_index()) {
+ // No need to use lcp-match when there are no boot/app paths.
+ // TODO: LCP-match not yet supported for modules.
+ return false;
+ }
+
+ if (need_lcp_match_helper(boot_cp_start_index(), boot_cp_end_index(), all_css.boot_cp()) &&
+ need_lcp_match_helper(app_cp_start_index(), app_cp_end_index(), all_css.app_cp())) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
+bool AOTClassLocationConfig::need_lcp_match_helper(int start, int end, ClassLocationStream& css) const {
+ int i = start;
+ for (css.start(); i < end && css.has_next(); ) {
+ const AOTClassLocation* cs = class_location_at(i++);
+ const char* runtime_path = css.get_next();
+ if (cs->must_exist() && os::same_files(cs->path(), runtime_path)) {
+ // Most likely, we will come to here at the first iteration.
+ return false;
+ }
+ }
+ return true;
+}
+
+bool AOTClassLocationConfig::validate(bool has_aot_linked_classes, bool* has_extra_module_paths) const {
+ ResourceMark rm;
+ AllClassLocationStreams all_css;
+
+ const char* jrt = ClassLoader::get_jrt_entry()->name();
+ bool success = class_location_at(0)->check(jrt, has_aot_linked_classes);
+ log_info(class, path)("Modules image %s validation: %s", jrt, success ? "passed" : "failed");
+ if (!success) {
+ return false;
+ }
+ if (class_locations()->length() == 1) {
+ if ((module_path_start_index() >= module_path_end_index()) && Arguments::get_property("jdk.module.path") != nullptr) {
+ *has_extra_module_paths = true;
+ } else {
+ *has_extra_module_paths = false;
+ }
+ } else {
+ bool use_lcp_match = need_lcp_match(all_css);
+ const char* runtime_lcp;
+ size_t runtime_lcp_len;
+
+ log_info(class, path)("Longest common prefix substitution in boot/app classpath matching: %s",
+ use_lcp_match ? "yes" : "no");
+ if (use_lcp_match) {
+ runtime_lcp = find_lcp(all_css.boot_and_app_cp(), runtime_lcp_len);
+ log_info(class, path)("Longest common prefix: %s (%zu chars)", runtime_lcp, runtime_lcp_len);
+ } else {
+ runtime_lcp = nullptr;
+ runtime_lcp_len = 0;
+ }
+
+ success = check_classpaths(true, has_aot_linked_classes, boot_cp_start_index(), boot_cp_end_index(), all_css.boot_cp(),
+ use_lcp_match, runtime_lcp, runtime_lcp_len);
+ log_info(class, path)("Archived boot classpath validation: %s", success ? "passed" : "failed");
+
+ if (success && need_to_check_app_classpath()) {
+ success = check_classpaths(false, has_aot_linked_classes, app_cp_start_index(), app_cp_end_index(), all_css.app_cp(),
+ use_lcp_match, runtime_lcp, runtime_lcp_len);
+ log_info(class, path)("Archived app classpath validation: %s", success ? "passed" : "failed");
+ }
+
+ if (success) {
+ success = check_module_paths(has_aot_linked_classes, module_path_start_index(), module_path_end_index(),
+ all_css.module_path(), has_extra_module_paths);
+ log_info(class, path)("Archived module path validation: %s%s", success ? "passed" : "failed",
+ (*has_extra_module_paths) ? " (extra module paths found)" : "");
+ }
+
+ if (runtime_lcp_len > 0) {
+ os::free((void*)runtime_lcp);
+ }
+ }
+
+ if (success) {
+ _runtime_instance = this;
+ } else {
+ const char* mismatch_msg = "shared class paths mismatch";
+ const char* hint_msg = log_is_enabled(Info, class, path) ?
+ "" : " (hint: enable -Xlog:class+path=info to diagnose the failure)";
+ if (RequireSharedSpaces && !PrintSharedArchiveAndExit) {
+ log_error(cds)("%s%s", mismatch_msg, hint_msg);
+ MetaspaceShared::unrecoverable_loading_error();
+ } else {
+ log_warning(cds)("%s%s", mismatch_msg, hint_msg);
+ }
+ }
+ return success;
+}
diff --git a/src/hotspot/share/cds/aotClassLocation.hpp b/src/hotspot/share/cds/aotClassLocation.hpp
new file mode 100644
index 0000000000000..cb53e9c96e9d4
--- /dev/null
+++ b/src/hotspot/share/cds/aotClassLocation.hpp
@@ -0,0 +1,269 @@
+/*
+ * 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
+ * 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_AOTCLASSLOCATION_HPP
+#define SHARE_CDS_AOTCLASSLOCATION_HPP
+
+#include "memory/allocation.hpp"
+#include "oops/array.hpp"
+#include "utilities/exceptions.hpp"
+#include "utilities/growableArray.hpp"
+#include "utilities/globalDefinitions.hpp"
+#include "utilities/macros.hpp"
+
+class AllClassLocationStreams;
+class ClassLocationStream;
+class LogStream;
+
+// An AOTClassLocation is a location where the application is configured to load Java classes
+// from. It can be:
+// - the location of $JAVA_HOME/lib/modules
+// - an entry in -Xbootclasspath/a
+// - an entry in -classpath
+// - a JAR file specified using --module-path.
+//
+// AOTClassLocation is similar to java.security.CodeSource, except:
+// - Only local files/dirs are allowed. Directories must be empty. Network locations are not allowed.
+// - No code signing information is recorded.
+//
+// We avoid using pointers in AOTClassLocation to avoid runtime pointer relocation. Each AOTClassLocation
+// is a variable-size structure:
+// [ all fields specified below (sizeof(AOTClassLocation) bytes) ]
+// [ path (_path_length bytes, including the terminating zero) ]
+// [ manifest (_manifest_length bytes, including the terminating zero) ]
+class AOTClassLocation {
+public:
+ enum class Group : int {
+ MODULES_IMAGE,
+ BOOT_CLASSPATH,
+ APP_CLASSPATH,
+ MODULE_PATH
+ };
+private:
+ enum class FileType : int {
+ NORMAL,
+ DIR,
+ NOT_EXIST
+ };
+ size_t _path_length; // does NOT include terminating zero
+ size_t _manifest_length; // does NOT include terminating zero
+ bool _check_time;
+ bool _from_cpattr;
+ bool _is_multi_release_jar; // is this a JAR file that has multi-release classes?
+ FileType _file_type;
+ Group _group;
+ int _index; // index of this AOTClassLocation inside AOTClassLocationConfig::_class_locations
+ time_t _timestamp;
+ int64_t _filesize;
+
+ static size_t header_size() { return sizeof(AOTClassLocation); } // bytes
+ size_t path_offset() const { return header_size(); }
+ size_t manifest_offset() const { return path_offset() + _path_length + 1; }
+ static char* read_manifest(JavaThread* current, const char* path, size_t& manifest_length);
+
+public:
+ static AOTClassLocation* allocate(JavaThread* current, const char* path, int index, Group group,
+ bool from_cpattr = false, bool is_jrt = false);
+
+ size_t total_size() const { return manifest_offset() + _manifest_length + 1; }
+ const char* path() const { return ((const char*)this) + path_offset(); }
+ size_t manifest_length() const { return _manifest_length; }
+ const char* manifest() const { return ((const char*)this) + manifest_offset(); }
+ bool must_exist() const { return _file_type != FileType::NOT_EXIST; }
+ bool must_not_exist() const { return _file_type == FileType::NOT_EXIST; }
+ bool is_dir() const { return _file_type == FileType::DIR; }
+ int index() const { return _index; }
+ bool is_modules_image() const { return _group == Group::MODULES_IMAGE; }
+ bool from_boot_classpath() const { return _group == Group::BOOT_CLASSPATH; }
+ bool from_app_classpath() const { return _group == Group::APP_CLASSPATH; }
+ bool from_module_path() const { return _group == Group::MODULE_PATH; }
+ bool is_multi_release_jar() const { return _is_multi_release_jar; }
+
+ // Only boot/app classpaths can contain unnamed module
+ bool has_unnamed_module() const { return from_boot_classpath() || from_app_classpath(); }
+
+ char* get_cpattr() const;
+ AOTClassLocation* write_to_archive() const;
+
+ // Returns true IFF this AOTClassLocation is discovered from the -classpath or -Xbootclasspath/a by parsing the
+ // "Class-Path" attribute of a JAR file.
+ bool from_cpattr() const { return _from_cpattr; }
+ const char* file_type_string() const;
+ bool check(const char* runtime_path, bool has_aot_linked_classes) const;
+};
+
+// AOTClassLocationConfig
+//
+// Keep track of the set of AOTClassLocations used when an AOTCache is created.
+// To load the AOTCache in a production run, the JVM must be using a compatible set of
+// AOTClassLocations (subjected to AOTClassLocationConfig::validate()).
+//
+// In general, validation is performed on the AOTClassLocations to ensure the code locations used
+// during AOTCache creation are the same as when the AOTCache is used during runtime.
+// Non-existent entries are recorded during AOTCache creation. Those non-existent entries,
+// if they are specified at runtime, must not exist.
+//
+// Some details on validation:
+// - the boot classpath can be appended to at runtime if there's no app classpath and no
+// module path specified when an AOTCache is created;
+// - the app classpath can be appended to at runtime;
+// - the module path at runtime can be a superset of the one specified during AOTCache creation.
+
+class AOTClassLocationConfig : public CHeapObj {
+ using Group = AOTClassLocation::Group;
+ using GrowableClassLocationArray = GrowableArrayCHeap;
+
+ // Note: both of the following are non-null if we are dumping a dynamic archive.
+ static AOTClassLocationConfig* _dumptime_instance;
+ static const AOTClassLocationConfig* _runtime_instance;
+
+ Array* _class_locations; // jrt -> -Xbootclasspath/a -> -classpath -> --module_path
+ int _boot_classpath_end;
+ int _app_classpath_end;
+ int _module_end;
+ bool _has_non_jar_modules;
+ bool _has_platform_classes;
+ bool _has_app_classes;
+ int _max_used_index;
+ size_t _dumptime_lcp_len;
+
+ // accessors
+ Array* class_locations() const { return _class_locations; }
+
+ void parse(JavaThread* current, GrowableClassLocationArray& tmp_array, ClassLocationStream& css,
+ Group group, bool parse_manifest);
+ void add_class_location(JavaThread* current, GrowableClassLocationArray& tmp_array, const char* path,
+ Group group, bool parse_manifest, bool from_cpattr);
+ void dumptime_init_helper(TRAPS);
+
+ bool check_classpaths(bool is_boot_classpath, bool has_aot_linked_classes,
+ int index_start, int index_end, ClassLocationStream& runtime_css,
+ bool use_lcp_match, const char* runtime_lcp, size_t runtime_lcp_len) const;
+ bool check_module_paths(bool has_aot_linked_classes, int index_start, int index_end, ClassLocationStream& runtime_css,
+ bool* has_extra_module_paths) const;
+ bool file_exists(const char* filename) const;
+ bool check_paths_existence(ClassLocationStream& runtime_css) const;
+
+ static const char* substitute(const char* path, size_t remove_prefix_len,
+ const char* prepend, size_t prepend_len);
+ static const char* find_lcp(ClassLocationStream& css, size_t& lcp_len);
+ bool need_lcp_match(AllClassLocationStreams& all_css) const;
+ bool need_lcp_match_helper(int start, int end, ClassLocationStream& css) const;
+
+ template void dumptime_iterate_helper(FUNC func) const {
+ assert(_class_locations != nullptr, "sanity");
+ int n = _class_locations->length();
+ for (int i = 0; i < n; i++) {
+ if (!func(_class_locations->at(i))) {
+ break;
+ }
+ }
+ }
+
+ template void iterate(FUNC func) const {
+ int n = class_locations()->length();
+ for (int i = 0; i < n; i++) {
+ if (!func(class_locations()->at(i))) {
+ break;
+ }
+ }
+ }
+
+ void check_nonempty_dirs() const;
+ bool need_to_check_app_classpath() const {
+ return (num_app_classpaths() > 0) && (_max_used_index >= app_cp_start_index()) && has_platform_or_app_classes();
+ }
+
+ void print_dumptime_classpath(LogStream& ls, int index_start, int index_limit,
+ bool do_substitute, size_t remove_prefix_len,
+ const char* prepend, size_t prepend_len) const;
+public:
+ static AOTClassLocationConfig* dumptime() {
+ assert(_dumptime_instance != nullptr, "can only be called when dumping an AOT cache");
+ return _dumptime_instance;
+ }
+
+ static const AOTClassLocationConfig* runtime() {
+ assert(_runtime_instance != nullptr, "can only be called when using an AOT cache");
+ return _runtime_instance;
+ }
+
+ // Common accessors
+ int boot_cp_start_index() const { return 1; }
+ int boot_cp_end_index() const { return _boot_classpath_end; }
+ int app_cp_start_index() const { return boot_cp_end_index(); }
+ int app_cp_end_index() const { return _app_classpath_end; }
+ int module_path_start_index() const { return app_cp_end_index(); }
+ int module_path_end_index() const { return _module_end; }
+ bool has_platform_or_app_classes() const { return _has_app_classes || _has_platform_classes; }
+ bool has_non_jar_modules() const { return _has_non_jar_modules; }
+ int num_boot_classpaths() const { return boot_cp_end_index() - boot_cp_start_index(); }
+ int num_app_classpaths() const { return app_cp_end_index() - app_cp_start_index(); }
+ int num_module_paths() const { return module_path_end_index() - module_path_start_index(); }
+
+ int length() const {
+ return _class_locations->length();
+ }
+
+ const AOTClassLocation* class_location_at(int index) const;
+ int get_module_shared_path_index(Symbol* location) const;
+
+ // Functions used only during dumptime
+ static void dumptime_init(JavaThread* current);
+
+ static void dumptime_set_has_app_classes() {
+ _dumptime_instance->_has_app_classes = true;
+ }
+
+ static void dumptime_set_has_platform_classes() {
+ _dumptime_instance->_has_platform_classes = true;
+ }
+
+ static void dumptime_update_max_used_index(int index) {
+ if (_dumptime_instance == nullptr) {
+ assert(index == 0, "sanity");
+ } else if (_dumptime_instance->_max_used_index < index) {
+ _dumptime_instance->_max_used_index = index;
+ }
+ }
+
+ static void dumptime_check_nonempty_dirs() {
+ _dumptime_instance->check_nonempty_dirs();
+ }
+
+ static bool dumptime_is_ready() {
+ return _dumptime_instance != nullptr;
+ }
+ template static void dumptime_iterate(FUNC func) {
+ _dumptime_instance->dumptime_iterate_helper(func);
+ }
+
+ AOTClassLocationConfig* write_to_archive() const;
+
+ // Functions used only during runtime
+ bool validate(bool has_aot_linked_classes, bool* has_extra_module_paths) const;
+};
+
+
+#endif // SHARE_CDS_AOTCLASSLOCATION_HPP
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 1cd9d13c3bab9..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"
@@ -47,6 +47,7 @@
#include "logging/log.hpp"
#include "logging/logStream.hpp"
#include "memory/allStatic.hpp"
+#include "memory/memoryReserver.hpp"
#include "memory/memRegion.hpp"
#include "memory/resourceArea.hpp"
#include "oops/compressedKlass.inline.hpp"
@@ -152,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),
@@ -171,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);
@@ -193,8 +190,10 @@ ArchiveBuilder::~ArchiveBuilder() {
delete _klasses;
delete _symbols;
if (_shared_rs.is_reserved()) {
- _shared_rs.release();
+ MemoryReserver::release(_shared_rs);
}
+
+ AOTArtifactFinder::dispose();
}
// Returns a deterministic sequence of pseudo random numbers. The main purpose is NOT
@@ -232,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();
@@ -246,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);
@@ -287,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();
@@ -314,57 +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();
- ReservedSpace rs(buffer_size, MetaspaceShared::core_region_alignment(), os::vm_page_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);
@@ -583,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) {
@@ -1242,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());
@@ -1262,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);
}
@@ -1303,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();
}
@@ -1406,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);
@@ -1631,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);
}
@@ -1644,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 e42b2f478ec08..e3efedd46f14c 100644
--- a/src/hotspot/share/cds/archiveBuilder.hpp
+++ b/src/hotspot/share/cds/archiveBuilder.hpp
@@ -29,6 +29,8 @@
#include "cds/dumpAllocStats.hpp"
#include "memory/metaspace.hpp"
#include "memory/metaspaceClosure.hpp"
+#include "memory/reservedSpace.hpp"
+#include "memory/virtualspace.hpp"
#include "oops/array.hpp"
#include "oops/klass.hpp"
#include "runtime/os.hpp"
@@ -94,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
@@ -271,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/archiveHeapLoader.hpp b/src/hotspot/share/cds/archiveHeapLoader.hpp
index 8b9fab91aa3fd..e559b447ebf5e 100644
--- a/src/hotspot/share/cds/archiveHeapLoader.hpp
+++ b/src/hotspot/share/cds/archiveHeapLoader.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
@@ -25,7 +25,6 @@
#ifndef SHARE_CDS_ARCHIVEHEAPLOADER_HPP
#define SHARE_CDS_ARCHIVEHEAPLOADER_HPP
-#include "cds/filemap.hpp"
#include "gc/shared/gc_globals.hpp"
#include "memory/allocation.hpp"
#include "memory/allStatic.hpp"
diff --git a/src/hotspot/share/cds/archiveHeapWriter.cpp b/src/hotspot/share/cds/archiveHeapWriter.cpp
index be821044a96ba..5684066105f1f 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"
@@ -78,7 +78,7 @@ static FillersTable* _fillers;
static int _num_native_ptrs = 0;
void ArchiveHeapWriter::init() {
- if (HeapShared::can_write()) {
+ if (CDSConfig::is_dumping_heap()) {
Universe::heap()->collect(GCCause::_java_lang_system_gc);
_buffer_offset_to_source_obj_table = new BufferOffsetToSourceObjectTable(/*size (prime)*/36137, /*max size*/1 * M);
@@ -99,7 +99,7 @@ void ArchiveHeapWriter::add_source_obj(oop src_obj) {
void ArchiveHeapWriter::write(GrowableArrayCHeap* roots,
ArchiveHeapInfo* heap_info) {
- assert(HeapShared::can_write(), "sanity");
+ assert(CDSConfig::is_dumping_heap(), "sanity");
allocate_buffer();
copy_source_objs_to_buffer(roots);
set_requested_address(heap_info);
@@ -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..564298fa5c8e9 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,10 +22,10 @@
*
*/
-#include "precompiled.hpp"
#include "cds/archiveHeapLoader.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/classListWriter.hpp"
+#include "cds/filemap.hpp"
#include "cds/heapShared.hpp"
#include "classfile/classLoaderDataShared.hpp"
#include "classfile/moduleEntry.hpp"
@@ -47,6 +47,7 @@ bool CDSConfig::_is_using_full_module_graph = true;
bool CDSConfig::_has_aot_linked_classes = false;
bool CDSConfig::_has_archived_invokedynamic = false;
bool CDSConfig::_old_cds_flags_used = false;
+bool CDSConfig::_disable_heap_dumping = false;
char* CDSConfig::_default_archive_path = nullptr;
char* CDSConfig::_static_archive_path = nullptr;
@@ -420,6 +421,11 @@ void CDSConfig::check_flag_aliases() {
bool CDSConfig::check_vm_args_consistency(bool patch_mod_javabase, bool mode_flag_cmd_line) {
check_flag_aliases();
+ if (!FLAG_IS_DEFAULT(AOTMode)) {
+ // Using any form of the new AOTMode switch enables enhanced optimizations.
+ FLAG_SET_ERGO_IF_DEFAULT(AOTClassLinking, true);
+ }
+
if (AOTClassLinking) {
// If AOTClassLinking is specified, enable all AOT optimizations by default.
FLAG_SET_ERGO_IF_DEFAULT(AOTInvokeDynamicLinking, true);
@@ -528,10 +534,53 @@ bool CDSConfig::current_thread_is_vm_or_dumper() {
return t != nullptr && (t->is_VM_thread() || t == _dumper_thread);
}
+// If an incompatible VM options is found, return a text message that explains why
+static const char* check_options_incompatible_with_dumping_heap() {
+#if INCLUDE_CDS_JAVA_HEAP
+ if (!UseCompressedClassPointers) {
+ return "UseCompressedClassPointers must be true";
+ }
+
+ // Almost all GCs support heap region dump, except ZGC (so far).
+ if (UseZGC) {
+ return "ZGC is not supported";
+ }
+
+ return nullptr;
+#else
+ return "JVM not configured for writing Java heap objects";
+#endif
+}
+
+void CDSConfig::log_reasons_for_not_dumping_heap() {
+ const char* reason;
+
+ assert(!is_dumping_heap(), "sanity");
+
+ if (_disable_heap_dumping) {
+ reason = "Programmatically disabled";
+ } else {
+ reason = check_options_incompatible_with_dumping_heap();
+ }
+
+ assert(reason != nullptr, "sanity");
+ log_info(cds)("Archived java heap is not supported: %s", reason);
+}
+
#if INCLUDE_CDS_JAVA_HEAP
+bool CDSConfig::are_vm_options_incompatible_with_dumping_heap() {
+ return check_options_incompatible_with_dumping_heap() != nullptr;
+}
+
+
bool CDSConfig::is_dumping_heap() {
- // heap dump is not supported in dynamic dump
- return is_dumping_static_archive() && HeapShared::can_write();
+ if (!is_dumping_static_archive() // heap dump is not supported in dynamic dump
+ || are_vm_options_incompatible_with_dumping_heap()
+ || _disable_heap_dumping) {
+ return false;
+ }
+
+ return true;
}
bool CDSConfig::is_loading_heap() {
diff --git a/src/hotspot/share/cds/cdsConfig.hpp b/src/hotspot/share/cds/cdsConfig.hpp
index cceaceeb6d768..c2dc2b41a93c5 100644
--- a/src/hotspot/share/cds/cdsConfig.hpp
+++ b/src/hotspot/share/cds/cdsConfig.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
@@ -46,6 +46,7 @@ class CDSConfig : public AllStatic {
static char* _dynamic_archive_path;
static bool _old_cds_flags_used;
+ static bool _disable_heap_dumping;
static JavaThread* _dumper_thread;
#endif
@@ -116,6 +117,10 @@ class CDSConfig : public AllStatic {
// --- Archived java objects
+ static bool are_vm_options_incompatible_with_dumping_heap() NOT_CDS_JAVA_HEAP_RETURN_(true);
+ static void log_reasons_for_not_dumping_heap();
+
+ static void disable_heap_dumping() { CDS_ONLY(_disable_heap_dumping = true); }
static bool is_dumping_heap() NOT_CDS_JAVA_HEAP_RETURN_(false);
static bool is_loading_heap() NOT_CDS_JAVA_HEAP_RETURN_(false);
static bool is_initing_classes_at_dump_time() NOT_CDS_JAVA_HEAP_RETURN_(false);
diff --git a/src/hotspot/share/cds/cdsConstants.cpp b/src/hotspot/share/cds/cdsConstants.cpp
index 6dbacb2774f12..81b5920cc534f 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"
@@ -38,7 +37,6 @@ CDSConst CDSConstants::offsets[] = {
{ "GenericCDSFileMapHeader::_base_archive_name_size", offset_of(GenericCDSFileMapHeader, _base_archive_name_size) },
{ "CDSFileMapHeaderBase::_regions[0]", offset_of(CDSFileMapHeaderBase, _regions) },
{ "FileMapHeader::_jvm_ident", offset_of(FileMapHeader, _jvm_ident) },
- { "FileMapHeader::_common_app_classpath_prefix_size", offset_of(FileMapHeader, _common_app_classpath_prefix_size) },
{ "CDSFileMapRegion::_crc", offset_of(CDSFileMapRegion, _crc) },
{ "CDSFileMapRegion::_used", offset_of(CDSFileMapRegion, _used) },
{ "DynamicArchiveHeader::_base_region_crc", offset_of(DynamicArchiveHeader, _base_region_crc) }
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..dc3d8621db1b0 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,7 @@
*
*/
-#include "precompiled.hpp"
+#include "cds/aotClassLocation.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/cdsProtectionDomain.hpp"
#include "classfile/classLoader.hpp"
@@ -50,10 +50,10 @@ OopHandle CDSProtectionDomain::_shared_jar_manifests;
Handle CDSProtectionDomain::init_security_info(Handle class_loader, InstanceKlass* ik, PackageEntry* pkg_entry, TRAPS) {
int index = ik->shared_classpath_index();
assert(index >= 0, "Sanity");
- SharedClassPathEntry* ent = FileMapInfo::shared_path(index);
+ const AOTClassLocation* cl = AOTClassLocationConfig::runtime()->class_location_at(index);
Symbol* class_name = ik->name();
- if (ent->is_modules_image()) {
+ if (cl->is_modules_image()) {
// For shared app/platform classes originated from the run-time image:
// The ProtectionDomains are cached in the corresponding ModuleEntries
// for fast access by the VM.
@@ -64,15 +64,14 @@ Handle CDSProtectionDomain::init_security_info(Handle class_loader, InstanceKlas
return get_shared_protection_domain(class_loader, mod_entry, THREAD);
} else {
// For shared app/platform classes originated from JAR files on the class path:
- // Each of the 3 SystemDictionaryShared::_shared_xxx arrays has the same length
- // as the shared classpath table in the shared archive (see
- // FileMap::_shared_path_table in filemap.hpp for details).
+ // Each of the 3 CDSProtectionDomain::_shared_xxx arrays has the same length
+ // as the shared classpath table in the shared archive.
//
// If a shared InstanceKlass k is loaded from the class path, let
//
- // index = k->shared_classpath_index():
+ // index = k->shared_classpath_index();
//
- // FileMap::_shared_path_table[index] identifies the JAR file that contains k.
+ // AOTClassLocationConfig::_runtime_instance->_array->at(index) identifies the JAR file that contains k.
//
// k's protection domain is:
//
@@ -85,10 +84,10 @@ Handle CDSProtectionDomain::init_security_info(Handle class_loader, InstanceKlas
// define_shared_package(class_name, class_loader, manifest, url, CHECK_NH);
//
// Note that if an element of these 3 _shared_xxx arrays is null, it will be initialized by
- // the corresponding SystemDictionaryShared::get_shared_xxx() function.
+ // the corresponding CDSProtectionDomain::get_shared_xxx() function.
Handle manifest = get_shared_jar_manifest(index, CHECK_NH);
Handle url = get_shared_jar_url(index, CHECK_NH);
- int index_offset = index - ClassLoaderExt::app_class_paths_start_index();
+ int index_offset = index - AOTClassLocationConfig::runtime()->app_cp_start_index();
if (index_offset < PackageEntry::max_index_for_defined_in_class_path()) {
if (pkg_entry == nullptr || !pkg_entry->is_defined_by_cds_in_class_path(index_offset)) {
// define_shared_package only needs to be called once for each package in a jar specified
@@ -179,14 +178,14 @@ Handle CDSProtectionDomain::create_jar_manifest(const char* manifest_chars, size
Handle CDSProtectionDomain::get_shared_jar_manifest(int shared_path_index, TRAPS) {
Handle manifest;
if (shared_jar_manifest(shared_path_index) == nullptr) {
- SharedClassPathEntry* ent = FileMapInfo::shared_path(shared_path_index);
- size_t size = (size_t)ent->manifest_size();
+ const AOTClassLocation* cl = AOTClassLocationConfig::runtime()->class_location_at(shared_path_index);
+ size_t size = cl->manifest_length();
if (size == 0) {
return Handle();
}
// ByteArrayInputStream bais = new ByteArrayInputStream(buf);
- const char* src = ent->manifest();
+ const char* src = cl->manifest();
assert(src != nullptr, "No Manifest data");
manifest = create_jar_manifest(src, size, CHECK_NH);
atomic_set_shared_jar_manifest(shared_path_index, manifest());
@@ -199,7 +198,7 @@ Handle CDSProtectionDomain::get_shared_jar_manifest(int shared_path_index, TRAPS
Handle CDSProtectionDomain::get_shared_jar_url(int shared_path_index, TRAPS) {
Handle url_h;
if (shared_jar_url(shared_path_index) == nullptr) {
- const char* path = FileMapInfo::shared_path_name(shared_path_index);
+ const char* path = AOTClassLocationConfig::runtime()->class_location_at(shared_path_index)->path();
oop result_oop = to_file_URL(path, url_h, CHECK_(url_h));
atomic_set_shared_jar_url(shared_path_index, result_oop);
}
diff --git a/src/hotspot/share/cds/classListParser.cpp b/src/hotspot/share/cds/classListParser.cpp
index 47925f578ea1f..e0c008678caf2 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);
@@ -424,10 +443,9 @@ void ClassListParser::print_diagnostic_info(outputStream* st, const char* msg, v
error_index = 0;
}
- jio_fprintf(defaultStream::error_stream(),
- "An error has occurred while processing class list file %s %zu:%d.\n",
- _classlist_file, lineno(), (error_index + 1));
- jio_vfprintf(defaultStream::error_stream(), msg, ap);
+ st->print("An error has occurred while processing class list file %s %zu:%d.\n",
+ _classlist_file, lineno(), (error_index + 1));
+ st->vprint(msg, ap);
if (_line_len <= 0) {
st->print("\n");
@@ -515,7 +533,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 +763,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);
@@ -861,6 +846,14 @@ void ClassListParser::parse_constant_pool_tag() {
}
}
+ if (SystemDictionaryShared::should_be_excluded(ik)) {
+ if (log_is_enabled(Warning, cds, resolve)) {
+ ResourceMark rm;
+ log_warning(cds, resolve)("Cannot aot-resolve constants for %s because it is excluded", ik->external_name());
+ }
+ return;
+ }
+
if (preresolve_class) {
AOTConstantPoolResolver::preresolve_class_cp_entries(THREAD, ik, &preresolve_list);
}
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..39849571015e1 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"
@@ -259,7 +258,6 @@ intptr_t* CppVtables::get_archived_vtable(MetaspaceObj::Type msotype, address ob
case MetaspaceObj::ConstantPoolCacheType:
case MetaspaceObj::AnnotationsType:
case MetaspaceObj::MethodCountersType:
- case MetaspaceObj::SharedClassPathEntryType:
case MetaspaceObj::RecordComponentType:
// These have no vtables.
break;
diff --git a/src/hotspot/share/cds/dumpAllocStats.cpp b/src/hotspot/share/cds/dumpAllocStats.cpp
index e88a77de7adb7..5587ac2fac82a 100644
--- a/src/hotspot/share/cds/dumpAllocStats.cpp
+++ b/src/hotspot/share/cds/dumpAllocStats.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "cds/aotClassLinker.hpp"
#include "cds/dumpAllocStats.hpp"
#include "logging/log.hpp"
diff --git a/src/hotspot/share/cds/dumpTimeClassInfo.cpp b/src/hotspot/share/cds/dumpTimeClassInfo.cpp
index 6ee18c17a57da..18136d6eeec66 100644
--- a/src/hotspot/share/cds/dumpTimeClassInfo.cpp
+++ b/src/hotspot/share/cds/dumpTimeClassInfo.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,6 @@
*
*/
-#include "precompiled.hpp"
#include "cds/archiveBuilder.hpp"
#include "cds/dumpTimeClassInfo.inline.hpp"
#include "cds/runTimeClassInfo.hpp"
diff --git a/src/hotspot/share/cds/dumpTimeClassInfo.hpp b/src/hotspot/share/cds/dumpTimeClassInfo.hpp
index c060601f1fb01..79ede224bb6e7 100644
--- a/src/hotspot/share/cds/dumpTimeClassInfo.hpp
+++ b/src/hotspot/share/cds/dumpTimeClassInfo.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -42,8 +42,6 @@ class DumpTimeClassInfo: public CHeapObj {
bool _excluded;
bool _is_early_klass;
bool _has_checked_exclusion;
- bool _is_required_hidden_class;
- bool _has_scanned_constant_pool;
class DTLoaderConstraint {
Symbol* _name;
char _loader_type1;
@@ -123,7 +121,7 @@ class DumpTimeClassInfo: public CHeapObj {
InstanceKlass* _klass;
InstanceKlass* _nest_host;
bool _failed_verification;
- bool _is_archived_lambda_proxy;
+ bool _is_registered_lambda_proxy;
int _id;
int _clsfile_size;
int _clsfile_crc32;
@@ -136,10 +134,8 @@ class DumpTimeClassInfo: public CHeapObj {
_klass = nullptr;
_nest_host = nullptr;
_failed_verification = false;
- _is_archived_lambda_proxy = false;
+ _is_registered_lambda_proxy = false;
_has_checked_exclusion = false;
- _is_required_hidden_class = false;
- _has_scanned_constant_pool = false;
_id = -1;
_clsfile_size = -1;
_clsfile_crc32 = -1;
@@ -217,11 +213,6 @@ class DumpTimeClassInfo: public CHeapObj {
InstanceKlass* nest_host() const { return _nest_host; }
void set_nest_host(InstanceKlass* nest_host) { _nest_host = nest_host; }
- bool is_required_hidden_class() const { return _is_required_hidden_class; }
- void set_is_required_hidden_class() { _is_required_hidden_class = true; }
- bool has_scanned_constant_pool() const { return _has_scanned_constant_pool; }
- void set_has_scanned_constant_pool() { _has_scanned_constant_pool = true; }
-
size_t runtime_info_bytesize() const;
};
diff --git a/src/hotspot/share/cds/dynamicArchive.cpp b/src/hotspot/share/cds/dynamicArchive.cpp
index f102282f68201..4ccf23ff91c9d 100644
--- a/src/hotspot/share/cds/dynamicArchive.cpp
+++ b/src/hotspot/share/cds/dynamicArchive.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,8 +22,9 @@
*
*/
-#include "precompiled.hpp"
+#include "cds/aotArtifactFinder.hpp"
#include "cds/aotClassLinker.hpp"
+#include "cds/aotClassLocation.hpp"
#include "cds/archiveBuilder.hpp"
#include "cds/archiveHeapWriter.hpp"
#include "cds/archiveUtils.inline.hpp"
@@ -89,7 +90,7 @@ class DynamicArchiveBuilder : public ArchiveBuilder {
void sort_methods();
void sort_methods(InstanceKlass* ik) const;
void remark_pointers_for_instance_klass(InstanceKlass* k, bool should_mark) const;
- void write_archive(char* serialized_data);
+ void write_archive(char* serialized_data, AOTClassLocationConfig* cl_config);
void gather_array_klasses();
public:
@@ -112,7 +113,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,14 +133,13 @@ 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");
make_klasses_shareable();
char* serialized_data;
+ AOTClassLocationConfig* cl_config;
{
// Write the symbol table and system dictionaries to the RO space.
// Note that these tables still point to the *original* objects, so
@@ -151,6 +150,7 @@ class DynamicArchiveBuilder : public ArchiveBuilder {
ArchiveBuilder::OtherROAllocMark mark;
SystemDictionaryShared::write_to_archive(false);
+ cl_config = AOTClassLocationConfig::dumptime()->write_to_archive();
DynamicArchive::dump_array_klasses();
AOTClassLinker::write_to_archive();
@@ -159,14 +159,12 @@ 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();
relocate_to_requested();
- write_archive(serialized_data);
+ write_archive(serialized_data, cl_config);
release_header();
DynamicArchive::post_dump();
@@ -177,7 +175,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);
}
@@ -339,8 +337,8 @@ void DynamicArchiveBuilder::remark_pointers_for_instance_klass(InstanceKlass* k,
}
}
-void DynamicArchiveBuilder::write_archive(char* serialized_data) {
- _header->set_shared_path_table(FileMapInfo::shared_path_table().table());
+void DynamicArchiveBuilder::write_archive(char* serialized_data, AOTClassLocationConfig* cl_config) {
+ _header->set_class_location_config(cl_config);
_header->set_serialized_data(serialized_data);
FileMapInfo* dynamic_info = FileMapInfo::dynamic_info();
@@ -355,7 +353,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());
@@ -393,8 +391,7 @@ class VM_PopulateDynamicDumpSharedSpace: public VM_GC_Sync_Operation {
log_warning(cds)("This archive was created with AllowArchivingWithJavaAgent. It should be used "
"for testing purposes only and should not be used in a production environment");
}
- FileMapInfo::check_nonempty_dir_in_shared_path_table();
-
+ AOTClassLocationConfig::dumptime_check_nonempty_dirs();
_builder.doit();
}
~VM_PopulateDynamicDumpSharedSpace() {
@@ -509,12 +506,9 @@ void DynamicArchive::dump_at_exit(JavaThread* current, const char* archive_name)
JavaThread* THREAD = current; // For TRAPS processing related to link_shared_classes
MetaspaceShared::link_shared_classes(false/*not from jcmd*/, THREAD);
if (!HAS_PENDING_EXCEPTION) {
- // copy shared path table to saved.
- if (!HAS_PENDING_EXCEPTION) {
- VM_PopulateDynamicDumpSharedSpace op(archive_name);
- VMThread::execute(&op);
- return;
- }
+ VM_PopulateDynamicDumpSharedSpace op(archive_name);
+ VMThread::execute(&op);
+ return;
}
// One of the prepatory steps failed
diff --git a/src/hotspot/share/cds/dynamicArchive.hpp b/src/hotspot/share/cds/dynamicArchive.hpp
index 479e7daa153db..eb5fd5f9aba8d 100644
--- a/src/hotspot/share/cds/dynamicArchive.hpp
+++ b/src/hotspot/share/cds/dynamicArchive.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019, 2023, 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,7 +29,6 @@
#include "classfile/compactHashtable.hpp"
#include "memory/allStatic.hpp"
#include "memory/memRegion.hpp"
-#include "memory/virtualspace.hpp"
#include "oops/array.hpp"
#include "oops/oop.hpp"
#include "utilities/exceptions.hpp"
diff --git a/src/hotspot/share/cds/filemap.cpp b/src/hotspot/share/cds/filemap.cpp
index c87081d9d14e6..7db8e78743e20 100644
--- a/src/hotspot/share/cds/filemap.cpp
+++ b/src/hotspot/share/cds/filemap.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,7 @@
*
*/
-#include "precompiled.hpp"
+#include "cds/aotClassLocation.hpp"
#include "cds/archiveBuilder.hpp"
#include "cds/archiveHeapLoader.inline.hpp"
#include "cds/archiveHeapWriter.hpp"
@@ -157,7 +157,6 @@ void FileMapInfo::populate_header(size_t core_region_alignment) {
size_t header_size;
size_t base_archive_name_size = 0;
size_t base_archive_name_offset = 0;
- size_t longest_common_prefix_size = 0;
if (is_static()) {
c_header_size = sizeof(FileMapHeader);
header_size = c_header_size;
@@ -174,30 +173,24 @@ void FileMapInfo::populate_header(size_t core_region_alignment) {
base_archive_name_offset = c_header_size;
}
}
- ResourceMark rm;
- GrowableArray* app_cp_array = create_dumptime_app_classpath_array();
- int len = app_cp_array->length();
- longest_common_prefix_size = longest_common_app_classpath_prefix_len(len, app_cp_array);
_header = (FileMapHeader*)os::malloc(header_size, mtInternal);
memset((void*)_header, 0, header_size);
_header->populate(this,
core_region_alignment,
header_size,
base_archive_name_size,
- base_archive_name_offset,
- longest_common_prefix_size);
+ base_archive_name_offset);
}
void FileMapHeader::populate(FileMapInfo *info, size_t core_region_alignment,
size_t header_size, size_t base_archive_name_size,
- size_t base_archive_name_offset, size_t common_app_classpath_prefix_size) {
+ size_t base_archive_name_offset) {
// 1. We require _generic_header._magic to be at the beginning of the file
// 2. FileMapHeader also assumes that _generic_header is at the beginning of the file
assert(offset_of(FileMapHeader, _generic_header) == 0, "must be");
set_header_size((unsigned int)header_size);
set_base_archive_name_offset((unsigned int)base_archive_name_offset);
set_base_archive_name_size((unsigned int)base_archive_name_size);
- set_common_app_classpath_prefix_size((unsigned int)common_app_classpath_prefix_size);
set_magic(CDSConfig::is_dumping_dynamic_archive() ? CDS_DYNAMIC_ARCHIVE_MAGIC : CDS_ARCHIVE_MAGIC);
set_version(CURRENT_CDS_ARCHIVE_VERSION);
@@ -237,22 +230,12 @@ void FileMapHeader::populate(FileMapInfo *info, size_t core_region_alignment,
// JVM version string ... changes on each build.
get_header_version(_jvm_ident);
- _app_class_paths_start_index = ClassLoaderExt::app_class_paths_start_index();
- _app_module_paths_start_index = ClassLoaderExt::app_module_paths_start_index();
- _max_used_path_index = ClassLoaderExt::max_used_path_index();
- _num_module_paths = ClassLoader::num_module_path_entries();
-
_verify_local = BytecodeVerificationLocal;
_verify_remote = BytecodeVerificationRemote;
- _has_platform_or_app_classes = ClassLoaderExt::has_platform_or_app_classes();
- _has_non_jar_in_classpath = ClassLoaderExt::has_non_jar_in_classpath();
+ _has_platform_or_app_classes = AOTClassLocationConfig::dumptime()->has_platform_or_app_classes();
_requested_base_address = (char*)SharedBaseAddress;
_mapped_base_address = (char*)SharedBaseAddress;
_allow_archiving_with_java_agent = AllowArchivingWithJavaAgent;
-
- if (!CDSConfig::is_dumping_dynamic_archive()) {
- set_shared_path_table(info->_shared_path_table);
- }
}
void FileMapHeader::copy_base_archive_name(const char* archive) {
@@ -269,7 +252,6 @@ void FileMapHeader::print(outputStream* st) {
st->print_cr("- crc: 0x%08x", crc());
st->print_cr("- version: 0x%x", version());
st->print_cr("- header_size: " UINT32_FORMAT, header_size());
- st->print_cr("- common_app_classpath_size: " UINT32_FORMAT, common_app_classpath_prefix_size());
st->print_cr("- base_archive_name_offset: " UINT32_FORMAT, base_archive_name_offset());
st->print_cr("- base_archive_name_size: " UINT32_FORMAT, base_archive_name_size());
@@ -279,42 +261,37 @@ 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("- 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);
- st->print_cr("- max_used_path_index: %d", _max_used_path_index);
+ st->print_cr("- class_location_config_offset: 0x%zx", _class_location_config_offset);
st->print_cr("- verify_local: %d", _verify_local);
st->print_cr("- verify_remote: %d", _verify_remote);
st->print_cr("- has_platform_or_app_classes: %d", _has_platform_or_app_classes);
- st->print_cr("- has_non_jar_in_classpath: %d", _has_non_jar_in_classpath);
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);
@@ -322,676 +299,23 @@ void FileMapHeader::print(outputStream* st) {
st->print_cr("- has_archived_invokedynamic %d", _has_archived_invokedynamic);
}
-void SharedClassPathEntry::init_as_non_existent(const char* path, TRAPS) {
- _type = non_existent_entry;
- set_name(path, CHECK);
-}
-
-void SharedClassPathEntry::init(bool is_modules_image,
- bool is_module_path,
- ClassPathEntry* cpe, TRAPS) {
- assert(CDSConfig::is_dumping_archive(), "sanity");
- _timestamp = 0;
- _filesize = 0;
- _from_class_path_attr = false;
-
- struct stat st;
- if (os::stat(cpe->name(), &st) == 0) {
- if ((st.st_mode & S_IFMT) == S_IFDIR) {
- _type = dir_entry;
- } else {
- // The timestamp of the modules_image is not checked at runtime.
- if (is_modules_image) {
- _type = modules_image_entry;
- } else {
- _type = jar_entry;
- _timestamp = st.st_mtime;
- _from_class_path_attr = cpe->from_class_path_attr();
- _is_multi_release = cpe->is_multi_release_jar();
- }
- _filesize = st.st_size;
- _is_module_path = is_module_path;
- }
- } else {
- // The file/dir must exist, or it would not have been added
- // into ClassLoader::classpath_entry().
- //
- // If we can't access a jar file in the boot path, then we can't
- // make assumptions about where classes get loaded from.
- log_error(cds)("Unable to open file %s.", cpe->name());
- MetaspaceShared::unrecoverable_loading_error();
- }
-
- // No need to save the name of the module file, as it will be computed at run time
- // to allow relocation of the JDK directory.
- const char* name = is_modules_image ? "" : cpe->name();
- set_name(name, CHECK);
-}
-
-void SharedClassPathEntry::set_name(const char* name, TRAPS) {
- size_t len = strlen(name) + 1;
- _name = MetadataFactory::new_array(ClassLoaderData::the_null_class_loader_data(), (int)len, CHECK);
- strcpy(_name->data(), name);
-}
-
-void SharedClassPathEntry::copy_from(SharedClassPathEntry* ent, ClassLoaderData* loader_data, TRAPS) {
- assert(ent != nullptr, "sanity");
- _type = ent->_type;
- _is_module_path = ent->_is_module_path;
- _timestamp = ent->_timestamp;
- _filesize = ent->_filesize;
- _from_class_path_attr = ent->_from_class_path_attr;
- set_name(ent->name(), CHECK);
-
- if (ent->is_jar() && ent->manifest() != nullptr) {
- Array