[foreign] RFR: switch to toplevel annotations
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Thu May 24 18:11:00 UTC 2018
Hi,
this patch completes the migration towards the annotation model
described in [1].
More specifically, @NativeStruct, now contains a full layout
description, with layout annotation which point to Java accessors.
@NativeHeader contains a set of declarations of the kind
'symbol=descriptor', where 'symbol' is the linker name of the given
symbol, whereas descriptor can be either a function descriptor or a layout.
I did some refactoring of the binder code, which I think helped in
making it even clearer, I hope.
Note that now the binder doesn't depend on @NativeType, nor @Offset, but
I left those in place because we have some jextract tests depending on
them (jextract still needs to be fixed to generate the new stuff).
In order to compute offset of fields, I added a new LayoutPaths helper
class, which allows the binder to get a layout path given a predicate
expression and a layout. This is useful to get a path to a given struct
field, which then gives you info about things such as offset (and, maybe
in the future, alignment).
Of course, many tests have to be updated; since I touched the dreaded
UnixSystem test, it'd be better to give it a try on MacOS.
Webrev:
http://cr.openjdk.java.net/~mcimadamore/panama/toplevel_annos/
Cheers
Maurizio
[1] - http://cr.openjdk.java.net/~mcimadamore/panama/panama-binder-v3.html
More information about the panama-dev
mailing list