On Wed, Nov 4, 2020 at 9:36 AM [email protected] <[email protected]> wrote:
> I got it, the code is here > https://github.com/golang/go/blob/633f9e206045176a12c301eb2c249c1c1d9a5d2e/src/cmd/compile/internal/gc/pgen.go#L186 > , > I don't know why the slot is required to be aligned at least 8 bytes on > these architectures. I will try to see if this requirement can be removed > on linux/arm64, > and to determine the slot size based on the actual size of the variable, > just like linux/amd64 does. > > If my memory serves (and it is spotty, you should definitely look it up) arm64 requires sp to be 16-byte aligned (or two times the word size to be precise), and this is a hardware requirement if accessing memory. There might be other reasons to want aligned access pertaining to atomicity guarantees and memory models. If the garbage collector assumes certain things about memory access when it is doing its unspeakable things to the stack, you may want it to have alignment to ensure certain operations behave nicely. Tread carefully, my friend. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAGrdgiVyRQiZ_z8snW-FBSgdPrA3a4c9qkOQFFQ-qD_ASkQQ%2BQ%40mail.gmail.com.
