[foreign] RFR: Port clang-ffi source code to new API
Henry Jen
henry.jen at oracle.com
Fri Jun 1 05:08:29 UTC 2018
> On May 31, 2018, at 7:56 AM, Maurizio Cimadamore <maurizio.cimadamore at oracle.com> wrote:
>
> Some comments
>
> * to instantiate the SystemABI in a platform agnostic way, see the static factory SystemABI.getInstance (right now it just creates SysV ABI, but I think you don't want to call 'new' on that yourself)
>
> * I think you can remove some cruft for Void handling, now that I've pushed the related patch
>
Thanks for the review, I have updated the webrev[1] to reflect above two.
> * The changes in ABI go in the opposite direction of what I'd like to see - e.g. I'd like ABI impl to be layout-centric, not CType centric. So, I'm ok with having some kind of enum for common c types, but I think this enum should give you back the corresponding layout under given ABI - e.g.
>
> Layout layoutFor(CType) { …
> }
>
Fair enough, adapted in the webrev.
> And leave definedAlignment and definedSize alone. This will allow you to reduce changes in the System ABI classes.
>
The purpose of those two methods are to know the right size and alignment requirement for a particular type. My understanding to Layout is that it suppose to eliminate all platform uncertainty, meaning the result should be constant, we don’t really need those two methods. So I removed them. sizeof and alignment methods should be done based on the size of Layout.
Make sense?
In this updated webrev, I also add null pointer test and modify test to reflect the removal annotation of undefined struct. As undefined struct is used by Pointer only, and we always return Pointer<Void>, without the annotation is no big deal just that we have no hint at all. But I understand this is still an open discussion on how to deal with it.
[1] http://cr.openjdk.java.net/~henryjen/panama/foreign/jclang-ffi/1/webrev/
Cheers,
Henry
More information about the panama-dev
mailing list