Skip to content

Commit 56048f9

Browse files
8297852: Backout 8252584 for the time being
Reviewed-by: kbarrett
1 parent f49acd5 commit 56048f9

File tree

2 files changed

+2
-94
lines changed

2 files changed

+2
-94
lines changed

doc/hotspot-style.html

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ <h1 class="title">HotSpot Coding Style</h1>
7272
<li><a href="#expression-sfinae" id="toc-expression-sfinae">Expression
7373
SFINAE</a></li>
7474
<li><a href="#enum" id="toc-enum">enum</a></li>
75-
<li><a href="#alignas" id="toc-alignas">alignas</a></li>
7675
<li><a href="#thread_local" id="toc-thread_local">thread_local</a></li>
7776
<li><a href="#nullptr" id="toc-nullptr">nullptr</a></li>
7877
<li><a href="#atomic" id="toc-atomic">&lt;atomic&gt;</a></li>
@@ -599,7 +598,7 @@ <h3 id="c-standard-library">C++ Standard Library</h3>
599598
<code>std::numeric_limits</code>.</li>
600599
<li><code>#include &lt;type_traits&gt;</code>.</li>
601600
<li><code>#include &lt;cstddef&gt;</code> to use
602-
<code>std::nullptr_t</code> and <code>std::max_align_t</code>.</li>
601+
<code>std::nullptr_t</code>.</li>
603602
</ul>
604603
<p>TODO: Rather than directly #including (permitted) Standard Library
605604
headers, use a convention of #including wrapper headers (in some
@@ -671,52 +670,6 @@ <h3 id="enum">enum</h3>
671670
constant members. Compilers having such bugs are no longer supported.
672671
Except where an enum is semantically appropriate, new code should use
673672
integral constants.</p>
674-
<h3 id="alignas">alignas</h3>
675-
<p><em>Alignment-specifiers</em> (<code>alignas</code> <a
676-
href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf">n2341</a>)
677-
are permitted, with restrictions.</p>
678-
<p><em>Alignment-specifiers</em> are permitted when the requested
679-
alignment is a <em>fundamental alignment</em> (not greater than
680-
<code>alignof(std::max_align_t)</code> <a
681-
href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4296.pdf">C++14
682-
3.11/2</a>).</p>
683-
<p><em>Alignment-specifiers</em> with an <em>extended alignment</em>
684-
(greater than <code>alignof(std::max_align_t)</code> <a
685-
href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4296.pdf">C++14
686-
3.11/3</a>) may only be used to align variables with static or automatic
687-
storage duration (<a
688-
href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4296.pdf">C++14
689-
3.7.1, 3.7.3</a>). As a consequence, <em>over-aligned types</em> are
690-
forbidden; this may change if HotSpot updates to using C++17 or later <a
691-
href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0035r4.html">p0035r4</a>.</p>
692-
<p>Large <em>extended alignments</em> should be avoided, particularly
693-
for stack allocated objects. What is a large value may depend on the
694-
platform and configuration. There may also be hard limits for some
695-
platforms.</p>
696-
<p>An <em>alignment-specifier</em> must always be applied to a
697-
definition (<a
698-
href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4296.pdf">C++14
699-
10.6.2/6</a>). (C++ allows an <em>alignment-specifier</em> to optionally
700-
also be applied to a declaration, so long as the definition has
701-
equivalent alignment. There isn't any known benefit from duplicating the
702-
alignment in a non-definition declaration, so such duplication should be
703-
avoided in HotSpot code.)</p>
704-
<p>Enumerations are forbidden from having <em>alignment-specifiers</em>.
705-
Aligned enumerations were originally permitted but insufficiently
706-
specified, and were later (C++20) removed <a
707-
href="https://cplusplus.github.io/CWG/issues/2354.html">CWG 2354</a>.
708-
Permitting such usage in HotSpot now would just cause problems in the
709-
future.</p>
710-
<p><em>Alignment-specifiers</em> are forbidden in <code>typedef</code>
711-
and <em>alias-declarations</em>. This may work or may have worked in
712-
some versions of some compilers, but was later (C++14) explicitly
713-
disallowed <a
714-
href="https://cplusplus.github.io/CWG/issues/1437.html">CWG
715-
1437</a>.</p>
716-
<p>The HotSpot macro <code>ATTRIBUTE_ALIGNED</code> provides similar
717-
capabilities for platforms that define it. This macro predates the use
718-
by HotSpot of C++ versions providing <code>alignas</code>. New code
719-
should use <code>alignas</code>.</p>
720673
<h3 id="thread_local">thread_local</h3>
721674
<p>Avoid use of <code>thread_local</code> (<a
722675
href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2659.htm">n2659</a>);

doc/hotspot-style.md

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ There are a few exceptions to this rule.
573573
* `#include <new>` to use placement `new`, `std::nothrow`, and `std::nothrow_t`.
574574
* `#include <limits>` to use `std::numeric_limits`.
575575
* `#include <type_traits>`.
576-
* `#include <cstddef>` to use `std::nullptr_t` and `std::max_align_t`.
576+
* `#include <cstddef>` to use `std::nullptr_t`.
577577

578578
TODO: Rather than directly \#including (permitted) Standard Library
579579
headers, use a convention of \#including wrapper headers (in some
@@ -651,51 +651,6 @@ constant members. Compilers having such bugs are no longer supported.
651651
Except where an enum is semantically appropriate, new code should use
652652
integral constants.
653653

654-
### alignas
655-
656-
_Alignment-specifiers_ (`alignas`
657-
[n2341](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf))
658-
are permitted, with restrictions.
659-
660-
_Alignment-specifiers_ are permitted when the requested alignment is a
661-
_fundamental alignment_ (not greater than `alignof(std::max_align_t)`
662-
[C++14 3.11/2](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4296.pdf)).
663-
664-
_Alignment-specifiers_ with an _extended alignment_ (greater than
665-
`alignof(std::max_align_t)`
666-
[C++14 3.11/3](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4296.pdf))
667-
may only be used to align variables with static or automatic storage duration
668-
([C++14 3.7.1, 3.7.3](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4296.pdf)).
669-
As a consequence, _over-aligned types_ are forbidden; this may change if
670-
HotSpot updates to using C++17 or later
671-
[p0035r4](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0035r4.html).
672-
673-
Large _extended alignments_ should be avoided, particularly for stack
674-
allocated objects. What is a large value may depend on the platform and
675-
configuration. There may also be hard limits for some platforms.
676-
677-
An _alignment-specifier_ must always be applied to a definition
678-
([C++14 10.6.2/6](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4296.pdf)).
679-
(C++ allows an _alignment-specifier_ to optionally also be applied to a
680-
declaration, so long as the definition has equivalent alignment. There isn't
681-
any known benefit from duplicating the alignment in a non-definition
682-
declaration, so such duplication should be avoided in HotSpot code.)
683-
684-
Enumerations are forbidden from having _alignment-specifiers_. Aligned
685-
enumerations were originally permitted but insufficiently specified, and were
686-
later (C++20) removed
687-
[CWG 2354](https://cplusplus.github.io/CWG/issues/2354.html).
688-
Permitting such usage in HotSpot now would just cause problems in the future.
689-
690-
_Alignment-specifiers_ are forbidden in `typedef` and _alias-declarations_.
691-
This may work or may have worked in some versions of some compilers, but was
692-
later (C++14) explicitly disallowed
693-
[CWG 1437](https://cplusplus.github.io/CWG/issues/1437.html).
694-
695-
The HotSpot macro `ATTRIBUTE_ALIGNED` provides similar capabilities for
696-
platforms that define it. This macro predates the use by HotSpot of C++
697-
versions providing `alignas`. New code should use `alignas`.
698-
699654
### thread_local
700655

701656
Avoid use of `thread_local`

0 commit comments

Comments
 (0)