Hi, This patch improves the performance of a typical `Arena::allocate` in several ways:
- Delay the creation of the NativeMemorySegmentImpl. This avoids the merge of the instance with the one obtained from the call in the uncommon path, increasing the chance the object being scalar replaced. - Split the allocation of over-aligned memory to a slow-path method. - Align the memory to 8 bytes, allowing faster zeroing. - Use a dedicated method to zero the just-allocated native memory, reduce code size and make it more straightforward. - Make `VM.pageAlignDirectMemory` a `Boolean` instead of a `boolean` so that `false` value can be constant folded. Please take a look and leave your reviews, thanks a lot. ------------- Commit messages: - improve the implementation of SegmentFactories::allocateSegment Changes: https://git.openjdk.org/jdk/pull/22610/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=22610&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8345687 Stats: 138 lines in 4 files changed: 67 ins; 31 del; 40 mod Patch: https://git.openjdk.org/jdk/pull/22610.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/22610/head:pull/22610 PR: https://git.openjdk.org/jdk/pull/22610