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
Copy file name to clipboardExpand all lines: docs/design/coreclr/botr/clr-abi.md
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -537,6 +537,22 @@ The extra state created by the JIT for synchronized methods (lock taken flag) mu
537
537
538
538
EnC is supported for adding and editing generic methods and methods on generic types and generic methods on non-generic types.
539
539
540
+
# Portable entrypoints
541
+
542
+
On platforms that allow dynamic code generation, the runtime abstracts away execution strategies for dynamically loaded methods by allocating [`Precode`](method-descriptor.md#precode)s. The `Precode` is a small code fragment that is used as a temporary method entrypoint until the actual method code is acquired. `Precode`s are also used as part of the execution for methods that do not have regular JITed or AOT-compiled code, for example stubs or interpreted methods. `Precode`s allow native code to use the same native code calling convention irrespective of the execution strategy used by the target method.
543
+
544
+
On platforms that do not allow dynamic code generation (Wasm), the runtime abstracts away execution strategies by allocating portable entrypoints for dynamically loaded methods. The `PortableEntryPoint` is a data structure that allows efficient transition to the desired execution strategy for the target method. When the runtime is configured to use portable entrypoints, the managed calling convention is modified as follows:
545
+
546
+
- The native code to call is obtained by dereferencing the entrypoint
547
+
548
+
- The entrypoint address is passed in as an extra last hidden argument. The extra hidden argument must be present in signatures of all methods. It is unused by the code of JITed or AOT-compiled methods.
549
+
550
+
Pseudo code for a call with portable entrypoints:
551
+
552
+
> `(*(void**)pfn)(arg0, arg1, ..., argN, pfn)`
553
+
554
+
Portable entrypoints are used for Wasm with interpreter only currently. Note that portable entrypoints are unnecessary for Wasm with native AOT since native AOT does not support dynamic loading.
555
+
540
556
# System V x86_64 support
541
557
542
558
This section relates mostly to calling conventions on System V systems (such as Ubuntu Linux and Mac OS X).
0 commit comments