RFR: 8345687: Improve the implementation of SegmentFactories::allocateSegment [v2]
Quan Anh Mai
qamai at openjdk.org
Wed Dec 11 18:44:49 UTC 2024
On Fri, 6 Dec 2024 18:29:46 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:
>> Quan Anh Mai has updated the pull request incrementally with one additional commit since the last revision:
>>
>> address review
>
> src/java.base/share/classes/jdk/internal/foreign/ArenaImpl.java line 53:
>
>> 51: Utils.checkAllocationSizeAndAlign(byteSize, byteAlignment);
>> 52: long address = SegmentFactories.allocateNative(byteSize, byteAlignment, session, shouldReserveMemory, false);
>> 53: return new NativeMemorySegmentImpl(address, byteSize, false, session);
>
> Could you move this constructor call (and the one below) to `allocateNative`? All segment construction calls are currently in `SegmentFactories` as a measure to avoid bootstrap cycles, which we had problems with in the past.
I want to put it here so that even if `SegmentFactories::allocateNative` is not inlined, this small method will be more likely to be inlined and the segment can be non-escape, then. I have added a comment regarding class initialization cycles.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22610#discussion_r1880718202
More information about the core-libs-dev
mailing list