Skip to content

Commit

Permalink
Merge branch 'master' into JDK-8327182
Browse files Browse the repository at this point in the history
  • Loading branch information
johnshajiang authored Mar 14, 2024
2 parents 8e889cb + 98e4b75 commit 8ceabf7
Show file tree
Hide file tree
Showing 1,085 changed files with 13,795 additions and 77,028 deletions.
18 changes: 9 additions & 9 deletions doc/building.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ <h1 class="title">Building the JDK</h1>
<li><a href="#apple-xcode" id="toc-apple-xcode">Apple Xcode</a></li>
<li><a href="#microsoft-visual-studio"
id="toc-microsoft-visual-studio">Microsoft Visual Studio</a></li>
<li><a href="#ibm-xl-cc" id="toc-ibm-xl-cc">IBM XL C/C++</a></li>
<li><a href="#ibm-open-xl-cc" id="toc-ibm-open-xl-cc">IBM Open XL
C/C++</a></li>
</ul></li>
<li><a href="#boot-jdk-requirements" id="toc-boot-jdk-requirements">Boot
JDK Requirements</a>
Expand Down Expand Up @@ -562,7 +563,7 @@ <h2 id="native-compiler-toolchain-requirements">Native Compiler
</tr>
<tr class="odd">
<td>AIX</td>
<td>IBM XL C/C++</td>
<td>IBM Open XL C/C++</td>
</tr>
<tr class="even">
<td>Windows</td>
Expand Down Expand Up @@ -601,13 +602,13 @@ <h2 id="native-compiler-toolchain-requirements">Native Compiler
<p>All compilers are expected to be able to handle the C11 language
standard for C, and C++14 for C++.</p>
<h3 id="gcc">gcc</h3>
<p>The minimum accepted version of gcc is 6.0. Older versions will not
<p>The minimum accepted version of gcc is 10.0. Older versions will not
be accepted by <code>configure</code>.</p>
<p>The JDK is currently known to compile successfully with gcc version
13.2 or newer.</p>
<p>In general, any version between these two should be usable.</p>
<h3 id="clang">clang</h3>
<p>The minimum accepted version of clang is 3.5. Older versions will not
<p>The minimum accepted version of clang is 13. Older versions will not
be accepted by <code>configure</code>.</p>
<p>To use clang instead of gcc on Linux, use
<code>--with-toolchain-type=clang</code>.</p>
Expand Down Expand Up @@ -673,11 +674,10 @@ <h3 id="microsoft-visual-studio">Microsoft Visual Studio</h3>
version number accordingly. If you have not installed the
<code>BuildTools</code>, but e.g. <code>Professional</code>, adjust the
product ID accordingly.</p>
<h3 id="ibm-xl-cc">IBM XL C/C++</h3>
<p>Please consult the AIX section of the <a
href="https://wiki.openjdk.org/display/Build/Supported+Build+Platforms">Supported
Build Platforms</a> OpenJDK Build Wiki page for details about which
versions of XLC are supported.</p>
<h3 id="ibm-open-xl-cc">IBM Open XL C/C++</h3>
<p>The minimum accepted version of Open XL is 17.1.1.4. This is in
essence clang 15, and will be treated as such by the OpenJDK build
system.</p>
<h2 id="boot-jdk-requirements">Boot JDK Requirements</h2>
<p>Paradoxically, building the JDK requires a pre-existing JDK. This is
called the "boot JDK". The boot JDK does not, however, have to be a JDK
Expand Down
13 changes: 6 additions & 7 deletions doc/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ one-to-one correlation between target operating system and toolchain.
| ------------------ | ------------------------- |
| Linux | gcc, clang |
| macOS | Apple Xcode (using clang) |
| AIX | IBM XL C/C++ |
| AIX | IBM Open XL C/C++ |
| Windows | Microsoft Visual Studio |

Please see the individual sections on the toolchains for version
Expand All @@ -403,7 +403,7 @@ C, and C++14 for C++.

### gcc

