3 ms·
Segmented stacks in Go went away in Go 1.3 (https://golang.org/doc/go1.3#stacks; https://golang.org/doc/go1.3#stacks; June 2014). The alternate stack structure
by dsymonds 10y ago
Segmented stacks in Go went away in Go 1.3 (https://golang.org/doc/go1.3#stacks; https://golang.org/doc/go1.3#stacks; June 2014).
The alternate stack structure is indeed one issue. The bigger one is the GC, though; the Go runtime needs to know which pointers it is responsible for freeing, and which are the responsibility of the C code.
- masklinn 10y ago> The bigger one is the GC; the Go runtime needs to know which pointers it is responsible for freeing That is not the bigger issue, and AFAIK already handled for C types. The stack/calling conventions is the reason why cgo is "not go", cgo calls have significantly more overhead than just about every other FFI (the overhead of a cgo call is ~2 orders of magnitude more than a "native" go call, or was around the same time last year, that is you could perform ~100 no-op non-inlined native calls to a do-nothing function by the time you need for a single cgo call to the same).
- dsymonds 10y agoThe original question was about why C extensions are not supported by Go. It's not a matter of performance; it's a matter of correctness.