Skip to content

Commit 024b6e8

Browse files
jkotasfilipnavara
authored andcommitted
Use funclets and new EH on win-x86
1 parent 1151925 commit 024b6e8

32 files changed

+546
-293
lines changed

src/coreclr/clr.featuredefines.props

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,13 @@
1616
<FeatureCominteropApartmentSupport>true</FeatureCominteropApartmentSupport>
1717
<FeatureTypeEquivalence>true</FeatureTypeEquivalence>
1818
<FeatureIjw>true</FeatureIjw>
19+
<FeatureEHFunclets>true</FeatureEHFunclets>
1920
</PropertyGroup>
2021

2122
<PropertyGroup Condition="'$(TargetsOSX)' == 'true' OR '$(TargetsMacCatalyst)' == 'true' OR '$(TargetsiOS)' == 'true' OR '$(TargetstvOS)' == 'true'">
2223
<FeatureObjCMarshal>true</FeatureObjCMarshal>
2324
</PropertyGroup>
2425

25-
<PropertyGroup Condition="!('$(TargetsWindows)' == 'true' AND '$(Platform)' == 'x86')">
26-
<FeatureEHFunclets>true</FeatureEHFunclets>
27-
</PropertyGroup>
28-
2926
<PropertyGroup>
3027
<DefineConstants Condition="'$(FeatureComWrappers)' == 'true'">$(DefineConstants);FEATURE_COMWRAPPERS</DefineConstants>
3128
<DefineConstants Condition="'$(FeatureCominterop)' == 'true'">$(DefineConstants);FEATURE_COMINTEROP</DefineConstants>

src/coreclr/clrdefinitions.cmake

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,7 @@ if(CLR_CMAKE_TARGET_WIN32)
205205
endif(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386)
206206
endif(CLR_CMAKE_TARGET_WIN32)
207207

208-
if (NOT CLR_CMAKE_TARGET_ARCH_I386 OR NOT CLR_CMAKE_TARGET_WIN32)
209-
add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_ARCH>>>:FEATURE_EH_FUNCLETS>)
210-
endif (NOT CLR_CMAKE_TARGET_ARCH_I386 OR NOT CLR_CMAKE_TARGET_WIN32)
208+
add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_ARCH>>>:FEATURE_EH_FUNCLETS>)
211209

212210
if (CLR_CMAKE_TARGET_WIN32 AND (CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64))
213211
add_definitions(-DFEATURE_SPECIAL_USER_MODE_APC)

src/coreclr/cpp.hint

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
extern "C" _EXCEPTION_HANDLER_DECL(funcname)
3737

3838
#define EXCEPTION_HANDLER_IMPL(funcname) \
39-
_EXCEPTION_HANDLER_DECL(funcname)
39+
extern "C" _EXCEPTION_HANDLER_DECL(funcname)
4040

4141
#define EXCEPTION_HANDLER_FWD(funcname) \
4242
funcname(pExceptionRecord, pEstablisherFrame, pContext, pDispatcherContext)

src/coreclr/debug/ee/debugger.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3994,7 +3994,7 @@ HANDLE OpenWin32EventOrThrow(
39943994
// Returns true if the specified IL offset has a special meaning (eg. prolog, etc.)
39953995
bool DbgIsSpecialILOffset(DWORD offset);
39963996

3997-
#if defined(TARGET_WINDOWS)
3997+
#if defined(TARGET_WINDOWS) && !defined(TARGET_X86)
39983998
void FixupDispatcherContext(T_DISPATCHER_CONTEXT* pDispatcherContext, T_CONTEXT* pContext, PEXCEPTION_ROUTINE pUnwindPersonalityRoutine = NULL);
39993999
#endif
40004000

src/coreclr/debug/ee/funceval.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3990,7 +3990,7 @@ void * STDCALL FuncEvalHijackWorker(DebuggerEval *pDE)
39903990
}
39913991

39923992

3993-
#if defined(FEATURE_EH_FUNCLETS) && !defined(TARGET_UNIX)
3993+
#if defined(FEATURE_EH_FUNCLETS) && !defined(TARGET_UNIX) && !defined(TARGET_X86)
39943994

