[PATCH] tools/widl/header.c: Add a way to declare interface data members.

Michael Stefaniuc mstefani at redhat.com
Sun Nov 11 14:05:53 CST 2012


On 11/11/2012 07:12 AM, Max TenEyck Woodbury wrote:
> On 11/11/2012 01:01 AM, Nikolay Sivov wrote:
>> On 11/11/2012 05:00, Max TenEyck Woodbury wrote:
>>> I mentioned this a few days ago.  It would have helped if you had
>>> raised this point then.
>>>
>>> As it stands, it is simply a way to adding data members to an aggregate
>>> with an interface.
>>
>> Data members to an aggregate? What are you talking about and what it has
>> to do with interface definition?
> 
> An aggregate is a collection of information, like a class, struct or
> union.
Your mixing up terminology.

> Some aggregates include 'interface's, a COM, OLE or RPC thingy.  The
> interface can have only methods defined, but those methods might want
> access to some additional data.  To get to that data, the method now
> has to build a pointer to the containing aggregate and reference the
> data through that pointer.  This introduces complications to the code
> since the data may not be in same place in the aggregate in each
> instance where the interface is used.  You need a slightly different
> code sequence for each different place the method is needed.  However,
> the source code will be virtually identical for each instance.
> 
> This patch allows those aggregate data members associated with the
> interface, which are not technically part of the interface, to be
> placed in a fixed relation to the interfaces Vtbl pointer.
> (Practically the Vtbl pointer is the interface.)  By establishing such
> a relationship, the need to convert from the pointer to the interface
> (specifically to its Vtbl pointer) to a pointer to its containing
> aggregate in order to get to the relevant data is removed.
Please check how a C compiler is laying out structs in memory. In both
cases the data is at a fixed offset (calculated at compile time) in
relation to the interface.

> Now, technically, the associated data is not part of the interface.  It
> is part of the aggregate containing and implementing the interface.
> Moving the declaration from the aggregate to the end of the struc for
> the interface is a hack that lets simpler and more general code to be
> generated.
>
> So, it's a hack, that you only use if you want to, to speed up
> execution and simplify maintenance.
> 
It is a hack that breaks the ABI (sizeof(interface) == sizeof(void*)),
doesn't improves the generated code, doesn't simplify maintenance at
all, quite the contrary. This sounds more like trolling than a serious
attempt to improve Wine.

bye
	michael



More information about the wine-devel mailing list