[foreign] RFR: jextract should emit toplevel annotations
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Thu May 31 11:52:06 UTC 2018
Hi,
I've fixed both comments:
* added a space separator between the header declaration
* fixed support for undefined structs; I also did some cleanup in this
area as jextract was attempting to generate an interface for the
undefined struct, which I think was wrong, since there was no
declaration (we can of course revise this as discussed in a separate
thread).
Maurizio
On 30/05/18 19:32, Henry Jen wrote:
> Look good to me.
>
> Functional wise, I think it’s fine at this point. The big declaration on the top annotation is hard to read without separator though.
>
> One potential issue is that, for undefined struct, the layout has a symbolic reference to an Annotation class, which won’t have any layout, is that working?
>
> Cheers,
> Henry
>
>
>> On May 28, 2018, at 11:07 AM, Maurizio Cimadamore <maurizio.cimadamore at oracle.com> wrote:
>>
>> Hi,
>> this patch fixes jextract so that it generates the toplevel annotations described in [1] - which are also the one understood by the binder in the foreign branch.
>>
>> I've garbage collected the unused annotations (NativeType, Array and Offset).
>>
>> The general tactic to generate the new layout strings is to parse a clang type into a Layout API object. Then use the toString method of the layout to generate the string description.
>>
>> There are few subtleties in the code that does the parsing:
>>
>> * there are two paths that generate record layouts: one is from Utils.getLayout, which generates a symbolic reference to the layout (e.g. $(Foo)). Another from Utils.getRecordLayout, which generates the full record layout description.
>>
>> * getRecordLayout must recursively call getRecordLayout in case of nested anonymous struct, whose layout is inlined with the enclosing struct
>>
>> * inside getRecordLayout padding is added to the layout, as needed, so as to respect the offset returned by clang
>>
>> Webrev:
>>
>> http://cr.openjdk.java.net/~mcimadamore/panama/jextract_toplevel/
>>
>> Cheers
>> Maurizio
>>
>> [1] - http://cr.openjdk.java.net/~mcimadamore/panama/panama-binder-v3.html
>>
>>
More information about the panama-dev
mailing list