All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qom: fix cast results caching
@ 2013-12-17  9:17 Sergey Fedorov
  0 siblings, 0 replies; 4+ messages in thread
From: Sergey Fedorov @ 2013-12-17  9:17 UTC (permalink / raw)
  To: qemu-devel
  Cc: peter.crosthwaite, Sergey Fedorov, aliguori, mdroth, paul,
	pbonzini, a.basov, afaerber

A single cast cache is used for both an object casting and a class
casting.  In case of interface presence a class cast result may be not
the same pointer as opposite to an object casting. So do not cache cast
results for an object casting in a presence of interfaces.

Signed-off-by: Sergey Fedorov <s.fedorov@samsung.com>
---
 qom/object.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qom/object.c b/qom/object.c
index fc19cf6..f7384de 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -473,7 +473,7 @@ Object *object_dynamic_cast_assert(Object *obj, const char *typename,
 
     assert(obj == inst);
 
-    if (obj && obj == inst) {
+    if (obj && obj == inst && !obj->class->interfaces) {
         for (i = 1; i < OBJECT_CLASS_CAST_CACHE; i++) {
             obj->class->cast_cache[i - 1] = obj->class->cast_cache[i];
         }
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PATCH] qom: fix cast results caching
@ 2013-12-17  9:20 Sergey Fedorov
  2013-12-17  9:40 ` Peter Crosthwaite
  0 siblings, 1 reply; 4+ messages in thread
From: Sergey Fedorov @ 2013-12-17  9:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: peter.crosthwaite, Sergey Fedorov, mdroth, paul, aliguori,
	pbonzini, a.basov, afaerber

A single cast cache is used for both an object casting and a class
casting.  In case of interface presence a class cast result may be not
the same pointer as opposite to an object casting. So do not cache cast
results for an object casting in a presence of interfaces.

Signed-off-by: Sergey Fedorov <s.fedorov@samsung.com>
---
 qom/object.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qom/object.c b/qom/object.c
index fc19cf6..f7384de 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -473,7 +473,7 @@ Object *object_dynamic_cast_assert(Object *obj, const char *typename,
 
     assert(obj == inst);
 
-    if (obj && obj == inst) {
+    if (obj && obj == inst && !obj->class->interfaces) {
         for (i = 1; i < OBJECT_CLASS_CAST_CACHE; i++) {
             obj->class->cast_cache[i - 1] = obj->class->cast_cache[i];
         }
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] qom: fix cast results caching
  2013-12-17  9:20 [Qemu-devel] [PATCH] qom: fix cast results caching Sergey Fedorov
@ 2013-12-17  9:40 ` Peter Crosthwaite
  2013-12-17  9:55   ` Fedorov Sergey
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Crosthwaite @ 2013-12-17  9:40 UTC (permalink / raw)
  To: Sergey Fedorov
  Cc: qemu-devel@nongnu.org Developers, Michael Roth, Paul Brook,
	Anthony Liguori, Paolo Bonzini, a.basov, Andreas Färber

On Tue, Dec 17, 2013 at 7:20 PM, Sergey Fedorov <s.fedorov@samsung.com> wrote:
> A single cast cache is used for both an object casting and a class
> casting.  In case of interface presence a class cast result may be not
> the same pointer as opposite to an object casting. So do not cache cast
> results for an object casting in a presence of interfaces.
>

I think this is fixed by my cast cache splitter patch which is
currently enqueued.

http://patchwork.ozlabs.org/patch/294766/

Regards,
Peter


> Signed-off-by: Sergey Fedorov <s.fedorov@samsung.com>
> ---
>  qom/object.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/qom/object.c b/qom/object.c
> index fc19cf6..f7384de 100644
> --- a/qom/object.c
> +++ b/qom/object.c
> @@ -473,7 +473,7 @@ Object *object_dynamic_cast_assert(Object *obj, const char *typename,
>
>      assert(obj == inst);
>
> -    if (obj && obj == inst) {
> +    if (obj && obj == inst && !obj->class->interfaces) {
>          for (i = 1; i < OBJECT_CLASS_CAST_CACHE; i++) {
>              obj->class->cast_cache[i - 1] = obj->class->cast_cache[i];
>          }
> --
> 1.7.9.5
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] qom: fix cast results caching
  2013-12-17  9:40 ` Peter Crosthwaite
@ 2013-12-17  9:55   ` Fedorov Sergey
  0 siblings, 0 replies; 4+ messages in thread
From: Fedorov Sergey @ 2013-12-17  9:55 UTC (permalink / raw)
  To: Peter Crosthwaite
  Cc: qemu-devel@nongnu.org Developers, Michael Roth, Paul Brook,
	Anthony Liguori, Paolo Bonzini, a.basov, Andreas Färber


On 12/17/2013 01:40 PM, Peter Crosthwaite wrote:
> On Tue, Dec 17, 2013 at 7:20 PM, Sergey Fedorov <s.fedorov@samsung.com> wrote:
>> A single cast cache is used for both an object casting and a class
>> casting.  In case of interface presence a class cast result may be not
>> the same pointer as opposite to an object casting. So do not cache cast
>> results for an object casting in a presence of interfaces.
>>
> I think this is fixed by my cast cache splitter patch which is
> currently enqueued.
>
> http://patchwork.ozlabs.org/patch/294766/
>
> Regards,
> Peter

Yes, your cache splitter looks much better. Thank you.

Best regards,
Sergey Fedorov


>
>
>> Signed-off-by: Sergey Fedorov <s.fedorov@samsung.com>
>> ---
>>   qom/object.c |    2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/qom/object.c b/qom/object.c
>> index fc19cf6..f7384de 100644
>> --- a/qom/object.c
>> +++ b/qom/object.c
>> @@ -473,7 +473,7 @@ Object *object_dynamic_cast_assert(Object *obj, const char *typename,
>>
>>       assert(obj == inst);
>>
>> -    if (obj && obj == inst) {
>> +    if (obj && obj == inst && !obj->class->interfaces) {
>>           for (i = 1; i < OBJECT_CLASS_CAST_CACHE; i++) {
>>               obj->class->cast_cache[i - 1] = obj->class->cast_cache[i];
>>           }
>> --
>> 1.7.9.5
>>
>>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-12-17  9:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-17  9:20 [Qemu-devel] [PATCH] qom: fix cast results caching Sergey Fedorov
2013-12-17  9:40 ` Peter Crosthwaite
2013-12-17  9:55   ` Fedorov Sergey
  -- strict thread matches above, loose matches on Subject: below --
2013-12-17  9:17 Sergey Fedorov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.