summaryrefslogtreecommitdiff
path: root/packaging/0003-dllimportcallback-remove-code-for-CallbackOnCollecte.patch
blob: f7b650569ff918ac6dcee8b7c4650b8d4372fd64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
From 7244ba7107daea201faac0b6c71b545d77fbcb57 Mon Sep 17 00:00:00 2001
From: Konstantin Baladurin <k.baladurin@partner.samsung.com>
Date: Fri, 12 Jan 2018 11:46:48 +0300
Subject: [PATCH 03/47] dllimportcallback: remove code for
 CallbackOnCollectedDelegate MDA

---
 src/vm/dllimportcallback.cpp | 71 --------------------------------------------
 src/vm/dllimportcallback.h   | 19 ------------
 2 files changed, 90 deletions(-)

diff --git a/src/vm/dllimportcallback.cpp b/src/vm/dllimportcallback.cpp
index fe03f47..8623d46 100644
--- a/src/vm/dllimportcallback.cpp
+++ b/src/vm/dllimportcallback.cpp
@@ -112,34 +112,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
@@ -412,25 +384,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);
 
@@ -1217,30 +1170,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();
 }
 
diff --git a/src/vm/dllimportcallback.h b/src/vm/dllimportcallback.h
index d820a76..555b737 100644
--- a/src/vm/dllimportcallback.h
+++ b/src/vm/dllimportcallback.h
@@ -424,13 +424,7 @@ public:
             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;
     
@@ -503,15 +497,6 @@ public:
 
     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:
@@ -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__
-- 
2.7.4