From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout1.rbg.tum.de (mailout1.rbg.tum.de [IPv6:2a09:80c0::201]) by sourceware.org (Postfix) with ESMTPS id E642A3858C41 for ; Fri, 19 May 2023 18:50:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E642A3858C41 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=in.tum.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=in.tum.de Received: from mailrelay1.rbg.tum.de (mailrelay1.in.tum.de [131.159.254.14]) by mailout1.rbg.tum.de (Postfix) with ESMTPS id 81C5873; Fri, 19 May 2023 20:50:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=in.tum.de; s=20220209; t=1684522235; bh=pVw56mHdHo+O2f6iPkRwhbAUOJUpWP6fUib5eZVb+2A=; h=Date:Subject:To:References:From:In-Reply-To:From; b=csm1oaUhRt4o5VFQsdIyS61Sb5nW/sLdDfp4oXxqIrfVTd4/nL5RN066a+SM/mJsD H7vVqzpksfu+F7BBbs0JCbTt4iSycW6WlmyQsWAL7wMOYW5h4xJ8FUsdviIEzxE9IF C2qRzMSfTaRElgLIN3I7dO3/B9ldxufTm2mBNkGynT/yRNM+EEG49C+aLvYP/L+a19 iAuZzlsr1sNM6GzwopjGLHAm0vYQpBvw2LFBl2sywPqDfUaLK3rOMzonlDpfWrn5iv 2LqJU0wPZEvM3nMXBWfLGCePx6I41ksxlxAdx7D53S3tZ68qbVni9D+A/3NewFi6ag WDwmFY9QhkAow== Received: by mailrelay1.rbg.tum.de (Postfix, from userid 112) id 7CDD5440; Fri, 19 May 2023 20:50:35 +0200 (CEST) Received: from mailrelay1.rbg.tum.de (localhost [127.0.0.1]) by mailrelay1.rbg.tum.de (Postfix) with ESMTP id 2E6C643F; Fri, 19 May 2023 20:50:35 +0200 (CEST) Received: from mail.in.tum.de (mailproxy.in.tum.de [IPv6:2a09:80c0::78]) by mailrelay1.rbg.tum.de (Postfix) with ESMTPS id 2B46343D; Fri, 19 May 2023 20:50:35 +0200 (CEST) Received: by mail.in.tum.de (Postfix, from userid 112) id 247D54A0279; Fri, 19 May 2023 20:50:35 +0200 (CEST) Received: (Authenticated sender: neumann) by mail.in.tum.de (Postfix) with ESMTPSA id 59F2F4A0041; Fri, 19 May 2023 20:50:34 +0200 (CEST) (Extended-Queue-bit xtech_pr@fff.in.tum.de) Message-ID: Date: Fri, 19 May 2023 20:50:33 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: [PATCH v2] release the sorted FDE array when deregistering a frame [PR109685] To: Jeff Law , gcc-patches@gcc.gnu.org References: <13233832-d564-6007-f890-53e7e6df2ca6@in.tum.de> <4709ac08-d45c-e152-3549-3bb903d68b46@gmail.com> Content-Language: en-US From: Thomas Neumann In-Reply-To: <4709ac08-d45c-e152-3549-3bb903d68b46@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,GIT_PATCH_0,KAM_SHORT,SPF_HELO_NONE,SPF_PASS,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 List-Id: Am 19.05.23 um 19:26 schrieb Jeff Law: >> See: >> https://gcc.gnu.org/pipermail/gcc-patches/2023-May/617245.html > I think this needs an update given the other changes in this space. > > jeff I have included the updated the patch below. The atomic fastpath bypasses the code that releases the sort array which was lazily allocated during unwinding. We now check after deregistering if there is an array to free. libgcc/ChangeLog: * unwind-dw2-fde.c: Free sort array in atomic fast path. --- libgcc/unwind-dw2-fde.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libgcc/unwind-dw2-fde.c b/libgcc/unwind-dw2-fde.c index a5786bf729c..32b9e64a1c8 100644 --- a/libgcc/unwind-dw2-fde.c +++ b/libgcc/unwind-dw2-fde.c @@ -241,6 +241,12 @@ __deregister_frame_info_bases (const void *begin) // And remove ob = btree_remove (®istered_frames, range[0]); bool empty_table = (range[1] - range[0]) == 0; + + // Deallocate the sort array if any. + if (ob && ob->s.b.sorted) + { + free (ob->u.sort); + } #else init_object_mutex_once (); __gthread_mutex_lock (&object_mutex); -- 2.39.2