diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0d8663fab1a..4d1e8a8be3d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -327,8 +327,8 @@ jobs: uses: ./.github/workflows/build-macos.yml with: platform: macos-x64 - runs-on: 'macos-13' - xcode-toolset-version: '14.3.1' + runs-on: 'macos-15-intel' + xcode-toolset-version: '16.4' configure-arguments: ${{ github.event.inputs.configure-arguments }} make-arguments: ${{ github.event.inputs.make-arguments }} dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }} @@ -340,8 +340,8 @@ jobs: uses: ./.github/workflows/build-macos.yml with: platform: macos-aarch64 - runs-on: 'macos-14' - xcode-toolset-version: '15.4' + runs-on: 'macos-15' + xcode-toolset-version: '16.4' configure-arguments: ${{ github.event.inputs.configure-arguments }} make-arguments: ${{ github.event.inputs.make-arguments }} dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }} @@ -432,9 +432,9 @@ jobs: with: platform: macos-aarch64 bootjdk-platform: macos-aarch64 - runs-on: macos-14 + runs-on: macos-15 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }} - xcode-toolset-version: '15.4' + xcode-toolset-version: '16.4' debug-suffix: -debug test-windows-x64: diff --git a/.gitignore b/.gitignore index 9145a9fa67b..0743489f8ec 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,9 @@ NashornProfile.txt **/core.[0-9]* *.rej *.orig +test/benchmarks/**/target +/src/hotspot/CMakeLists.txt +/src/hotspot/compile_commands.json +/src/hotspot/cmake-build-debug/ +/src/hotspot/.cache/ +/src/hotspot/.idea/ diff --git a/doc/building.html b/doc/building.html index 99eb3e0c473..19313ebf43a 100644 --- a/doc/building.html +++ b/doc/building.html @@ -668,7 +668,7 @@ update.

(Note that this version is often presented as "MSVC 14.28", and reported by cl.exe as 19.28.) Older versions will not be accepted by configure and will not work. The maximum accepted version -of Visual Studio is 2022.

+of Visual Studio is 2026.

