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 [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 4CAA43858C51 for ; Fri, 1 Jul 2022 20:32:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4CAA43858C51 Received: from mail-oa1-f69.google.com (mail-oa1-f69.google.com [209.85.160.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-360-wZWMw9LcPfGFuH1-pFTcfg-1; Fri, 01 Jul 2022 16:32:02 -0400 X-MC-Unique: wZWMw9LcPfGFuH1-pFTcfg-1 Received: by mail-oa1-f69.google.com with SMTP id 586e51a60fabf-10bad082b72so2052641fac.12 for ; Fri, 01 Jul 2022 13:32:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2wr4zt1nJeOAX+7/32PsDvlBy8NuPFjsoU1zf7nb6eE=; b=z5XyNQJSKqHnzmckcosy9XqvNOJ2IGo5oZBMcWvd997xRlt+9rSl+3xknTBlgT246a OguTwwQq8P5ka5x2/oTby+8SQTrSRPEP2N+HTEWhdnVS7vRQBS0LMY7xZ1jd3XrPytS1 9yQ9t8HaLKfX2QxVbxOqausr2dUYgGtrPAYgwrV4egDAzdFBA5dG28eBYWNADb4PK2Q2 BQQPXcpGdZMKL+0anBM0x8lAwnRB01TEgcpaNaTUZefgjyUST17HVyBR48HLqIpUX4QS 8qSSKmWIfMdS+KTUTzx/rEpQRSjrI0cECRTmeI3gG6Xf5iroMR59IA2SjDFhZ43ZK6RV ZlTQ== X-Gm-Message-State: AJIora8S/oXR4nCwVNuD38J+ub7qtcRgZLTHtAAqx0GYp+tQRtc8ZQH2 PUdtKsFs5VbFbn3PAKC5Lo4O3WUGuF7IwMzSHg3jJ60lw+6ok4Y6pFQnCGHDDvZltJhj9XP3WT6 kYc8v+1WZxSRNhI1uQfKxBwtfbDSBXz2apg== X-Received: by 2002:a05:6870:c38e:b0:ed:f230:1494 with SMTP id g14-20020a056870c38e00b000edf2301494mr10760973oao.36.1656707521970; Fri, 01 Jul 2022 13:32:01 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tt1bmwRB3GkhTuC+VIx1j1PU0xIMRkBPvmIyGltmrLS6DKY3hzQ6N1OimNrTm+h4OmdwdqUty/0ZvgUd5ZNgA= X-Received: by 2002:a05:6870:c38e:b0:ed:f230:1494 with SMTP id g14-20020a056870c38e00b000edf2301494mr10760965oao.36.1656707521755; Fri, 01 Jul 2022 13:32:01 -0700 (PDT) MIME-Version: 1.0 References: <20220629092157.230287-1-aldyh@redhat.com> In-Reply-To: From: Aldy Hernandez Date: Fri, 1 Jul 2022 22:31:50 +0200 Message-ID: Subject: Re: [RFC] trailing_wide_ints with runtime variable lengths To: Jakub Jelinek Cc: GCC patches , Andrew MacLeod , Richard Sandiford X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jul 2022 20:32:06 -0000 On Fri, Jul 1, 2022 at 8:53 PM Jakub Jelinek wrote: > > On Fri, Jul 01, 2022 at 07:43:28PM +0200, Aldy Hernandez wrote: > > You can still say N=255 and things continue to work as they do now, since > > m_len[] is still statically determined. The only difference is that before, > > the size of the structure would be 2+1+255+sizeof(int) whereas now it would > > be 1 more because of the byte I'm using for num_elements. > > So, what N do you want to use for SSA_NAME_RANGE_INFO? > N=255 wouldn't be very space efficient especially if the common case is a > single range or two. > For such cases making e.g. m_len not an embedded array, but pointer to > somewhere after the HOST_WIDE_INT array in the same allocation would be > better. As I mentioned in my original post, 12. This means that I'm taking the 4 bytes that are left over from the current padding plus 8 (64-bits). My trailing wide int structure for SSA_NAME_RANGE_INFO will be one word larger than what is currently there. But we'll be able to store up to 5 pairs plus one for the nonzero bits plus one for future development (5*2 + 1 + 1 = 12), all without going over the 64 bit alignment. This is a theoretical max, in reality as I mentioned, 99% of ranges calculated in infinite precision by the ranger fit into 3-4 pairs. Aldy