1
0
mirror of https://github.com/golang/go synced 2024-11-11 23:10:23 -07:00

[dev.typeparams] reflect: use internal/abi.FuncPCABI0 to take address of assembly functions

makeFuncStub and methodValueCall on AMD64 are marked as
ABIInternal, so Go code can get their (unwrapped) addresses
(using open-coded funcPC). Ues internal/abi.FuncPCABI0 instead,
and un-mark the functions.

Change-Id: Id28b6101ec7e55bc5a357d4236482cec70cd7e5d
Reviewed-on: https://go-review.googlesource.com/c/go/+/322350
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
Cherry Mui 2021-05-21 18:28:25 -04:00
parent e0844acfc8
commit f642742678
2 changed files with 4 additions and 16 deletions

View File

@ -24,10 +24,8 @@
// See the comment on the declaration of makeFuncStub in makefunc.go
// for more details.
// No arg size here; runtime pulls arg map out of the func value.
// makeFuncStub must be ABIInternal because it is placed directly
// in function values.
// This frame contains two locals. See the comment above LOCAL_RETVALID.
TEXT ·makeFuncStub<ABIInternal>(SB),(NOSPLIT|WRAPPER),$312
TEXT ·makeFuncStub(SB),(NOSPLIT|WRAPPER),$312
NO_LOCAL_POINTERS
// NO_LOCAL_POINTERS is a lie. The stack map for the two locals in this
// frame is specially handled in the runtime. See the comment above LOCAL_RETVALID.
@ -55,10 +53,8 @@ TEXT ·makeFuncStub<ABIInternal>(SB),(NOSPLIT|WRAPPER),$312
// See the comment on the declaration of methodValueCall in makefunc.go
// for more details.
// No arg size here; runtime pulls arg map out of the func value.
// methodValueCall must be ABIInternal because it is placed directly
// in function values.
// This frame contains two locals. See the comment above LOCAL_RETVALID.
TEXT ·methodValueCall<ABIInternal>(SB),(NOSPLIT|WRAPPER),$312
TEXT ·methodValueCall(SB),(NOSPLIT|WRAPPER),$312
NO_LOCAL_POINTERS
// NO_LOCAL_POINTERS is a lie. The stack map for the two locals in this
// frame is specially handled in the runtime. See the comment above LOCAL_RETVALID.

View File

@ -52,11 +52,7 @@ func MakeFunc(typ Type, fn func(args []Value) (results []Value)) Value {
t := typ.common()
ftyp := (*funcType)(unsafe.Pointer(t))
// Indirect Go func value (dummy) to obtain
// actual code address. (A Go func value is a pointer
// to a C function pointer. https://golang.org/s/go11func.)
dummy := makeFuncStub
code := **(**uintptr)(unsafe.Pointer(&dummy))
code := abi.FuncPCABI0(makeFuncStub)
// makeFuncImpl contains a stack map for use by the runtime
_, _, abi := funcLayout(ftyp, nil)
@ -111,11 +107,7 @@ func makeMethodValue(op string, v Value) Value {
// v.Type returns the actual type of the method value.
ftyp := (*funcType)(unsafe.Pointer(v.Type().(*rtype)))
// Indirect Go func value (dummy) to obtain
// actual code address. (A Go func value is a pointer
// to a C function pointer. https://golang.org/s/go11func.)
dummy := methodValueCall
code := **(**uintptr)(unsafe.Pointer(&dummy))
code := abi.FuncPCABI0(methodValueCall)
// methodValue contains a stack map for use by the runtime
_, _, abi := funcLayout(ftyp, nil)