You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Delete MethodDescCallSite, CallDescrWorker and their argument-copying, return-value, architecture assembly, build, and EH identification closure after the reflection, custom-attribute, and func-eval migrations. Remove orphaned multicore-JIT diagnostic state and update VM-to-managed calling documentation. Preserve live field-access helpers, typed UCO calls, GC argument reporting, and calling-convention traits.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/design/coreclr/botr/corelib.md
+19-15Lines changed: 19 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -296,31 +296,35 @@ Then, you can use the `REF<T>` template to create a type name like `SAFEHANDLERE
296
296
297
297
# Calling into managed code from unmanaged code
298
298
299
-
Clearly there are places where the CLR must call into managed code from native. For this purpose, we have added a `MethodDescCallSite` class to handle a lot of plumbing for you. Conceptually, all you need to do is find the `MethodDesc*` for the method you want to call, find a managed object for the "this" pointer (if you're calling an instance method), pass in an array of arguments, and deal with the return value. Internally, you'll need to potentially toggle your thread's state to allow the GC to run in preemptive mode, etc.
299
+
The VM calls CoreLib methods marked `[UnmanagedCallersOnly]` through `UnmanagedCallersOnlyCaller`. The binder identifies the entrypoint, and the helper transitions to preemptive GC mode before calling it through the platform's unmanaged ABI. The caller must keep managed references GC-protected and pass their addresses to the managed entrypoint. Instance or virtual dispatch is performed in a managed wrapper rather than by constructing a native argument stack.
300
300
301
-
Here's a simplified example. Note how this instance uses the binder described in the previous section to call `SafeHandle`'s virtual `ReleaseHandle` method.
301
+
The `InvokeThrowing` variants append an exception-handle argument. The managed entrypoint catches exceptions and stores them through that argument; the native helper rethrows them after returning. For example, `Exception.CreateTargetInvocationException` returns its newly allocated object through an output argument:
CONFIG_DWORD_INFO(INTERNAL_ActivatePatchSkip, W("ActivatePatchSkip"), 0, "Allows an assert when ActivatePatchSkip is called")
730
730
CONFIG_DWORD_INFO(INTERNAL_AlwaysUseMetadataInterfaceMapLayout, W("AlwaysUseMetadataInterfaceMapLayout"), 0, "Used for debugging generic interface map layout.")
731
-
CONFIG_DWORD_INFO(INTERNAL_AssertOnUnneededThis, W("AssertOnUnneededThis"), 0, "While the ConfigDWORD is unnecessary, the contained ASSERT should be kept. This may result in some work tracking down violating MethodDescCallSites.")
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_DisableConfigCache, W("DisableConfigCache"), 0, "Used to disable the \"probabilistic\" config cache, which walks through the appropriate config registry keys on init and probabilistically keeps track of which exist.")
734
733
CONFIG_STRING_INFO(INTERNAL_DumpOnClassLoad, W("DumpOnClassLoad"), "Dumps information about loaded class to log.")
0 commit comments