On Wed, Jul 12, 2017 at 3:23 AM, <
Wei....@arm.com> wrote:
>
> I find some comments mentioning "Go ABI".
> Is there a document for it?
I assume you mean the ABI that is used by the gc toolchain, which is
the default Go installation. I don't think there is any official
documentation of that ABI. And there are no promises that the ABI
will not change in future versions--for example, see
https://golang.org/issue/18597.
The current ABI is fairly simple: all function arguments are pushed on
the stack, and all result arguments are returned on the stack. In
effect you construct a struct of the receiver, the normal parameters,
and the result parameters, put that struct on the stack, fill in the
receiver and normal parameters, and then call the function. Closures
are handled by passing the address of the closure struct in a
register, where the register varies by platform.
Ian