From patchwork Tue Mar 24 21:54:25 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: 454070 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 6DA3814011D for ; Wed, 25 Mar 2015 08:54:38 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass reason="1024-bit key; unprotected key" header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=dwjp3ZpM; dkim-adsp=none (unprotected policy); 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:cc:subject:references :in-reply-to:content-type; q=dns; s=default; b=yIAB2ovG87GpDgy40 FjV1cWhFsAXBKFSc0mwvzFVO1rTs0KdIpUrYAnYqDczTrlFW3T4InWZGG0GLcNga ItVlj36EiirQKRaNPehTVAR4Y81nQzyZYSRLBHmi7c24uY0AOBHTsry+kBpTnuiP HAM2WKvQw6bMgdIJ9hFoIdE2Ok= 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:cc:subject:references :in-reply-to:content-type; s=default; bh=UdqOYFgu5+U8tc7zxTMKzGe 9CyY=; b=dwjp3ZpMX5UGV9uaRMmMtFFQXW1EvjS7KDl9V6KbMg2Bhz00RAyMct1 jpLgfIntXeUO19foNVbHmgzF25DOEKxlau+6G7WMpat1DLCRZd1JoETqgBOdbvd7 4NKe6BciMW/3qZjaA8/Vo9dz0dR9+7gWBtJakDDhYSNE5gcZMH6w= Received: (qmail 16627 invoked by alias); 24 Mar 2015 21:54:31 -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 16612 invoked by uid 89); 24 Mar 2015 21:54:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=3.2 required=5.0 tests=AWL, BAYES_40, KAM_STOCKTIP 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; Tue, 24 Mar 2015 21:54:29 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 794C1AC7F; Tue, 24 Mar 2015 21:54:26 +0000 (UTC) Message-ID: <5511DD11.2070502@suse.cz> Date: Tue, 24 Mar 2015 22:54:25 +0100 From: =?windows-1252?Q?Martin_Li=9Aka?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Jan Hubicka CC: GCC Patches Subject: Re: [PATCH] Fix PR65538 References: <55116E76.4070405@suse.cz> <20150324173805.GG19215@atrey.karlin.mff.cuni.cz> In-Reply-To: <20150324173805.GG19215@atrey.karlin.mff.cuni.cz> X-IsSubscribed: yes On 03/24/2015 06:38 PM, Jan Hubicka wrote: >> Hi. >> >> In following patch, I've added missing delete call for all item summaries that are >> allocated within a function_summary container in case the container does not use >> GGC memory allocation. >> >> Can boostrap on ppc64le and no regression is seen on x86_64-linux-pc. >> >> Ready for trunk? >> Thanks, >> Martin > >> >From c9912b88e8a381e6be7dc1e4be4f7b8859d72e2f Mon Sep 17 00:00:00 2001 >> From: mliska >> Date: Tue, 24 Mar 2015 13:58:50 +0100 >> Subject: [PATCH] Fix PR65538. >> >> gcc/ChangeLog: >> >> 2015-03-24 Martin Liska >> >> PR tree-optimization/65538 >> * symbol-summary.h (function_summary::~function_summary): >> Relese memory for allocated summaries in case non-GGC template >> instance. >> --- >> gcc/symbol-summary.h | 6 ++++++ >> 1 file changed, 6 insertions(+) >> >> diff --git a/gcc/symbol-summary.h b/gcc/symbol-summary.h >> index 8d7e42c..35615ba 100644 >> --- a/gcc/symbol-summary.h >> +++ b/gcc/symbol-summary.h >> @@ -81,6 +81,12 @@ public: >> m_symtab_insertion_hook = NULL; >> m_symtab_removal_hook = NULL; >> m_symtab_duplication_hook = NULL; >> + >> + /* Release all summaries in case we use non-GGC memory. */ >> + typedef typename hash_map ::iterator map_iterator; >> + if (!m_ggc) >> + for (map_iterator it = m_map.begin (); it != m_map.end (); ++it) >> + delete (*it).second; > > I think you sould also do the walk with GGC memory and call ggc_free. > During WPA we almost never call ggc_collect so it is better to keep things explicitly freed. > OK with that change. > > Honza > There's updated version of patch, I've been testing. I'm going to install the patch after it finishes. Thanks, Martin From 8ae68cd2c69287c26543b22fa7afe2ff5cdcda8c Mon Sep 17 00:00:00 2001 From: mliska Date: Tue, 24 Mar 2015 13:58:50 +0100 Subject: [PATCH] Fix PR65538. gcc/ChangeLog: 2015-03-24 Martin Liska PR tree-optimization/65538 * symbol-summary.h (function_summary::~function_summary): Relese memory for allocated summaries in case non-GGC template instance. --- gcc/symbol-summary.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/gcc/symbol-summary.h b/gcc/symbol-summary.h index 8d7e42c..9a87891 100644 --- a/gcc/symbol-summary.h +++ b/gcc/symbol-summary.h @@ -81,6 +81,12 @@ public: m_symtab_insertion_hook = NULL; m_symtab_removal_hook = NULL; m_symtab_duplication_hook = NULL; + + /* Release all summaries in case we use non-GGC memory. */ + typedef typename hash_map ::iterator map_iterator; + if (!m_ggc) + for (map_iterator it = m_map.begin (); it != m_map.end (); ++it) + release ((*it).second); } /* Traverses all summarys with a function F called with @@ -106,6 +112,15 @@ public: return m_ggc ? new (ggc_alloc ()) T() : new T () ; } + /* Release an item that is stored within map. */ + void release (T *item) + { + if (m_ggc) + ggc_free (item); + else + delete item; + } + /* Getter for summary callgraph node pointer. */ T* get (cgraph_node *node) { -- 2.1.4