qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH qom v1 1/1] qom/object.c: Split out object and c


From: Andreas Färber
Subject: Re: [Qemu-devel] [PATCH qom v1 1/1] qom/object.c: Split out object and class caches.
Date: Sun, 15 Dec 2013 21:09:16 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0

Am 13.12.2013 02:36, schrieb Edgar E. Iglesias:
> On Wed, Nov 27, 2013 at 08:27:33PM -0800, Peter Crosthwaite wrote:
>> The object-cast and class-cast caches cannot be shared because class
>> caching is conditional on the target type not being an interface and
>> object caching is unconditional. Leads to a bug when a class cast
>> to an interface follows an object cast to the same interface type:
>>
>> FooObject = FOO(obj);
>> FooClass = FOO_GET_CLASS(obj);
>>
>> Where TYPE_FOO is an interface. The first (object) cast will be
>> successful and cache the casting result (i.e. TYPE_FOO will be cached).
>> The second (class) cast will then check the shared cast cache
>> and register a hit. The issue is, when a class cast hits in the cache
>> it just returns a pointer cast of the input class (i.e. the concrete
>> class).
>>
>> When casting to an interface, the cast itself must return the
>> interface class, not the concrete class. The implementation of class
>> cast caching already ensures that the returned cast result is only
>> a pointer cast before caching. The object cast logic however does
>> not have this check.
>>
>> Resolve by just splitting the object and class caches.
>>
>> Signed-off-by: Peter Crosthwaite <address@hidden>
> 
> Reviewed-by: Edgar E. Iglesias <address@hidden>

Thanks, applied to qom-next:
https://github.com/afaerber/qemu-cpu/commits/qom-next

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg



reply via email to

[Prev in Thread] Current Thread [Next in Thread]