]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile, internal/abi: add FuncPCABIxxx intrinsics
authorCherry Zhang <cherryyz@google.com>
Fri, 2 Apr 2021 17:24:35 +0000 (13:24 -0400)
committerCherry Zhang <cherryyz@google.com>
Fri, 23 Apr 2021 21:05:39 +0000 (21:05 +0000)
commit142151697397235ba5f30a7a660ed8a159adce0b
treeeb10ad530ae354ba5304cc4e1ce28f26b12f9399
parent691e1b84c11d038060807f9c79107996ca2f19ae
cmd/compile, internal/abi: add FuncPCABIxxx intrinsics

When ABI wrappers are used, there are cases where in Go code we
need the PC of the defined function instead of the ABI wrapper.
Currently we work around this by define such functions as
ABIInternal, even if they do not actually follow the internal ABI.

This CL introduces internal/abi.FuncPCABIxxx functions as compiler
intrinsics, which return the underlying defined function's entry
PC if the argument is a direct reference of a function of the
expected ABI, and reject it if it is of a different ABI.

As a proof of concept, change runtime.goexit back to ABI0 and use
internal/abi.FuncPCABI0 to retrieve its PC.

Updates #44065.

Change-Id: I02286f0f9d99e6a3090f9e8169dbafc6804a2da6
Reviewed-on: https://go-review.googlesource.com/c/go/+/304232
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
src/cmd/compile/internal/staticdata/data.go
src/cmd/compile/internal/walk/expr.go
src/cmd/compile/internal/walk/order.go
src/internal/abi/abi.go
src/internal/abi/abi_test.go [new file with mode: 0644]
src/internal/abi/abi_test.s [new file with mode: 0644]
src/internal/abi/export_test.go [new file with mode: 0644]
src/internal/abi/testdata/x.go [new file with mode: 0644]
src/internal/abi/testdata/x.s [new file with mode: 0644]
src/runtime/asm_amd64.s
src/runtime/proc.go