From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2122) id 70FF63858401; Thu, 1 Jun 2023 12:49:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 70FF63858401 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685623790; bh=Wc+06x/0z2oqy1ft3jszSypBft/CVYVl6YV7EwmIDxM=; h=From:To:Subject:Date:From; b=b/htumt6jIGyzuMctWWAiruZxj9EkFLyJJvWqkhJSSw+C4yNEOSPuPtcfaEHhDuFb aD6C0w6bLpn5yuaN6mULoR/wGmKZ9pQbdYw4BAo0avlGZQhv7g8s9ZcKhsR6ZjoP74 467C0MDjxyNcHQaCTKrbh3t0YlaavdnEsQDycNG0= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jason Merrill To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r14-1465] libstdc++: optimize EH phase 2 X-Act-Checkin: gcc X-Git-Author: Jason Merrill X-Git-Refname: refs/heads/trunk X-Git-Oldrev: eeb92704967875411416b0b9508aa6f49e8192fd X-Git-Newrev: 5d9c9119079ef14798b0a4fc771fd8d3905ec746 Message-Id: <20230601124950.70FF63858401@sourceware.org> Date: Thu, 1 Jun 2023 12:49:50 +0000 (GMT) List-Id: https://gcc.gnu.org/g:5d9c9119079ef14798b0a4fc771fd8d3905ec746 commit r14-1465-g5d9c9119079ef14798b0a4fc771fd8d3905ec746 Author: Jason Merrill Date: Wed May 31 15:02:05 2023 -0400 libstdc++: optimize EH phase 2 In the ABI's two-phase EH model, first we walk the stack looking for a handler, then we walk the stack running cleanups until we reach that handler. In the cleanup phase, we shouldn't redundantly check the handlers along the way, e.g. when walking through g(): void f() { throw 42; } void g() { try { f(); } catch (void *) { } } int main() { try { g(); } catch (int) { } } libstdc++-v3/ChangeLog: * libsupc++/eh_personality.cc (PERSONALITY_FUNCTION): Don't check handlers in the cleanup phase. Diff: --- libstdc++-v3/libsupc++/eh_personality.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libstdc++-v3/libsupc++/eh_personality.cc b/libstdc++-v3/libsupc++/eh_personality.cc index 12391e563d6..cc6bc048892 100644 --- a/libstdc++-v3/libsupc++/eh_personality.cc +++ b/libstdc++-v3/libsupc++/eh_personality.cc @@ -592,6 +592,10 @@ PERSONALITY_FUNCTION (int version, // Zero filter values are cleanups. saw_cleanup = true; } + else if (actions == _UA_CLEANUP_PHASE) + // We checked the handlers in the search phase; if one of them + // matched, actions would also have _UA_HANDLER_FRAME set. + ; else if (ar_filter > 0) { // Positive filter values are handlers.