[foreign] RFR: jextract should emit toplevel annotations
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Mon May 28 18:07:58 UTC 2018
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