From patchwork Wed Mar 7 14:38:02 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 145299 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 8BC04B6EF3 for ; Thu, 8 Mar 2012 01:38:26 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1331735906; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Cc:Subject:Message-ID: MIME-Version:Content-Type:Content-Disposition:User-Agent: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=OP3Teok8Kiy83545Ioew w4B8SfA=; b=Z499pGwcponZbBtPV1bN+whONrnU7Grflh7Ei8lfH8aJmkB6QSYx T0kZt1ZO+psRTR/NIy8PO/Mw75bLM/6OCsUidI/inUg1628q1JvtpVZZx5Xh+/hL BgsWroMIY6FuE00FPEC2d454G8Q3wAxOmN0+zaowxds/2mXC94Ae2hk= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type:Content-Disposition:User-Agent:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=wk0wCHjNwWkUjjQ/I0etYiOTF8keDuykvDUMB7lrTJNaw9yslFecPEpeSz5uLH j2S8kJziE6CM+WBiNZVK51nNfiX/PtBATO16Ky6nObz3yYVh67SCQdV3RUREUMuu XKsEajGF8Lu2AUkrEOwHDDYD+8NIvQritsnGscbJJ7C1c=; Received: (qmail 22304 invoked by alias); 7 Mar 2012 14:38:19 -0000 Received: (qmail 22022 invoked by uid 22791); 7 Mar 2012 14:38:16 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 07 Mar 2012 14:38:03 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 752101C6875; Wed, 7 Mar 2012 09:38:02 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 34BJNlBeqpTF; Wed, 7 Mar 2012 09:38:02 -0500 (EST) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id 5BB0C1C6851; Wed, 7 Mar 2012 09:38:02 -0500 (EST) Received: by kwai.gnat.com (Postfix, from userid 4192) id 559813FEE8; Wed, 7 Mar 2012 09:38:02 -0500 (EST) Date: Wed, 7 Mar 2012 09:38:02 -0500 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Bob Duff Subject: [Ada] Increase efficiency of bounded strings Message-ID: <20120307143802.GA17814@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This patch increases the efficiency of bounded strings by removing an unnecessary default. No change in functional behavior. Tested on x86_64-pc-linux-gnu, committed on trunk 2012-03-07 Bob Duff * a-strsup.ads, a-stwisu.ads, a-stzsup.ads (Super_String): Remove default initial value for Data. It is no longer needed because "=" now composes properly for untagged records. This default has caused efficiency problems. Index: a-strsup.ads =================================================================== --- a-strsup.ads (revision 185043) +++ a-strsup.ads (working copy) @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2003-2010, Free Software Foundation, Inc. -- +-- Copyright (C) 2003-2012, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -43,7 +43,10 @@ type Super_String (Max_Length : Positive) is record Current_Length : Natural := 0; - Data : String (1 .. Max_Length) := (others => ASCII.NUL); + Data : String (1 .. Max_Length); + -- A previous version had a default initial value for Data, which is no + -- longer necessary, because "=" now composes properly for untagged + -- records. Leaving it out is more efficient. end record; -- Type Bounded_String in Ada.Strings.Bounded.Generic_Bounded_Length is -- derived from this type, with the constraint of the maximum length. Index: a-stwisu.ads =================================================================== --- a-stwisu.ads (revision 185043) +++ a-stwisu.ads (working copy) @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2003-2010, Free Software Foundation, Inc. -- +-- Copyright (C) 2003-2012, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -46,7 +46,10 @@ type Super_String (Max_Length : Positive) is record Current_Length : Natural := 0; - Data : Wide_String (1 .. Max_Length) := (others => Wide_NUL); + Data : Wide_String (1 .. Max_Length); + -- A previous version had a default initial value for Data, which is no + -- longer necessary, because "=" now composes properly for untagged + -- records. Leaving it out is more efficient. end record; -- Ada.Strings.Wide_Bounded.Generic_Bounded_Length.Wide_Bounded_String is -- derived from this type, with the constraint of the maximum length. Index: a-stzsup.ads =================================================================== --- a-stzsup.ads (revision 185043) +++ a-stzsup.ads (working copy) @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2003-2010, Free Software Foundation, Inc. -- +-- Copyright (C) 2003-2012, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -47,8 +47,10 @@ type Super_String (Max_Length : Positive) is record Current_Length : Natural := 0; - Data : Wide_Wide_String (1 .. Max_Length) := - (others => Wide_Wide_NUL); + Data : Wide_Wide_String (1 .. Max_Length); + -- A previous version had a default initial value for Data, which is no + -- longer necessary, because "=" now composes properly for untagged + -- records. Leaving it out is more efficient. end record; -- Wide_Wide_Bounded.Generic_Bounded_Length.Wide_Wide_Bounded_String is -- derived from this type, with the constraint of the maximum length.