diff --git a/.github/workflows/build-cross-compile.yml b/.github/workflows/build-cross-compile.yml index 351d087ef7d..b3c63f488a0 100644 --- a/.github/workflows/build-cross-compile.yml +++ b/.github/workflows/build-cross-compile.yml @@ -64,33 +64,33 @@ jobs: gnu-arch: aarch64 debian-arch: arm64 debian-repository: https://httpredir.debian.org/debian/ - debian-version: bookworm + debian-version: trixie tolerate-sysroot-errors: false - target-cpu: arm gnu-arch: arm debian-arch: armhf debian-repository: https://httpredir.debian.org/debian/ - debian-version: bookworm + debian-version: trixie tolerate-sysroot-errors: false gnu-abi: eabihf - target-cpu: s390x gnu-arch: s390x debian-arch: s390x debian-repository: https://httpredir.debian.org/debian/ - debian-version: bookworm + debian-version: trixie tolerate-sysroot-errors: false - target-cpu: ppc64le gnu-arch: powerpc64le debian-arch: ppc64el debian-repository: https://httpredir.debian.org/debian/ - debian-version: bookworm + debian-version: trixie tolerate-sysroot-errors: false - target-cpu: riscv64 gnu-arch: riscv64 debian-arch: riscv64 debian-repository: https://httpredir.debian.org/debian/ - debian-version: sid - tolerate-sysroot-errors: true + debian-version: trixie + tolerate-sysroot-errors: false steps: - name: 'Checkout the JDK source' diff --git a/make/scripts/generate-symbol-data.sh b/bin/generate-symbol-data.sh similarity index 83% rename from make/scripts/generate-symbol-data.sh rename to bin/generate-symbol-data.sh index 6f38d873009..283757a6918 100644 --- a/make/scripts/generate-symbol-data.sh +++ b/bin/generate-symbol-data.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# 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 @@ -52,12 +52,39 @@ # include the SCM state that was used to build it, which can be found in ${JDK_N_INSTALL}/release, # in property "SOURCE". +source_path="$(dirname ${0})" +this_script_dir="$(cd -- "${source_path}" > /dev/null && pwd)" +if test -z "${this_script_dir}"; then + echo "Error: Could not determine location of this script" + exit 1 +fi + +symbols_dir="$(dirname $this_script_dir)/src/jdk.compiler/share/data/symbols" +if [ ! -d $symbols_dir ] ; then + echo "Cannot locate symbols directory: $symbols_dir" >&2 + exit 1 +fi + +generator_dir="$(dirname $this_script_dir)/make/langtools/src/classes/build/tools/symbolgenerator" + if [ "$1x" = "x" ] ; then echo "Must provide the target JDK as a parameter:" >&2 echo "$0 " >&2 exit 1 fi; +if [ ! -d $1 ] ; then + echo "Target JDK argument is not a directory:" $1 >&2 + exit 1 +fi; + +if [ ! -x $1/bin/java ] ; then + echo "Target JDK argument is not a valid JDK: $1" >&2 + exit 1 +fi; + +cd $symbols_dir + if [ ! -f symbols ] ; then echo "Must run inside the src/jdk.compiler/share/data/symbols directory" >&2 exit 1 @@ -72,5 +99,5 @@ $1/bin/java --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \ --add-modules jdk.jdeps \ - ../../../../../make/langtools/src/classes/build/tools/symbolgenerator/CreateSymbols.java \ + $generator_dir/CreateSymbols.java \ build-description-incremental symbols include.list diff --git a/make/scripts/lic_check.sh b/bin/lic_check.sh similarity index 98% rename from make/scripts/lic_check.sh rename to bin/lic_check.sh index d70d8914181..2fc6abf4d82 100644 --- a/make/scripts/lic_check.sh +++ b/bin/lic_check.sh @@ -1,6 +1,6 @@ #! /bin/sh -f # -# Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -62,7 +62,7 @@ B=`basename "${script_directory}"` script_dir="`cd \"${D}\" 2>/dev/null && pwd || echo \"${D}\"`/${B}" # set up a variable for the template directory -template_dir=${script_dir}/../data/license-templates +template_dir=${script_dir}/../make/data/license-templates # Check existence of the template directory. if [ ! -d ${template_dir} ] ; then diff --git a/make/scripts/normalizer.pl b/bin/normalizer.pl similarity index 100% rename from make/scripts/normalizer.pl rename to bin/normalizer.pl diff --git a/bin/unshuffle_list.txt b/bin/unshuffle_list.txt deleted file mode 100644 index a910f6b4621..00000000000 --- a/bin/unshuffle_list.txt +++ /dev/null @@ -1,191 +0,0 @@ -# -# 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 -# 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. -# - -src/bsd : jdk/src/bsd -src/demo : jdk/src/demo -src/java.activation : jaxws/src/java.activation -src/java.base : jdk/src/java.base -src/java.compiler : langtools/src/java.compiler -src/java.corba : corba/src/java.corba -src/java.datatransfer : jdk/src/java.datatransfer -src/java.desktop : jdk/src/java.desktop -src/java.instrument : jdk/src/java.instrument -src/java.logging : jdk/src/java.logging -src/java.management : jdk/src/java.management -src/java.management.rmi : jdk/src/java.management.rmi -src/java.naming : jdk/src/java.naming -src/java.prefs : jdk/src/java.prefs -src/java.rmi : jdk/src/java.rmi -src/java.scripting : jdk/src/java.scripting -src/java.se : jdk/src/java.se -src/java.security.jgss : jdk/src/java.security.jgss -src/java.security.sasl : jdk/src/java.security.sasl -src/java.se.ee : jdk/src/java.se.ee -src/java.smartcardio : jdk/src/java.smartcardio -src/java.sql : jdk/src/java.sql -src/java.sql.rowset : jdk/src/java.sql.rowset -src/java.transaction : jdk/src/java.transaction -src/java.xml : jaxp/src/java.xml -src/java.xml.bind : jaxws/src/java.xml.bind -src/java.xml.crypto : jdk/src/java.xml.crypto -src/java.xml.ws : jaxws/src/java.xml.ws -src/java.xml.ws.annotation : jaxws/src/java.xml.ws.annotation -src/jdk.accessibility : jdk/src/jdk.accessibility -src/jdk.aot : hotspot/src/jdk.aot -src/jdk.attach : jdk/src/jdk.attach -src/jdk.charsets : jdk/src/jdk.charsets -src/jdk.compiler : jdk/src/jdk.compiler langtools/src/jdk.compiler -src/jdk.crypto.cryptoki : jdk/src/jdk.crypto.cryptoki -src/jdk.crypto.ec : jdk/src/jdk.crypto.ec -src/jdk.crypto.mscapi : jdk/src/jdk.crypto.mscapi -src/jdk.dynalink : nashorn/src/jdk.dynalink -src/jdk.editpad : jdk/src/jdk.editpad -src/jdk.hotspot.agent : hotspot/src/jdk.hotspot.agent -src/jdk.httpserver : jdk/src/jdk.httpserver -src/jdk.incubator.httpclient : jdk/src/jdk.incubator.httpclient -src/jdk.internal.ed : jdk/src/jdk.internal.ed -src/jdk.internal.jvmstat : jdk/src/jdk.internal.jvmstat -src/jdk.internal.le : jdk/src/jdk.internal.le -src/jdk.internal.opt : jdk/src/jdk.internal.opt -src/jdk.internal.vm.ci : hotspot/src/jdk.internal.vm.ci -src/jdk.internal.vm.compiler : hotspot/src/jdk.internal.vm.compiler -src/jdk.jartool : jdk/src/jdk.jartool -src/jdk.javadoc : langtools/src/jdk.javadoc -src/jdk.jcmd : jdk/src/jdk.jcmd -src/jdk.jconsole : jdk/src/jdk.jconsole -src/jdk.jdeps : langtools/src/jdk.jdeps -src/jdk.jdi : jdk/src/jdk.jdi -src/jdk.jdwp.agent : jdk/src/jdk.jdwp.agent -src/jdk.jlink : jdk/src/jdk.jlink -src/jdk.jshell : langtools/src/jdk.jshell -src/jdk.jstatd : jdk/src/jdk.jstatd -src/jdk.localedata : jdk/src/jdk.localedata -src/jdk.management : jdk/src/jdk.management -src/jdk.management.agent : jdk/src/jdk.management.agent -src/jdk.naming.dns : jdk/src/jdk.naming.dns -src/jdk.naming.rmi : jdk/src/jdk.naming.rmi -src/jdk.net : jdk/src/jdk.net -src/jdk.pack : jdk/src/jdk.pack -src/jdk.scripting.nashorn : nashorn/src/jdk.scripting.nashorn -src/jdk.scripting.nashorn.shell : nashorn/src/jdk.scripting.nashorn.shell -src/jdk.sctp : jdk/src/jdk.sctp -src/jdk.security.auth : jdk/src/jdk.security.auth -src/jdk.security.jgss : jdk/src/jdk.security.jgss -src/jdk.unsupported : jdk/src/jdk.unsupported -src/jdk.xml.bind : jaxws/src/jdk.xml.bind -src/jdk.xml.dom : jaxp/src/jdk.xml.dom -src/jdk.xml.ws : jaxws/src/jdk.xml.ws -src/jdk.zipfs : jdk/src/jdk.zipfs -src/langtools/sample : langtools/src/sample -src/linux : jdk/src/linux -src/sample : jdk/src/sample -src/hotspot/share : hotspot/src/share/vm -src/hotspot/cpu/aarch64 : hotspot/src/cpu/aarch64/vm -src/hotspot/cpu/arm : hotspot/src/cpu/arm/vm -src/hotspot/cpu/ppc : hotspot/src/cpu/ppc/vm -src/hotspot/cpu/s390 : hotspot/src/cpu/s390/vm -src/hotspot/cpu/x86 : hotspot/src/cpu/x86/vm -src/hotspot/cpu/zero : hotspot/src/cpu/zero/vm -src/hotspot/os/aix : hotspot/src/os/aix/vm -src/hotspot/os/bsd : hotspot/src/os/bsd/vm -src/hotspot/os/linux : hotspot/src/os/linux/vm -src/hotspot/os/posix/dtrace : hotspot/src/os/posix/dtrace -src/hotspot/os/posix : hotspot/src/os/posix/vm -src/hotspot/os/windows : hotspot/src/os/windows/vm -src/hotspot/os_cpu/aix_ppc : hotspot/src/os_cpu/aix_ppc/vm -src/hotspot/os_cpu/bsd_x86 : hotspot/src/os_cpu/bsd_x86/vm -src/hotspot/os_cpu/bsd_zero : hotspot/src/os_cpu/bsd_zero/vm -src/hotspot/os_cpu/linux_aarch64 : hotspot/src/os_cpu/linux_aarch64/vm -src/hotspot/os_cpu/linux_arm : hotspot/src/os_cpu/linux_arm/vm -src/hotspot/os_cpu/linux_ppc : hotspot/src/os_cpu/linux_ppc/vm -src/hotspot/os_cpu/linux_s390 : hotspot/src/os_cpu/linux_s390/vm -src/hotspot/os_cpu/linux_x86 : hotspot/src/os_cpu/linux_x86/vm -src/hotspot/os_cpu/linux_zero : hotspot/src/os_cpu/linux_zero/vm -src/hotspot/os_cpu/windows_x86 : hotspot/src/os_cpu/windows_x86/vm -src/hotspot : hotspot/src -src/utils/IdealGraphVisualizer : hotspot/src/share/tools/IdealGraphVisualizer -src/utils/LogCompilation : hotspot/src/share/tools/LogCompilation -src/utils/hsdis : hotspot/src/share/tools/hsdis -src/utils/reorder : jdk/make/non-build-utils/reorder -src/utils/src/build : jdk/make/non-build-utils/src/build -make/BuildNashorn.gmk : nashorn/make/BuildNashorn.gmk -make/CompileDemos.gmk : jdk/make/CompileDemos.gmk -make/CompileInterimLangtools.gmk : langtools/make/CompileInterim.gmk -make/CompileModuleTools.gmk : jdk/make/CompileModuleTools.gmk -make/CompileToolsHotspot.gmk : hotspot/make/CompileTools.gmk -make/CompileToolsJdk.gmk : jdk/make/CompileTools.gmk -make/CopyInterimCLDRConverter.gmk : jdk/make/CopyInterimCLDRConverter.gmk -make/GenerateModuleSummary.gmk : jdk/make/GenerateModuleSummary.gmk -make/ModuleTools.gmk : jdk/make/ModuleTools.gmk -make/ToolsJdk.gmk : jdk/make/Tools.gmk -make/ToolsLangtools.gmk : langtools/make/Tools.gmk -make/UnpackSecurity.gmk : jdk/make/UnpackSecurity.gmk -make/autoconf : common/autoconf -make/conf : common/conf -make/copy : jdk/make/copy -make/copy/Copy-java.corba.gmk : corba/make/copy/Copy-java.corba.gmk -make/corba : corba/make -make/data : jdk/make/data -make/gendata : jdk/make/gendata -make/gendata/Gendata-jdk.compiler.gmk : langtools/make/gendata/Gendata-jdk.compiler.gmk -make/gensrc : jdk/make/gensrc -make/gensrc/Gensrc-java.corba.gmk : corba/make/gensrc/Gensrc-java.corba.gmk -make/gensrc/Gensrc-jdk.compiler.gmk : langtools/make/gensrc/Gensrc-jdk.compiler.gmk -make/gensrc/Gensrc-jdk.hotspot.agent.gmk : hotspot/make/gensrc/Gensrc-jdk.hotspot.agent.gmk -make/gensrc/Gensrc-jdk.internal.vm.compiler.gmk : hotspot/make/gensrc/Gensrc-jdk.internal.vm.compiler.gmk -make/gensrc/Gensrc-jdk.javadoc.gmk : langtools/make/gensrc/Gensrc-jdk.javadoc.gmk -make/gensrc/Gensrc-jdk.jdeps.gmk : langtools/make/gensrc/Gensrc-jdk.jdeps.gmk -make/gensrc/Gensrc-jdk.jshell.gmk : langtools/make/gensrc/Gensrc-jdk.jshell.gmk -make/gensrc/GensrcCommonLangtools.gmk : langtools/make/gensrc/GensrcCommon.gmk -make/hotspot : hotspot/make -make/jdk : jdk/make -make/langtools : langtools/make -make/launcher : jdk/make/launcher -make/lib : jdk/make/lib -make/lib/Lib-jdk.hotspot.agent.gmk : hotspot/make/lib/Lib-jdk.hotspot.agent.gmk -make/mapfiles : jdk/make/mapfiles -make/mapfiles/libjsig : hotspot/make/mapfiles/libjsig -make/mapfiles/libjvm_db : hotspot/make/mapfiles/libjvm_db -make/mapfiles/libjvm_dtrace : hotspot/make/mapfiles/libjvm_dtrace -make/mapfiles/libsaproc : hotspot/make/mapfiles/libsaproc -make/nashorn : nashorn/make -make/nb_native : common/nb_native -make/scripts/addNotices.sh : jdk/make/scripts/addNotices.sh -make/scripts/compare.sh : common/bin/compare.sh -make/scripts/compare_exceptions.sh.incl : common/bin/compare_exceptions.sh.incl -make/scripts/genExceptions.sh : jdk/make/scripts/genExceptions.sh -make/scripts/hide_important_warnings_from_javac.sh : common/bin/hide_important_warnings_from_javac.sh -make/scripts/logger.sh : common/bin/logger.sh -make/src/native/fixpath.c : common/src/fixpath.c -make/test/JtregNativeHotspot.gmk : hotspot/make/test/JtregNative.gmk -make/test/JtregNativeJdk.gmk : jdk/make/test/JtregNative.gmk -test/jdk : jdk/test -test/langtools : langtools/test -test/nashorn : nashorn/test -test/jaxp : jaxp/test -test/hotspot/gtest : hotspot/test/native -test/hotspot/jtreg : hotspot/test -bin : common/bin -bin/nashorn : nashorn/bin -doc : common/doc -doc/nashorn : nashorn/docs diff --git a/bin/unshuffle_patch.sh b/bin/unshuffle_patch.sh deleted file mode 100644 index c5cdc3851c3..00000000000 --- a/bin/unshuffle_patch.sh +++ /dev/null @@ -1,237 +0,0 @@ -#!/bin/bash -# -# Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. -# 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. -# - -# Script for updating a patch file as per the shuffled/unshuffled source location. - -usage() { - echo "Usage: $0 [-h|--help] [-v|--verbose] [-to9|-to10] [-r ] " - echo "where:" - echo " -to9 create patches appropriate for a JDK 9 source tree" - echo " When going to 9, the output patches will be suffixed with the" - echo " repo name" - echo " -to10 create patches appropriate for a JDK 10 source tree" - echo " -r specify repo for source patch, set to 'top' for top repo" - echo " is the input patch file, that needs shuffling/unshuffling" - echo " is the updated patch file " - echo " " - exit 1 -} - -SCRIPT_DIR=`dirname $0` -UNSHUFFLE_LIST=$SCRIPT_DIR"/unshuffle_list.txt" - -if [ ! -f "$UNSHUFFLE_LIST" ] ; then - echo "FATAL: cannot find $UNSHUFFLE_LIST" >&2 - exit 1 -fi - -vflag="false" -while [ $# -gt 0 ] -do - case $1 in - -h | --help ) - usage - ;; - - -v | --verbose ) - vflag="true" - ;; - - -r) - repo="$2" - shift - ;; - - -to9) - shuffle_to=9 - ;; - - -to10) - shuffle_to=10 - ;; - - -*) # bad option - usage - ;; - - * ) # non option - break - ;; - esac - shift -done - -# Make sure we have the right number of arguments -if [ ! $# -eq 2 ] ; then - echo "ERROR: Invalid number of arguments." >&2 - usage -fi - -# Check the given repo -repos="top corba jaxp jaxws jdk langtools nashorn hotspot" -found="false" -if [ -n "$repo" ]; then - for r in $repos ; do - if [ $repo = "$r" ] ; then - found="true" - break; - fi - done - if [ $found = "false" ] ; then - echo "ERROR: Unknown repo: $repo. Should be one of [$repos]." >&2 - usage - fi -fi - -if [ "$shuffle_to" != "9" -a "$shuffle_to" != "10" ]; then - echo "ERROR: Must pick either -to9 or -to10" - exit 1 -fi - -# When going to 10, a repo must be specified for the source patch -if [ "$shuffle_to" = "10" -a -z "$repo" ]; then - echo "ERROR: Must specify src repo for JDK 9 patch" - exit 1 -fi - -# Check given input/output files -input="$1" -if [ "x$input" = "x-" ] ; then - input="/dev/stdin" -fi - -if [ ! -f $input -a "x$input" != "x/dev/stdin" ] ; then - echo "ERROR: Cannot find input patch file: $input" >&2 - exit 1 -fi - -output="$2" -if [ "x$output" = "x-" ] ; then - output="/dev/stdout" -fi -base_output="$output" - -if [ "$shuffle_to" = "10" ]; then - if [ -f $output -a "x$output" != "x/dev/stdout" ] ; then - echo "ERROR: Output patch already exists: $output" >&2 - exit 1 - fi -else - for r in $repos; do - if [ -f "$output.$r" ]; then - echo "ERROR: Output patch already exists: $output.$r" >&2 - exit 1 - fi - done -fi - -verbose() { - if [ ${vflag} = "true" ] ; then - echo "$@" >&2 - fi -} - -unshuffle() { - line=$@ - verbose "Attempting to rewrite: \"$line\"" - - # Retrieve the file name - path= - if echo "$line" | egrep '^diff' > /dev/null ; then - if ! echo "$line" | egrep '\-\-git' > /dev/null ; then - echo "ERROR: Only git patches supported. Please use 'hg export --git ...'." >&2 - exit 1 - fi - path="`echo "$line" | sed -e s@'diff --git a/'@@ -e s@' b/.*$'@@`" - elif echo "$line" | egrep '^\-\-\-' > /dev/null ; then - path="`echo "$line" | sed -e s@'--- a/'@@`" - elif echo "$line" | egrep '^\+\+\+' > /dev/null ; then - path="`echo "$line" | sed s@'+++ b/'@@`" - fi - verbose "Extracted path: \"$path\"" - - # Find the most specific matches in the shuffle list - matches= - if [ -n "$repo" -a "$repo" != "top" ]; then - matchpath="$repo"/"$path"/x - else - matchpath="$path"/x - fi - while [ "$matchpath" != "" ] ; do - matchpath="`echo $matchpath | sed s@'\(.*\)/.*$'@'\1'@`" - - if [ "$shuffle_to" = "10" ] ; then - pattern=": $matchpath$" - else - pattern="^$matchpath :" - fi - verbose "Attempting to find \"$matchpath\"" - matches=`egrep "$pattern" "$UNSHUFFLE_LIST"` - if ! [ "x${matches}" = "x" ] ; then - verbose "Got matches: [$matches]" - break; - fi - - if ! echo "$matchpath" | egrep '.*/.*' > /dev/null ; then - break; - fi - done - - # Rewrite the line, if we have a match - if ! [ "x${matches}" = "x" ] ; then - shuffled="${matches%% : *}" - unshuffled="${matches#* : }" - patch_suffix_9="" - for r in $repos; do - if [ "$unshuffled" != "${unshuffled#$r}" ]; then - unshuffled="${unshuffled#$r\/}" - patch_suffix_9=".$r" - fi - done - verbose "shuffled: $shuffled" - verbose "unshuffled: $unshuffled" - verbose "patch_suffix_9: $patch_suffix_9" - if [ "$shuffle_to" = "10" ] ; then - newline="`echo "$line" | sed -e s@"$unshuffled"@"$shuffled"@g`" - else - newline="`echo "$line" | sed -e s@"$shuffled"@"$unshuffled"@g`" - output=$base_output$patch_suffix_9 - verbose "Writing to $output" - fi - verbose "Rewriting to \"$newline\"" - echo "$newline" >> $output - else - echo "WARNING: no match found for $path" - echo "$line" >> $output - fi -} - -while IFS= read -r line -do - if echo "$line" | egrep '^diff|^\-\-\-|^\+\+\+' > /dev/null ; then - unshuffle "$line" - else - printf "%s\n" "$line" >> $output - fi -done < "$input" diff --git a/make/scripts/update_copyright_year.sh b/bin/update_copyright_year.sh similarity index 95% rename from make/scripts/update_copyright_year.sh rename to bin/update_copyright_year.sh index 578ab4cbc99..fa7989d234b 100644 --- a/make/scripts/update_copyright_year.sh +++ b/bin/update_copyright_year.sh @@ -62,17 +62,22 @@ Help() echo "options:" echo "-c Specifies the company. Set to Oracle by default." echo "-y Specifies the copyright year. Set to current year by default." + echo "-b Specifies the base reference for change set lookup." echo "-f Updates the copyright for all change sets in a given year," - echo " as specified by -y." + echo " as specified by -y. Overrides -b flag." echo "-h Print this help." echo } full_year=false +base_reference=master # Process options -while getopts "c:fhy:" option; do +while getopts "b:c:fhy:" option; do case $option in + b) # supplied base reference + base_reference=${OPTARG} + ;; c) # supplied company year company=${OPTARG} ;; @@ -111,7 +116,7 @@ else if [ "$full_year" = "true" ]; then vcs_list_changesets=(git log --no-merges --since="${year}-01-01T00:00:00Z" --until="${year}-12-31T23:59:59Z" --pretty=tformat:"%H") else - vcs_list_changesets=(git log --no-merges 'master..HEAD' --since="${year}-01-01T00:00:00Z" --until="${year}-12-31T23:59:59Z" --pretty=tformat:"%H") + vcs_list_changesets=(git log --no-merges "${base_reference}..HEAD" --since="${year}-01-01T00:00:00Z" --until="${year}-12-31T23:59:59Z" --pretty=tformat:"%H") fi vcs_changeset_message=(git log -1 --pretty=tformat:"%B") # followed by ${changeset} vcs_changeset_files=(git diff-tree --no-commit-id --name-only -r) # followed by ${changeset} diff --git a/bin/update_pch.sh b/bin/update_pch.sh new file mode 100644 index 00000000000..d7871fdd753 --- /dev/null +++ b/bin/update_pch.sh @@ -0,0 +1,111 @@ +#!/bin/sh +# 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. + +# The output of this script may require some degree of human curation: +# - Redundant headers, e.g. both x.hpp, x.inline.hpp are included; +# - Headers relative to a non-default feature should be protected by an +# appropriate 'if' clause to make sure all variants can build without +# errors. + +source_path="$(dirname ${0})" +this_script_dir="$(cd -- "${source_path}" > /dev/null && pwd)" +if test -z "${this_script_dir}"; then + echo "Error: Could not determine location of this script" + exit 1 +fi + +# Work in top directory +cd $this_script_dir/.. + +# Time threshold for header compilation, if the time exceeds the +# threshold the header will be precompiled. +if [ -z "$MIN_MS" ]; then + MIN_MS=100000 +fi + +if [ -z "$CLEAN" ]; then + CLEAN=true +elif [ "$CLEAN" != "true" ] && [ "$CLEAN" != "false" ]; then + echo "Expected either 'true' or 'false' for CLEAN" +fi + +# CBA_PATH should point to a valid ClangBuildAnalyzer executable. +# Build steps: +# git clone --depth 1 git@github.com:aras-p/ClangBuildAnalyzer.git +# cd ClangBuildAnalyzer +# make -f projects/make/Makefile +if [ -z "$CBA_PATH" ]; then + CBA_PATH="./ClangBuildAnalyzer/build/ClangBuildAnalyzer" +fi + +set -eux + +PRECOMPILED_HPP="src/hotspot/share/precompiled/precompiled.hpp" +CBA_CONFIG="ClangBuildAnalyzer.ini" +TIMESTAMP="$(date +%Y%m%d-%H%M)" +RUN_NAME="pch_update_$TIMESTAMP" +CBA_OUTPUT="cba_out_$TIMESTAMP" + +if [ "$CLEAN" = "true" ]; then + trap 'rm -rf "build/'"$RUN_NAME"'" "$CBA_OUTPUT" "$CBA_CONFIG"' EXIT +fi + +sh configure --with-toolchain-type=clang \ + --with-conf-name="$RUN_NAME" \ + --disable-precompiled-headers \ + --with-extra-cxxflags="-ftime-trace" \ + --with-extra-cflags="-ftime-trace" + +make clean CONF_NAME="$RUN_NAME" +make hotspot CONF_NAME="$RUN_NAME" +"$CBA_PATH" --all "./build/$RUN_NAME/hotspot/variant-server/libjvm/objs" \ + "$CBA_OUTPUT" + +# Preserve license and comments on top +cat "$PRECOMPILED_HPP" | awk '/^#include/ {exit} {print}' > "$PRECOMPILED_HPP.tmp" + +if [ ! -f "$CBA_CONFIG" ]; then +cat < "$CBA_CONFIG" +[counts] +header=100 +headerChain=0 +template=0 +function=0 +fileCodegen=0 +fileParse=0 + +[misc] +onlyRootHeaders=true +EOF +fi + +"$CBA_PATH" --analyze "$CBA_OUTPUT" | \ + grep " ms: " | \ + # Keep the headers more expensive than ${1}ms + awk -v x="$MIN_MS" '$1 < x { exit } { print $3 }' | \ + # Filter away non-hotspot headers + grep hotspot/share | \ + awk -F "hotspot/share/" '{ printf "#include \"%s\"\n", $2 }' \ + >> "$PRECOMPILED_HPP.tmp" +mv "$PRECOMPILED_HPP.tmp" "$PRECOMPILED_HPP" + +java test/hotspot/jtreg/sources/SortIncludes.java --update "$PRECOMPILED_HPP" diff --git a/doc/hotspot-style.html b/doc/hotspot-style.html index dafd29d6f54..7be6867b3ca 100644 --- a/doc/hotspot-style.html +++ b/doc/hotspot-style.html @@ -50,6 +50,9 @@ id="toc-factoring-and-class-design">Factoring and Class Design
  • Commenting
  • Macros
  • Whitespace
  • +
  • Avoid implicit conversions +to bool
  • Miscellaneous
  • @@ -72,28 +75,78 @@ Standard Library Deduction
  • Expression SFINAE
  • +
  • Trailing return type +syntax for functions
  • +
  • Non-type template parameter +values
  • enum
  • alignas
  • thread_local
  • nullptr
  • <atomic>
  • +
  • Variable Templates and +Inline Variables
  • Initializing variables with static storage duration
  • Uniform Initialization
  • +
  • Mandatory Copy Elision
  • Local Function Objects
  • Inheriting constructors
  • Attributes
  • noexcept
  • +
  • Enhanced selection +statements
  • +
  • Expression Evaluation +Order
  • +
  • Compatibility with C11
  • Additional Permitted Features
  • +
  • Excluded +Features +
  • Undecided +Features +
  • @@ -209,6 +262,16 @@ lines of code. Name what you must repeat.

    attribute, the change should be done with a "setter" accessor matched to the simple "getter".

    +

    Conventions for Lock-free +Code

    +

    Sometimes variables are accessed concurrently without appropriate +synchronization context, such as a held mutex or at a safepoint. In such +cases the variable should be declared volatile and it +should NOT be accessed as a normal C++ lvalue. Rather, access should be +performed via functions from Atomic, such as +Atomic::load, Atomic::store, etc.

    +

    This special formulation makes it more clear to maintainers that the +variable is accessed concurrently in a lock-free manner.

    Source Files

    • All source files must have a globally unique basename. The build @@ -408,22 +471,25 @@ adjust new lines horizontally to be consistent with that organization. (E.g., trailing backslashes on long macro definitions often align.)

    -

    Miscellaneous

    -
      -
    • Use the Resource Acquisition Is -Initialization (RAII) design pattern to manage bracketed critical -sections. See class ResourceMark for an example.

    • -
    • Avoid implicit conversions to bool.

      +

      Avoid implicit conversions +to bool

      • Use bool for boolean values.
      • Do not use ints or pointers as (implicit) booleans with &&, ||, if, while. Instead, compare explicitly, i.e. if (x != 0) or if (ptr != nullptr), etc.
      • -
      • Do not use declarations in condition forms, i.e. don't use -if (T v = value) { ... }.
      • -
    • +
    • Do not use non-boolean declarations in condition forms, +i.e. don't use if (T v = value) { ... }. But see Enhanced selection +statements.
    • +
    +

    Miscellaneous

    +
      +
    • Use the Resource Acquisition Is +Initialization (RAII) design pattern to manage bracketed critical +sections. See class ResourceMark for an example.

    • Use functions from globalDefinitions.hpp and related files when performing bitwise operations on integers. Do not code directly as C operators, unless they are extremely simple. (Examples: @@ -435,16 +501,16 @@ default case. It is ok to have an empty default with comment.

    Use of C++ Features

    HotSpot was originally written in a subset of the C++98/03 language. -More recently, support for C++14 is provided, though again, HotSpot only +More recently, support for C++17 is provided, though again, HotSpot only uses a subset. (Backports to JDK versions lacking support for more recent Standards must of course stick with the original C++98/03 subset.)

    This section describes that subset. Features from the C++98/03 language may be used unless explicitly excluded here. Features from -C++11 and C++14 may be explicitly permitted or explicitly excluded, and -discussed accordingly here. There is a third category, undecided -features, about which HotSpot developers have not yet reached a -consensus, or perhaps have not discussed at all. Use of these features +C++11, C++14, and C++17 may be explicitly permitted or explicitly +excluded, and discussed accordingly here. There is a third category, +undecided features, about which HotSpot developers have not yet reached +a consensus, or perhaps have not discussed at all. Use of these features is also excluded.

    (The use of some features may not be immediately obvious and may slip in anyway, since the compiler will accept them. The code review process @@ -453,9 +519,9 @@ is the main defense against this.)

    provide more extensive discussion or rationale for limitations. Features that don't have their own subsection are listed in omnibus feature sections for permitted, excluded, and undecided features.

    -

    Lists of new features for C++11 and C++14, along with links to their -descriptions, can be found in the online documentation for some of the -compilers and libraries. The C++14 Standard is the definitive +

    Lists of new features for C++11, C++14, and C++17, along with links +to their descriptions, can be found in the online documentation for some +of the compilers and libraries. The C++17 Standard is the definitive description.

    +

    * Function return type +deduction (n3638)
    Only use if the function body has a very small number of return -statements, and generally relatively little other code.

    +statements, and generally relatively little other code.

    +
      +
    • Class template argument deduction (n3602, p0091r3)
      The template arguments +of a class template may be deduced from the arguments to a constructor. +This is similar to ordinary function argument deduction, though partial +deduction with only some template arguments explicitly provided +is not permitted for class template argument deduction. Deduction guides +may be used to provide additional control over the deduction. As with +auto variable declarations, excessive use can make code +harder to understand, because explicit type information is lacking. But +it can also remove the need to be explicit about types that are either +obvious, or that are very hard to write. For example, these allow the +addition of a scope-guard mechanism with nice syntax; something like +this
    • +
    +
      ScopeGuard guard{[&]{ ... cleanup code ... }};
    +
    • Also see lambda expressions.

    • +
    • decltype(auto) should be avoided, whether for +variables, for non-type template parameters, or for function return +types. There are subtle and complex differences between this placeholder +type and auto. Any use would need very careful +explanation.

    Expression SFINAE

    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95468
    https://developercommunity.visualstudio.com/content/problem/396562/sizeof-deduced-type-is-sometimes-not-a-constant-ex.html

    +

    Trailing return type +syntax for functions

    +

    A function's return type may be specified after the parameters and +qualifiers (n2541). +In such a declaration the normal return type is auto and +the return type is indicated by -> followed by the type. +Although both use auto in the "normal" leading return type +position, this differs from function return type +deduction, in that the return type is explicit rather than deduced, +but specified in a trailing position.

    +

    Use of trailing return types is permitted. However, the normal, +leading position for the return type is preferred. A trailing return +type should only be used where it provides some benefit. Such benefits +usually arise because a trailing return type is in a different scope +than a leading return type.

    +
      +
    • If the function identifier is a nested name specifier, then the +trailing return type occurs in the nested scope. This may permit simpler +naming in the return type because of the different name lookup +context.

    • +
    • The trailing return type is in the scope of the parameters, +making their types accessible via decltype. For +example

    • +
    +
    template<typename T, typename U> auto add(T t, U u) -> decltype(t + u);
    +

    rather than

    +
    template<typename T, typename U> decltype((*(T*)0) + (*(U*)0)) add(T t, U u);
    +
      +
    • Complex calculated leading return types may obscure the normal +syntactic boundaries, making it more difficult for a reader to find the +function name and parameters. This is particularly common in cases where +the return type is being used for SFINAE. A trailing +return type may be preferable in such situations.
    • +
    +

    Non-type template parameter +values

    +

    C++17 extended the arguments permitted for non-type template +parameters (n4268). The kinds of +values (the parameter types) aren't changed. However, the values can now +be the result of arbitrary constant expressions (with a few restrictions +on the result), rather than a much more limited and restrictive set of +expressions. In particular, the argument for a pointer or reference type +parameter can now be the result of a constexpr function.

    enum

    Where appropriate, scoped-enums should be used. (n2347)

    @@ -795,6 +938,41 @@ differ from what the Java compilers implement.

    "conservative" memory ordering, which may differ from (may be stronger than) sequentially consistent. There are algorithms in HotSpot that are believed to rely on that ordering.

    +

    Variable Templates and +Inline Variables

    +

    The use of variable templates (including static data member +templates) (N3651) is permitted. +They provide parameterized variables and constants in a simple and +direct form, instead of requiring the use of various workarounds.

    +

    Variables with static storage duration and variable templates may be +declared inline (p0386r2), and this usage is +permitted. This has similar effects as for declaring a function inline: +it can be defined, identically, in multiple translation units, must be +defined in every translation unit in which it is ODR used, and the behavior of the +program is as if there is exactly one variable.

    +

    Declaring a variable inline allows the complete definition to be in a +header file, rather than having a declaration in a header and the +definition in a .cpp file. The guidance on initialization +of such variables still applies. Inline variables with dynamic +initializations can make initialization order problems worse. The few +ordering constraints that exist for non-inline variables don't apply, as +there isn't a single program-designated translation unit containing the +definition.

    +

    A constexpr static data member or static data member +template is implicitly inline. As a consequence, an ODR use of such a member doesn't require +a definition in some .cpp file. (This is a change from pre-C++17. +Beginning with C++17, such a definition is considered a duplicate +definition, and is deprecated.)

    +

    Declaring a thread_local variable template or +inline variable is forbidden in HotSpot code. The use of thread_local is already +heavily restricted.

    Initializing variables with static storage duration

    @@ -846,6 +1024,45 @@ initialization

    Although related, the use of std::initializer_list remains forbidden, as part of the avoidance of the C++ Standard Library in HotSpot code.

    +

    Mandatory Copy Elision

    +

    Copy elision +(or here) +is a compiler optimization used to avoid potentially expensive copies in +certain situations. It is critical to making practical the performance +of return by value or pass by value. It is also unusual in not following +the as-if rule for optimizations - copy elision can be applied even if +doing so bypasses side-effects of copying/moving the object. The C++ +standard explicitly permits this.

    +

    However, because it's an optional optimization, the relevant +copy/move constructor must be available and accessible, in case the +compiler chooses to not apply the optimization even in a situation where +permitted.

    +

    C++17 changed some cases of copy elision so that there is never a +copy/move in these cases (p0135r1). The interesting cases +involve a function that returns an unnamed temporary object, and +constructors. In such cases the object being initialized from the +temporary is always direct initialized, with no copy/move ever involved; +see RVO and more specifically URVO.

    +

    Since this is now standard behavior it can't be avoided in the +covered situations. This could change the behavior of code that relied +on side effects by constructors, but that's both uncommon and was +already problematic because of the previous optional copy elision. But +HotSpot code can, and should, explicitly take advantage of this newly +required behavior where it makes sense to do so.

    +

    For example, it may be beneficial to delay construction of the result +of a function until the return statement, rather than having a local +variable that is modified into the desired state and then returned. +(Though NRVO may apply in that +case.)

    +

    It is also now possible to define a factory function for a class that +is neither movable nor copyable, if it can be written in a way that +makes use of this feature.

    Local Function Objects

    • Local function objects, including lambda expressions, may be @@ -918,6 +1135,13 @@ href="https://en.wikipedia.org/wiki/Partial_application" title="Partial Application">partial application. Again here, lambdas are typically much simpler and less verbose than function object classes.

      +

      A lambda is a constexpr function if either the parameter declaration +clause is followed by constexpr, or it satisfies the +requirements for a constexpr function (p0170r1). +Thus, using a lambda to package up some computation doesn't incur +unnecessary overhead or prevent use in a context required to be +compile-time evaluated (such as an array size).

      Because of these benefits, lambda expressions are permitted in HotSpot code, with some restrictions and usage guidance. An anonymous lambda is one which is passed directly as an argument. A named lambda is @@ -965,6 +1189,18 @@ making the captured value unaffected by modifications to the outer variable. But this only applies to captured auto variables, not member variables, and is inconsistent with referential transparency.

    +
  • By-value capture of this (using a capture list like +[*this] (p0018r3)) +is also not permitted. One of the motivating use-cases is when the +lifetime of the lambda exceeds the lifetime of the object for the +containing member function. That is, we have an upward lambda that is +capturing this of the enclosing method. But again, that +use-case doesn't apply if only downward lambdas are used. Another +use-case is when we simply want the lambda to be operating on a copy of +this for some reason. This is sufficiently uncommon that it +can be handled by manual copying, so readers don't need to understand +this rare syntax.

  • Non-capturing lambdas (with an empty capture list - []) have limited utility. There are cases where no captures are required (pure functions, for example), but if the function is small @@ -974,14 +1210,15 @@ href="https://isocpp.org/files/papers/N3649.html">N3649) are not permitted. Capture initializers inherently increase the complexity of the capture list, and provide little benefit over an additional in-scope local variable.

  • - -

    The use of mutable lambda expressions is forbidden +

  • The use of mutable lambda expressions is forbidden because there don't seem to be many, if any, good use-cases for them in HotSpot. A lambda expression needs to be mutable in order to modify a by-value captured value. But with only downward lambdas, such usage seems likely to be rare and complicated. It is better to use a function object class in any such cases that arise, rather than requiring all -HotSpot developers to understand this relatively obscure feature.

    +HotSpot developers to understand this relatively obscure +feature.

  • +

    While it is possible to directly invoke an anonymous lambda expression, that feature should not be used, as such a form can be confusing to readers. Instead, name the lambda and call it by name.

    @@ -1099,23 +1336,12 @@ href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2540.htm">n2540C++11 provides simple syntax allowing a class to inherit the constructors of a base class. Unfortunately there are a number of problems with the original specification, and C++17 contains significant -revisions (p0136r1 opens with a list of 8 Core Issues). Since -HotSpot doesn't support use of C++17, use of inherited constructors -could run into those problems. Such uses might also change behavior in a -future HotSpot update to use C++17 or later, potentially in subtle ways -that could lead to hard to diagnose problems. Because of this, HotSpot -code must not use inherited constructors.

    -

    Note that gcc7 provides the -fnew-inheriting-ctors -option to use the p0136r1 semantics. This is enabled by default when -using C++17 or later. It is also enabled by default for -fabi-version=11 (introduced by gcc7) or higher when using -C++11/14, as the change is considered a Defect Report that applies to -those versions. Earlier versions of gcc don't have that option, and -other supported compilers may not have anything similar.

    +revisions (p0136r1 +opens with a list of 8 Core Issues). Although those issues have been +addressed, the benefits from this feature are small compared to the +complexity. Because of this, HotSpot code must not use inherited +constructors.

    +

    p0195r0

    Attributes

    The use of some attributes (n2761) @@ -1131,9 +1357,17 @@ those cases HotSpot has a preferred location.

    beginning of the function's declaration, rather than between the function name and the parameter list. +

    p0068r0 is the initial +proposal for the attributes added by C++17.)

    Only the following attributes are permitted:

    The following attributes are expressly forbidden:

      @@ -1141,6 +1375,23 @@ function name and the parameter list. memory_order_consume.
    • [[deprecated]] - Not relevant in HotSpot code.
    +

    Direct use of non-standard (and presumably scoped) attributes in +shared code is also forbidden. Using such would depend on the C++17 +feature that an attribute not recognized by the implementation is +ignored (p0283r2). If such an +attribute is needed in shared code, the well-established technique of +providing an ATTRIBUTE_XXX macro with per-compiler +definitions (sometimes empty) should be used. Compilers may warn about +unrecognized attributes (whether by name or by location), in order to +report typos or misuse. Disabling such warnings globally would not be +desirable.

    +

    The use of using directives in attribute lists is also +forbidden. (p0028r0) (p0028r4) We don't generally use +scoped attributes in attribute lists with other attributes. Rather, uses +of scoped attributes (which are implementation defined) are generally +hidden behind a portability macro that includes the surrounding +brackets.

    noexcept

    Use of noexcept exception specifications (n3050) are permitted with restrictions @@ -1190,9 +1441,72 @@ Standard Library facilities.

    functions not declared noexcept. So HotSpot code doesn't ever need to check, either with conditional exception specifications or with noexcept expressions.

    +

    The exception specification is part of the type of a function (p0012r1. This likely has little +impact on HotSpot code, since the use of noexcept is +expected to be rare.

    Dynamic exception specifications were deprecated in C++11. C++17 removed all but throw(), with that remaining a deprecated equivalent to noexcept.

    +

    Enhanced selection +statements

    +

    C++17 modified the condition part of if and +switch statements, permitting an init-statement to +be included (p0305r1).

    +

    Use of this feature is permitted. (However, complex uses may +interfere with readability.) Limiting the scope of a variable involved +in the condition, while also making the value available to the +statement's body, can improve readability. The alternative method of +scope-limiting by introducing a nested scope isn't very popular and is +rarely used.

    +

    This new syntax is in addition to the condition being a +declaration with a brace-or-equal-initializer. For an +if statement this new sytax gains that benefit without +violating the long-standing guidance against using implicit conversions to +bool, which still stands.

    +

    For example, uses of Unified Logging sometimes explicitly check +whether a LogTarget is enabled. Instead of

    +
      LogTarget(...) lt;
    +  if (lt.is_enabled()) {
    +    LogStream log(lt);
    +    ... use log ...
    +  }
    +  ... lt is accessible but probably not needed here ...
    +

    using this feature one could write

    +
      if (LogTarget(...) lt; lt.is_enabled()) {
    +    LogStream log(lt);
    +    ... use log ...
    +  }
    +

    C++17 also added compile-time if statements (p0292r2). Use of +if constexpr is permitted. This feature can replace and +(sometimes vastly) simplify many uses of SFINAE. The same +declaration and initialization guidance for the condition part +apply here as for ordinary if statements.

    +

    Expression Evaluation Order

    +

    C++17 tightened up the evaluation order for some kinds of +subexpressions (p0138r2). Note, +however, that the Alternate Evaluation Order for Function Calls +alternative in that paper was adopted, rather than the strict left to +right order of evaluation for function call arguments that was proposed +in the main body of the paper.

    +

    The primary purpose of this change seems to be to make certain kinds +of call chaining well defined. That's not a style widely used in +HotSpot. In general it is better to continue to avoid questions in this +area by isolating operations with side effects from other statements. In +particular, continue to avoid modifying a value in an expression where +it is also used.

    +

    Compatibility with C11

    +

    C++17 refers to C11 rather than C99. This means that C11 libraries +and functions may be used in HotSpot. There may be limitations because +of differing levels of compatibility among various compilers and +versions of those compilers.

    +

    Note that the C parts of the JDK have been built with C11 selected +for some time (JDK-8292008).

    Additional Permitted Features

      @@ -1208,8 +1522,10 @@ href="https://isocpp.org/files/papers/n3778.html">n3778)

      href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2242.pdf">n2242) (n2555)

      -
    • Static assertions (n1720)

    • +
    • Static assertions (n1720) +(n3928)
      Both the original +(C++11) two-argument form and the new (C++17) single-argument form are +permitted.

    • decltype (n2343) (n2930< href="https://en.cppreference.com/w/cpp/language/range-for">range-for)

    • Unrestricted Unions (n2544)

    • +
    • Preprocessor Condition __has_include (p0061r0) (p0061r1)

    • +
    • Hexadecimal Floating-Point Literals (p0245r1)

    • +
    • Construction Rules for enum class Values (p0138r2)

    • +
    • Allow typename in template template parameter (n4051) — template template parameters +are barely used (if at all) in HotSpot, but there's no reason to +artificially disallow this syntactic regularization in any such +uses.

    -

    Excluded Features

    +

    Excluded Features

    +

    Structured Bindings

    +

    The use of structured bindings p0217r3 is forbidden. Preferred +approaches for handling functions with multiple return values +include

    +
      +
    • Return a named class/struct intended for that purpose, with named +and typed members/accessors.

    • +
    • Return a value along with out parameters (usually pointers, +sometimes references).

    • +
    • Designate a sentinel "failure" value in the normal return value +type, with some out of band location for additional information. For +example, this is the model typically used with errno, where +a function returns a normal result, or -1 to indicate an error, with +additional error information in errno.

    • +
    +

    There is a strong preference for names and explicit types, as opposed +to offsets and implicit types. For example, there are folks who strongly +dislike that some of the Standard Library functions return +std::pair because first and +second members don't carry any useful information.

    +

    File System Library

    +

    The use of the File System library is forbidden. HotSpot doesn't do +very much with files, and already has adequate mechanisms for its needs. +Rewriting in terms of this new library doesn't provide any obviously +significant benefits. Having a mix of the existing usage and uses of +this new library would be confusing.

    +

    n4100 p0218r0 p0219r1 p0317r1 p0392r0 p0430r2 p0492r2 p1164r1

    +

    Aggregate Extensions

    +

    Aggregates with base classes are forbidden. C++17 allows aggregate +initialization for classes with base classes (p0017r1). HotSpot makes very little +use of aggregate classes, preferring explicit constructors even for very +simple classes.

    +

    Additional Excluded Features