[foreign-jextract] [Rev 02] RFR: 8239490: jextract throws "No matching declaration found for bitfield" because wrong bitfield content is found

Athijegannathan Sundararajan sundar at openjdk.java.net
Mon Mar 2 09:56:38 UTC 2020


On Fri, 28 Feb 2020 13:30:46 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> This patch fixes an issue wit bitfields handling; the issue is that we are using a map to keep track of which layouts are associated with bitfield contents. Unfortunately, most of the times, bitfield contents is associated with "shared" layouts, such as int layouts - so we end up overwriting the map, associating different contents to the same underlying layout and this causes downstream issues in the code that needs to access this information.
>> 
>> A more robust solution is to use layout annotations to do this - these are not exposed in a public API, but we already have some reflective hacks in order to use them from within jextract. I've added one more hack to add a single annotation to a layout. Longer term, we plan to make this part of the layout API public, so that no more hacks will be required (as we have other use cases for public metadata on layouts).
>> 
>> I've also added a test to verify that bitfields are correctly parsed. While writing the test, I've realized that our testing framework, while decent, can probably be streamlined more, I'll start thinking about ways on how to do that as a separate change, so that we can write these kind of tests more quickly (which hopefully will lead us to write more of them).
>
> The pull request has been updated with 1 additional commit.

Copyright missing in .h file

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



PR: https://git.openjdk.java.net/panama-foreign/pull/36


More information about the panama-dev mailing list