You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Move coreclr EH second pass to native code (#119863)
* [WIP] Move coreclr EH second pass to native code
There were some GC holes discovered caused by the fact that GC can be
triggered during 2nd pass of EH in-between calls to finally handlers and
catch handler. After considering options, moving the 2nd pass to native
code seems the most reasonable solution.
* Several fixes
* Reflect PR feedback
* Implement rethrow
* Implement new way of collided unwind detection now that the
CallCatchFunclet is not called via pinvoke
* Remove forced reporting of EH code from stack frame iterator, as we
now cannot have that code on the stack during 2nd pass
* Fix arm64 build and remove now useless stuff from stackwalk
* Fix build break
* Fix offsets, exception interception and MUSL build break
* Alternative change with minimalistic managed code differences
* Fix 32 bit offsets
* Fix arm64 issue
* Update src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/ExceptionHandling.cs
* Add/fix some contracts
* Fix another arm64 issue - need to use adjusted PC
* Change the GC prevention to single frame only
* Fix one new contract issue
* Update GC forbid locations
This is done to ensure that no GC is allowed between the scanned stack
range is extended and a funclet for the current frame is called.
* Fix/add comment based on review
---------
Co-authored-by: Jan Kotas <[email protected]>
Debug.Assert(pCatchHandler!=null||pReversePInvokePropagationCallback!=IntPtr.Zero||unwoundReversePInvoke||isExceptionIntercepted,"We should have a handler if we're starting the second pass");
871
842
Debug.Assert(!isExceptionIntercepted||(pCatchHandler==null),"No catch handler should be returned for intercepted exceptions in the first pass");
Debug.Assert(pReversePInvokePropagationCallback!=IntPtr.Zero,"Unwound to a reverse P/Invoke in the second pass. We should have a propagation handler.");
908
894
Debug.Assert(frameIter.PreviousTransitionFrame!=IntPtr.Zero,"Should have a transition frame for reverse P/Invoke.");
909
-
#endif
910
895
Debug.Assert(frameIter.SP==handlingFrameSP,"Encountered a different reverse P/Invoke frame in the second pass.");
911
896
// Found the native frame that called the reverse P/invoke.
912
897
// It is not possible to run managed second pass handlers on a native frame.
0 commit comments