If you have multiple versions of Visual Studio installed, configure will by default pick the latest. You can request a specific version to be used by setting diff --git a/doc/building.md b/doc/building.md index 047255d1848..1fbd395a9d1 100644 --- a/doc/building.md +++ b/doc/building.md @@ -468,7 +468,7 @@ available for this update. The minimum accepted version is Visual Studio 2019 version 16.8. (Note that this version is often presented as "MSVC 14.28", and reported by cl.exe as 19.28.) Older versions will not be accepted by `configure` and will not work. -The maximum accepted version of Visual Studio is 2022. +The maximum accepted version of Visual Studio is 2026. If you have multiple versions of Visual Studio installed, `configure` will by default pick the latest. You can request a specific version to be used by diff --git a/doc/hotspot-style.html b/doc/hotspot-style.html index fb4cffc9d43..a2ffb57e5a3 100644 --- a/doc/hotspot-style.html +++ b/doc/hotspot-style.html @@ -86,8 +86,9 @@ values

  • thread_local
  • nullptr
  • <atomic>
  • -
  • Inline -Variables
  • +
  • Variable Templates and +Inline Variables
  • Initializing variables with static storage duration
  • @@ -113,7 +114,7 @@ id="toc-compatibility-with-c11">Compatibility with C11 id="toc-additional-permitted-features">Additional Permitted Features -
  • Excluded +
  • Forbidden Features
  • Undecided @@ -505,19 +506,19 @@ 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 +language may be used unless explicitly forbidden here. Features from C++11, C++14, and C++17 may be explicitly permitted or explicitly -excluded, and discussed accordingly here. There is a third category, +forbidden, 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.

    +is also forbidden.

    (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 is the main defense against this.)

    Some features are discussed in their own subsection, typically to 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.

    +sections for permitted, forbidden, and undecided features.

    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 @@ -593,14 +594,15 @@ title="Runtime Type Information">RTTI are deemed not worthwhile, given the alternatives.

    Memory Allocation

    Do not use the standard global allocation and deallocation functions -(operator new and related functions). Use of these functions by HotSpot -code is disabled for some platforms.

    +(global operator new and related functions), other than the +non-allocating forms of those functions. Use of these functions by +HotSpot code is disabled for some platforms.

    Rationale: HotSpot often uses "resource" or "arena" allocation. Even where heap allocation is used, the standard global functions are avoided -in favor of wrappers around malloc and free that support the VM's Native -Memory Tracking (NMT) feature. Typically, uses of the global operator -new are inadvertent and therefore often associated with memory -leaks.

    +in favor of wrappers around malloc and free +that support the JVM's Native Memory Tracking (NMT) feature. Typically, +uses of the global operator new are inadvertent and +therefore often associated with memory leaks.

    Native memory allocation failures are often treated as non-recoverable. The place where "out of memory" is (first) detected may be an innocent bystander, unrelated to the actual culprit.

    @@ -647,7 +649,39 @@ for anonymous namespaces.

    class="uri">https://sourceware.org/bugzilla/show_bug.cgi?id=16874
    Bug for similar gdb problems.

    C++ Standard Library

    -

    Avoid using the C++ Standard Library.

    +

    Only curated parts of the C++ Standard Library may be used by HotSpot +code.

    +

    Functions that may throw exceptions must not be used. This is in +accordance with the HotSpot policy of not +using exceptions.

    +

    Also in accordance with HotSpot policy, the standard global allocator must not be +used. This means that uses of standard container classes cannot +presently be used, as doing so requires specialization on some allocator +type that is integrated with the existing HotSpot allocation mechanisms. +(Such allocators may be provided in the future.)

    +

    Standard Library identifiers should usually be fully qualified; +using directives must not be used to bring Standard Library +identifiers into scope just to remove the need for namespace +qualification. Requiring qualification makes it easy to distinguish +between references to external libraries and code that is part of +HotSpot.

    +

    As with language features, Standard Library facilities are either +permitted, explicitly forbidden, or undecided (and so implicitly +forbidden).

    +

    Most HotSpot code should not directly #include C++ +Standard Library headers. HotSpot provides a set of wrapper headers for +the Standard Library headers containing permitted definitions. These +wrappers are in the cppstdlib directory, with the same name +as the corresponding Standard Library header and a .hpp +extension. These wrappers provide a place for any additional code (some +of which may be platform-specific) needed to support HotSpot usage.

    +

    These wrappers also provide a place to document HotSpot usage, +including any restrictions. The set of wrappers and the usage +documentation should be considered part of HotSpot style. Any changes +are subject to the same process as applies to this document. (For +historical reasons, there may be many direct inclusions of some C++ +Standard Library headers.)

    Historically, HotSpot has mostly avoided use of the Standard Library.

    (It used to be impossible to use most of it in shared code, because @@ -660,46 +694,60 @@ in mid-2017. Support for Solaris was removed in 2020.)

    of Standard Library facilities is exceptions. HotSpot does not use exceptions and, for platforms which allow doing so, builds with them turned off. Many Standard Library facilities implicitly or explicitly -use exceptions.

  • +use exceptions. On the other hand, many don't, and can be used without +concern for this issue. Others may have a useful subset that doesn't use +exceptions.

  • assert. An issue that is quickly encountered is the assert macro name collision (JDK-8007770). -Some mechanism for addressing this would be needed before much of the -Standard Library could be used. (Not all Standard Library -implementations use assert in header files, but some do.)

  • +(Not all Standard Library implementations use assert in +header files, but some do.) HotSpot provides a mechanism for addressing +this, by establishing a scope around the include of a library header +where the HotSpot assert macro is suppressed. One of the +reasons for using wrapper headers rather than directly including +standard headers is to provide a central place to deal with this issue +for each header.

  • Memory allocation. HotSpot requires explicit control over where allocations occur. The C++98/03 std::allocator class is too -limited to support our usage. (Changes in more recent Standards may -remove this limitation.)

  • +limited to support our usage. But changes to the allocator concept in +more recent Standards removed some of the limitations, supporting +stateful allocators. HotSpot may, in the future, provide +standard-conforming allocators that are integrated with HotSpot's +existing allocation mechanisms.

  • Implementation vagaries. Bugs, or simply different implementation choices, can lead to different behaviors among the various Standard -Libraries we need to deal with.

  • +Libraries we need to deal with. But only selected parts of the Standard +Library are being permitted, and one of the selection criteria is +maturity. Some of these facilities are among the most heavily tested and +used C++ codes that exist.

  • Inconsistent naming conventions. HotSpot and the C++ Standard use different naming conventions. The coexistence of those different -conventions might appear jarring and reduce readability.

  • - -

    There are a few exceptions to this rule.

    +conventions might appear jarring and reduce readability. However, +experience in some other code bases suggests this isn't a significant +problem, so long as Standard Library names are namespace-qualified. It +is tempting to bring the Standard Library names into scope via a +using std; directive. Doing so makes writing code using +those names easier, since the qualifiers don't need to be included. But +there are several reasons not to do that.

    -

    Certain restrictions apply to the declarations provided by -<type_traits>.

    - -

    TODO: Rather than directly #including (permitted) Standard Library -headers, use a convention of #including wrapper headers (in some -location like hotspot/shared/stdcpp). This provides a single place for -dealing with issues we might have for any given header, esp. -platform-specific issues.

    Type Deduction

    Use type deduction only if it makes the code clearer or safer. Do not use it merely to avoid the inconvenience of writing an explicit type, @@ -937,12 +985,18 @@ 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.

    -

    Inline Variables

    -

    Variables with static storage duration may be declared -inline (p0386r2). -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 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.

    @@ -955,16 +1009,17 @@ 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 is implicitly -inline. As a consequence, an A constexpr static data member or static data member +template is implicitly inline. As a consequence, an ODR use of such a variable 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 inline is -forbidden for HotSpot code. The use of -thread_local is already heavily restricted.

    +title="One Definition Rule">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

    @@ -1569,10 +1624,10 @@ href="http://wg21.link/p0138r2">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 +artificially forbid this syntactic regularization in any such uses.

  • -

    Excluded Features

    +

    Forbidden Features

    Structured Bindings

    The use of structured bindings p0217r3 is forbidden. Preferred @@ -1614,8 +1669,33 @@ 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

    +

    Additional Forbidden +Features