From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 871A5386F43F for ; Thu, 24 Sep 2020 19:57:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 871A5386F43F Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-451-A50QXYd6M9SBtsNaHphx4w-1; Thu, 24 Sep 2020 15:57:45 -0400 X-MC-Unique: A50QXYd6M9SBtsNaHphx4w-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 350A51005E76; Thu, 24 Sep 2020 19:57:44 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-112-37.ams2.redhat.com [10.36.112.37]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D616A5D9D2; Thu, 24 Sep 2020 19:57:43 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id 08OJveal026023; Thu, 24 Sep 2020 21:57:41 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id 08OJvdwF026022; Thu, 24 Sep 2020 21:57:39 +0200 Date: Thu, 24 Sep 2020 21:57:39 +0200 From: Jakub Jelinek To: Mark Wielaard Cc: dwz@sourceware.org Subject: Re: [PATCH 4/4] Handle DW_FORM_implicit_const [experiment]. Message-ID: <20200924195739.GR2176@tucnak> Reply-To: Jakub Jelinek References: <20200924162557.15870-1-mark@klomp.org> <20200924162557.15870-5-mark@klomp.org> MIME-Version: 1.0 In-Reply-To: <20200924162557.15870-5-mark@klomp.org> User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, 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: dwz@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Dwz mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Sep 2020 19:57:48 -0000 On Thu, Sep 24, 2020 at 06:25:57PM +0200, Mark Wielaard wrote: > --- a/dwz.c > +++ b/dwz.c > @@ -848,6 +848,8 @@ struct abbrev_attr > unsigned int attr; > /* DW_FORM_* form code. */ > unsigned int form; > + /* Only for DW_FORM_implicit_const. */ > + int64_t value; > }; Indeed, this is the most expensive choice memory-wise, but I guess it might be interesting to take some very large dwz run (e.g. the webkits) and measure how many abbrev_attr structs we have actually allocated at peak time and whether it just isn't acceptable. It is true we'd waste all that memory e.g. when processing DWARF4 and never actually use it in that case. On the other side, it is the cleanest and fastest approach. Another possibility is to add int64_t * field to struct abbrev_tag and if the abbreviation contains at least one DW_FORM_implicit_const, then allocate tail payload of int64_ts (either nattr of them, or perhaps optimize and allocate only index of highest DW_FORM_implicit_const + 1 ones, or optimize even more and allocate index of highest DW_FORM_implicit_const - index of lowest DW_FORM_implicit_const + 1 times int64_t and point the pointer earlier such that t1->value[i] would be the the value for each DW_FORM_implicit_const). Or even optimize memory even more and just allocate as many int64_ts as there are DW_FORM_implicit_const forms. Except that then all the loops that iterate from 0 to nattr looking through the attributes would need to track how many DW_FORM_implicit_const were seen (or there would need to be another loop to count that afterwards). Jakub