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
+2-6
Original file line number
Diff line number
Diff line change
@@ -108,9 +108,7 @@ Passing/returning structs according to hardware floating-point calling conventio
108
108
109
109
## Return buffers
110
110
111
-
The same applies to some return buffers. See `MethodTable::IsStructRequiringStackAllocRetBuf()`. When that returns `false`, the return buffer might be on the heap, either due to reflection/remoting code paths mentioned previously or due to a JIT optimization where a call with a return buffer that then assigns to a field (on the GC heap) are changed into passing the field reference as the return buffer. Conversely, when it returns true, the JIT does not need to use a write barrier when storing to the return buffer, but it is still not guaranteed to be a compiler temp, and as such the JIT should not introduce spurious writes to the return buffer.
112
-
113
-
NOTE: This optimization is now disabled for all platforms (`IsStructRequiringStackAllocRetBuf()` always returns `false`).
111
+
Since .NET 10, return buffers must always be allocated on the stack by the caller. After the call, the caller is responsible for copying the return buffer to the final destination using write barriers if necessary. The JIT can assume that the return buffer is always on the stack and may optimize accordingly, such as by omitting write barriers when writing GC pointers to the return buffer. In addition, the buffer is allowed to be used for temporary storage within the method since its content must not be aliased or cross-thread visible.
114
112
115
113
ARM64-only: When a method returns a structure that is larger than 16 bytes the caller reserves a return buffer of sufficient size and alignment to hold the result. The address of the buffer is passed as an argument to the method in `R8` (defined in the JIT as `REG_ARG_RET_BUFF`). The callee isn't required to preserve the value stored in `R8`.
116
114
@@ -778,9 +776,7 @@ The return value is handled as follows:
778
776
1. Floating-point values are returned on the top of the hardware FP stack.
779
777
2. Integers up to 32 bits long are returned in EAX.
780
778
3. 64-bit integers are passed with EAX holding the least significant 32 bits and EDX holding the most significant 32 bits.
781
-
4. All other cases require the use of a return buffer, through which the value is returned.
782
-
783
-
In addition, there is a guarantee that if a return buffer is used a value is stored there only upon ordinary exit from the method. The buffer is not allowed to be used for temporary storage within the method and its contents will be unaltered if an exception occurs while executing the method.
779
+
4. All other cases require the use of a return buffer, through which the value is returned. See [Return buffers](#return-buffers).
// If you update this, ensure you run `git grep MINIMUM_READYTORUN_MAJOR_VERSION`
21
21
// and handle pending work.
22
-
#defineREADYTORUN_MAJOR_VERSION11
22
+
#defineREADYTORUN_MAJOR_VERSION12
23
23
#defineREADYTORUN_MINOR_VERSION 0x0000
24
24
25
-
#defineMINIMUM_READYTORUN_MAJOR_VERSION11
25
+
#defineMINIMUM_READYTORUN_MAJOR_VERSION12
26
26
27
27
// R2R Version 2.1 adds the InliningInfo section
28
28
// R2R Version 2.2 adds the ProfileDataInfo section
@@ -39,6 +39,7 @@
39
39
// R2R Version 10.0 adds support for the statics being allocated on a per type basis instead of on a per module basis, disable support for LogMethodEnter helper
40
40
// R2R Version 10.1 adds Unbox_TypeTest helper
41
41
// R2R Version 11 uses GCInfo v4, which encodes safe points without -1 offset and does not track return kinds in GCInfo
42
+
// R2R Version 12 requires all return buffers to be always on the stack
0 commit comments