From patchwork Wed May 27 13:56:52 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: 477155 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 BAF2D14029C for ; Thu, 28 May 2015 00:19:24 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=QEtBUBGl; 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 :resent-from:resent-to:resent-date:resent-message-id:message-id :in-reply-to:references:from:date:subject:to; q=dns; s=default; b= rzbSVhgORPmQatnYnKtNl+chvCZFp0glZhYdL49GWvWiDdbm0qBXuK9mVQrbnfd+ n2ilFAWrrg4HHQtT8YW7xGkbaiiIlCFGgNaKo/vLJmCRC8v5XcxnKx2ca0mPaolm WUBTssh/hAr+Lcfb7J11hw90SKWHHjBhoKnV5vxeOHM= 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 :resent-from:resent-to:resent-date:resent-message-id:message-id :in-reply-to:references:from:date:subject:to; s=default; bh=wBrP HzybCOJlMvxs9tnMq2othC8=; b=QEtBUBGlnQRg3F9APWEyoMXgjEB94Zve7dd5 iekKFHwJFjwTbMwueGnD8niRABVpjMBRWYFae9pTlgCS+KISTkdnCettxHTLEBxe 6Ty3jr5c4mPT/6jUF5l7ksIyZa9iJubHUX0JEUDax4CyXwlAn2aCmzlzA+O5vI32 0NLoT+k= Received: (qmail 97106 invoked by alias); 27 May 2015 14:18:16 -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 95598 invoked by uid 89); 27 May 2015 14:18:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.7 required=5.0 tests=AWL, BAYES_50, KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 X-HELO: eggs.gnu.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (208.118.235.92) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 27 May 2015 14:18:03 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YxbsJ-0007HV-4l for gcc-patches@gcc.gnu.org; Wed, 27 May 2015 10:00:10 -0400 Received: from cantor2.suse.de ([195.135.220.15]:57514 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxbsI-00078i-VW for gcc-patches@gcc.gnu.org; Wed, 27 May 2015 10:00:03 -0400 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id D1F10AE01 for ; Wed, 27 May 2015 13:59:57 +0000 (UTC) Resent-From: =?UTF-8?B?TWFydGluIExpxaFrYQ==?= Resent-To: GCC Patches Resent-Date: Wed, 27 May 2015 15:59:57 +0200 Resent-Message-ID: <5565CDDD.3030908@suse.cz> Resent-User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 Message-Id: <07cd11be6a3792e5cbdfb435b1f786adf42d77bf.1432735040.git.mliska@suse.cz> In-Reply-To: <83d59ba92a3c4b3ba831ebc2fce325f0416848d0.1432735040.git.mliska@suse.cz> References: <83d59ba92a3c4b3ba831ebc2fce325f0416848d0.1432735040.git.mliska@suse.cz> From: mliska Date: Wed, 27 May 2015 15:56:52 +0200 Subject: [PATCH 22/35] Change use to type-based pool allocator in sched-deps.c. To: gcc-patches@gcc.gnu.org X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 X-IsSubscribed: yes gcc/ChangeLog: 2015-04-30 Martin Liska * sched-deps.c (create_dep_node): Use new type-based pool allocator. (delete_dep_node): Likewise. (create_deps_list): Likewise. (free_deps_list): Likewise. (sched_deps_init): Likewise. (sched_deps_finish): Likewise. --- gcc/sched-deps.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c index c1cfc1f..30d4630 100644 --- a/gcc/sched-deps.c +++ b/gcc/sched-deps.c @@ -334,7 +334,7 @@ dep_link_is_detached_p (dep_link_t link) } /* Pool to hold all dependency nodes (dep_node_t). */ -static alloc_pool dn_pool; +static pool_allocator<_dep_node> *dn_pool; /* Number of dep_nodes out there. */ static int dn_pool_diff = 0; @@ -343,7 +343,7 @@ static int dn_pool_diff = 0; static dep_node_t create_dep_node (void) { - dep_node_t n = (dep_node_t) pool_alloc (dn_pool); + dep_node_t n = dn_pool->allocate (); dep_link_t back = DEP_NODE_BACK (n); dep_link_t forw = DEP_NODE_FORW (n); @@ -371,11 +371,11 @@ delete_dep_node (dep_node_t n) --dn_pool_diff; - pool_free (dn_pool, n); + dn_pool->remove (n); } /* Pool to hold dependencies lists (deps_list_t). */ -static alloc_pool dl_pool; +static pool_allocator<_deps_list> *dl_pool; /* Number of deps_lists out there. */ static int dl_pool_diff = 0; @@ -393,7 +393,7 @@ deps_list_empty_p (deps_list_t l) static deps_list_t create_deps_list (void) { - deps_list_t l = (deps_list_t) pool_alloc (dl_pool); + deps_list_t l = dl_pool->allocate (); DEPS_LIST_FIRST (l) = NULL; DEPS_LIST_N_LINKS (l) = 0; @@ -410,7 +410,7 @@ free_deps_list (deps_list_t l) --dl_pool_diff; - pool_free (dl_pool, l); + dl_pool->remove (l); } /* Return true if there is no dep_nodes and deps_lists out there. @@ -4075,10 +4075,10 @@ sched_deps_init (bool global_p) if (global_p) { - dl_pool = create_alloc_pool ("deps_list", sizeof (struct _deps_list), + dl_pool = new pool_allocator<_deps_list> ("deps_list", /* Allocate lists for one block at a time. */ insns_in_block); - dn_pool = create_alloc_pool ("dep_node", sizeof (struct _dep_node), + dn_pool = new pool_allocator<_dep_node> ("dep_node", /* Allocate nodes for one block at a time. We assume that average insn has 5 producers. */ @@ -4128,9 +4128,10 @@ void sched_deps_finish (void) { gcc_assert (deps_pools_are_empty_p ()); - free_alloc_pool_if_empty (&dn_pool); - free_alloc_pool_if_empty (&dl_pool); - gcc_assert (dn_pool == NULL && dl_pool == NULL); + dn_pool->release_if_empty (); + dn_pool = NULL; + dl_pool->release_if_empty (); + dl_pool = NULL; h_d_i_d.release (); cache_size = 0;