RFR: 8250269: Replace ATTRIBUTE_ALIGNED with alignas

Julian Waters jwaters at openjdk.org
Wed Nov 30 12:47:33 UTC 2022


C++11 added the alignas attribute, for the purpose of specifying alignment on types, much like compiler specific syntax such as gcc's __attribute__((aligned(x))) or Visual C++'s __declspec(align(x)).

We can phase out the use of the macro in favor of the standard attribute. In the meantime, we can replace the toolchain specific definitions of ATTRIBUTE_ALIGNED with a portable definition. We might deprecate the use of the macro but changing its implementation quickly and cleanly applies the feature where the macro is being used.

Note: With certain parts of HotSpot using ATTRIBUTE_ALIGNED so indiscriminately, this commit will likely take some time to get right

This will require adding the alignas attribute to the list of language features approved for use in HotSpot code. ([Addressed in 8252584](https://github.com/openjdk/jdk/pull/11404#issuecomment-1331751901))

-------------

Commit messages:
 - alignas

Changes: https://git.openjdk.org/jdk/pull/11431/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11431&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8250269
  Stats: 8 lines in 3 files changed: 0 ins; 7 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/11431.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/11431/head:pull/11431

PR: https://git.openjdk.org/jdk/pull/11431


More information about the hotspot-dev mailing list