On Fri, 6 Dec 2024 18:29:46 GMT, Jorn Vernee <jver...@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

Reply via email to