Skip to content

Commit

Permalink
Reorganize protection flipping (#48118)
Browse files Browse the repository at this point in the history
Get rid of explicit protection change to RW
  • Loading branch information
janvorli authored Feb 10, 2021
1 parent 9962cfd commit 8176a2b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 17 deletions.
9 changes: 5 additions & 4 deletions src/coreclr/vm/dllimportcallback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,6 @@ PCODE TheUMEntryPrestubWorker(UMEntryThunk * pUMEntryThunk)
if (pThread->IsAbortRequested())
pThread->HandleThreadAbort();

#if defined(HOST_OSX) && defined(HOST_ARM64)
auto jitWriteEnableHolder = PAL_JITWriteEnable(true);
#endif // defined(HOST_OSX) && defined(HOST_ARM64)

UMEntryThunk::DoRunTimeInit(pUMEntryThunk);

return (PCODE)pUMEntryThunk->GetCode();
Expand Down Expand Up @@ -288,6 +284,11 @@ void STDCALL UMEntryThunk::DoRunTimeInit(UMEntryThunk* pUMEntryThunk)

{
GCX_PREEMP();

#if defined(HOST_OSX) && defined(HOST_ARM64)
auto jitWriteEnableHolder = PAL_JITWriteEnable(true);
#endif // defined(HOST_OSX) && defined(HOST_ARM64)

pUMEntryThunk->RunTimeInit();
}

Expand Down
8 changes: 0 additions & 8 deletions src/coreclr/vm/exceptionhandling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3312,10 +3312,6 @@ DWORD_PTR ExceptionTracker::CallHandler(
break;
}

#if defined(HOST_OSX) && defined(HOST_ARM64)
auto jitWriteEnableHolder = PAL_JITWriteEnable(false);
#endif // defined(HOST_OSX) && defined(HOST_ARM64)

#ifdef USE_FUNCLET_CALL_HELPER
// Invoke the funclet. We pass throwable only when invoking the catch block.
// Since the actual caller of the funclet is the assembly helper, pass the reference
Expand Down Expand Up @@ -3952,10 +3948,6 @@ void ExceptionTracker::ResumeExecution(
EH_LOG((LL_INFO100, "resuming execution at 0x%p\n", GetIP(pContextRecord)));
EH_LOG((LL_INFO100, "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n"));

#if defined(HOST_OSX) && defined(HOST_ARM64)
auto jitWriteEnableHolder = PAL_JITWriteEnable(false);
#endif // defined(HOST_OSX) && defined(HOST_ARM64)

RtlRestoreContext(pContextRecord, pExceptionRecord);

UNREACHABLE();
Expand Down
12 changes: 7 additions & 5 deletions src/coreclr/vm/prestub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1921,10 +1921,6 @@ extern "C" PCODE STDCALL PreStubWorker(TransitionBlock* pTransitionBlock, Method

ETWOnStartup(PrestubWorker_V1, PrestubWorkerEnd_V1);

#if defined(HOST_OSX) && defined(HOST_ARM64)
auto jitWriteEnableHolder = PAL_JITWriteEnable(true);
#endif // defined(HOST_OSX) && defined(HOST_ARM64)

MAKE_CURRENT_THREAD_AVAILABLE();

// Attempt to check what GC mode we are running under.
Expand Down Expand Up @@ -1994,7 +1990,13 @@ extern "C" PCODE STDCALL PreStubWorker(TransitionBlock* pTransitionBlock, Method
}

GCX_PREEMP_THREAD_EXISTS(CURRENT_THREAD);
pbRetVal = pMD->DoPrestub(pDispatchingMT, CallerGCMode::Coop);
{
#if defined(HOST_OSX) && defined(HOST_ARM64)
auto jitWriteEnableHolder = PAL_JITWriteEnable(true);
#endif // defined(HOST_OSX) && defined(HOST_ARM64)

pbRetVal = pMD->DoPrestub(pDispatchingMT, CallerGCMode::Coop);
}

UNINSTALL_UNWIND_AND_CONTINUE_HANDLER;
UNINSTALL_MANAGED_EXCEPTION_DISPATCHER;
Expand Down

0 comments on commit 8176a2b

Please sign in to comment.