[foreign] RFR 8217784: Ignore anonymous bitfields so they are handled as padding

Jorn Vernee jbvernee at xs4all.nl
Mon Jan 28 11:52:05 UTC 2019


Yes, it's my IDE. I'm also using IntelliJ, it does that automatically 
when you have 5 or more imports from the same package. I will fix it 
before pushing.

Jorn

Maurizio Cimadamore schreef op 2019-01-28 12:02:
> On 28/01/2019 09:41, Sundararajan Athijegannathan wrote:
>> Looks good. Mac build/test fine.
>> 
>> Minor: why is the specific imports in bitfields.java are replaced with 
>> import *. Your IDE?
> 
> That happens with me too with IntelliJ - you need to tweak import
> setting and tell the IDE to use star import when you have a
> ridiculously high number of inner classes (e.g. 9999). :-)
> 
> Maurizio
> 
>> 
>> -Sundar
>> 
>> On 26/01/19, 2:56 AM, Maurizio Cimadamore wrote:
>>> Looks good by me - I suggest you also wait for Sundar's opinion, 
>>> since he's fresh with this code
>>> 
>>> Maurizio
>>> 
>>> On 25/01/2019 21:24, Maurizio Cimadamore wrote:
>>>> The patch is functionally good, I just wonder if it's too magic - 
>>>> e.g. wouldn't be better if the record computer processed the 
>>>> anonymous bitfield (so that the correct padding can be added) 
>>>> instead of relying on the right thing to happen (which will be 
>>>> fragile if e.g. the impl changes a bit) ?
>>>> 
>>>> Maurizio
>>>> 
>>>> On 25/01/2019 19:18, Jorn Vernee wrote:
>>>>> Good catch. I kinda glossed over unions since I thought there would 
>>>>> be no point in having anonymous bitfields in a union, since there 
>>>>> is no need for padding - but on second thought, these could be used 
>>>>> to manually widen the type. Any ways, the compiler seems to allow 
>>>>> anonymous bitfields in unions, so it's good to support that as 
>>>>> well.
>>>>> 
>>>>> Updated webrev: 
>>>>> http://cr.openjdk.java.net/~jvernee/panama/webrevs/8217784/webrev.01/
>>>>> 
>>>>> Jorn
>>>>> 
>>>>> Maurizio Cimadamore schreef op 2019-01-25 19:25:
>>>>>> Looks good - but what happens with unions? I'm worried we'd get a
>>>>>> similar failure there...
>>>>>> 
>>>>>> Maurizio
>>>>>> 
>>>>>> On 25/01/2019 13:52, Jorn Vernee wrote:
>>>>>>> Hi,
>>>>>>> 
>>>>>>> From the bug description:
>>>>>>> 
>>>>>>> Jextract fails on the following example:
>>>>>>> 
>>>>>>> ```
>>>>>>> struct Foo {
>>>>>>>     unsigned int x: 1;
>>>>>>>     int :7;
>>>>>>>     unsigned int y: 8;
>>>>>>>     int :16;
>>>>>>>     int z;
>>>>>>> };
>>>>>>> ```
>>>>>>> 
>>>>>>> The current code tries to look up the second field, but because 
>>>>>>> it has no name this throws an illegal field name error.
>>>>>>> 
>>>>>>> ---
>>>>>>> 
>>>>>>> I've fixed this by ignoring anonymous bitfields, since the 
>>>>>>> StructLayoutComputer inserts padding automatically before the 
>>>>>>> next field.
>>>>>>> 
>>>>>>> Please review the following.
>>>>>>> 
>>>>>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8217784
>>>>>>> Webrev: 
>>>>>>> http://cr.openjdk.java.net/~jvernee/panama/webrevs/8217784/webrev.00/ 
>>>>>>> Thanks,
>>>>>>> Jorn


More information about the panama-dev mailing list