[foreign-memaccess+abi] RFR: 8308858: FFM API and strings

Maurizio Cimadamore mcimadamore at openjdk.org
Fri Jun 2 20:50:19 UTC 2023


On Fri, 2 Jun 2023 19:05:34 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

> The use of `@ForceInline` should be removed I think. Since it messes with the JIT's own heuristics, it should be avoided in general, unless we know that the contents of a method is likely to fold up to almost nothing (such as for MS::get*/set*). However, that is not the case here. Better to not mess with it and let the JIT, which has more information, make the decision IMO. (at the end of the day, we bottom out into an out-of-line call to `Unsafe::copyMemory` any way)

I tend to agree. But I believe copyMemory is an intrinsic:
https://github.com/openjdk/jdk/blob/master/src/hotspot/share/classfile/vmIntrinsics.hpp#L612

> src/java.base/share/classes/java/lang/foreign/SegmentAllocator.java line 120:
> 
>> 118:         if (termCharSize == -1) {
>> 119:             throw new UnsupportedOperationException("Unsupported charset: " + charset);
>> 120:         }
> 
> This check seems unnecessary since `CharsetKind::of` should already fail for an unsupported charset.

Yeah - this is a leftover from the code I had before consolidating with CharsetKind

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

PR Comment: https://git.openjdk.org/panama-foreign/pull/836#issuecomment-1574295498
PR Review Comment: https://git.openjdk.org/panama-foreign/pull/836#discussion_r1214824236


More information about the panama-dev mailing list