summaryrefslogtreecommitdiff
path: root/src/vm/comdelegate.h
diff options
context:
space:
mode:
authorJan Vorlicek <janvorli@microsoft.com>2018-08-23 02:42:43 +0200
committerGitHub <noreply@github.com>2018-08-23 02:42:43 +0200
commit8cd4b39a42c1c7cf37502357e6a4cb2888f5dfd7 (patch)
treea767facb00becfc9b6b9f0c3a8d731e566e3d1c3 /src/vm/comdelegate.h
parent8013a4b6786d9e6618f8ed36bd0a473aa17b72aa (diff)
downloadcoreclr-8cd4b39a42c1c7cf37502357e6a4cb2888f5dfd7.tar.gz
coreclr-8cd4b39a42c1c7cf37502357e6a4cb2888f5dfd7.tar.bz2
coreclr-8cd4b39a42c1c7cf37502357e6a4cb2888f5dfd7.zip
Enable unloading of AssemblyLoadContext (#18476)
Enable assembly unloading * Allow PInvoke methods on collectible assemblies * Fix test unloadability Several hundreds of tests were using Helper class that created GCHandle, but never freed it. That prevented unloading of those tests. The change modifies the Helper class to keep the handle in a finalizable object. Several GCHandle related tests were not freeing the GCHandle they allocated, so this change adds freeing them to enable the unloading. * Add missing error messages to the resources * Fix shuffle thunk cache for unloadability * Add GetLoaderAllocator to ICLRPrivBinder
Diffstat (limited to 'src/vm/comdelegate.h')
-rw-r--r--src/vm/comdelegate.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/vm/comdelegate.h b/src/vm/comdelegate.h
index 1f6d10b907..5877b48185 100644
--- a/src/vm/comdelegate.h
+++ b/src/vm/comdelegate.h
@@ -224,4 +224,53 @@ struct ShuffleEntry
#include <poppack.h>
+class ShuffleThunkCache : public StubCacheBase
+{
+public:
+ ShuffleThunkCache(LoaderHeap* heap) : StubCacheBase(heap)
+ {
+ }
+private:
+ //---------------------------------------------------------
+ // Compile a static delegate shufflethunk. Always returns
+ // STANDALONE since we don't interpret these things.
+ //---------------------------------------------------------
+ virtual void CompileStub(const BYTE *pRawStub,
+ StubLinker *pstublinker)
+ {
+ STANDARD_VM_CONTRACT;
+
+ ((CPUSTUBLINKER*)pstublinker)->EmitShuffleThunk((ShuffleEntry*)pRawStub);
+ }
+
+ //---------------------------------------------------------
+ // Tells the StubCacheBase the length of a ShuffleEntryArray.
+ //---------------------------------------------------------
+ virtual UINT Length(const BYTE *pRawStub)
+ {
+ LIMITED_METHOD_CONTRACT;
+ ShuffleEntry *pse = (ShuffleEntry*)pRawStub;
+ while (pse->srcofs != ShuffleEntry::SENTINEL)
+ {
+ pse++;
+ }
+ return sizeof(ShuffleEntry) * (UINT)(1 + (pse - (ShuffleEntry*)pRawStub));
+ }
+
+ virtual void AddStub(const BYTE* pRawStub, Stub* pNewStub)
+ {
+ CONTRACTL
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ MODE_ANY;
+ }
+ CONTRACTL_END;
+
+#ifndef CROSSGEN_COMPILE
+ DelegateInvokeStubManager::g_pManager->AddStub(pNewStub);
+#endif
+ }
+};
+
#endif // _COMDELEGATE_H_