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

Commit 757f7a8

Browse files
author
Konstantin Baladurin
committed
dllimportcallback: remove code for CallbackOnCollectedDelegate MDA
1 parent a7c9712 commit 757f7a8

File tree

2 files changed

+0
-90
lines changed

2 files changed

+0
-90
lines changed

src/vm/dllimportcallback.cpp

-71
Original file line numberDiff line numberDiff line change
@@ -111,34 +111,6 @@ EXTERN_C void STDCALL UM2MThunk_WrapperHelper(void *pThunkArgs,
111111
UMEntryThunk *pEntryThunk,
112112
Thread *pThread);
113113

114-
#ifdef MDA_SUPPORTED
115-
EXTERN_C void __fastcall CallbackOnCollectedDelegateHelper(UMEntryThunk *pEntryThunk)
116-
{
117-
CONTRACTL
118-
{
119-
THROWS;
120-
GC_TRIGGERS;
121-
MODE_COOPERATIVE;
122-
SO_TOLERANT;
123-
PRECONDITION(CheckPointer(pEntryThunk));
124-
}
125-
CONTRACTL_END;
126-
127-
MdaCallbackOnCollectedDelegate* pProbe = MDA_GET_ASSISTANT(CallbackOnCollectedDelegate);
128-
129-
// This MDA must be active if we generated a call to CallbackOnCollectedDelegateHelper
130-
_ASSERTE(pProbe);
131-
132-
if (pEntryThunk->IsCollected())
133-
{
134-
INSTALL_UNWIND_AND_CONTINUE_HANDLER;
135-
pProbe->ReportViolation(pEntryThunk->GetMethod());
136-
COMPlusThrow(kNullReferenceException);
137-
UNINSTALL_UNWIND_AND_CONTINUE_HANDLER;
138-
}
139-
}
140-
#endif // MDA_SUPPORTED
141-
142114
// This is used as target of callback from DoADCallBack. It sets up the environment and effectively
143115
// calls back into the thunk that needed to switch ADs.
144116
void UM2MThunk_Wrapper(LPVOID ptr) // UM2MThunk_Args
@@ -411,25 +383,6 @@ VOID UMEntryThunk::CompileUMThunkWorker(UMThunkStubInfo *pInfo,
411383
// would deadlock).
412384
pcpusl->EmitLabel(pDoADCallBackStartLabel);
413385

414-
415-
#ifdef MDA_SUPPORTED
416-
if ((pInfo->m_wFlags & umtmlSkipStub) && !(pInfo->m_wFlags & umtmlIsStatic) &&
417-
MDA_GET_ASSISTANT(CallbackOnCollectedDelegate))
418-
{
419-
// save registers
420-
pcpusl->X86EmitPushReg(kEAXentryThunk);
421-
pcpusl->X86EmitPushReg(kECXthread);
422-
423-
// CallbackOnCollectedDelegateHelper is a fast call
424-
pcpusl->X86EmitMovRegReg(kECX, kEAXentryThunk);
425-
pcpusl->X86EmitCall(pcpusl->NewExternalCodeLabel((LPVOID)CallbackOnCollectedDelegateHelper), 0);
426-
427-
// restore registers
428-
pcpusl->X86EmitPopReg(kECXthread);
429-
pcpusl->X86EmitPopReg(kEAXentryThunk);
430-
}
431-
#endif
432-
433386
// save the thread pointer
434387
pcpusl->X86EmitPushReg(kECXthread);
435388

@@ -1216,30 +1169,6 @@ VOID UMEntryThunk::FreeUMEntryThunk(UMEntryThunk* p)
12161169
}
12171170
CONTRACTL_END;
12181171

1219-
#ifdef MDA_SUPPORTED
1220-
MdaCallbackOnCollectedDelegate* pProbe = MDA_GET_ASSISTANT(CallbackOnCollectedDelegate);
1221-
if (pProbe)
1222-
{
1223-
if (p->GetObjectHandle())
1224-
{
1225-
DestroyLongWeakHandle(p->GetObjectHandle());
1226-
p->m_pObjectHandle = NULL;
1227-
1228-
// We are intentionally not reseting m_pManagedTarget here so that
1229-
// it is available for diagnostics of call on collected delegate crashes.
1230-
}
1231-
else
1232-
{
1233-
p->m_pManagedTarget = NULL;
1234-
}
1235-
1236-
// Add this to the array of delegates to be cleaned up.
1237-
pProbe->AddToList(p);
1238-
1239-
return;
1240-
}
1241-
#endif
1242-
12431172
p->Terminate();
12441173
}
12451174

src/vm/dllimportcallback.h

-19
Original file line numberDiff line numberDiff line change
@@ -424,13 +424,7 @@ class UMEntryThunk
424424
MODE_ANY;
425425
SUPPORTS_DAC;
426426
PRECONDITION(m_state == kRunTimeInited || m_state == kLoadTimeInited);
427-
#ifdef MDA_SUPPORTED
428-
// We can return NULL here if the CollectedDelegate probe is on because
429-
// a collected delegate will have set this field to NULL.
430-
POSTCONDITION(g_pDebugInterface->ThisIsHelperThread() || MDA_GET_ASSISTANT(CallbackOnCollectedDelegate) || CheckPointer(RETVAL));
431-
#else
432427
POSTCONDITION(CheckPointer(RETVAL));
433-
#endif
434428
}
435429
CONTRACT_END;
436430

@@ -503,15 +497,6 @@ class UMEntryThunk
503497

504498
static UMEntryThunk* Decode(LPVOID pCallback);
505499

506-
#ifdef MDA_SUPPORTED
507-
BOOL IsCollected() const
508-
{
509-
LIMITED_METHOD_CONTRACT;
510-
_ASSERTE(m_pMD != NULL && m_pMD->IsEEImpl());
511-
return m_pObjectHandle == NULL;
512-
}
513-
#endif
514-
515500
static VOID __fastcall ReportViolation(UMEntryThunk* p);
516501

517502
private:
@@ -613,8 +598,4 @@ EXTERN_C void UMThunkStub(void);
613598
void STDCALL LogUMTransition(UMEntryThunk* thunk);
614599
#endif
615600

616-
#ifdef MDA_SUPPORTED
617-
EXTERN_C void __fastcall CallbackOnCollectedDelegateHelper(UMEntryThunk *pEntryThunk);
618-
#endif // MDA_SUPPORTED
619-
620601
#endif //__dllimportcallback_h__

0 commit comments

Comments
 (0)