RFR: JDK-8303817: Add constexpr for natural malloc alignment

Kim Barrett kbarrett at openjdk.org
Thu Mar 9 20:27:42 UTC 2023


On Wed, 8 Mar 2023 11:23:53 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

> I miss having an easy way to get the alignment the libc guarantees for malloc. Let's add this, and we can use this right away with NMT's MallocHeader.
> 
> Tests: manually built and tested x64 linux (clang + GCC) and x86 linux.

src/hotspot/share/utilities/globalDefinitions.hpp line 1313:

> 1311:   long double d;
> 1312: };
> 1313: constexpr int minimum_malloc_alignment = alignof(AllTheBigTypes);

How is this different from `alignof(std::max_align_t)`?  (Which we can use - JDK-8274400 (approved, just noticed author hasn't integrated yet) and JDK-8297912.)

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

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


More information about the hotspot-dev mailing list