RFR: 7903449: Jextract generates structs that cannot be compiled [v3]
Maurizio Cimadamore
mcimadamore at openjdk.org
Thu Mar 30 11:01:46 UTC 2023
On Tue, 28 Mar 2023 22:42:37 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> src/main/java/org/openjdk/jextract/impl/Constants.java line 506:
>>
>>> 504: record DowncallKey(FunctionDescriptor desc) { }
>>> 505: DowncallKey downcallKey = new DowncallKey(descriptor);
>>> 506: Constant constant = cache.get(downcallKey);
>>
>> Isn't dropping the names from the layouts required here as well?
>
> Likely, if we want to deduplicate fully. I'm a bit worried about doing a full traversal and creating a brand new function descriptor just for the lookup though. I guess I could implement some custom equals method in the key.
After some more consideration, I decided to leave this as is. Reason being that the benefit would be somewhat limited - note that this method is only used for functional upcall interfaces. So, for this to make a difference you'd need to have several function pointers taking different structs by value with the same underlying layout (modulo names) - which seems a bit obscure. If needed we can fix later.
-------------
PR Review Comment: https://git.openjdk.org/jextract/pull/117#discussion_r1153087263
More information about the jextract-dev
mailing list