From patchwork Fri May 29 13:40:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 477903 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 5AE57140F95 for ; Fri, 29 May 2015 23:40:50 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=ybb1DDiW; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:references :in-reply-to:content-type; q=dns; s=default; b=SLUh0Wb6HrKr1MtJ8 F06xZEX0471MhlTZ54sF+9fCQBTsMkZ4OhWcsI5XccEdaLh/i0JyJ6jzcu1GOAZ6 giJcw6p2yaEW6SzLZQpJan315d4EllXBr5sxI3K3Z3s8toFfpLmRZGcYQBBiTKZo A/JjWAtHT3KupnpacpLYsvZrDY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:references :in-reply-to:content-type; s=default; bh=nkBGqdysdhhIA7hTJNRYJDt GqYk=; b=ybb1DDiWP5mVT+e7nQ5qEH/Kw6fBO6Y0G3ZiBiFpgHn9Op73tbUYnw0 55O4kaFzOzjD4S4L9V/1hyzig4wMmVXp2Xo6oiSCJnAr1hA3C/AjxU9Y5sQm5J7e zweWhp9NKwBus2DyLZZLkyMf3/fkAPaWAn0b0PNnp97Uc3JVRy5U= Received: (qmail 84788 invoked by alias); 29 May 2015 13:40:43 -0000 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 Received: (qmail 84777 invoked by uid 89); 29 May 2015 13:40:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.8 required=5.0 tests=AWL, BAYES_50, KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 X-HELO: mx2.suse.de Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Fri, 29 May 2015 13:40:42 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 64798AC69 for ; Fri, 29 May 2015 13:40:38 +0000 (UTC) Message-ID: <55686C56.80902@suse.cz> Date: Fri, 29 May 2015 15:40:38 +0200 From: =?windows-1252?Q?Martin_Li=9Aka?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: gcc-patches@gcc.gnu.org Subject: Re: [PATCH 26/35] Change use to type-based pool allocator in tree-ssa-strlen.c. References: <83d59ba92a3c4b3ba831ebc2fce325f0416848d0.1432735040.git.mliska@suse.cz> In-Reply-To: X-IsSubscribed: yes On 05/27/2015 03:56 PM, mliska wrote: > gcc/ChangeLog: > > 2015-04-30 Martin Liska > > * tree-ssa-strlen.c (new_strinfo): Use new type-based pool allocator. > (free_strinfo): Likewise. > (pass_strlen::execute): Likewise. > --- > gcc/tree-ssa-strlen.c | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) > > diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c > index 34776a3..2664189 100644 > --- a/gcc/tree-ssa-strlen.c > +++ b/gcc/tree-ssa-strlen.c > @@ -142,7 +142,7 @@ typedef struct strinfo_struct > } *strinfo; > > /* Pool for allocating strinfo_struct entries. */ > -static alloc_pool strinfo_pool; > +static pool_allocator strinfo_pool ("strinfo_struct pool", 64); > > /* Vector mapping positive string indexes to strinfo, for the > current basic block. The first pointer in the vector is special, > @@ -431,7 +431,7 @@ new_addr_stridx (tree exp) > static strinfo > new_strinfo (tree ptr, int idx, tree length) > { > - strinfo si = (strinfo) pool_alloc (strinfo_pool); > + strinfo si = strinfo_pool.allocate (); > si->length = length; > si->ptr = ptr; > si->stmt = NULL; > @@ -452,7 +452,7 @@ static inline void > free_strinfo (strinfo si) > { > if (si && --si->refcount == 0) > - pool_free (strinfo_pool, si); > + strinfo_pool.remove (si); > } > > /* Set strinfo in the vector entry IDX to SI. */ > @@ -2400,8 +2400,6 @@ pass_strlen::execute (function *fun) > { > ssa_ver_to_stridx.safe_grow_cleared (num_ssa_names); > max_stridx = 1; > - strinfo_pool = create_alloc_pool ("strinfo_struct pool", > - sizeof (struct strinfo_struct), 64); > > calculate_dominance_info (CDI_DOMINATORS); > > @@ -2410,7 +2408,7 @@ pass_strlen::execute (function *fun) > strlen_dom_walker (CDI_DOMINATORS).walk (fun->cfg->x_entry_block_ptr); > > ssa_ver_to_stridx.release (); > - free_alloc_pool (strinfo_pool); > + strinfo_pool.release (); > if (decl_to_stridxlist_htab) > { > obstack_free (&stridx_obstack, NULL); > v2 From d3b5cce7467dea3cc06489e087ca5d2f15a0eb32 Mon Sep 17 00:00:00 2001 From: mliska Date: Wed, 27 May 2015 15:56:53 +0200 Subject: [PATCH 25/32] Change use to type-based pool allocator in tree-ssa-strlen.c. gcc/ChangeLog: 2015-04-30 Martin Liska * tree-ssa-strlen.c (new_strinfo): Use new type-based pool allocator. (free_strinfo): Likewise. (pass_strlen::execute): Likewise. --- gcc/tree-ssa-strlen.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c index 34776a3..2664189 100644 --- a/gcc/tree-ssa-strlen.c +++ b/gcc/tree-ssa-strlen.c @@ -142,7 +142,7 @@ typedef struct strinfo_struct } *strinfo; /* Pool for allocating strinfo_struct entries. */ -static alloc_pool strinfo_pool; +static pool_allocator strinfo_pool ("strinfo_struct pool", 64); /* Vector mapping positive string indexes to strinfo, for the current basic block. The first pointer in the vector is special, @@ -431,7 +431,7 @@ new_addr_stridx (tree exp) static strinfo new_strinfo (tree ptr, int idx, tree length) { - strinfo si = (strinfo) pool_alloc (strinfo_pool); + strinfo si = strinfo_pool.allocate (); si->length = length; si->ptr = ptr; si->stmt = NULL; @@ -452,7 +452,7 @@ static inline void free_strinfo (strinfo si) { if (si && --si->refcount == 0) - pool_free (strinfo_pool, si); + strinfo_pool.remove (si); } /* Set strinfo in the vector entry IDX to SI. */ @@ -2400,8 +2400,6 @@ pass_strlen::execute (function *fun) { ssa_ver_to_stridx.safe_grow_cleared (num_ssa_names); max_stridx = 1; - strinfo_pool = create_alloc_pool ("strinfo_struct pool", - sizeof (struct strinfo_struct), 64); calculate_dominance_info (CDI_DOMINATORS); @@ -2410,7 +2408,7 @@ pass_strlen::execute (function *fun) strlen_dom_walker (CDI_DOMINATORS).walk (fun->cfg->x_entry_block_ptr); ssa_ver_to_stridx.release (); - free_alloc_pool (strinfo_pool); + strinfo_pool.release (); if (decl_to_stridxlist_htab) { obstack_free (&stridx_obstack, NULL); -- 2.1.4