-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Move funclets invocation to code managers #114180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
f5acd7a
dd389a6
9d7af16
81dd7cb
e797e63
8378130
79efd27
30676ee
9203881
f5a4e79
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -21,6 +21,8 @@ | |||||
| #include "interpexec.h" | ||||||
| #endif // FEATURE_INTERPRETER | ||||||
|
|
||||||
| #include "exinfo.h" | ||||||
|
|
||||||
| #ifdef TARGET_X86 | ||||||
|
|
||||||
| // NOTE: enabling compiler optimizations, even for debug builds. | ||||||
|
|
@@ -37,6 +39,8 @@ void promoteVarArgs(PTR_BYTE argsStart, PTR_VASigCookie varArgSig, GCCONTEXT* ct | |||||
|
|
||||||
| #include "argdestination.h" | ||||||
|
|
||||||
| #include "exceptionhandling.h" | ||||||
|
|
||||||
| #ifndef DACCESS_COMPILE | ||||||
| #ifndef FEATURE_EH_FUNCLETS | ||||||
|
|
||||||
|
|
@@ -2124,7 +2128,163 @@ void EECodeManager::LeaveCatch(GCInfoToken gcInfoToken, | |||||
|
|
||||||
| return; | ||||||
| } | ||||||
| #else // !FEATURE_EH_FUNCLETS | ||||||
|
|
||||||
| #ifndef TARGET_WASM | ||||||
|
|
||||||
| #ifdef USE_FUNCLET_CALL_HELPER | ||||||
| // This is an assembly helper that enables us to call into EH funclets. | ||||||
| EXTERN_C DWORD_PTR STDCALL CallEHFunclet(Object *pThrowable, UINT_PTR pFuncletToInvoke, UINT_PTR *pFirstNonVolReg, UINT_PTR *pFuncletCallerSP); | ||||||
|
|
||||||
| // This is an assembly helper that enables us to call into EH filter funclets. | ||||||
| EXTERN_C DWORD_PTR STDCALL CallEHFilterFunclet(Object *pThrowable, TADDR CallerSP, UINT_PTR pFuncletToInvoke, UINT_PTR *pFuncletCallerSP); | ||||||
|
|
||||||
| typedef DWORD_PTR (HandlerFn)(UINT_PTR uStackFrame, Object* pExceptionObj); | ||||||
|
|
||||||
| static inline UINT_PTR CastHandlerFn(HandlerFn *pfnHandler) | ||||||
| { | ||||||
| #ifdef TARGET_ARM | ||||||
| return DataPointerToThumbCode<UINT_PTR, HandlerFn *>(pfnHandler); | ||||||
| #else | ||||||
| return (UINT_PTR)pfnHandler; | ||||||
| #endif | ||||||
| } | ||||||
|
|
||||||
| static inline UINT_PTR *GetFirstNonVolatileRegisterAddress(PCONTEXT pContextRecord) | ||||||
| { | ||||||
| #if defined(TARGET_ARM) | ||||||
| return (UINT_PTR*)&(pContextRecord->R4); | ||||||
| #elif defined(TARGET_ARM64) | ||||||
| return (UINT_PTR*)&(pContextRecord->X19); | ||||||
| #elif defined(TARGET_LOONGARCH64) | ||||||
| return (UINT_PTR*)&(pContextRecord->S0); | ||||||
| #elif defined(TARGET_X86) | ||||||
| return (UINT_PTR*)&(pContextRecord->Edi); | ||||||
| #elif defined(TARGET_RISCV64) | ||||||
| return (UINT_PTR*)&(pContextRecord->Fp); | ||||||
| #else | ||||||
| PORTABILITY_ASSERT("GetFirstNonVolatileRegisterAddress"); | ||||||
| return NULL; | ||||||
| #endif | ||||||
| } | ||||||
|
|
||||||
| static inline TADDR GetFrameRestoreBase(PCONTEXT pContextRecord) | ||||||
| { | ||||||
| #if defined(TARGET_ARM) || defined(TARGET_ARM64) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV64) | ||||||
| return GetSP(pContextRecord); | ||||||
| #elif defined(TARGET_X86) | ||||||
| return pContextRecord->Ebp; | ||||||
| #else | ||||||
| PORTABILITY_ASSERT("GetFrameRestoreBase"); | ||||||
| return NULL; | ||||||
| #endif | ||||||
| } | ||||||
|
|
||||||
| #endif // USE_FUNCLET_CALL_HELPER | ||||||
|
|
||||||
| typedef DWORD_PTR (HandlerFn)(UINT_PTR uStackFrame, Object* pExceptionObj); | ||||||
| static UINT_PTR GetEstablisherFrame(REGDISPLAY* pvRegDisplay, ExInfo* exInfo) | ||||||
| { | ||||||
| #ifdef HOST_AMD64 | ||||||
| _ASSERTE(exInfo->m_frameIter.m_crawl.GetRegisterSet() == pvRegDisplay); | ||||||
| if (exInfo->m_frameIter.m_crawl.GetCodeInfo()->HasFrameRegister()) | ||||||
| { | ||||||
| ULONG frameOffset = exInfo->m_frameIter.m_crawl.GetCodeInfo()->GetFrameOffsetFromUnwindInfo(); | ||||||
| return pvRegDisplay->pCurrentContext->Rbp - 16 * frameOffset; | ||||||
| } | ||||||
| else | ||||||
| { | ||||||
| return pvRegDisplay->SP; | ||||||
| } | ||||||
| #elif defined(HOST_ARM64) | ||||||
| return pvRegDisplay->SP; | ||||||
| #elif defined(HOST_ARM) | ||||||
| return pvRegDisplay->SP; | ||||||
| #elif defined(HOST_X86) | ||||||
| return pvRegDisplay->SP; | ||||||
| #elif defined(HOST_RISCV64) | ||||||
| return pvRegDisplay->SP; | ||||||
| #elif defined(HOST_LOONGARCH64) | ||||||
| return pvRegDisplay->SP; | ||||||
| #endif | ||||||
| } | ||||||
|
|
||||||
| #endif // TARGET_WASM | ||||||
|
|
||||||
| // Call catch, finally or filter funclet. | ||||||
| // Return value: | ||||||
| // * Catch funclet: address to resume at after the catch returns | ||||||
| // * Finally funclet: unused | ||||||
| // * Filter funclet: result of the filter funclet (EXCEPTION_CONTINUE_SEARCH (0) or EXCEPTION_EXECUTE_HANDLER (1)) | ||||||
| // | ||||||
| // NOTE: This function must be prevented from calling the actual funclet via a tail call to ensure | ||||||
| // that the m_csfEHClause is really set to what is a SP of the caller frame of the funclet. The | ||||||
| // StackFrameIterator relies on this. | ||||||
| #ifdef _MSC_VER | ||||||
| #pragma optimize("", off) | ||||||
| #else | ||||||
| __attribute__((disable_tail_calls)) | ||||||
| #endif | ||||||
| DWORD_PTR EECodeManager::CallFunclet(OBJECTREF throwable, void* pHandler, REGDISPLAY *pRD, ExInfo *pExInfo, bool isFilterFunclet) | ||||||
| { | ||||||
| DWORD_PTR dwResult = 0; | ||||||
| #ifdef TARGET_WASM | ||||||
| _ASSERTE(!"CallFunclet for WASM not implemented yet"); | ||||||
| #else | ||||||
| HandlerFn* pfnHandler = (HandlerFn*)pHandler; | ||||||
|
|
||||||
| pExInfo->m_csfEHClause = CallerStackFrame((UINT_PTR)GetCurrentSP()); | ||||||
|
||||||
| pExInfo->m_csfEHClause = CallerStackFrame((UINT_PTR)GetCurrentSP()); |
Uh oh!
There was an error while loading. Please reload this page.