[foreign-memaccess+abi] RFR: 8287516: Implement fallback Linker [v2]
Jorn Vernee
jvernee at openjdk.org
Thu Jan 19 12:16:45 UTC 2023
On Thu, 19 Jan 2023 12:09:35 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision:
>>
>> remove TypeClass
>
> src/java.base/share/classes/jdk/internal/foreign/abi/fallback/FallbackLinker.java line 218:
>
>> 216: private static void writeValue(Object arg, MemoryLayout layout, MemorySegment argSeg,
>> 217: Consumer<MemorySegment> acquireCallback) {
>> 218: if (layout instanceof ValueLayout.OfBoolean bl) {
>
> Do you think we lose a lot of performance if we don't switch? E.g. use the underlying var handle (which is stored in the value layout) and access it in an inexact mode?
I considered that, but thought inexact access would be a lot worse in terms of performance since then we lose all inlining, and have to go through `asType` a lot of the time (since we probably won't see the same layout type all the time).
I think what I ended up doing is a nice balance between performance and simplicity, and looks kind of like a 'template' for using type switch in the future.
-------------
PR: https://git.openjdk.org/panama-foreign/pull/770
More information about the panama-dev
mailing list