39953995
EXTERN_C EXCEPTION_DISPOSITION
39963996
FuncEvalHijackPersonalityRoutine(IN PEXCEPTION_RECORD pExceptionRecord,
@@ -4028,7 +4028,6 @@ FuncEvalHijackPersonalityRoutine(IN PEXCEPTION_RECORD pExceptionRecord,
40284028
return ExceptionCollidedUnwind;
40294029
}
40304030

4031-
4032-
#endif // FEATURE_EH_FUNCLETS && !TARGET_UNIX
4031+
#endif // FEATURE_EH_FUNCLETS && !TARGET_UNIX && !TARGET_X86
40334032

40344033
#endif // ifndef DACCESS_COMPILE

src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ add_dependencies(coreclr coreclr_exports)
7676
set_property(TARGET coreclr APPEND_STRING PROPERTY LINK_FLAGS ${EXPORTS_LINKER_OPTION})
7777
set_property(TARGET coreclr APPEND_STRING PROPERTY LINK_DEPENDS ${EXPORTS_FILE})
7878

79-
if (CLR_CMAKE_HOST_UNIX)
79+
if (CLR_CMAKE_HOST_UNIX OR CLR_CMAKE_TARGET_ARCH_I386)
8080
set(LIB_UNWINDER unwinder_wks)
8181
endif (CLR_CMAKE_HOST_UNIX)
8282

src/coreclr/inc/crosscomp.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,36 @@ typedef struct _T_KNONVOLATILE_CONTEXT_POINTERS {
667667
#define T_DISPATCHER_CONTEXT DISPATCHER_CONTEXT
668668
#define PT_DISPATCHER_CONTEXT PDISPATCHER_CONTEXT
669669

670+
#if defined(TARGET_WINDOWS) && defined(TARGET_X86)
671+
typedef struct _KNONVOLATILE_CONTEXT {
672+
673+
DWORD Edi;
674+
DWORD Esi;
675+
DWORD Ebx;
676+
DWORD Ebp;
677+
678+
} KNONVOLATILE_CONTEXT, *PKNONVOLATILE_CONTEXT;
679+
680+
typedef struct _KNONVOLATILE_CONTEXT_POINTERS_EX
681+
{
682+
// The ordering of these fields should be aligned with that
683+
// of corresponding fields in CONTEXT
684+
//
685+
// (See FillRegDisplay in inc/regdisp.h for details)
686+
PDWORD Edi;
687+
PDWORD Esi;
688+
PDWORD Ebx;
689+
PDWORD Edx;
690+
PDWORD Ecx;
691+
PDWORD Eax;
692+
693+
PDWORD Ebp;
694+
695+
} KNONVOLATILE_CONTEXT_POINTERS_EX, *PKNONVOLATILE_CONTEXT_POINTERS_EX;
696+
697+
#define KNONVOLATILE_CONTEXT_POINTERS KNONVOLATILE_CONTEXT_POINTERS_EX
698+
#define PKNONVOLATILE_CONTEXT_POINTERS PKNONVOLATILE_CONTEXT_POINTERS_EX
699+
#endif
670700
#define T_KNONVOLATILE_CONTEXT_POINTERS KNONVOLATILE_CONTEXT_POINTERS
671701
#define PT_KNONVOLATILE_CONTEXT_POINTERS PKNONVOLATILE_CONTEXT_POINTERS
672702

src/coreclr/inc/regdisp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#ifndef __REGDISP_H
55
#define __REGDISP_H
66

7+
#include <clrnt.h>
78

89
#ifdef DEBUG_REGDISPLAY
910
class Thread;

src/coreclr/jit/targetx86.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@
5252
// target
5353
#define FEATURE_EH 1 // To aid platform bring-up, eliminate exceptional EH clauses (catch, filter,
5454
// filter-handler, fault) and directly execute 'finally' clauses.
55-
#if !defined(UNIX_X86_ABI)
56-
#define FEATURE_EH_WINDOWS_X86 1 // Enable support for SEH regions
57-
#endif
5855
#define ETW_EBP_FRAMED 1 // if 1 we cannot use EBP as a scratch register and must create EBP based
5956
// frames for most methods
6057
#define CSE_CONSTS 1 // Enable if we want to CSE constants

src/coreclr/unwinder/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ set(UNWINDER_SOURCES
1818

1919
convert_to_absolute_path(UNWINDER_SOURCES ${UNWINDER_SOURCES})
2020

21-
if(CLR_CMAKE_HOST_UNIX)
21+
if(CLR_CMAKE_HOST_UNIX OR CLR_CMAKE_TARGET_ARCH_I386)
2222
add_library_clr(unwinder_wks OBJECT ${UNWINDER_SOURCES})
2323
add_unwinder_include_directories(unwinder_wks)
2424
add_dependencies(unwinder_wks eventing_headers)

0 commit comments

Comments
 (0)