From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6618 invoked by alias); 16 Sep 2009 08:28:40 -0000 Received: (qmail 6603 invoked by uid 22791); 16 Sep 2009 08:28:38 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-vw0-f174.google.com (HELO mail-vw0-f174.google.com) (209.85.212.174) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 16 Sep 2009 08:28:31 +0000 Received: by vws4 with SMTP id 4so1714964vws.0 for ; Wed, 16 Sep 2009 01:28:30 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.88.100 with SMTP id z36mr12054067vcl.114.1253089709907; Wed, 16 Sep 2009 01:28:29 -0700 (PDT) In-Reply-To: <1253054340.7094.70.camel@tidbit.site> References: <1253054340.7094.70.camel@tidbit.site> Date: Wed, 16 Sep 2009 08:28:00 -0000 Message-ID: <84fc9c000909160128h5b2ea7bfpd6186fea488c6ee0@mail.gmail.com> Subject: Re: Types with power-of-two size in ggc-page.c extra_order_size_table[] From: Richard Guenther To: okellogg@users.sourceforge.net Cc: gcc@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2009-09/txt/msg00289.txt.bz2 On Wed, Sep 16, 2009 at 12:39 AM, Oliver Kellogg wrote: > Hi, > > Looking at ggc-page.c:175ff., > > static const size_t extra_order_size_table[] =3D { > =A0sizeof (struct var_ann_d), > =A0sizeof (struct tree_decl_non_common), > =A0sizeof (struct tree_field_decl), > =A0sizeof (struct tree_parm_decl), > =A0sizeof (struct tree_var_decl), > =A0sizeof (struct tree_list), > =A0sizeof (struct tree_ssa_name), > =A0sizeof (struct function), > =A0sizeof (struct basic_block_def), > =A0sizeof (bitmap_element), > =A0sizeof (bitmap_head), > =A0TREE_EXP_SIZE (2), > =A0RTL_SIZE (2), =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* MEM, PLUS, etc. =A0*/ > =A0RTL_SIZE (9), =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* INSN */ > }; > > On my openSuSE-11.1 i686-pc-linux-gnu, sizeof (struct basic_block_def) > is 64 and sizeof (bitmap_head) is 16. > Why are these types entered into extra_order_size_table? They likely changed in size and/or the 64bit host-wide-int variants are not power-of-two sized. > > ggc-page.c (init_ggc):1567ff. > =A0for (order =3D HOST_BITS_PER_PTR; order < NUM_ORDERS; ++order) > =A0 =A0{ > =A0 =A0 =A0int o; > =A0 =A0 =A0int i; > > =A0 =A0 =A0i =3D OBJECT_SIZE (order); > =A0 =A0 =A0if (i >=3D NUM_SIZE_LOOKUP) > =A0 =A0 =A0 =A0continue; > > =A0 =A0 =A0for (o =3D size_lookup[i]; o =3D=3D size_lookup [i]; --i) > =A0 =A0 =A0 =A0size_lookup[i] =3D order; > =A0 =A0} > > At order 42, OBJECT_SIZE returns 16 (from extra_order_size_table[10]) > and size_lookup[16] down to [9] is changed to 42. > That seems strange to me, given the documentation of size_lookup[], I don't remember exactly but the last time I spent with the code it did the right thing. Giving more context might help to understand the problem you are seeing. Richard. > /* This table provides a fast way to determine ceil(log_2(size)) for > =A0 allocation requests. =A0The minimum allocation size is eight bytes. = =A0*/ > > > Thanks, > > Oliver > > > > >