On Wed, Apr 29, 2020 at 12:45 PM <
nano...@gmail.com> wrote:
>
> 1) I have heard gccgo can call C much quicker than the standard go
> implementation can. If this statement is true, why is that?
It's because gccgo uses the C calling convention. So you can use a
magic //go:linkname comment to rename a Go function declaration to a C
function, and then just call it. This is completely unsafe, because
if the C function blocks or misuses pointers your program will crash
horribly. But it is fast.
> 2) How could a systemstack-like function but which can be friends with
> preemption mechanism of Go 1.14 be achieved?
That is basically a cgo call: a preemption friendly switch to the system stack.
Ian