diff options
author | Ayke van Laethem <[email protected]> | 2022-12-20 17:13:33 +0100 |
---|---|---|
committer | Ayke <[email protected]> | 2023-01-17 19:32:18 +0100 |
commit | 26b6d0b06d4d0f82a2e60299df149ebeb955e851 (patch) | |
tree | d7b4e7649810109f906d8b752d2e19bf83a5a97f | |
parent | 38252e338fc29c2335f960713a8f38767908f1cc (diff) | |
download | tinygo-26b6d0b06d4d0f82a2e60299df149ebeb955e851.tar.gz tinygo-26b6d0b06d4d0f82a2e60299df149ebeb955e851.zip |
runtime: arm actually has 8-byte alignment
Specification:
https://developer.arm.com/documentation/dui0472/k/C-and-C---Implementation-Details/Basic-data-types-in-ARM-C-and-C--
There are multiple types that have an 8-byte alignment (long long,
double) so we need to use the same maximum alignment in TinyGo.
Fixing this is necessary for the precise GC.
-rw-r--r-- | src/runtime/arch_arm.go | 4 | ||||
-rw-r--r-- | src/runtime/arch_cortexm.go | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/runtime/arch_arm.go b/src/runtime/arch_arm.go index 16d3649bb..1868b7ebd 100644 --- a/src/runtime/arch_arm.go +++ b/src/runtime/arch_arm.go @@ -9,9 +9,9 @@ const TargetBits = 32 const deferExtraRegs = 0 -// Align on word boundary. +// Align on the maximum alignment for this platform (double). func align(ptr uintptr) uintptr { - return (ptr + 3) &^ 3 + return (ptr + 7) &^ 7 } func getCurrentStackPointer() uintptr { diff --git a/src/runtime/arch_cortexm.go b/src/runtime/arch_cortexm.go index 613dfd5fc..45134405c 100644 --- a/src/runtime/arch_cortexm.go +++ b/src/runtime/arch_cortexm.go @@ -15,7 +15,7 @@ const deferExtraRegs = 0 // Align on word boundary. func align(ptr uintptr) uintptr { - return (ptr + 3) &^ 3 + return (ptr + 7) &^ 7 } func getCurrentStackPointer() uintptr { |