The minimum accepted version of gcc is 6.0. Older versions will not be accepted
The minimum accepted version of gcc is 10.0. Older versions will not be accepted
by `configure`.

The JDK is currently known to compile successfully with gcc version 13.2 or
Expand All @@ -413,7 +413,7 @@ In general, any version between these two should be usable.

### clang

The minimum accepted version of clang is 3.5. Older versions will not be
The minimum accepted version of clang is 13. Older versions will not be
accepted by `configure`.

To use clang instead of gcc on Linux, use `--with-toolchain-type=clang`.
Expand Down Expand Up @@ -487,11 +487,10 @@ that the " characters are essential)
accordingly. If you have not installed the `BuildTools`, but e.g.
`Professional`, adjust the product ID accordingly.

### IBM XL C/C++
### IBM Open XL C/C++

Please consult the AIX section of the [Supported Build Platforms](
https://wiki.openjdk.org/display/Build/Supported+Build+Platforms) OpenJDK Build
Wiki page for details about which versions of XLC are supported.
The minimum accepted version of Open XL is 17.1.1.4. This is in essence clang
15, and will be treated as such by the OpenJDK build system.

## Boot JDK Requirements

Expand Down
13 changes: 8 additions & 5 deletions doc/hotspot-style.html
Original file line number Diff line number Diff line change
Expand Up @@ -748,12 +748,15 @@ <h3 id="thread_local">thread_local</h3>
href="https://bugs.openjdk.org/browse/JDK-8282469">JDK-8282469</a> for
further discussion.</p>
<h3 id="nullptr">nullptr</h3>
<p>Prefer <code>nullptr</code> (<a
<p>Use <code>nullptr</code> (<a
href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf">n2431</a>)
to <code>NULL</code>. Don't use (constexpr or literal) 0 for
pointers.</p>
<p>For historical reasons there are widespread uses of both
<code>NULL</code> and of integer 0 as a pointer value.</p>
rather than <code>NULL</code>. See the paper for reasons to avoid
<code>NULL</code>.</p>
<p>Don't use (constant expression or literal) 0 for pointers. Note that
C++14 removed non-literal 0 constants from <em>null pointer
constants</em>, though some compilers continue to treat them as such.
For historical reasons there may be lingering uses of 0 as a
pointer.</p>
<h3 id="atomic">&lt;atomic&gt;</h3>
<p>Do not use facilities provided by the <code>&lt;atomic&gt;</code>
header (<a
Expand Down
10 changes: 6 additions & 4 deletions doc/hotspot-style.md
Original file line number Diff line number Diff line change
Expand Up @@ -725,12 +725,14 @@ for further discussion.

### nullptr

Prefer `nullptr`
Use `nullptr`
([n2431](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf))
to `NULL`. Don't use (constexpr or literal) 0 for pointers.
rather than `NULL`. See the paper for reasons to avoid `NULL`.

For historical reasons there are widespread uses of both `NULL` and of
integer 0 as a pointer value.
Don't use (constant expression or literal) 0 for pointers. Note that C++14
removed non-literal 0 constants from _null pointer constants_, though some
compilers continue to treat them as such. For historical reasons there may be
lingering uses of 0 as a pointer.

### &lt;atomic&gt;

Expand Down
6 changes: 3 additions & 3 deletions make/Global.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ help:
$(info $(_) # method is 'auto', 'ignore' or 'fail' (default))
$(info $(_) TEST="test1 ..." # Use the given test descriptor(s) for testing, e.g.)
$(info $(_) # make test TEST="jdk_lang gtest:all")
$(info $(_) JTREG="OPT1=x;OPT2=y" # Control the JTREG test harness, use 'help' to list)
$(info $(_) GTEST="OPT1=x;OPT2=y" # Control the GTEST test harness, use 'help' to list)
$(info $(_) MICRO="OPT1=x;OPT2=y" # Control the MICRO test harness, use 'help' to list)
$(info $(_) JTREG="OPT1=x;OPT2=y" # Control the JTREG test harness, use 'make test-only JTREG=help' to list)
$(info $(_) GTEST="OPT1=x;OPT2=y" # Control the GTEST test harness, use 'make test-only GTEST=help' to list)
$(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 )
Expand Down
5 changes: 1 addition & 4 deletions make/autoconf/build-performance.m4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -359,9 +359,6 @@ AC_DEFUN_ONCE([BPERF_SETUP_PRECOMPILED_HEADERS],
if test "x$ICECC" != "x"; then
AC_MSG_RESULT([no, does not work effectively with icecc])
PRECOMPILED_HEADERS_AVAILABLE=false
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
AC_MSG_RESULT([no, does not work with xlc])
PRECOMPILED_HEADERS_AVAILABLE=false
elif test "x$TOOLCHAIN_TYPE" = xgcc; then
# Check that the compiler actually supports precomp headers.
echo "int alfa();" > conftest.h
Expand Down
96 changes: 17 additions & 79 deletions make/autoconf/flags-cflags.m4
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# Setup flags for C/C++ compiler
#

###############################################################################
################################################################################
#
# How to compile shared libraries.
#
Expand All @@ -37,7 +37,10 @@ AC_DEFUN([FLAGS_SETUP_SHARED_LIBS],
if test "x$TOOLCHAIN_TYPE" = xgcc; then
# Default works for linux, might work on other platforms as well.
SHARED_LIBRARY_FLAGS='-shared'
SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$ORIGIN[$]1'
# --disable-new-dtags forces use of RPATH instead of RUNPATH for rpaths.
# This protects internal library dependencies within the JDK from being
# overridden using LD_LIBRARY_PATH. See JDK-8326891 for more information.
SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$ORIGIN[$]1 -Wl,--disable-new-dtags'
SET_SHARED_LIBRARY_ORIGIN="-Wl,-z,origin $SET_EXECUTABLE_ORIGIN"
SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1'
Expand All @@ -60,6 +63,9 @@ AC_DEFUN([FLAGS_SETUP_SHARED_LIBS],
# Default works for linux, might work on other platforms as well.
SHARED_LIBRARY_FLAGS='-shared'
SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$ORIGIN[$]1'
if test "x$OPENJDK_TARGET_OS" = xlinux; then
SET_EXECUTABLE_ORIGIN="$SET_EXECUTABLE_ORIGIN -Wl,--disable-new-dtags"
fi
SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1'
# arm specific settings
Expand All @@ -71,12 +77,6 @@ AC_DEFUN([FLAGS_SETUP_SHARED_LIBS],
fi
fi
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
SHARED_LIBRARY_FLAGS="-qmkshrobj -bM:SRE -bnoentry"
SET_EXECUTABLE_ORIGIN=""
SET_SHARED_LIBRARY_ORIGIN=''
SET_SHARED_LIBRARY_NAME=''
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
SHARED_LIBRARY_FLAGS="-dll"
SET_EXECUTABLE_ORIGIN=''
Expand Down Expand Up @@ -146,8 +146,6 @@ AC_DEFUN([FLAGS_SETUP_DEBUG_SYMBOLS],
CFLAGS_DEBUG_SYMBOLS="-g ${GDWARF_FLAGS}"
ASFLAGS_DEBUG_SYMBOLS="-g"
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
CFLAGS_DEBUG_SYMBOLS="-g1"
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
CFLAGS_DEBUG_SYMBOLS="-Z7"
fi
Expand Down Expand Up @@ -213,11 +211,7 @@ AC_DEFUN([DEBUG_PREFIX_MAP_GCC_INCLUDE_PATHS],
AC_DEFUN([FLAGS_SETUP_WARNINGS],
[
# Set default value.
if test "x$TOOLCHAIN_TYPE" != xxlc; then
WARNINGS_AS_ERRORS_DEFAULT=true
else
WARNINGS_AS_ERRORS_DEFAULT=false
fi
WARNINGS_AS_ERRORS_DEFAULT=true
UTIL_ARG_ENABLE(NAME: warnings-as-errors, DEFAULT: $WARNINGS_AS_ERRORS_DEFAULT,
RESULT: WARNINGS_AS_ERRORS,
Expand Down Expand Up @@ -267,15 +261,6 @@ AC_DEFUN([FLAGS_SETUP_WARNINGS],
DISABLED_WARNINGS="unknown-warning-option unused-parameter unused"
;;
xlc)
DISABLE_WARNING_PREFIX="-Wno-"
CFLAGS_WARNINGS_ARE_ERRORS="-qhalt=w"
# Possibly a better subset than "all" is "lan:trx:ret:zea:cmp:ret"
WARNINGS_ENABLE_ALL="-qinfo=all -qformat=all"
DISABLED_WARNINGS=""
;;
esac
AC_SUBST(DISABLE_WARNING_PREFIX)
AC_SUBST(BUILD_CC_DISABLE_WARNING_PREFIX)
Expand Down Expand Up @@ -357,15 +342,6 @@ AC_DEFUN([FLAGS_SETUP_OPTIMIZATION],
C_O_FLAG_SIZE="-Os"
C_O_FLAG_DEBUG="-O0"
C_O_FLAG_NONE="-O0"
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
C_O_FLAG_HIGHEST_JVM="-O3 -qhot=level=1 -qinline -qinlglue"
C_O_FLAG_HIGHEST="-O3 -qhot=level=1 -qinline -qinlglue"
C_O_FLAG_HI="-O3 -qinline -qinlglue"
C_O_FLAG_NORM="-O2"
C_O_FLAG_DEBUG="-qnoopt"
# FIXME: Value below not verified.
C_O_FLAG_DEBUG_JVM=""
C_O_FLAG_NONE="-qnoopt"
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
C_O_FLAG_HIGHEST_JVM="-O2 -Oy-"
C_O_FLAG_HIGHEST="-O2"
Expand Down Expand Up @@ -518,12 +494,6 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
else
DEBUG_CFLAGS_JDK="-DDEBUG"
if test "x$TOOLCHAIN_TYPE" = xxlc; then
# We need '-qminimaltoc' or '-qpic=large -bbigtoc' if the TOC overflows.
# Hotspot now overflows its 64K TOC (currently only for debug),
# so for debug we build with '-qpic=large -bbigtoc'.
DEBUG_CFLAGS_JVM="-qpic=large"
fi
if test "x$TOOLCHAIN_TYPE" = xclang && test "x$OPENJDK_TARGET_OS" = xaix; then
DEBUG_CFLAGS_JVM="-fpic -mcmodel=large"
fi
Expand All @@ -540,9 +510,6 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
ALWAYS_DEFINES_JVM="-D_GNU_SOURCE -D_REENTRANT"
elif test "x$TOOLCHAIN_TYPE" = xclang; then
ALWAYS_DEFINES_JVM="-D_GNU_SOURCE"
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
ALWAYS_DEFINES_JVM="-D_REENTRANT"
ALWAYS_DEFINES_JDK="-D_GNU_SOURCE -D_REENTRANT -DSTDC"
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
# Access APIs for Windows 8 and above
# see https://docs.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt?view=msvc-170
Expand Down Expand Up @@ -606,12 +573,6 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
TOOLCHAIN_CFLAGS_JDK_CONLY="-fno-strict-aliasing" # technically NOT for CXX
fi
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
# Suggested additions: -qsrcmsg to get improved error reporting
# set -qtbtable=full for a better traceback table/better stacks in hs_err when xlc16 is used
TOOLCHAIN_CFLAGS_JDK="-qtbtable=full -qchars=signed -qfullpath -qsaveopt -qstackprotect" # add on both CFLAGS
TOOLCHAIN_CFLAGS_JVM="-qtbtable=full -qtune=balanced -fno-exceptions \
-qalias=noansi -qstrict -qtls=default -qnortti -qnoeh -qignerrno -qstackprotect"
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.
Expand All @@ -620,20 +581,20 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
fi
# CFLAGS C language level for JDK sources (hotspot only uses C++)
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang || test "x$TOOLCHAIN_TYPE" = xxlc; then
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
LANGSTD_CFLAGS="-std=c11"
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
LANGSTD_CFLAGS="-std:c11"
fi
TOOLCHAIN_CFLAGS_JDK_CONLY="$LANGSTD_CFLAGS $TOOLCHAIN_CFLAGS_JDK_CONLY"
# CXXFLAGS C++ language level for all of JDK, including Hotspot.
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang || test "x$TOOLCHAIN_TYPE" = xxlc; then
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
LANGSTD_CXXFLAGS="-std=c++14"
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
LANGSTD_CXXFLAGS="-std:c++14"
else
AC_MSG_ERROR([Don't know how to enable C++14 for this toolchain])
AC_MSG_ERROR([Cannot enable C++14 for this toolchain])
fi
TOOLCHAIN_CFLAGS_JDK_CXXONLY="$TOOLCHAIN_CFLAGS_JDK_CXXONLY $LANGSTD_CXXFLAGS"
TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM $LANGSTD_CXXFLAGS"
Expand All @@ -652,8 +613,6 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
WARNING_CFLAGS="$WARNINGS_ENABLE_ALL"
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
WARNING_CFLAGS="" # currently left empty
fi
# Set some additional per-OS defines.
Expand All @@ -678,31 +637,16 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
PICFLAG="-fPIC"
PIEFLAG="-fPIE"
elif test "x$TOOLCHAIN_TYPE" = xclang && test "x$OPENJDK_TARGET_OS" = xaix; then
JVM_PICFLAG="-fpic -mcmodel=large -Wl,-bbigtoc
JDK_PICFLAG="-fpic
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
# '-qpic' defaults to 'qpic=small'. This means that the compiler generates only
# one instruction for accessing the TOC. If the TOC grows larger than 64K, the linker
# will have to patch this single instruction with a call to some out-of-order code which
# does the load from the TOC. This is of course slower, and we also would have
# to use '-bbigtoc' for linking anyway so we could also change the PICFLAG to 'qpic=large'.
# With 'qpic=large' the compiler will by default generate a two-instruction sequence which
# can be patched directly by the linker and does not require a jump to out-of-order code.
#
# Since large TOC causes perf. overhead, only pay it where we must. Currently this is
# for all libjvm variants (both gtest and normal) but no other binaries. So, build
# libjvm with -qpic=large and link with -bbigtoc.
JVM_PICFLAG="-qpic=large"
JDK_PICFLAG="-qpic"
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
PICFLAG=""
fi
if test "x$TOOLCHAIN_TYPE" != xxlc; then
if test "x$TOOLCHAIN_TYPE" = xclang && test "x$OPENJDK_TARGET_OS" = xaix; then
JVM_PICFLAG="-fpic -mcmodel=large"
else
JVM_PICFLAG="$PICFLAG"
JDK_PICFLAG="$PICFLAG"
fi
JDK_PICFLAG="$PICFLAG"
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
# Linking is different on MacOSX
Expand Down Expand Up @@ -752,8 +696,7 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
$1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -DARCH='\"$FLAGS_CPU_LEGACY\"' \
-D$FLAGS_CPU_LEGACY"
if test "x$FLAGS_CPU_BITS" = x64 && test "x$FLAGS_OS" != xaix; then
# xlc on AIX defines _LP64=1 by default and issues a warning if we redefine it.
if test "x$FLAGS_CPU_BITS" = x64; then
$1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -D_LP64=1"
$1_DEFINES_CPU_JVM="${$1_DEFINES_CPU_JVM} -D_LP64=1"
fi
Expand Down Expand Up @@ -830,11 +773,6 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
$1_CFLAGS_CPU="-mcpu=pwr8"
fi
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
if test "x$FLAGS_CPU" = xppc64; then
$1_CFLAGS_CPU_JVM="-qarch=ppc64"
fi
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
if test "x$FLAGS_CPU" = xx86; then
$1_CFLAGS_CPU_JVM="-arch:IA32"
Expand Down
Loading

0 comments on commit 8ceabf7

Please sign in to comment.