From patchwork Thu Jul 9 13:17:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 39996 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 19F68384404C; Thu, 9 Jul 2020 13:17:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 19F68384404C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1594300658; bh=EVSPii0LeJGpjRGOqaTZcQtGDTJMde/SJZyZBzjEeFc=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Help: List-Subscribe:From:Reply-To:From; b=KRjS36Az9x2DMNBkoO91PRyXTwqlpr/H1guBdHHSkrl8B7L28GupMJpMBHxFRhQxp QBPjzAPQCAVoVe0B6OXa6gfNuLdGtPisCb4+7Ob7Nm1sHPKQgfbHM59o9EZUeF0XpA 4E5hKlLXT1ah8e5+V7b58hMFlUb9dlERzbHNFtc8= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by sourceware.org (Postfix) with ESMTP id C7BC3384404C for ; Thu, 9 Jul 2020 13:17:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C7BC3384404C Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-139-zZezkzUvMoeyDIRebaOiwQ-1; Thu, 09 Jul 2020 09:17:32 -0400 X-MC-Unique: zZezkzUvMoeyDIRebaOiwQ-1 Received: by mail-wm1-f72.google.com with SMTP id l5so2114887wml.7 for ; Thu, 09 Jul 2020 06:17:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:organization:date:message-id :user-agent:mime-version; bh=EVSPii0LeJGpjRGOqaTZcQtGDTJMde/SJZyZBzjEeFc=; b=oyz46KMkyCvF0bBGw2/d7Nzt1B7XKvcDPIsaxH5+9lTaAHm7H9jM3jLLABGn1me2ou 25QUttCyPr/M69BmNd4rXdEQkUsbs6rNtrEQCLoncJCMYeGwAAzxhu5DtA1FTg13zAWR nggjRsKFPzHJl0/wrdWNM0/T8+fHmmzinrbulJFQGxcOLSe04a7WX1X7b2pqsyrjmnbs aLEcAE341dGnkyISUJp6zsHpsO6Po5sUO80oTYirxSNrBn3NjAFPv8IkKV3AALZJJl+H ZzWfZkHuDV4sS/6PQC33HGU0+rnaOWqSEjPQ+8WsD0naSiYe28ObptXRwhbCcJ51HlfC APpw== X-Gm-Message-State: AOAM532uNQL8wgbh4tcHUh4oNBtebm5D6FNctbrnvWNDA2mivt/P6DT0 jVypAfH9z6lmfU7VY96/NnY6RzTEsJ1grdDalGVF+NB5uDQQi0Ip9t3eYAFAl3z+4yhk8s4b7CV Se6xpAK/m7eb93zLJW/vg X-Received: by 2002:adf:eec2:: with SMTP id a2mr62191438wrp.127.1594300651161; Thu, 09 Jul 2020 06:17:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwlqiemAa9KdpPVuHI7jo4ySTsoaXvidePjGRIYBAMrS06oJ0SefC/4sCtV8iiQpo9VVbYTOw== X-Received: by 2002:adf:eec2:: with SMTP id a2mr62191408wrp.127.1594300650823; Thu, 09 Jul 2020 06:17:30 -0700 (PDT) Received: from localhost (91-166-131-130.subs.proxad.net. [91.166.131.130]) by smtp.gmail.com with ESMTPSA id 33sm6019923wri.16.2020.07.09.06.17.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Jul 2020 06:17:30 -0700 (PDT) Received: by localhost (Postfix, from userid 1000) id C78CE1800867; Thu, 9 Jul 2020 15:17:28 +0200 (CEST) To: libabigail@sourceware.org Subject: [PATCH] reader: Remove useless support for WIP types Organization: Red Hat / France X-Operating-System: Red Hat Enterprise Linux Workstation 7.8 Beta X-URL: http://www.redhat.com Date: Thu, 09 Jul 2020 15:17:28 +0200 Message-ID: <87blkorfo7.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-9.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Dodji Seketeli via Libabigail From: Dodji Seketeli Reply-To: Dodji Seketeli Errors-To: libabigail-bounces@sourceware.org Sender: "Libabigail" Hello, In the abixml reader, WIP types are tracked to know if a type has been fully constructed yet or not. This information is later useful to know if a given type should be canonicalized right away, or if its canonicalization should be delayed until the entire abixml file has been read. Right now, with all the evolutions that happened in the abixml reader, only scalar types are canonicalized right away. All other types are canonicalized late, meaning, after the entire abixml file is read. This doesn't have any noticeable performance impact because the volume of types coming from an abixml file is relatively small enough, compared to what we can see in a DWARF/ELF binary due to type duplication. So the whole WIP tracking becomes is now pretty much useless, in practise. So this patch does away with it altogether. * src/abg-reader.cc (read_context::m_wip_types_map): Remove data member. (read_context::{clear_wip_classes_map, mark_type_as_wip, unmark_type_as_wip, is_wip_type}): Remove member functions. (read_context::maybe_canonicalize_type): Remove use of is_wip_type. Signed-off-by: Dodji Seketeli Applied to master. --- src/abg-reader.cc | 67 ------------------------------------------------------- 1 file changed, 67 deletions(-) diff --git a/src/abg-reader.cc b/src/abg-reader.cc index ce90aca..e72a5de 100644 --- a/src/abg-reader.cc +++ b/src/abg-reader.cc @@ -119,7 +119,6 @@ private: unordered_map > m_types_map; unordered_map > m_fn_tmpl_map; unordered_map > m_class_tmpl_map; - unordered_map m_wip_types_map; vector m_types_to_canonicalize; string_xml_node_map m_id_xml_node_map; xml_node_decl_base_sptr_map m_xml_node_decl_map; @@ -518,65 +517,6 @@ public: clear_types_to_canonicalize() {m_types_to_canonicalize.clear();} - /// Clean the map of classes that are "Work In Progress"; that is, - /// the map of the class that are currently being built, but at not - /// yet fully built. - void - clear_wip_classes_map() - {m_wip_types_map.clear();} - - /// Mark a given type as being "Work In Progress"; that is, mark it - /// as being currently built. - /// - /// @param t the class to mark as being "Work In Progress". - void - mark_type_as_wip(const type_base_sptr t) - { - if (!t) - return; - string qname = get_type_name(t, /*qualified=*/true); - unordered_map::iterator it = m_wip_types_map.find(qname); - if (it == m_wip_types_map.end()) - m_wip_types_map[qname] = 1; - else - ++it->second; - } - - /// Mark a given class as being *NOT* "Work In Progress" anymore; - /// that is, mark it as being fully built. - /// - /// @param t the type to mark as being built. - void - unmark_type_as_wip(const type_base_sptr t) - { - if (!t) - return; - - string qname = get_type_name(t, /*qualified=*/true); - unordered_map::iterator it = m_wip_types_map.find(qname); - if (it == m_wip_types_map.end()) - return; - if (it->second) - --it->second; - if (it->second == 0) - m_wip_types_map.erase(it); - } - - /// Test if a type is being currently built; that is, if it's "Work - /// In Progress". - /// - /// @param t the type to consider. - bool - is_wip_type(const type_base_sptr t) const - { - if (!t) - return false; - - string qname = get_type_name(t, /*qualified=*/true); - unordered_map::const_iterator i = - m_wip_types_map.find(qname); - return i != m_wip_types_map.end(); - } /// Test if two types are equal, without comparing them structurally. /// @@ -883,7 +823,6 @@ public: && !type_has_non_canonicalized_subtype(t) && !is_class_type(t) && !is_union_type(t) - && !is_wip_type(t) // Below are types that *must* be canonicalized only after // they are added to their context; but then this function // might be called to early, before they are actually added to @@ -3818,7 +3757,6 @@ build_function_type(read_context& ctxt, parms, size, align)); ctxt.get_translation_unit()->bind_function_type_life_time(fn_type); - ctxt.mark_type_as_wip(fn_type); ctxt.key_type_decl(fn_type, id); for (xmlNodePtr n = node->children; n ; n = n->next) @@ -3845,7 +3783,6 @@ build_function_type(read_context& ctxt, } fn_type->set_parameters(parms); - ctxt.unmark_type_as_wip(fn_type); return fn_type; } @@ -4543,7 +4480,6 @@ build_class_decl(read_context& ctxt, ctxt.push_decl_to_current_scope(decl, add_to_current_scope); ctxt.map_xml_node_to_decl(node, decl); - ctxt.mark_type_as_wip(decl); ctxt.key_type_decl(decl, id); // If this class has a naming typedef, get it and refer to it. @@ -4767,7 +4703,6 @@ build_class_decl(read_context& ctxt, } ctxt.pop_scope_or_abort(decl); - ctxt.unmark_type_as_wip(decl); return decl; } @@ -4950,7 +4885,6 @@ build_union_decl(read_context& ctxt, ctxt.push_decl_to_current_scope(decl, add_to_current_scope); ctxt.map_xml_node_to_decl(node, decl); - ctxt.mark_type_as_wip(decl); ctxt.key_type_decl(decl, id); for (xmlNodePtr n = node->children; !is_decl_only && n; n = n->next) @@ -5102,7 +5036,6 @@ build_union_decl(read_context& ctxt, } ctxt.pop_scope_or_abort(decl); - ctxt.unmark_type_as_wip(decl); return decl; }