From nobody Sun Sep 28 15:25:48 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1758895507; cv=none; d=zohomail.com; s=zohoarc; b=Ntxjiva+JwGCBkxTNJVHFCyF2K0OwpB58djGKYqEwDzjLLZCxMlN3sbhBg+6dO324UJFPR2uKEvk7VUqDpApfYwDBkN+c+d+cLoXgtzZvOx4Unj/3rPnb5vuTfXkhaMEYcRJwyJlMiWmOScaTSwP4t0HX5afE2zuU8r4Yh6S02w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1758895507; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=GKOEfxYbwSdrTXZEFWiWj/ei+zi84OVrn7iulMS2fTU=; b=iBw8RVQ5TrWjF5P0G+5UdDF1EbfPe5Kts+2jJuqNs3poK8mUQXYozezDMolXuHcNH765yDF+uXqS0hPAqnu0MWvSz7JtpFJN3xU8+/w6FH+2QSAC7Qf88PIyu1uMW+7cn/ATZaySW6rfbmxBuVrS4AVYyT99MxVRm2Sk84zLe7U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1758895507192609.4897987863646; Fri, 26 Sep 2025 07:05:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1v291s-00062q-HR; Fri, 26 Sep 2025 10:02:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1v291a-0005yh-OQ for qemu-devel@nongnu.org; Fri, 26 Sep 2025 10:02:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1v291O-0004YK-PE for qemu-devel@nongnu.org; Fri, 26 Sep 2025 10:02:12 -0400 Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-447-K1zx4fNBOuy_0rYqXQfPKQ-1; Fri, 26 Sep 2025 10:01:54 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A040A195608A; Fri, 26 Sep 2025 14:01:53 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.175]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 86CFD19540ED; Fri, 26 Sep 2025 14:01:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1758895317; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GKOEfxYbwSdrTXZEFWiWj/ei+zi84OVrn7iulMS2fTU=; b=A+jwfi2uaFuLI/fqGff6RgqdtGfPB6SL+FfoIJlly6AqffnXDvV+fvKQ1vySsnuZp+RPz7 EzpJtQ8c8VXXRW9/vb4rOf3WMunLeBq7smcus71P3jIz2te/SBPoBT3A2Gc1/ie4w+v74p BOMRaAenzDJ/vqnjuKEd/jflPNS+nLQ= X-MC-Unique: K1zx4fNBOuy_0rYqXQfPKQ-1 X-Mimecast-MFC-AGG-ID: K1zx4fNBOuy_0rYqXQfPKQ_1758895313 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , Stefan Hajnoczi , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Maydell , Markus Armbruster , Paolo Bonzini , "Michael S. Tsirkin" , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH v2 01/32] qom: replace 'abstract' with 'flags' Date: Fri, 26 Sep 2025 15:01:12 +0100 Message-ID: <20250926140144.1998694-2-berrange@redhat.com> In-Reply-To: <20250926140144.1998694-1-berrange@redhat.com> References: <20250926140144.1998694-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.446, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1758895508845116600 This will allow extra boolean flags without expending the memory usage of the Type struct. Signed-off-by: Daniel P. Berrang=C3=A9 --- qom/object.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/qom/object.c b/qom/object.c index 1856bb36c7..a654765e0a 100644 --- a/qom/object.c +++ b/qom/object.c @@ -45,6 +45,10 @@ struct InterfaceImpl const char *typename; }; =20 +enum TypeImplFlags { + TYPE_IMPL_FLAG_ABSTRACT =3D (1 << 0), +}; + struct TypeImpl { const char *name; @@ -63,7 +67,7 @@ struct TypeImpl void (*instance_post_init)(Object *obj); void (*instance_finalize)(Object *obj); =20 - bool abstract; + int flags; =20 const char *parent; TypeImpl *parent_type; @@ -127,7 +131,9 @@ static TypeImpl *type_new(const TypeInfo *info) ti->instance_post_init =3D info->instance_post_init; ti->instance_finalize =3D info->instance_finalize; =20 - ti->abstract =3D info->abstract; + if (info->abstract) { + ti->flags |=3D TYPE_IMPL_FLAG_ABSTRACT; + } =20 for (i =3D 0; info->interfaces && info->interfaces[i].type; i++) { ti->interfaces[i].typename =3D g_strdup(info->interfaces[i].type); @@ -348,11 +354,11 @@ static void type_initialize(TypeImpl *ti) * This means interface types are all abstract. */ if (ti->instance_size =3D=3D 0) { - ti->abstract =3D true; + ti->flags |=3D TYPE_IMPL_FLAG_ABSTRACT; } if (type_is_ancestor(ti, type_interface)) { assert(ti->instance_size =3D=3D 0); - assert(ti->abstract); + assert(ti->flags & TYPE_IMPL_FLAG_ABSTRACT); assert(!ti->instance_init); assert(!ti->instance_post_init); assert(!ti->instance_finalize); @@ -558,7 +564,7 @@ static void object_initialize_with_type(Object *obj, si= ze_t size, TypeImpl *type type_initialize(type); =20 g_assert(type->instance_size >=3D sizeof(Object)); - g_assert(type->abstract =3D=3D false); + g_assert(!(type->flags & TYPE_IMPL_FLAG_ABSTRACT)); g_assert(size >=3D type->instance_size); =20 memset(obj, 0, type->instance_size); @@ -1045,7 +1051,7 @@ ObjectClass *object_get_class(Object *obj) =20 bool object_class_is_abstract(ObjectClass *klass) { - return klass->type->abstract; + return klass->type->flags & TYPE_IMPL_FLAG_ABSTRACT; } =20 const char *object_class_get_name(ObjectClass *klass) @@ -1110,7 +1116,8 @@ static void object_class_foreach_tramp(gpointer key, = gpointer value, type_initialize(type); k =3D type->class; =20 - if (!data->include_abstract && type->abstract) { + if (!data->include_abstract && + (type->flags & TYPE_IMPL_FLAG_ABSTRACT)) { return; } =20 --=20 2.50.1