Received: from eggs.gnu.org ([2001:4830:134:3::10]:48756) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsqnV-0005t5-Cs for qemu-devel@nongnu.org; Tue, 17 Dec 2013 04:18:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VsqnN-0000SZ-QJ for qemu-devel@nongnu.org; Tue, 17 Dec 2013 04:18:37 -0500 Received: from mailout4.w1.samsung.com ([210.118.77.14]:11123) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsqnN-0000RO-KA for qemu-devel@nongnu.org; Tue, 17 Dec 2013 04:18:29 -0500 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MXY002BY1UOEI80@mailout4.w1.samsung.com> for qemu-devel@nongnu.org; Tue, 17 Dec 2013 09:18:24 +0000 (GMT) From: Sergey Fedorov Date: Tue, 17 Dec 2013 13:17:59 +0400 Message-id: <1387271879-18464-1-git-send-email-s.fedorov@samsung.com> Subject: [Qemu-devel] [PATCH] qom: fix cast results caching List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.crosthwaite@xilinx.com, Sergey Fedorov , aliguori@us.ibm.com, mdroth@linux.vnet.ibm.com, paul@codesourcery.com, pbonzini@redhat.com, a.basov@samsung.com, afaerber@suse.de 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 --- 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