bitfields support in jextract

Samuel Audet samuel.audet at gmail.com
Tue Jul 3 03:09:06 UTC 2018


On 07/02/2018 06:25 PM, Maurizio Cimadamore wrote:
> I've checked the compatibility link last week - and also found nothing 
> relevant.
> 
> I know that bitfield layout is impl specific (the C language spec, I 
> checked say nothing about that - just that there's some storage unit of 
> some kind).
> 
> That said, I'm using  the offsets returned by the clang API to add 
> bitfields support. As long as clang in Windows does the sensible thing - 
> e.g. be compatible with MSC - and I have not seen any proof pointing at 
> the opposite direction, we should be ok, I think.

You're right, it looks like since GCC 4.7 it (and by extension Clang) 
uses by default the same packing algorithm as MSVC when targeting Windows:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52991

So we can probably handle the differences between platforms when it 
comes to bit fields in the same way as for other types (mainly "long" 
being 32-bit on Windows vs 64-bit on pretty much any other OS). 
Although, this still doesn't work for C++ in general...

> As for your claim on scope, this is (i) not the right mailing list where 
> to raise such concerns (you should use the panama-spec-experts alias), 

I've tried twice now to subscribe, but confirmation returns an error. 
Says the cause should be in the log on your side somewhere.

> and (ii) you seem to keep forgetting that our current incarnation of 
> jextract is deliberately that of a tool that is built on whatever 
> support clang has to offer. The start of the show is not jextract, it's 
> the binder - nothing prevents us (or the community) to have a different 
> jextract on windows that is based on MSVC (the work carried out around 
> project Roselyn few years ago might help in that direction?).

Yes, that is also what I'm guessing Panama is all about from our 
previous exchanges, but that's not clear from what's written at say
     http://cr.openjdk.java.net/~mcimadamore/panama/panama-binder-v3.html
People I talk to also do not get the impression that jextract is 
supposed to be just a "demo", and that Panama is somehow already 
supporting all of C++ for all platforms and all compilers in some secret 
project inside Oracle... :)

> If your broader point is that we should verify what's the compatibility 
> status w.r.t. MSVC with any of the features we have added to jextract 
> (not just bitfields) - yes, that's something that has occurred to us.

Yes, that's a good idea, but I see that you've already been thinking 
about that. Thanks for clarifying!

Samuel


More information about the panama-dev mailing list