@@ -3916,141 +3916,6 @@ class CatchHardwareExceptionHolder
39163916#define HardwareExceptionHolder
39173917#endif // FEATURE_ENABLE_HARDWARE_EXCEPTIONS
39183918
3919- class NativeExceptionHolderBase ;
3920-
3921- PALIMPORT
3922- PALAPI
3923- NativeExceptionHolderBase * *
3924- PAL_GetNativeExceptionHolderHead ();
3925-
3926- extern "C++" {
3927-
3928- //
3929- // This is the base class of native exception holder used to provide
3930- // the filter function to the exception dispatcher. This allows the
3931- // filter to be called during the first pass to better emulate SEH
3932- // the xplat platforms that only have C++ exception support.
3933- //
3934- class NativeExceptionHolderBase
3935- {
3936- // Save the address of the holder head so the destructor
3937- // doesn't have access the slow (on Linux) TLS value again.
3938- NativeExceptionHolderBase * * m_head ;
3939-
3940- // The next holder on the stack
3941- NativeExceptionHolderBase * m_next ;
3942-
3943- protected :
3944- NativeExceptionHolderBase ()
3945- {
3946- m_head = nullptr ;
3947- m_next = nullptr ;
3948- }
3949-
3950- ~NativeExceptionHolderBase ()
3951- {
3952- // Only destroy if Push was called
3953- if (m_head != nullptr )
3954- {
3955- * m_head = m_next ;
3956- m_head = nullptr ;
3957- m_next = nullptr ;
3958- }
3959- }
3960-
3961- public :
3962- // Calls the holder's filter handler.
3963- virtual EXCEPTION_DISPOSITION InvokeFilter (PAL_SEHException & ex ) = 0 ;
3964-
3965- // Adds the holder to the "stack" of holders. This is done explicitly instead
3966- // of in the constructor was to avoid the mess of move constructors combined
3967- // with return value optimization (in CreateHolder).
3968- void Push ()
3969- {
3970- NativeExceptionHolderBase * * head = PAL_GetNativeExceptionHolderHead ();
3971- m_head = head ;
3972- m_next = * head ;
3973- * head = this ;
3974- }
3975-
3976- // Given the currentHolder and locals stack range find the next holder starting with this one
3977- // To find the first holder, pass nullptr as the currentHolder.
3978- static NativeExceptionHolderBase * FindNextHolder (NativeExceptionHolderBase * currentHolder , PVOID frameLowAddress , PVOID frameHighAddress );
3979- };
3980-
3981- //
3982- // This is the second part of the native exception filter holder. It is
3983- // templated because the lambda used to wrap the exception filter is a
3984- // unknown type.
3985- //
3986- template < class FilterType >
3987- class NativeExceptionHolder : public NativeExceptionHolderBase
3988- {
3989- FilterType * m_exceptionFilter ;
3990-
3991- public :
3992- NativeExceptionHolder (FilterType * exceptionFilter )
3993- : NativeExceptionHolderBase ()
3994- {
3995- m_exceptionFilter = exceptionFilter ;
3996- }
3997-
3998- virtual EXCEPTION_DISPOSITION InvokeFilter (PAL_SEHException & ex )
3999- {
4000- return (* m_exceptionFilter )(ex );
4001- }
4002- };
4003-
4004- //
4005- // This is a native exception holder that is used when the catch catches
4006- // all exceptions.
4007- //
4008- class NativeExceptionHolderCatchAll : public NativeExceptionHolderBase
4009- {
4010-
4011- public :
4012- NativeExceptionHolderCatchAll ()
4013- : NativeExceptionHolderBase ()
4014- {
4015- }
4016-
4017- virtual EXCEPTION_DISPOSITION InvokeFilter (PAL_SEHException & ex )
4018- {
4019- return EXCEPTION_EXECUTE_HANDLER ;
4020- }
4021- };
4022-
4023- // This is a native exception holder that doesn't catch any exceptions.
4024- class NativeExceptionHolderNoCatch : public NativeExceptionHolderBase
4025- {
4026-
4027- public :
4028- NativeExceptionHolderNoCatch ()
4029- : NativeExceptionHolderBase ()
4030- {
4031- }
4032-
4033- virtual EXCEPTION_DISPOSITION InvokeFilter (PAL_SEHException & ex )
4034- {
4035- return EXCEPTION_CONTINUE_SEARCH ;
4036- }
4037- };
4038-
4039- //
4040- // This factory class for the native exception holder is necessary because
4041- // templated functions don't need the explicit type parameter and can infer
4042- // the template type from the parameter.
4043- //
4044- class NativeExceptionHolderFactory
4045- {
4046- public :
4047- template < class FilterType >
4048- static NativeExceptionHolder < FilterType > CreateHolder (FilterType * exceptionFilter )
4049- {
4050- return NativeExceptionHolder < FilterType > (exceptionFilter );
4051- }
4052- };
4053-
40543919// Start of a try block for exceptions raised by RaiseException
40553920#define PAL_TRY (__ParamType , __paramDef , __paramRef ) \
40563921{ \
@@ -4078,8 +3943,6 @@ class NativeExceptionHolderFactory
40783943 try \
40793944 { \
40803945 HardwareExceptionHolder \
4081- auto __exceptionHolder = NativeExceptionHolderFactory::CreateHolder(&exceptionFilter); \
4082- __exceptionHolder.Push(); \
40833946 tryBlock(__param); \
40843947 } \
40853948 catch (PAL_SEHException& ex) \
@@ -4268,10 +4131,6 @@ class NativeExceptionHolderFactory
42684131
42694132#define HRESULT_FROM_NT (x ) ((HRESULT) ((x) | FACILITY_NT_BIT))
42704133
4271- #ifdef __cplusplus
4272- }
4273- #endif
4274-
42754134#ifndef TARGET_WASM
42764135#define _ReturnAddress () __builtin_return_address(0)
42774136#else
0 commit comments