[foreign] RFR duplicates in named layouts have to be reported as error

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Fri May 25 20:27:23 UTC 2018


It looks better than before, but I think I spotted an issue; in LayoutType:

Group type = (Group) new 
DescriptorParser(Util.getNativeHeaderClass(carrier), 
nativeStruct.value()).parseLayout();


This will always throw; unfortunately, the carrier passed here is a 
@NativeStruct carrier, not a @NativeHeader one. I forgot about this use 
case; this is another case of client-triggered layout parsing; to be 
complete and consistent with your other changes, the LayoutType.ofStruct 
would need to take an extra class argument, but if you pull on the rope 
some more, you discover that Scope.allocateStruct also need an 
argument... and we're quickly back to square one - e.g. polluting lots 
of signatures.

I think we need to think this through some more.

Maurizio

On 25/05/18 19:54, Sundararajan Athijegannathan wrote:
> I agree. We can associate "header" interface Class object during parse 
> time and thereby avoid passing LayoutResolver around - all the way 
> down to ABI classes.
>
> Updated webrev: 
> http://cr.openjdk.java.net/~sundar/redefinition_in_named_layouts/webrev.01/
>
> -Sundar
>
> On 25/05/18, 7:34 PM, Maurizio Cimadamore wrote:
>> As discussed privately, I'm thorn about this:
>>
>> On the one had it makes the world safer and tidier.
>>
>> On the other hand, all clients dealing with layouts (including 
>> clients external to the binder) have to manage Unresolved with hazmat 
>> suit - which is a marked difference with where we were before.
>>
>> I wonder if a better compromise can be achieved by associating a 
>> context to an unresolved layout at parse time?
>>
>> Maurizio
>>
>>
>> On 25/05/18 13:48, Sundararajan Athijegannathan wrote:
>>> If same name is used for two different (group) layouts, 
>>> LayoutResolver should detect and report error. But different header 
>>> file interfaces can use the same name.
>>>
>>> This is implemented by making LayoutResolver as a ClassValue rather 
>>> than global.
>>>
>>> Webrev: 
>>> http://cr.openjdk.java.net/~sundar/redefinition_in_named_layouts/webrev.00/
>>>
>>> Thanks,
>>> -Sundar
>>>
>>



More information about the panama-dev mailing list