From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28743 invoked by alias); 19 Sep 2011 03:11:36 -0000 Received: (qmail 28728 invoked by uid 22791); 19 Sep 2011 03:11:35 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-qy0-f175.google.com (HELO mail-qy0-f175.google.com) (209.85.216.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 19 Sep 2011 03:11:20 +0000 Received: by qyk10 with SMTP id 10so1824427qyk.20 for ; Sun, 18 Sep 2011 20:11:20 -0700 (PDT) Received: by 10.52.72.201 with SMTP id f9mr1599836vdv.12.1316401880062; Sun, 18 Sep 2011 20:11:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.52.183.197 with HTTP; Sun, 18 Sep 2011 20:11:00 -0700 (PDT) In-Reply-To: References: <1291979498-1604-1-git-send-email-dodji@redhat.com> <411c73e26bd46ba176c22962851cacf21b013be5.1310824121.git.dodji@redhat.com> <4E6E825F.8020408@redhat.com> From: Laurynas Biveinis Date: Mon, 19 Sep 2011 06:51:00 -0000 Message-ID: Subject: Re: [PATCH 7/7] Reduce memory waste due to non-power-of-2 allocs To: Dodji Seketeli Cc: Jason Merrill , gcc-patches@gcc.gnu.org, tromey@redhat.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-09/txt/msg01055.txt.bz2 2011/9/17 Dodji Seketeli : > OK, so the patch below extracts a public ggc_alloced_size_for_request > function from the different implementations of the ggc allocator's > interface, and lets new_linemap use that. > libcpp/ > > =C2=A0 =C2=A0 =C2=A0 =C2=A0* include/line-map.h (struct line_maps::alloce= d_size_for_request): > =C2=A0 =C2=A0 =C2=A0 =C2=A0New member. > =C2=A0 =C2=A0 =C2=A0 =C2=A0* line-map.c (new_linemap): Use set->alloced_s= ize_for_request to > =C2=A0 =C2=A0 =C2=A0 =C2=A0get the actual allocated size of line maps. > > gcc/ > > =C2=A0 =C2=A0 =C2=A0 =C2=A0* ggc.h (ggc_alloced_size_for_request): Declar= e new public entry > =C2=A0 =C2=A0 =C2=A0 =C2=A0point. > =C2=A0 =C2=A0 =C2=A0 =C2=A0* ggc-none.c (ggc_alloced_size_for_request): N= ew public stub > =C2=A0 =C2=A0 =C2=A0 =C2=A0function. > =C2=A0 =C2=A0 =C2=A0 =C2=A0* ggc-page.c (ggc_alloced_size_order_for_reque= st): New static > =C2=A0 =C2=A0 =C2=A0 =C2=A0function. =C2=A0Factorized from ggc_internal_a= lloc_stat. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(ggc_alloced_size_for_request): New public fun= ction. =C2=A0Uses > =C2=A0 =C2=A0 =C2=A0 =C2=A0ggc_alloced_size_order_for_request. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(ggc_internal_alloc_stat): Use ggc_alloced_siz= e_order_for_request. > =C2=A0 =C2=A0 =C2=A0 =C2=A0* ggc-zone.c (ggc_alloced_size_for_request): N= ew public function > =C2=A0 =C2=A0 =C2=A0 =C2=A0extracted from ggc_internal_alloc_zone_stat. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(ggc_internal_alloc_zone_stat): Use ggc_alloce= d_size_for_request. > =C2=A0 =C2=A0 =C2=A0 =C2=A0* toplev.c (general_init): Initialize > =C2=A0 =C2=A0 =C2=A0 =C2=A0line_table->alloced_size_for_request. For the record, the patch is fine with me. (I cannot approve it though, but you already got the approval) Thanks, --=20 Laurynas