Skip to content

Commit ed52c83

Browse files
committed
Merge branch 'master' into JDK-8367994
2 parents 234aa5d + f5eecc4 commit ed52c83

File tree

3,622 files changed

+274809
-126349
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,622 files changed

+274809
-126349
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,9 @@ NashornProfile.txt
2525
**/core.[0-9]*
2626
*.rej
2727
*.orig
28+
test/benchmarks/**/target
29+
/src/hotspot/CMakeLists.txt
30+
/src/hotspot/compile_commands.json
31+
/src/hotspot/cmake-build-debug/
32+
/src/hotspot/.cache/
33+
/src/hotspot/.idea/

doc/building.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ <h3 id="microsoft-visual-studio">Microsoft Visual Studio</h3>
668668
(Note that this version is often presented as "MSVC 14.28", and reported
669669
by cl.exe as 19.28.) Older versions will not be accepted by
670670
<code>configure</code> and will not work. The maximum accepted version
671-
of Visual Studio is 2022.</p>
671+
of Visual Studio is 2026.</p>
672672
<p>If you have multiple versions of Visual Studio installed,
673673
<code>configure</code> will by default pick the latest. You can request
674674
a specific version to be used by setting

doc/building.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ available for this update.
468468
The minimum accepted version is Visual Studio 2019 version 16.8. (Note that
469469
this version is often presented as "MSVC 14.28", and reported by cl.exe as
470470
19.28.) Older versions will not be accepted by `configure` and will not work.
471-
The maximum accepted version of Visual Studio is 2022.
471+
The maximum accepted version of Visual Studio is 2026.
472472

473473
If you have multiple versions of Visual Studio installed, `configure` will by
474474
default pick the latest. You can request a specific version to be used by

doc/hotspot-style.html

Lines changed: 153 additions & 46 deletions
Large diffs are not rendered by default.

doc/hotspot-style.md

Lines changed: 149 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -413,12 +413,12 @@ support for more recent Standards must of course stick with the
413413
original C++98/03 subset.)
414414

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

423423
(The use of some features may not be immediately obvious and may slip
424424
in anyway, since the compiler will accept them. The code review
@@ -427,7 +427,7 @@ process is the main defense against this.)
427427
Some features are discussed in their own subsection, typically to provide
428428
more extensive discussion or rationale for limitations. Features that
429429
don't have their own subsection are listed in omnibus feature sections
430-
for permitted, excluded, and undecided features.
430+
for permitted, forbidden, and undecided features.
431431

432432
Lists of new features for C++11, C++14, and C++17, along with links to their
433433
descriptions, can be found in the online documentation for some of the
@@ -494,15 +494,16 @@ worthwhile, given the alternatives.
494494

495495
### Memory Allocation
496496

497-
Do not use the standard global allocation and deallocation functions
498-
(operator new and related functions). Use of these functions by HotSpot
499-
code is disabled for some platforms.
497+
Do not use the standard global allocation and deallocation functions (global
498+
`operator new` and related functions), other than the non-allocating forms of
499+
those functions. Use of these functions by HotSpot code is disabled for some
500+
platforms.
500501

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

508509
Native memory allocation failures are often treated as non-recoverable.
@@ -560,7 +561,39 @@ Bug for similar gdb problems.
560561

561562
### C++ Standard Library
562563

