diff options
author | Jason Merrill <jason@redhat.com> | 2023-05-31 15:02:05 -0400 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2023-06-01 08:49:20 -0400 |
commit | 5d9c9119079ef14798b0a4fc771fd8d3905ec746 (patch) | |
tree | 700328c229e0897d620d4d3f9b308568096b96a0 | |
parent | eeb92704967875411416b0b9508aa6f49e8192fd (diff) | |
download | gcc-5d9c9119079ef14798b0a4fc771fd8d3905ec746.zip gcc-5d9c9119079ef14798b0a4fc771fd8d3905ec746.tar.gz gcc-5d9c9119079ef14798b0a4fc771fd8d3905ec746.tar.bz2 |
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.
-rw-r--r-- | libstdc++-v3/libsupc++/eh_personality.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libstdc++-v3/libsupc++/eh_personality.cc b/libstdc++-v3/libsupc++/eh_personality.cc index 12391e5..cc6bc04 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. |