From 98080f4771064b6971edaf1f14f2615651cf1d53 Mon Sep 17 00:00:00 2001 From: Colin Robertson Date: Thu, 28 Mar 2019 12:50:49 -0700 Subject: [PATCH 1/2] Update return values per Pratap --- docs/build/arm64-windows-abi-conventions.md | 24 ++++++++------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/docs/build/arm64-windows-abi-conventions.md b/docs/build/arm64-windows-abi-conventions.md index 55fcae7b4cd..e8eb9707ecc 100644 --- a/docs/build/arm64-windows-abi-conventions.md +++ b/docs/build/arm64-windows-abi-conventions.md @@ -181,27 +181,21 @@ Integral values are returned in x0. Floating-point values are returned in s0/d0/v0 as appropriate. -Types returned by value are handled differently depending on whether they have certain properties. +Types returned by value are handled differently depending on whether they have certain properties. Types which have all of these properties, -Types are given a "C" return style if they are aggregate by the C++14 standard definition. That is, - -- they have no user-provided constructors, no private or protected non-static data members, no base classes, and no virtual functions, +- they're *aggregate* by the C++14 standard definition, that is, they have no user-provided constructors, no private or protected non-static data members, no base classes, and no virtual functions, and - they have a trivial copy constructor, and -- they have a trivial destructor. - -All other types are given a "C++" return style. - -### C return style - -Types less than or equal to 8 bytes are returned in x0. +- they have a trivial destructor, -Types less than or equal to 16 bytes are returned in x0 and x1, with x0 containing the lower-order 8 bytes. +use the following return style: -For types greater than 16 bytes, the caller shall reserve a block of memory of sufficient size and alignment to hold the result. The address of the memory block shall be passed as an additional argument to the function in x8. The callee may modify the result memory block at any point during the execution of the subroutine. The callee isn't required to preserve the value stored in x8. +- Types less than or equal to 8 bytes are returned in x0. +- Types less than or equal to 16 bytes are returned in x0 and x1, with x0 containing the lower-order 8 bytes. +- For types greater than 16 bytes, the caller shall reserve a block of memory of sufficient size and alignment to hold the result. The address of the memory block shall be passed as an additional argument to the function in x8. The callee may modify the result memory block at any point during the execution of the subroutine. The callee isn't required to preserve the value stored in x8. -### C++ return style +All other types use this convention: -The caller shall reserve a block of memory of sufficient size and alignment to hold the result. The address of the memory block shall be passed as an additional argument to the function in x0, or x1 if $this is passed in x0. The callee may modify the result memory block at any point during the execution of the subroutine. The callee returns the address of the memory block in x0. +- The caller shall reserve a block of memory of sufficient size and alignment to hold the result. The address of the memory block shall be passed as an additional argument to the function in x0, or x1 if $this is passed in x0. The callee may modify the result memory block at any point during the execution of the subroutine. The callee returns the address of the memory block in x0. ## Stack From 4d912068d01e046ee821ad13e560b45766ca0eb0 Mon Sep 17 00:00:00 2001 From: Colin Robertson Date: Thu, 28 Mar 2019 16:06:03 -0700 Subject: [PATCH 2/2] Tweak ARM64 definition of types returned --- docs/build/arm64-windows-abi-conventions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build/arm64-windows-abi-conventions.md b/docs/build/arm64-windows-abi-conventions.md index e8eb9707ecc..4f5ccbedaf6 100644 --- a/docs/build/arm64-windows-abi-conventions.md +++ b/docs/build/arm64-windows-abi-conventions.md @@ -184,7 +184,7 @@ Floating-point values are returned in s0/d0/v0 as appropriate. Types returned by value are handled differently depending on whether they have certain properties. Types which have all of these properties, - they're *aggregate* by the C++14 standard definition, that is, they have no user-provided constructors, no private or protected non-static data members, no base classes, and no virtual functions, and -- they have a trivial copy constructor, and +- they have a trivial copy-assignment operator, and - they have a trivial destructor, use the following return style: