Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
dllimportcallback: remove code for CallbackOnCollectedDelegate MDA
Browse files Browse the repository at this point in the history
  • Loading branch information
Konstantin Baladurin committed Jan 12, 2018
1 parent a7c9712 commit 757f7a8
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 90 deletions.
71 changes: 0 additions & 71 deletions src/vm/dllimportcallback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,34 +111,6 @@ EXTERN_C void STDCALL UM2MThunk_WrapperHelper(void *pThunkArgs,
UMEntryThunk *pEntryThunk,
Thread *pThread);

#ifdef MDA_SUPPORTED
EXTERN_C void __fastcall CallbackOnCollectedDelegateHelper(UMEntryThunk *pEntryThunk)
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
MODE_COOPERATIVE;
SO_TOLERANT;
PRECONDITION(CheckPointer(pEntryThunk));
}
CONTRACTL_END;

MdaCallbackOnCollectedDelegate* pProbe = MDA_GET_ASSISTANT(CallbackOnCollectedDelegate);

// This MDA must be active if we generated a call to CallbackOnCollectedDelegateHelper
_ASSERTE(pProbe);

if (pEntryThunk->IsCollected())
{
INSTALL_UNWIND_AND_CONTINUE_HANDLER;
pProbe->ReportViolation(pEntryThunk->GetMethod());
COMPlusThrow(kNullReferenceException);
UNINSTALL_UNWIND_AND_CONTINUE_HANDLER;
}
}
#endif // MDA_SUPPORTED

// This is used as target of callback from DoADCallBack. It sets up the environment and effectively
// calls back into the thunk that needed to switch ADs.
void UM2MThunk_Wrapper(LPVOID ptr) // UM2MThunk_Args
Expand Down Expand Up @@ -411,25 +383,6 @@ VOID UMEntryThunk::CompileUMThunkWorker(UMThunkStubInfo *pInfo,
// would deadlock).
pcpusl->EmitLabel(pDoADCallBackStartLabel);


#ifdef MDA_SUPPORTED
if ((pInfo->m_wFlags & umtmlSkipStub) && !(pInfo->m_wFlags & umtmlIsStatic) &&
MDA_GET_ASSISTANT(CallbackOnCollectedDelegate))
{
// save registers
pcpusl->X86EmitPushReg(kEAXentryThunk);
pcpusl->X86EmitPushReg(kECXthread);

// CallbackOnCollectedDelegateHelper is a fast call
pcpusl->X86EmitMovRegReg(kECX, kEAXentryThunk);
pcpusl->X86EmitCall(pcpusl->NewExternalCodeLabel((LPVOID)CallbackOnCollectedDelegateHelper), 0);

// restore registers
pcpusl->X86EmitPopReg(kECXthread);
pcpusl->X86EmitPopReg(kEAXentryThunk);
}
#endif

// save the thread pointer
pcpusl->X86EmitPushReg(kECXthread);

Expand Down Expand Up @@ -1216,30 +1169,6 @@ VOID UMEntryThunk::FreeUMEntryThunk(UMEntryThunk* p)
}
CONTRACTL_END;

#ifdef MDA_SUPPORTED
MdaCallbackOnCollectedDelegate* pProbe = MDA_GET_ASSISTANT(CallbackOnCollectedDelegate);
if (pProbe)
{
if (p->GetObjectHandle())
{
DestroyLongWeakHandle(p->GetObjectHandle());
p->m_pObjectHandle = NULL;

// We are intentionally not reseting m_pManagedTarget here so that
// it is available for diagnostics of call on collected delegate crashes.
}
else
{
p->m_pManagedTarget = NULL;
}

// Add this to the array of delegates to be cleaned up.
pProbe->AddToList(p);

return;
}
#endif

p->Terminate();
}

Expand Down
19 changes: 0 additions & 19 deletions src/vm/dllimportcallback.h
Original file line number Diff line number Diff line change
Expand Up @@ -424,13 +424,7 @@ class UMEntryThunk
MODE_ANY;
SUPPORTS_DAC;
PRECONDITION(m_state == kRunTimeInited || m_state == kLoadTimeInited);
#ifdef MDA_SUPPORTED
// We can return NULL here if the CollectedDelegate probe is on because
// a collected delegate will have set this field to NULL.
POSTCONDITION(g_pDebugInterface->ThisIsHelperThread() || MDA_GET_ASSISTANT(CallbackOnCollectedDelegate) || CheckPointer(RETVAL));
#else
POSTCONDITION(CheckPointer(RETVAL));
#endif
}
CONTRACT_END;

Expand Down Expand Up @@ -503,15 +497,6 @@ class UMEntryThunk

static UMEntryThunk* Decode(LPVOID pCallback);

#ifdef MDA_SUPPORTED
BOOL IsCollected() const
{
LIMITED_METHOD_CONTRACT;
_ASSERTE(m_pMD != NULL && m_pMD->IsEEImpl());
return m_pObjectHandle == NULL;
}
#endif

static VOID __fastcall ReportViolation(UMEntryThunk* p);

private:
Expand Down Expand Up @@ -613,8 +598,4 @@ EXTERN_C void UMThunkStub(void);
void STDCALL LogUMTransition(UMEntryThunk* thunk);
#endif

#ifdef MDA_SUPPORTED
EXTERN_C void __fastcall CallbackOnCollectedDelegateHelper(UMEntryThunk *pEntryThunk);
#endif // MDA_SUPPORTED

#endif //__dllimportcallback_h__

0 comments on commit 757f7a8

Please sign in to comment.