RFR: 8344912: Sharpen the return type of various internal methods in jdk.internal.foreign [v3]

Quan Anh Mai qamai at openjdk.org
Tue Nov 26 15:14:53 UTC 2024


On Mon, 25 Nov 2024 12:26:37 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> src/java.base/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java line 144:
>> 
>>> 142:     }
>>> 143: 
>>> 144:     private NativeMemorySegmentImpl reinterpretInternal(Class<?> callerClass, long newSize, MemorySessionImpl scope, Consumer<MemorySegment> cleanup) {
>> 
>> This method is also probably missing a `ForceInline`
>
> I think it's the other `reinterpret` methods that use `Reflection.getCallerClass` which are alsocritical to force-inline. Since the non-inlined/non-intrinsic version does a very slow stack walk to get the caller.

Plus, this method can be expanded to a very large method (before constant folding) so we will need to be careful applying `@ForceInline` to it.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22344#discussion_r1858727891


More information about the core-libs-dev mailing list