summaryrefslogtreecommitdiff
path: root/src/vm/method.cpp
diff options
context:
space:
mode:
authorMorgan Brown <morganbr@users.noreply.github.com>2018-08-28 17:29:40 -0700
committerGitHub <noreply@github.com>2018-08-28 17:29:40 -0700
commit246ae784b826c79098a1b3967083c66187786197 (patch)
tree67b21a573bb1d89ba446f8a5bf38d077d35bed1e /src/vm/method.cpp
parent68a1167f6d12ca10ce6ce6ec9d3951e59912e4ce (diff)
downloadcoreclr-246ae784b826c79098a1b3967083c66187786197.tar.gz
coreclr-246ae784b826c79098a1b3967083c66187786197.tar.bz2
coreclr-246ae784b826c79098a1b3967083c66187786197.zip
Enable mixed mode assembly loading (#19542)
Bring back functionality for loading IJW assemblies and calling managed->native. Also add workaround to test case for the C++ compiler inserting calls to mscoree.
Diffstat (limited to 'src/vm/method.cpp')
-rw-r--r--src/vm/method.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/vm/method.cpp b/src/vm/method.cpp
index bcc11e85ff..2890c34fb7 100644
--- a/src/vm/method.cpp
+++ b/src/vm/method.cpp
@@ -5048,6 +5048,37 @@ LPVOID NDirectMethodDesc::FindEntryPoint(HINSTANCE hMod) const
}
#endif // CROSSGEN_COMPILE
+#if !defined(CROSSGEN_COMPILE)
+//*******************************************************************************
+void NDirectMethodDesc::InitEarlyBoundNDirectTarget()
+{
+ CONTRACTL
+ {
+ THROWS;
+ GC_TRIGGERS;
+ INJECT_FAULT(COMPlusThrowOM(););
+ }
+ CONTRACTL_END
+
+ _ASSERTE(IsEarlyBound());
+
+ if (IsClassConstructorTriggeredAtLinkTime())
+ {
+ GetMethodTable()->CheckRunClassInitThrowing();
+ }
+
+ const void *target = GetModule()->GetInternalPInvokeTarget(GetRVA());
+ _ASSERTE(target != 0);
+
+ if (HeuristicDoesThisLookLikeAGetLastErrorCall((LPBYTE)target))
+ target = (BYTE*)FalseGetLastError;
+
+ // As long as we've set the NDirect target field we don't need to backpatch the import thunk glue.
+ // All NDirect calls all through the NDirect target, so if it's updated, then we won't go into
+ // NDirectImportThunk(). In fact, backpatching the import thunk glue leads to race conditions.
+ SetNDirectTarget((LPVOID)target);
+}
+#endif // !CROSSGEN_COMPILE
//*******************************************************************************
void MethodDesc::ComputeSuppressUnmanagedCodeAccessAttr(IMDInternalImport *pImport)