[foreign-memaccess+abi] RFR: 8287516: Implement fallback Linker [v2]
Jorn Vernee
jvernee at openjdk.org
Thu Jan 19 12:06:53 UTC 2023
On Thu, 19 Jan 2023 11:27:15 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:
>> src/java.base/share/classes/jdk/internal/foreign/abi/fallback/TypeClass.java line 31:
>>
>>> 29: import java.lang.foreign.ValueLayout;
>>> 30:
>>> 31: enum TypeClass {
>>
>> Is this necessary? The mapping between layouts and FFI types seems pretty 1-1. If we keep this, would it make sense to make it "smarter" by adding the write/read functions in here? (I also understand if you want to keep it as classification token).
>
> Hmm, that's an interesting idea. We can not switch on just the carrier type, so would have to do a linear search in the write/read functions, but making them "smarter", using virtual methods to implement them, solves that.
>
> I'll take another look here.
I've removed the TypeClass class. We now do a linear search over the types in the write/read functions. This could be replaced with a virtual call, but then we'd hit the bimorphic inlining limit of 2.
Eventually, this can be improved by using type switch, but let's go with this simplified version (without TypeClass) for now.
-------------
PR: https://git.openjdk.org/panama-foreign/pull/770
More information about the panama-dev
mailing list