563-
Avoid using the C++ Standard Library.
564+
Only curated parts of the C++ Standard Library may be used by HotSpot code.
565+
566+
Functions that may throw exceptions must not be used. This is in accordance
567+
with the HotSpot policy of [not using exceptions](#error-handling).
568+
569+
Also in accordance with HotSpot policy, the
570+
[standard global allocator must not be used](#memory-allocation). This means
571+
that uses of standard container classes cannot presently be used, as doing so
572+
requires specialization on some allocator type that is integrated with the
573+
existing HotSpot allocation mechanisms. (Such allocators may be provided in
574+
the future.)
575+
576+
Standard Library identifiers should usually be fully qualified; `using`
577+
directives must not be used to bring Standard Library identifiers into scope
578+
just to remove the need for namespace qualification. Requiring qualification
579+
makes it easy to distinguish between references to external libraries and code
580+
that is part of HotSpot.
581+
582+
As with language features, Standard Library facilities are either permitted,
583+
explicitly forbidden, or undecided (and so implicitly forbidden).
584+
585+
Most HotSpot code should not directly `#include` C++ Standard Library headers.
586+
HotSpot provides a set of wrapper headers for the Standard Library headers
587+
containing permitted definitions. These wrappers are in the `cppstdlib`
588+
directory, with the same name as the corresponding Standard Library header and
589+
a `.hpp` extension. These wrappers provide a place for any additional code
590+
(some of which may be platform-specific) needed to support HotSpot usage.
591+
592+
These wrappers also provide a place to document HotSpot usage, including any
593+
restrictions. The set of wrappers and the usage documentation should be
594+
considered part of HotSpot style. Any changes are subject to the same process
595+
as applies to this document. (For historical reasons, there may be many direct
596+
inclusions of some C++ Standard Library headers.)
564597

565598
Historically, HotSpot has mostly avoided use of the Standard
566599
Library.
@@ -577,43 +610,59 @@ Some reasons for this include
577610
Standard Library facilities is exceptions. HotSpot does not use
578611
exceptions and, for platforms which allow doing so, builds with them
579612
turned off. Many Standard Library facilities implicitly or explicitly
613+
use exceptions. On the other hand, many don't, and can be used without
614+
concern for this issue. Others may have a useful subset that doesn't
580615
use exceptions.
581616

582617
* `assert`. An issue that is quickly encountered is the `assert` macro name
583618
collision ([JDK-8007770](https://bugs.openjdk.org/browse/JDK-8007770)).
584-
Some mechanism for addressing this would be needed before much of the
585-
Standard Library could be used. (Not all Standard Library implementations
586-
use assert in header files, but some do.)
587-
588-
* Memory allocation. HotSpot requires explicit control over where
589-
allocations occur. The C++98/03 `std::allocator` class is too limited
590-
to support our usage. (Changes in more recent Standards may remove
591-
this limitation.)
619+
(Not all Standard Library implementations use `assert` in header files, but
620+
some do.) HotSpot provides a mechanism for addressing this, by establishing a
621+
scope around the include of a library header where the HotSpot `assert` macro
622+
is suppressed. One of the reasons for using wrapper headers rather than
623+
directly including standard headers is to provide a central place to deal with
624+
this issue for each header.
625+
626+
* Memory allocation. HotSpot requires explicit control over where allocations
627+
occur. The C++98/03 `std::allocator` class is too limited to support our
628+
usage. But changes to the allocator concept in more recent Standards removed
629+
some of the limitations, supporting stateful allocators. HotSpot may, in the
630+
future, provide standard-conforming allocators that are integrated with
631+
HotSpot's existing allocation mechanisms.
592632

593633
* Implementation vagaries. Bugs, or simply different implementation choices,
594634
can lead to different behaviors among the various Standard Libraries we need
595-
to deal with.
596-
597-
* Inconsistent naming conventions. HotSpot and the C++ Standard use
598-
different naming conventions. The coexistence of those different conventions
599-
might appear jarring and reduce readability.
600-
601-
There are a few exceptions to this rule.
602-
603-
* `#include <new>` to use placement `new`, `std::nothrow`, and `std::nothrow_t`.
604-
* `#include <limits>` to use `std::numeric_limits`.
605-
* `#include <type_traits>` with some restrictions, listed below.
606-
* `#include <cstddef>` to use `std::nullptr_t` and `std::max_align_t`.
607-
608-
Certain restrictions apply to the declarations provided by `<type_traits>`.
609-
610-
* The `alignof` operator should be used rather than `std::alignment_of<>`.
611-
612-
TODO: Rather than directly \#including (permitted) Standard Library
613-
headers, use a convention of \#including wrapper headers (in some
614-
location like hotspot/shared/stdcpp). This provides a single place
615-
for dealing with issues we might have for any given header, esp.
616-
platform-specific issues.
635+
to deal with. But only selected parts of the Standard Library are being
636+
permitted, and one of the selection criteria is maturity. Some of these
637+
facilities are among the most heavily tested and used C++ codes that exist.
638+
639+
* Inconsistent naming conventions. HotSpot and the C++ Standard use different
640+
naming conventions. The coexistence of those different conventions might
641+
appear jarring and reduce readability. However, experience in some other code
642+
bases suggests this isn't a significant problem, so long as Standard Library
643+
names are namespace-qualified. It is tempting to bring the Standard Library
644+
names into scope via a `using std;` directive. Doing so makes writing code
645+
using those names easier, since the qualifiers don't need to be included. But
646+
there are several reasons not to do that.
647+
648+
* There is a risk of future name collisions. Additional Standard Library
649+
headers may be included, adding to the list of names being used. Also,
650+
future versions of the Standard Library may add currently unknown names to
651+
the headers already being included.
652+
653+
* It may harm readability. Code where this is relevant is a mixture of the
654+
local HotSpot naming conventions and the Standard Library's (or other
655+
3rd-party library's) naming conventions. With only unqualified names, any
656+
distinctions from the naming conventions for the different code sources
657+
are lost. Instead one may end up with an undifferentiated mess, where it's
658+
not obvious whether an identifier is from local code that is inconsistent
659+
with HotSpot style (and there's a regretable amount of that for historical
660+
reasons), or is following some other convention. Having the qualifiers
661+
disambiguates that.
662+
663+
* It can be helpful to know, at a glance, whether the definition is in
664+
HotSpot or elsewhere, for purposes of looking up the definition or
665+
documentation.
617666

618667
### Type Deduction
619668

@@ -1529,9 +1578,9 @@ single-argument form are permitted.
15291578
* Allow `typename` in template template parameter
15301579
([n4051](http://wg21.link/n4051)) &mdash; template template parameters are
15311580
barely used (if at all) in HotSpot, but there's no reason to artificially
1532-
disallow this syntactic regularization in any such uses.
1581+
forbid this syntactic regularization in any such uses.
15331582
1534-
## Excluded Features
1583+
## Forbidden Features
15351584
15361585
### Structured Bindings
15371586
@@ -1581,7 +1630,32 @@ initialization for classes with base classes
15811630
aggregate classes, preferring explicit constructors even for very simple
15821631
classes.
15831632
1584-
### Additional Excluded Features
1633+
### Additional Forbidden Features
1634+
1635+
* `<algorithm>`, `<iterator>`, `<numeric>`<br>
1636+
Not useful without standard containers or similar classes in HotSpot.
1637+
1638+
* `<bitset>` - Overlap with HotSpot `BitMap`.
1639+
1640+
* `<cassert>`, `assert.h` - HotSpot has its own `assert` macro.
1641+
1642+
* `<exception>`, `<stdexcept>` - Use of [exceptions](#error-handling) is not
1643+
permitted.
1644+
1645+
* Thread support - `<thread>`, `<mutex>`, `<shared_mutex>`,
1646+
`<condition_varible>`, `<future>`<br>
1647+
HotSpot has its own threading support.
1648+
1649+
* Streams - HotSpot doesn't use the C++ I/O library.
1650+
1651+
* `<scoped_allocator>` - Not useful without specialized allocators.
1652+
1653+
* `<string>` - Requires allocator support, similar to standard containers.
1654+
1655+
* `<typeinfo>`, `<typeindex>`<br>
1656+
Use of [runtime type information](#runtime-type-information) is not permitted.
1657+
1658+
* `<valarray>` - May allocate, but is not allocator-aware.
15851659
15861660
* New string and character literals
15871661
* New character types
@@ -1880,9 +1954,40 @@ should need to know about this feature. But if someone does come up with a
18801954
good use-case, it's likely that the alternatives are significantly worse,
18811955
because pack manipulation without this can be complicated.
18821956
1957+
* [`<tuple>`](https://en.cppreference.com/w/cpp/header/tuple.html) &mdash;
1958+
Prefer named access to class objects, rather than indexed access
1959+
to anonymous heterogeneous sequences. In particular, a standard-layout
1960+
class is preferred to a tuple.
1961+
18831962
* `std::invoke<>()`
18841963
([n4169](http://wg21.link/n4169))
18851964
1965+
* [`<chrono>`](https://en.cppreference.com/w/cpp/header/chrono.html) &mdash;
1966+
The argument for chrono is that our existing APIs aren't serving us well.
1967+
chrono provides strong type safety. We've had multiple cases of mistakes like
1968+
a double seconds being treated as double milliseconds or vice versa, and other
1969+
similar errors. But it would be a large effort to adopt chrono. We'd also need
1970+
to decide whether to use the predefined clocks or hook up chrono to our
1971+
clocks. It may be that using the predefined clocks is fine, but it's a
1972+
question that needs careful study.
1973+
1974+
* [`<initializer_list>`](https://en.cppreference.com/w/cpp/header/initializer_list.html) &mdash;
1975+
The potential ambiguity between some forms of direct initialization and
1976+
initializer list initialization, and the resolution of that ambiguity, is
1977+
unfortunate.
1978+
1979+
* [`<ratio>`](https://en.cppreference.com/w/cpp/header/ratio.html) &mdash;
1980+
`<ratio>` is a *compile-time* rational arithmetic package. It's also fixed
1981+
(though parameterized) precision. It's not a general purpose rational
1982+
arithmetic facility. It appears to have started out as an implementation
1983+
detail of chrono, and was extracted and promoted to a public facility in the
1984+
belief that it has broader utility.
1985+
1986+
* [`<system_error>`](https://en.cppreference.com/w/cpp/header/system_error.html) &mdash;
1987+
We don't really have a generally agreed upon mechanism for managing
1988+
errors. Instead, we have a plethora of bespoke ad hoc mechanisms. Managing
1989+
errors is a topic of substantial discussion. `<system_error>` might end up
1990+
being a part of a result from that discussion.
18861991
18871992
18881993
[ADL]: https://en.cppreference.com/w/cpp/language/adl

doc/hotspot-unit-tests.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -305,11 +305,11 @@ <h3 id="file-location">File location</h3>
305305
the product.</p>
306306
<ul>
307307
<li><p>All unit tests for a class from <code>foo/bar/baz.cpp</code>
308-
should be placed <code>foo/bar/test_baz.cpp</code> in
309-
<code>hotspot/test/native/</code> directory. Having all tests for a
310-
class in one file is a common practice for unit tests, it helps to see
311-
all existing tests at once, share functions and/or resources without
312-
losing encapsulation.</p></li>
308+
should be placed <code>foo/bar/test_baz.cpp</code> in the
309+
<code>test/hotspot/gtest/</code> directory. Having all tests for a class
310+
in one file is a common practice for unit tests, it helps to see all
311+
existing tests at once, share functions and/or resources without losing
312+
encapsulation.</p></li>
313313
<li><p>For tests which test more than one class, directory hierarchy
314314
should be the same as product hierarchy, and file name should reflect
315315
the name of the tested subsystem/functionality. For example, if a
@@ -319,7 +319,7 @@ <h3 id="file-location">File location</h3>
319319
<p>Please note that framework prepends directory name to a test group
320320
name. For example, if <code>TEST(foo, check_this)</code> and
321321
<code>TEST(bar, check_that)</code> are defined in
322-
<code>hotspot/test/native/gc/shared/test_foo.cpp</code> file, they will
322+
<code>test/hotspot/gtest/gc/shared/test_foo.cpp</code> file, they will
323323
be reported as <code>gc/shared/foo::check_this</code> and
324324
<code>gc/shared/bar::check_that</code>.</p>
325325
<h3 id="test-names">Test names</h3>

doc/hotspot-unit-tests.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ recognize your tests.
241241
Test file location should reflect a location of the tested part of the product.
242242

243243
* All unit tests for a class from `foo/bar/baz.cpp` should be placed
244-
`foo/bar/test_baz.cpp` in `hotspot/test/native/` directory. Having all
244+
`foo/bar/test_baz.cpp` in the `test/hotspot/gtest/` directory. Having all
245245
tests for a class in one file is a common practice for unit tests, it
246246
helps to see all existing tests at once, share functions and/or
247247
resources without losing encapsulation.
@@ -254,7 +254,7 @@ sub-system under tests belongs to `gc/g1`, tests should be placed in
254254

255255
Please note that framework prepends directory name to a test group
256256
name. For example, if `TEST(foo, check_this)` and `TEST(bar, check_that)`
257-
are defined in `hotspot/test/native/gc/shared/test_foo.cpp` file, they
257+
are defined in `test/hotspot/gtest/gc/shared/test_foo.cpp` file, they
258258
will be reported as `gc/shared/foo::check_this` and
259259
`gc/shared/bar::check_that`.
260260

doc/testing.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ <h4 id="timeout_factor-1">TIMEOUT_FACTOR</h4>
450450
programmatically wait a certain amount of time will apply this factor.
451451
If we run in forced compilation mode (<code>-Xcomp</code>), the build
452452
system will automatically adjust this factor to compensate for less
453-
performance. Defaults to 1.</p>
453+
performance. Defaults to 4.</p>
454454
<h4 id="failure_handler_timeout">FAILURE_HANDLER_TIMEOUT</h4>
455455
<p>Sets the argument <code>-timeoutHandlerTimeout</code> for JTReg. The
456456
default value is 0. This is only valid if the failure handler is
@@ -535,6 +535,8 @@ <h4 id="repeat_count">REPEAT_COUNT</h4>
535535
<h4 id="report">REPORT</h4>
536536
<p>Use this report style when reporting test results (sent to JTReg as
537537
<code>-report</code>). Defaults to <code>files</code>.</p>
538+
<h4 id="manual">MANUAL</h4>
539+
<p>Set to <code>true</code> to execute manual tests only.</p>
538540
<h3 id="gtest-keywords">Gtest keywords</h3>
539541
<h4 id="repeat">REPEAT</h4>
540542
<p>The number of times to repeat the tests

doc/testing.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ The `TIMEOUT_FACTOR` is forwarded to JTReg framework itself
387387
(`-timeoutFactor`). Also, some test cases that programmatically wait a
388388
certain amount of time will apply this factor. If we run in forced
389389
compilation mode (`-Xcomp`), the build system will automatically
390-
adjust this factor to compensate for less performance. Defaults to 1.
390+
adjust this factor to compensate for less performance. Defaults to 4.
391391

392392
#### FAILURE_HANDLER_TIMEOUT
393393

@@ -512,6 +512,10 @@ helps to reproduce intermittent test failures. Defaults to 0.
512512
Use this report style when reporting test results (sent to JTReg as `-report`).
513513
Defaults to `files`.
514514

515+
#### MANUAL
516+
517+
Set to `true` to execute manual tests only.
518+
515519
### Gtest keywords
516520

517521
#### REPEAT

make/Docs.gmk

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,7 @@ define SetupApiDocsGenerationBody
291291
$1_INDIRECT_EXPORTS := $$(call FindTransitiveIndirectDepsForModules, $$($1_MODULES))
292292
$1_ALL_MODULES := $$(sort $$($1_MODULES) $$($1_INDIRECT_EXPORTS))
293293

294-
$1_JAVA_ARGS := -Dextlink.spec.version=$$(VERSION_SPECIFICATION) \
295-
-Djspec.version=$$(VERSION_SPECIFICATION)
294+
$1_JAVA_ARGS := -Dextlink.spec.version=$$(VERSION_SPECIFICATION)
296295

297296
ifeq ($$(ENABLE_FULL_DOCS), true)
298297
$1_SEALED_GRAPHS_DIR := $$(SUPPORT_OUTPUTDIR)/docs/$1-sealed-graphs

0 commit comments

Comments
 (0)