←back to thread

Show HN: Go Plan9 Memo

(pehringer.info)
302 points pehringer | 1 comments | | HN request time: 0s | source

A quick dive into the Plan9 assembly I picked up while developing my SIMD package for Go, and how it led to a 450% performance boost in calculations.
Show context
joeegan2202 ◴[] No.41880998[source]
A couple points on Go assembly:

1. On amd64 those ints are actually 64bit. If you used int32 then they would be be word aligned in the parameter list. However, there is a gotcha with that. The return values will always start at a dword aligned offset on 64bit system.

2. NOSPLIT is defined in "textflag.h" which Go's compiler automatically provides. However, NOSPLIT is, from everything I've read, only respected on runtime.XX functions, so it's not doing anything there, and it's also not necessary. NOSPLIT tells the compiler not to insert code to check if the stack needs to split because it's going to overflow, which is technically unnecessary if the function doesn't need any stack space. It's basically only there on the function that checks for stack splits, to prevent that code from being injected into itself.

replies(1): >>41881052 #
pehringer ◴[] No.41881052[source]
Thank you for the explanation! That makes a lot more sense :)
replies(1): >>41891316 #
1. ◴[] No.41891316[source]