How to store Go pointers from assembly

42 pdziepak 6 6/23/2025, 12:40:24 PM mazzo.li ↗

Comments (6)

jasonthorsness · 1h ago
Go assembler is such a strange inclusion - I guess the idea is it lets you do low-level routines without requiring CGO?
Thaxll · 42m ago
It's heavily used where you need performance, for example crypto.

https://go.dev/wiki/AssemblyPolicy

https://github.com/golang/go/tree/master/src/crypto/internal...

nasretdinov · 23m ago
My understanding is that for crypto specifically it constant-time algorithms matter due to security implications, and those are only available when you use specific branchless assembly instructions, so it's not just performance
nu11ptr · 55m ago
That is my understanding. It lets you bypass CGo overhead, but I'd be lying if I said I fully understood it.
cyberax · 16m ago
Remember that Go actually compiles the code to machine code directly, so it needs to have an assembler for its compiler. And if you have it, then why not make it available?
pjmlp · 54m ago
Not really, having an Assembler around has been quite common in compiled languages, before the rise of scripting languages in the 2000's.

For all my complaints about Go's design, that is certainly one that I appreciate.