From: Daniel Lehman Subject: [PATCH 4/7] msvcrt: Simplify unwind logic. Message-Id: <6c26b7ab9f1141eda4cf34414b849caa@RED-INF-MXMB-P4.esri.com> Date: Wed, 24 May 2017 00:55:09 +0000 From 3a9415a166936a02aacef93c44f3b5bd94c3d6b7 Mon Sep 17 00:00:00 2001 From: Daniel Lehman Date: Fri, 19 May 2017 11:22:53 -0700 Subject: [PATCH 4/7] msvcrt: Simplify unwind logic. since the registered C++ object is moved out in the previous patch, this unwind block is purely unwind code. the consolidation and non-consolidation cases can be collapsed into one if at the target frame, the saved orig_frame and descr are redundant (but they still need to be saved for call_catch_block) the saved end try level from the consolidation record still needs to be used Signed-off-by: Daniel Lehman --- dlls/msvcrt/except_x86_64.c | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/dlls/msvcrt/except_x86_64.c b/dlls/msvcrt/except_x86_64.c index 68ea33a..1992e75 100644 --- a/dlls/msvcrt/except_x86_64.c +++ b/dlls/msvcrt/except_x86_64.c @@ -598,25 +598,11 @@ static DWORD cxx_frame_handler(EXCEPTION_RECORD *rec, ULONG64 frame, if (rec->ExceptionFlags & (EH_UNWINDING|EH_EXIT_UNWIND)) { - if (cxx_is_consolidate(rec)) - { - if (rec->ExceptionFlags & EH_TARGET_UNWIND) - { - const cxx_function_descr *orig_descr = (void*)rec->ExceptionInformation[2]; - int end_level = rec->ExceptionInformation[3]; - orig_frame = rec->ExceptionInformation[1]; - - cxx_local_unwind(orig_frame, dispatch, orig_descr, end_level); - } - else if(frame == orig_frame) - cxx_local_unwind(frame, dispatch, descr, -1); - else - cxx_catch_unwind(orig_frame, dispatch, descr); - return ExceptionContinueSearch; - } - - if (frame == orig_frame) - cxx_local_unwind(frame, dispatch, descr, rec->ExceptionFlags & EH_TARGET_UNWIND ? trylevel : -1); + if (rec->ExceptionFlags & EH_TARGET_UNWIND) + cxx_local_unwind(orig_frame, dispatch, descr, + cxx_is_consolidate(rec) ? rec->ExceptionInformation[3] : trylevel); + else if (frame == orig_frame) + cxx_local_unwind(orig_frame, dispatch, descr, -1); else cxx_catch_unwind(orig_frame, dispatch, descr); return ExceptionContinueSearch; -- 1.9.5